2 * Copyright (c) 2006 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Sepherosa Ziehau <sepherosa@gmail.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * $DragonFly: src/sys/dev/netif/acx/acxcmd.h,v 1.6 2007/02/17 07:05:53 sephe Exp $
42 void acx_init_cmd_reg(struct acx_softc *);
44 int acx_enable_txchan(struct acx_softc *, uint8_t);
45 int acx_enable_rxchan(struct acx_softc *, uint8_t);
46 int acx_init_radio(struct acx_softc *, uint32_t, uint32_t);
47 int acx_join_bss(struct acx_softc *, uint8_t,
48 struct ieee80211_node *, struct ieee80211_channel *);
51 * Possible values for the second parameter of acx_join_bss()
53 #define ACX_MODE_ADHOC 0
54 #define ACX_MODE_UNUSED 1
55 #define ACX_MODE_STA 2
59 * Do not use following functions directly
61 int acx_get_conf(struct acx_softc *, uint16_t, void *, uint16_t);
62 int acx_set_conf(struct acx_softc *, uint16_t, void *, uint16_t);
63 int acx_set_tmplt(struct acx_softc *, uint16_t, void *, uint16_t);
64 int acx_exec_command(struct acx_softc *, uint16_t, void *, uint16_t,
70 * Following structs' fields are little endian
74 uint16_t conf_id; /* see ACXCONF_ (_acxcmd.h) */
75 uint16_t conf_data_len;
78 struct acx_conf_mmap {
79 struct acx_conf confcom;
82 uint32_t wep_cache_start;
83 uint32_t wep_cache_end;
84 uint32_t pkt_tmplt_start;
85 uint32_t pkt_tmplt_end;
86 uint32_t fw_desc_start;
88 uint32_t memblk_start;
92 struct acx_conf_wepopt {
93 struct acx_conf confcom;
95 uint8_t opt; /* see WEPOPT_ */
98 #define WEPOPT_HDWEP 0 /* hardware WEP */
100 struct acx_conf_eaddr {
101 struct acx_conf confcom;
102 uint8_t eaddr[IEEE80211_ADDR_LEN];
105 struct acx_conf_regdom {
106 struct acx_conf confcom;
111 struct acx_conf_antenna {
112 struct acx_conf confcom;
116 struct acx_conf_fwrev {
117 struct acx_conf confcom;
118 #define ACX_FWREV_LEN 20
123 char fw_rev[ACX_FWREV_LEN];
127 struct acx_conf_nretry_long {
128 struct acx_conf confcom;
132 struct acx_conf_nretry_short {
133 struct acx_conf confcom;
137 struct acx_conf_msdu_lifetime {
138 struct acx_conf confcom;
142 struct acx_conf_rate_fallback {
143 struct acx_conf confcom;
144 uint8_t ratefb_enable; /* 0/1 */
147 struct acx_conf_rxopt {
148 struct acx_conf confcom;
149 uint16_t opt1; /* see RXOPT1_ */
150 uint16_t opt2; /* see RXOPT2_ */
153 #define RXOPT1_INCL_RXBUF_HDR 0x2000 /* rxbuf with acx_rxbuf_hdr */
154 #define RXOPT1_RECV_SSID 0x0400 /* recv frame for joined SSID */
155 #define RXOPT1_FILT_BCAST 0x0200 /* filt broadcast pkt */
156 #define RXOPT1_RECV_MCAST1 0x0100 /* recv pkt for multicast addr1 */
157 #define RXOPT1_RECV_MCAST0 0x0080 /* recv pkt for multicast addr0 */
158 #define RXOPT1_FILT_ALLMULTI 0x0040 /* filt allmulti pkt */
159 #define RXOPT1_FILT_FSSID 0x0020 /* filt frame for foreign SSID */
160 #define RXOPT1_FILT_FDEST 0x0010 /* filt frame for foreign dest addr */
161 #define RXOPT1_PROMISC 0x0008 /* promisc mode */
162 #define RXOPT1_INCL_FCS 0x0004
163 #define RXOPT1_INCL_PHYHDR 0x0000 /* XXX 0x0002 */
165 #define RXOPT2_RECV_ASSOC_REQ 0x0800
166 #define RXOPT2_RECV_AUTH 0x0400
167 #define RXOPT2_RECV_BEACON 0x0200
168 #define RXOPT2_RECV_CF 0x0100
169 #define RXOPT2_RECV_CTRL 0x0080
170 #define RXOPT2_RECV_DATA 0x0040
171 #define RXOPT2_RECV_BROKEN 0x0020 /* broken frame */
172 #define RXOPT2_RECV_MGMT 0x0010
173 #define RXOPT2_RECV_PROBE_REQ 0x0008
174 #define RXOPT2_RECV_PROBE_RESP 0x0004
175 #define RXOPT2_RECV_ACK 0x0002 /* RTS/CTS/ACK */
176 #define RXOPT2_RECV_OTHER 0x0001
178 struct acx_conf_wep_txkey {
179 struct acx_conf confcom;
184 struct acx_tmplt_null_data {
186 struct ieee80211_frame data;
189 struct acx_tmplt_probe_req {
193 struct ieee80211_frame f;
200 #define ACX_TMPLT_PROBE_REQ_SIZ(var_len) \
201 (sizeof(uint16_t) + sizeof(struct ieee80211_frame) + (var_len))
203 struct acx_tmplt_probe_resp {
207 struct ieee80211_frame f;
208 uint8_t time_stamp[8];
209 uint16_t beacon_intvl;
213 uint8_t u_mem[0x100];
217 /* XXX same as acx_tmplt_probe_resp */
218 struct acx_tmplt_beacon {
222 struct ieee80211_frame f;
223 uint8_t time_stamp[8];
224 uint16_t beacon_intvl;
228 uint8_t u_mem[0x100];
232 struct acx_tmplt_tim {
235 struct ieee80211_tim_ie u_tim;
236 uint8_t u_mem[0x100];
240 #define ACX_INIT_TMPLT_FUNC(name) \
241 static __inline int \
242 acx_init_##name##_tmplt(struct acx_softc *_sc) \
244 struct acx_tmplt_##name _tmplt; \
246 bzero(&_tmplt, sizeof(_tmplt)); \
247 return acx_set_tmplt(_sc, ACXCMD_TMPLT_##name, \
248 &_tmplt, sizeof(_tmplt)); \
252 #define ACX_SET_TMPLT_FUNC(name) \
253 static __inline int \
254 _acx_set_##name##_tmplt(struct acx_softc *_sc, \
255 struct acx_tmplt_##name *_tmplt, \
256 uint16_t _tmplt_len) \
258 return acx_set_tmplt(_sc, ACXCMD_TMPLT_##name, \
259 _tmplt, _tmplt_len); \
263 #define _ACX_CONF_FUNC(sg, name, chip) \
264 static __inline int \
265 acx##chip##_##sg##_##name##_conf(struct acx_softc *_sc, \
266 struct acx##chip##_conf_##name *_conf) \
268 return acx_##sg##_conf(_sc, ACX_CONF_##name, \
269 _conf, sizeof(*_conf)); \
273 #define ACX_NOARG_FUNC(name) \
274 static __inline int \
275 acx_##name(struct acx_softc *_sc) \
277 return acx_exec_command(_sc, ACXCMD_##name, \
283 #define ACXCMD_TMPLT_tim ACXCMD_TMPLT_TIM
284 #define ACXCMD_TMPLT_beacon ACXCMD_TMPLT_BEACON
285 #define ACXCMD_TMPLT_probe_resp ACXCMD_TMPLT_PROBE_RESP
286 #define ACXCMD_TMPLT_null_data ACXCMD_TMPLT_NULL_DATA
287 #define ACXCMD_TMPLT_probe_req ACXCMD_TMPLT_PROBE_REQ
288 ACX_INIT_TMPLT_FUNC(tim);
289 ACX_INIT_TMPLT_FUNC(null_data);
290 ACX_INIT_TMPLT_FUNC(beacon);
291 ACX_INIT_TMPLT_FUNC(probe_req);
292 ACX_INIT_TMPLT_FUNC(probe_resp);
293 ACX_SET_TMPLT_FUNC(tim);
294 ACX_SET_TMPLT_FUNC(null_data);
295 ACX_SET_TMPLT_FUNC(beacon);
296 ACX_SET_TMPLT_FUNC(probe_req);
297 ACX_SET_TMPLT_FUNC(probe_resp);
299 #define ACX_CONF_FUNC(sg, name) _ACX_CONF_FUNC(sg, name,)
300 #define ACX_CONF_wepopt ACX_CONF_WEPOPT
301 #define ACX_CONF_mmap ACX_CONF_MMAP
302 #define ACX_CONF_eaddr ACX_CONF_EADDR
303 #define ACX_CONF_regdom ACX_CONF_REGDOM
304 #define ACX_CONF_antenna ACX_CONF_ANTENNA
305 #define ACX_CONF_fwrev ACX_CONF_FWREV
306 #define ACX_CONF_nretry_long ACX_CONF_NRETRY_LONG
307 #define ACX_CONF_nretry_short ACX_CONF_NRETRY_SHORT
308 #define ACX_CONF_msdu_lifetime ACX_CONF_MSDU_LIFETIME
309 #define ACX_CONF_rate_fallback ACX_CONF_RATE_FALLBACK
310 #define ACX_CONF_rxopt ACX_CONF_RXOPT
311 #define ACX_CONF_wep_txkey ACX_CONF_WEP_TXKEY
312 ACX_CONF_FUNC(get, mmap);
313 ACX_CONF_FUNC(set, mmap);
314 ACX_CONF_FUNC(set, wepopt);
315 ACX_CONF_FUNC(get, eaddr);
316 ACX_CONF_FUNC(get, regdom);
317 ACX_CONF_FUNC(set, regdom);
318 ACX_CONF_FUNC(get, antenna);
319 ACX_CONF_FUNC(set, antenna);
320 ACX_CONF_FUNC(get, fwrev);
321 ACX_CONF_FUNC(set, nretry_long);
322 ACX_CONF_FUNC(set, nretry_short);
323 ACX_CONF_FUNC(set, msdu_lifetime);
324 ACX_CONF_FUNC(set, rate_fallback);
325 ACX_CONF_FUNC(set, rxopt);
326 ACX_CONF_FUNC(set, wep_txkey);
328 #define ACXCMD_sleep ACXCMD_SLEEP
329 #define ACXCMD_wakeup ACXCMD_WAKEUP
330 ACX_NOARG_FUNC(sleep);
331 ACX_NOARG_FUNC(wakeup);
333 #endif /* !_ACXCMD_H */