Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / drivers / net / hfa384x.h
1 /* src/prism2/include/prism2/hfa384x.h
2 *
3 * Defines the constants and data structures for the hfa384x
4 *
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
6 * --------------------------------------------------------------------
7 *
8 * linux-wlan
9 *
10 *   The contents of this file are subject to the Mozilla Public
11 *   License Version 1.1 (the "License"); you may not use this file
12 *   except in compliance with the License. You may obtain a copy of
13 *   the License at http://www.mozilla.org/MPL/
14 *
15 *   Software distributed under the License is distributed on an "AS
16 *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17 *   implied. See the License for the specific language governing
18 *   rights and limitations under the License.
19 *
20 *   Alternatively, the contents of this file may be used under the
21 *   terms of the GNU Public License version 2 (the "GPL"), in which
22 *   case the provisions of the GPL are applicable instead of the
23 *   above.  If you wish to allow the use of your version of this file
24 *   only under the terms of the GPL and not to allow others to use
25 *   your version of this file under the MPL, indicate your decision
26 *   by deleting the provisions above and replace them with the notice
27 *   and other provisions required by the GPL.  If you do not delete
28 *   the provisions above, a recipient may use your version of this
29 *   file under either the MPL or the GPL.
30 *
31 * --------------------------------------------------------------------
32 *
33 * Inquiries regarding the linux-wlan Open Source project can be
34 * made directly to:
35 *
36 * AbsoluteValue Systems Inc.
37 * info@linux-wlan.com
38 * http://www.linux-wlan.com
39 *
40 * --------------------------------------------------------------------
41 *
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
44 *
45 * --------------------------------------------------------------------
46 *
47 *   [Implementation and usage notes]
48 *
49 *   [References]
50 *       CW10 Programmer's Manual v1.5
51 *       IEEE 802.11 D10.0
52 *
53 * --------------------------------------------------------------------
54 */
55
56 FILE_LICENCE ( GPL2_ONLY );
57
58 #ifndef _HFA384x_H
59 #define _HFA384x_H
60
61 /*=============================================================*/
62 #define HFA384x_FIRMWARE_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
63
64 #define HFA384x_LEVEL_TO_dBm(v)   (0x100 + (v) * 100 / 255 - 100)
65
66 /*------ Constants --------------------------------------------*/
67 /*--- Mins & Maxs -----------------------------------*/
68 #define         HFA384x_CMD_ALLOC_LEN_MIN       ((uint16_t)4)
69 #define         HFA384x_CMD_ALLOC_LEN_MAX       ((uint16_t)2400)
70 #define         HFA384x_BAP_DATALEN_MAX         ((uint16_t)4096)
71 #define         HFA384x_BAP_OFFSET_MAX          ((uint16_t)4096)
72 #define         HFA384x_PORTID_MAX              ((uint16_t)7)
73 #define         HFA384x_NUMPORTS_MAX            ((uint16_t)(HFA384x_PORTID_MAX+1))
74 #define         HFA384x_PDR_LEN_MAX             ((uint16_t)512) /* in bytes, from EK */
75 #define         HFA384x_PDA_RECS_MAX            ((uint16_t)200) /* a guess */
76 #define         HFA384x_PDA_LEN_MAX             ((uint16_t)1024)        /* in bytes, from EK */
77 #define         HFA384x_SCANRESULT_MAX          ((uint16_t)31)
78 #define         HFA384x_HSCANRESULT_MAX         ((uint16_t)31)
79 #define         HFA384x_CHINFORESULT_MAX        ((uint16_t)16)
80 #define         HFA384x_DRVR_FIDSTACKLEN_MAX    (10)
81 #define         HFA384x_DRVR_TXBUF_MAX          (sizeof(hfa384x_tx_frame_t) + \
82                                                 WLAN_DATA_MAXLEN - \
83                                                 WLAN_WEP_IV_LEN - \
84                                                 WLAN_WEP_ICV_LEN + 2)
85 #define         HFA384x_DRVR_MAGIC              (0x4a2d)
86 #define         HFA384x_INFODATA_MAXLEN         (sizeof(hfa384x_infodata_t))
87 #define         HFA384x_INFOFRM_MAXLEN          (sizeof(hfa384x_InfFrame_t))
88 #define         HFA384x_RID_GUESSING_MAXLEN     2048  /* I'm not really sure */
89 #define         HFA384x_RIDDATA_MAXLEN          HFA384x_RID_GUESSING_MAXLEN
90 #define         HFA384x_USB_RWMEM_MAXLEN        2048
91
92 /*--- Support Constants -----------------------------*/
93 #define         HFA384x_BAP_PROC                        ((uint16_t)0)
94 #define         HFA384x_BAP_int                         ((uint16_t)1)
95 #define         HFA384x_PORTTYPE_IBSS                   ((uint16_t)0)
96 #define         HFA384x_PORTTYPE_BSS                    ((uint16_t)1)
97 #define         HFA384x_PORTTYPE_WDS                    ((uint16_t)2)
98 #define         HFA384x_PORTTYPE_PSUEDOIBSS             ((uint16_t)3)
99 #define         HFA384x_PORTTYPE_HOSTAP                 ((uint16_t)6)
100 #define         HFA384x_WEPFLAGS_PRIVINVOKED            ((uint16_t)BIT0)
101 #define         HFA384x_WEPFLAGS_EXCLUDE                ((uint16_t)BIT1)
102 #define         HFA384x_WEPFLAGS_DISABLE_TXCRYPT        ((uint16_t)BIT4)
103 #define         HFA384x_WEPFLAGS_DISABLE_RXCRYPT        ((uint16_t)BIT7)
104 #define         HFA384x_WEPFLAGS_DISALLOW_MIXED         ((uint16_t)BIT11)
105 #define         HFA384x_WEPFLAGS_IV_INTERVAL1           ((uint16_t)0)
106 #define         HFA384x_WEPFLAGS_IV_INTERVAL10          ((uint16_t)BIT5)
107 #define         HFA384x_WEPFLAGS_IV_INTERVAL50          ((uint16_t)BIT6)
108 #define         HFA384x_WEPFLAGS_IV_INTERVAL100         ((uint16_t)(BIT5 | BIT6))
109 #define         HFA384x_WEPFLAGS_FIRMWARE_WPA           ((uint16_t)BIT8)
110 #define         HFA384x_WEPFLAGS_HOST_MIC               ((uint16_t)BIT9)
111 #define         HFA384x_ROAMMODE_FWSCAN_FWROAM          ((uint16_t)1)
112 #define         HFA384x_ROAMMODE_FWSCAN_HOSTROAM        ((uint16_t)2)
113 #define         HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM      ((uint16_t)3)
114 #define         HFA384x_PORTSTATUS_DISABLED             ((uint16_t)1)
115 #define         HFA384x_PORTSTATUS_INITSRCH             ((uint16_t)2)
116 #define         HFA384x_PORTSTATUS_CONN_IBSS            ((uint16_t)3)
117 #define         HFA384x_PORTSTATUS_CONN_ESS             ((uint16_t)4)
118 #define         HFA384x_PORTSTATUS_OOR_ESS              ((uint16_t)5)
119 #define         HFA384x_PORTSTATUS_CONN_WDS             ((uint16_t)6)
120 #define         HFA384x_PORTSTATUS_HOSTAP               ((uint16_t)8)
121 #define         HFA384x_RATEBIT_1                       ((uint16_t)1)
122 #define         HFA384x_RATEBIT_2                       ((uint16_t)2)
123 #define         HFA384x_RATEBIT_5dot5                   ((uint16_t)4)
124 #define         HFA384x_RATEBIT_11                      ((uint16_t)8)
125
126 /*--- Just some symbolic names for legibility -------*/
127 #define         HFA384x_TXCMD_NORECL            ((uint16_t)0)
128 #define         HFA384x_TXCMD_RECL              ((uint16_t)1)
129
130 /*--- MAC Internal memory constants and macros ------*/
131 /* masks and macros used to manipulate MAC internal memory addresses. */
132 /* MAC internal memory addresses are 23 bit quantities.  The MAC uses
133  * a paged address space where the upper 16 bits are the page number
134  * and the lower 7 bits are the offset.  There are various Host API
135  * elements that require two 16-bit quantities to specify a MAC
136  * internal memory address.  Unfortunately, some of the API's use a
137  * page/offset format where the offset value is JUST the lower seven
138  * bits and the page is  the remaining 16 bits.  Some of the API's
139  * assume that the 23 bit address has been split at the 16th bit.  We
140  * refer to these two formats as AUX format and CMD format.  The
141  * macros below help handle some of this.
142  */
143
144 /* Handy constant */
145 #define         HFA384x_ADDR_AUX_OFF_MAX        ((uint16_t)0x007f)
146
147 /* Mask bits for discarding unwanted pieces in a flat address */
148 #define         HFA384x_ADDR_FLAT_AUX_PAGE_MASK (0x007fff80)
149 #define         HFA384x_ADDR_FLAT_AUX_OFF_MASK  (0x0000007f)
150 #define         HFA384x_ADDR_FLAT_CMD_PAGE_MASK (0xffff0000)
151 #define         HFA384x_ADDR_FLAT_CMD_OFF_MASK  (0x0000ffff)
152
153 /* Mask bits for discarding unwanted pieces in AUX format 16-bit address parts */
154 #define         HFA384x_ADDR_AUX_PAGE_MASK      (0xffff)
155 #define         HFA384x_ADDR_AUX_OFF_MASK       (0x007f)
156
157 /* Mask bits for discarding unwanted pieces in CMD format 16-bit address parts */
158 #define         HFA384x_ADDR_CMD_PAGE_MASK      (0x007f)
159 #define         HFA384x_ADDR_CMD_OFF_MASK       (0xffff)
160
161 /* Make a 32-bit flat address from AUX format 16-bit page and offset */
162 #define         HFA384x_ADDR_AUX_MKFLAT(p,o)    \
163                 (((uint32_t)(((uint16_t)(p))&HFA384x_ADDR_AUX_PAGE_MASK)) <<7) | \
164                 ((uint32_t)(((uint16_t)(o))&HFA384x_ADDR_AUX_OFF_MASK))
165
166 /* Make a 32-bit flat address from CMD format 16-bit page and offset */
167 #define         HFA384x_ADDR_CMD_MKFLAT(p,o)    \
168                 (((uint32_t)(((uint16_t)(p))&HFA384x_ADDR_CMD_PAGE_MASK)) <<16) | \
169                 ((uint32_t)(((uint16_t)(o))&HFA384x_ADDR_CMD_OFF_MASK))
170
171 /* Make AUX format offset and page from a 32-bit flat address */
172 #define         HFA384x_ADDR_AUX_MKPAGE(f) \
173                 ((uint16_t)((((uint32_t)(f))&HFA384x_ADDR_FLAT_AUX_PAGE_MASK)>>7))
174 #define         HFA384x_ADDR_AUX_MKOFF(f) \
175                 ((uint16_t)(((uint32_t)(f))&HFA384x_ADDR_FLAT_AUX_OFF_MASK))
176
177 /* Make CMD format offset and page from a 32-bit flat address */
178 #define         HFA384x_ADDR_CMD_MKPAGE(f) \
179                 ((uint16_t)((((uint32_t)(f))&HFA384x_ADDR_FLAT_CMD_PAGE_MASK)>>16))
180 #define         HFA384x_ADDR_CMD_MKOFF(f) \
181                 ((uint16_t)(((uint32_t)(f))&HFA384x_ADDR_FLAT_CMD_OFF_MASK))
182
183 /*--- Aux register masks/tests ----------------------*/
184 /* Some of the upper bits of the AUX offset register are used to */
185 /*  select address space. */
186 #define         HFA384x_AUX_CTL_EXTDS   (0x00)
187 #define         HFA384x_AUX_CTL_NV      (0x01)
188 #define         HFA384x_AUX_CTL_PHY     (0x02)
189 #define         HFA384x_AUX_CTL_ICSRAM  (0x03)
190
191 /* Make AUX register offset and page values from a flat address */
192 #define         HFA384x_AUX_MKOFF(f, c) \
193         (HFA384x_ADDR_AUX_MKOFF(f) | (((uint16_t)(c))<<12))
194 #define         HFA384x_AUX_MKPAGE(f)   HFA384x_ADDR_AUX_MKPAGE(f)
195
196
197 /*--- Controller Memory addresses -------------------*/
198 #define         HFA3842_PDA_BASE        (0x007f0000UL)
199 #define         HFA3841_PDA_BASE        (0x003f0000UL)
200 #define         HFA3841_PDA_BOGUS_BASE  (0x00390000UL)
201
202 /*--- Driver Download states  -----------------------*/
203 #define         HFA384x_DLSTATE_DISABLED                0
204 #define         HFA384x_DLSTATE_RAMENABLED              1
205 #define         HFA384x_DLSTATE_FLASHENABLED            2
206 #define         HFA384x_DLSTATE_FLASHWRITTEN            3
207 #define         HFA384x_DLSTATE_FLASHWRITEPENDING       4
208 #define         HFA384x_DLSTATE_GENESIS                 5
209
210 /*--- Register I/O offsets --------------------------*/
211 #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX))
212
213 #define         HFA384x_CMD_OFF                 (0x00)
214 #define         HFA384x_PARAM0_OFF              (0x02)
215 #define         HFA384x_PARAM1_OFF              (0x04)
216 #define         HFA384x_PARAM2_OFF              (0x06)
217 #define         HFA384x_STATUS_OFF              (0x08)
218 #define         HFA384x_RESP0_OFF               (0x0A)
219 #define         HFA384x_RESP1_OFF               (0x0C)
220 #define         HFA384x_RESP2_OFF               (0x0E)
221 #define         HFA384x_INFOFID_OFF             (0x10)
222 #define         HFA384x_RXFID_OFF               (0x20)
223 #define         HFA384x_ALLOCFID_OFF            (0x22)
224 #define         HFA384x_TXCOMPLFID_OFF          (0x24)
225 #define         HFA384x_SELECT0_OFF             (0x18)
226 #define         HFA384x_OFFSET0_OFF             (0x1C)
227 #define         HFA384x_DATA0_OFF               (0x36)
228 #define         HFA384x_SELECT1_OFF             (0x1A)
229 #define         HFA384x_OFFSET1_OFF             (0x1E)
230 #define         HFA384x_DATA1_OFF               (0x38)
231 #define         HFA384x_EVSTAT_OFF              (0x30)
232 #define         HFA384x_INTEN_OFF               (0x32)
233 #define         HFA384x_EVACK_OFF               (0x34)
234 #define         HFA384x_CONTROL_OFF             (0x14)
235 #define         HFA384x_SWSUPPORT0_OFF          (0x28)
236 #define         HFA384x_SWSUPPORT1_OFF          (0x2A)
237 #define         HFA384x_SWSUPPORT2_OFF          (0x2C)
238 #define         HFA384x_AUXPAGE_OFF             (0x3A)
239 #define         HFA384x_AUXOFFSET_OFF           (0x3C)
240 #define         HFA384x_AUXDATA_OFF             (0x3E)
241
242 #elif (WLAN_HOSTIF == WLAN_PCI || WLAN_HOSTIF == WLAN_USB)
243
244 #define         HFA384x_CMD_OFF                 (0x00)
245 #define         HFA384x_PARAM0_OFF              (0x04)
246 #define         HFA384x_PARAM1_OFF              (0x08)
247 #define         HFA384x_PARAM2_OFF              (0x0c)
248 #define         HFA384x_STATUS_OFF              (0x10)
249 #define         HFA384x_RESP0_OFF               (0x14)
250 #define         HFA384x_RESP1_OFF               (0x18)
251 #define         HFA384x_RESP2_OFF               (0x1c)
252 #define         HFA384x_INFOFID_OFF             (0x20)
253 #define         HFA384x_RXFID_OFF               (0x40)
254 #define         HFA384x_ALLOCFID_OFF            (0x44)
255 #define         HFA384x_TXCOMPLFID_OFF          (0x48)
256 #define         HFA384x_SELECT0_OFF             (0x30)
257 #define         HFA384x_OFFSET0_OFF             (0x38)
258 #define         HFA384x_DATA0_OFF               (0x6c)
259 #define         HFA384x_SELECT1_OFF             (0x34)
260 #define         HFA384x_OFFSET1_OFF             (0x3c)
261 #define         HFA384x_DATA1_OFF               (0x70)
262 #define         HFA384x_EVSTAT_OFF              (0x60)
263 #define         HFA384x_INTEN_OFF               (0x64)
264 #define         HFA384x_EVACK_OFF               (0x68)
265 #define         HFA384x_CONTROL_OFF             (0x28)
266 #define         HFA384x_SWSUPPORT0_OFF          (0x50)
267 #define         HFA384x_SWSUPPORT1_OFF          (0x54)
268 #define         HFA384x_SWSUPPORT2_OFF          (0x58)
269 #define         HFA384x_AUXPAGE_OFF             (0x74)
270 #define         HFA384x_AUXOFFSET_OFF           (0x78)
271 #define         HFA384x_AUXDATA_OFF             (0x7c)
272 #define         HFA384x_PCICOR_OFF              (0x4c)
273 #define         HFA384x_PCIHCR_OFF              (0x5c)
274 #define         HFA384x_PCI_M0_ADDRH_OFF        (0x80)
275 #define         HFA384x_PCI_M0_ADDRL_OFF        (0x84)
276 #define         HFA384x_PCI_M0_LEN_OFF          (0x88)
277 #define         HFA384x_PCI_M0_CTL_OFF          (0x8c)
278 #define         HFA384x_PCI_STATUS_OFF          (0x98)
279 #define         HFA384x_PCI_M1_ADDRH_OFF        (0xa0)
280 #define         HFA384x_PCI_M1_ADDRL_OFF        (0xa4)
281 #define         HFA384x_PCI_M1_LEN_OFF          (0xa8)
282 #define         HFA384x_PCI_M1_CTL_OFF          (0xac)
283
284 #endif
285
286 /*--- Register Field Masks --------------------------*/
287 #define         HFA384x_CMD_BUSY                ((uint16_t)BIT15)
288 #define         HFA384x_CMD_AINFO               ((uint16_t)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8))
289 #define         HFA384x_CMD_MACPORT             ((uint16_t)(BIT10 | BIT9 | BIT8))
290 #define         HFA384x_CMD_RECL                ((uint16_t)BIT8)
291 #define         HFA384x_CMD_WRITE               ((uint16_t)BIT8)
292 #define         HFA384x_CMD_PROGMODE            ((uint16_t)(BIT9 | BIT8))
293 #define         HFA384x_CMD_CMDCODE             ((uint16_t)(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0))
294
295 #define         HFA384x_STATUS_RESULT           ((uint16_t)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8))
296 #define         HFA384x_STATUS_CMDCODE          ((uint16_t)(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0))
297
298 #define         HFA384x_OFFSET_BUSY             ((uint16_t)BIT15)
299 #define         HFA384x_OFFSET_ERR              ((uint16_t)BIT14)
300 #define         HFA384x_OFFSET_DATAOFF          ((uint16_t)(BIT11 | BIT10 | BIT9 | BIT8 | BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1))
301
302 #define         HFA384x_EVSTAT_TICK             ((uint16_t)BIT15)
303 #define         HFA384x_EVSTAT_WTERR            ((uint16_t)BIT14)
304 #define         HFA384x_EVSTAT_INFDROP          ((uint16_t)BIT13)
305 #define         HFA384x_EVSTAT_INFO             ((uint16_t)BIT7)
306 #define         HFA384x_EVSTAT_DTIM             ((uint16_t)BIT5)
307 #define         HFA384x_EVSTAT_CMD              ((uint16_t)BIT4)
308 #define         HFA384x_EVSTAT_ALLOC            ((uint16_t)BIT3)
309 #define         HFA384x_EVSTAT_TXEXC            ((uint16_t)BIT2)
310 #define         HFA384x_EVSTAT_TX               ((uint16_t)BIT1)
311 #define         HFA384x_EVSTAT_RX               ((uint16_t)BIT0)
312
313 #define         HFA384x_INT_BAP_OP           (HFA384x_EVSTAT_INFO|HFA384x_EVSTAT_RX|HFA384x_EVSTAT_TX|HFA384x_EVSTAT_TXEXC)
314
315 #define         HFA384x_INT_NORMAL           (HFA384x_EVSTAT_INFO|HFA384x_EVSTAT_RX|HFA384x_EVSTAT_TX|HFA384x_EVSTAT_TXEXC|HFA384x_EVSTAT_INFDROP|HFA384x_EVSTAT_ALLOC|HFA384x_EVSTAT_DTIM)
316
317 #define         HFA384x_INTEN_TICK              ((uint16_t)BIT15)
318 #define         HFA384x_INTEN_WTERR             ((uint16_t)BIT14)
319 #define         HFA384x_INTEN_INFDROP           ((uint16_t)BIT13)
320 #define         HFA384x_INTEN_INFO              ((uint16_t)BIT7)
321 #define         HFA384x_INTEN_DTIM              ((uint16_t)BIT5)
322 #define         HFA384x_INTEN_CMD               ((uint16_t)BIT4)
323 #define         HFA384x_INTEN_ALLOC             ((uint16_t)BIT3)
324 #define         HFA384x_INTEN_TXEXC             ((uint16_t)BIT2)
325 #define         HFA384x_INTEN_TX                ((uint16_t)BIT1)
326 #define         HFA384x_INTEN_RX                ((uint16_t)BIT0)
327
328 #define         HFA384x_EVACK_TICK              ((uint16_t)BIT15)
329 #define         HFA384x_EVACK_WTERR             ((uint16_t)BIT14)
330 #define         HFA384x_EVACK_INFDROP           ((uint16_t)BIT13)
331 #define         HFA384x_EVACK_INFO              ((uint16_t)BIT7)
332 #define         HFA384x_EVACK_DTIM              ((uint16_t)BIT5)
333 #define         HFA384x_EVACK_CMD               ((uint16_t)BIT4)
334 #define         HFA384x_EVACK_ALLOC             ((uint16_t)BIT3)
335 #define         HFA384x_EVACK_TXEXC             ((uint16_t)BIT2)
336 #define         HFA384x_EVACK_TX                ((uint16_t)BIT1)
337 #define         HFA384x_EVACK_RX                ((uint16_t)BIT0)
338
339 #define         HFA384x_CONTROL_AUXEN           ((uint16_t)(BIT15 | BIT14))
340
341
342 /*--- Command Code Constants --------------------------*/
343 /*--- Controller Commands --------------------------*/
344 #define         HFA384x_CMDCODE_INIT            ((uint16_t)0x00)
345 #define         HFA384x_CMDCODE_ENABLE          ((uint16_t)0x01)
346 #define         HFA384x_CMDCODE_DISABLE         ((uint16_t)0x02)
347 #define         HFA384x_CMDCODE_DIAG            ((uint16_t)0x03)
348
349 /*--- Buffer Mgmt Commands --------------------------*/
350 #define         HFA384x_CMDCODE_ALLOC           ((uint16_t)0x0A)
351 #define         HFA384x_CMDCODE_TX              ((uint16_t)0x0B)
352 #define         HFA384x_CMDCODE_CLRPRST         ((uint16_t)0x12)
353
354 /*--- Regulate Commands --------------------------*/
355 #define         HFA384x_CMDCODE_NOTIFY          ((uint16_t)0x10)
356 #define         HFA384x_CMDCODE_INQ             ((uint16_t)0x11)
357
358 /*--- Configure Commands --------------------------*/
359 #define         HFA384x_CMDCODE_ACCESS          ((uint16_t)0x21)
360 #define         HFA384x_CMDCODE_DOWNLD          ((uint16_t)0x22)
361
362 /*--- Debugging Commands -----------------------------*/
363 #define         HFA384x_CMDCODE_MONITOR         ((uint16_t)(0x38))
364 #define         HFA384x_MONITOR_ENABLE          ((uint16_t)(0x0b))
365 #define         HFA384x_MONITOR_DISABLE         ((uint16_t)(0x0f))
366
367 /*--- Result Codes --------------------------*/
368 #define         HFA384x_SUCCESS                 ((uint16_t)(0x00))
369 #define         HFA384x_CARD_FAIL               ((uint16_t)(0x01))
370 #define         HFA384x_NO_BUFF                 ((uint16_t)(0x05))
371 #define         HFA384x_CMD_ERR                 ((uint16_t)(0x7F))
372
373 /*--- Programming Modes --------------------------
374         MODE 0: Disable programming
375         MODE 1: Enable volatile memory programming
376         MODE 2: Enable non-volatile memory programming
377         MODE 3: Program non-volatile memory section
378 --------------------------------------------------*/
379 #define         HFA384x_PROGMODE_DISABLE        ((uint16_t)0x00)
380 #define         HFA384x_PROGMODE_RAM            ((uint16_t)0x01)
381 #define         HFA384x_PROGMODE_NV             ((uint16_t)0x02)
382 #define         HFA384x_PROGMODE_NVWRITE        ((uint16_t)0x03)
383
384 /*--- AUX register enable --------------------------*/
385 #define         HFA384x_AUXPW0                  ((uint16_t)0xfe01)
386 #define         HFA384x_AUXPW1                  ((uint16_t)0xdc23)
387 #define         HFA384x_AUXPW2                  ((uint16_t)0xba45)
388
389 #define         HFA384x_CONTROL_AUX_ISDISABLED  ((uint16_t)0x0000)
390 #define         HFA384x_CONTROL_AUX_ISENABLED   ((uint16_t)0xc000)
391 #define         HFA384x_CONTROL_AUX_DOENABLE    ((uint16_t)0x8000)
392 #define         HFA384x_CONTROL_AUX_DODISABLE   ((uint16_t)0x4000)
393
394 /*--- Record ID Constants --------------------------*/
395 /*--------------------------------------------------------------------
396 Configuration RIDs: Network Parameters, Static Configuration Entities
397 --------------------------------------------------------------------*/
398 #define         HFA384x_RID_CNFPORTTYPE         ((uint16_t)0xFC00)
399 #define         HFA384x_RID_CNFOWNMACADDR       ((uint16_t)0xFC01)
400 #define         HFA384x_RID_CNFDESIREDSSID      ((uint16_t)0xFC02)
401 #define         HFA384x_RID_CNFOWNCHANNEL       ((uint16_t)0xFC03)
402 #define         HFA384x_RID_CNFOWNSSID          ((uint16_t)0xFC04)
403 #define         HFA384x_RID_CNFOWNATIMWIN       ((uint16_t)0xFC05)
404 #define         HFA384x_RID_CNFSYSSCALE         ((uint16_t)0xFC06)
405 #define         HFA384x_RID_CNFMAXDATALEN       ((uint16_t)0xFC07)
406 #define         HFA384x_RID_CNFWDSADDR          ((uint16_t)0xFC08)
407 #define         HFA384x_RID_CNFPMENABLED        ((uint16_t)0xFC09)
408 #define         HFA384x_RID_CNFPMEPS            ((uint16_t)0xFC0A)
409 #define         HFA384x_RID_CNFMULTICASTRX      ((uint16_t)0xFC0B)
410 #define         HFA384x_RID_CNFMAXSLEEPDUR      ((uint16_t)0xFC0C)
411 #define         HFA384x_RID_CNFPMHOLDDUR        ((uint16_t)0xFC0D)
412 #define         HFA384x_RID_CNFOWNNAME          ((uint16_t)0xFC0E)
413 #define         HFA384x_RID_CNFOWNDTIMPER       ((uint16_t)0xFC10)
414 #define         HFA384x_RID_CNFWDSADDR1         ((uint16_t)0xFC11)
415 #define         HFA384x_RID_CNFWDSADDR2         ((uint16_t)0xFC12)
416 #define         HFA384x_RID_CNFWDSADDR3         ((uint16_t)0xFC13)
417 #define         HFA384x_RID_CNFWDSADDR4         ((uint16_t)0xFC14)
418 #define         HFA384x_RID_CNFWDSADDR5         ((uint16_t)0xFC15)
419 #define         HFA384x_RID_CNFWDSADDR6         ((uint16_t)0xFC16)
420 #define         HFA384x_RID_CNFMCASTPMBUFF      ((uint16_t)0xFC17)
421
422 /*--------------------------------------------------------------------
423 Configuration RID lengths: Network Params, Static Config Entities
424   This is the length of JUST the DATA part of the RID (does not
425   include the len or code fields)
426 --------------------------------------------------------------------*/
427 /* TODO: fill in the rest of these */
428 #define         HFA384x_RID_CNFPORTTYPE_LEN     ((uint16_t)2)
429 #define         HFA384x_RID_CNFOWNMACADDR_LEN   ((uint16_t)6)
430 #define         HFA384x_RID_CNFDESIREDSSID_LEN  ((uint16_t)34)
431 #define         HFA384x_RID_CNFOWNCHANNEL_LEN   ((uint16_t)2)
432 #define         HFA384x_RID_CNFOWNSSID_LEN      ((uint16_t)34)
433 #define         HFA384x_RID_CNFOWNATIMWIN_LEN   ((uint16_t)2)
434 #define         HFA384x_RID_CNFSYSSCALE_LEN     ((uint16_t)0)
435 #define         HFA384x_RID_CNFMAXDATALEN_LEN   ((uint16_t)0)
436 #define         HFA384x_RID_CNFWDSADDR_LEN      ((uint16_t)6)
437 #define         HFA384x_RID_CNFPMENABLED_LEN    ((uint16_t)0)
438 #define         HFA384x_RID_CNFPMEPS_LEN        ((uint16_t)0)
439 #define         HFA384x_RID_CNFMULTICASTRX_LEN  ((uint16_t)0)
440 #define         HFA384x_RID_CNFMAXSLEEPDUR_LEN  ((uint16_t)0)
441 #define         HFA384x_RID_CNFPMHOLDDUR_LEN    ((uint16_t)0)
442 #define         HFA384x_RID_CNFOWNNAME_LEN      ((uint16_t)34)
443 #define         HFA384x_RID_CNFOWNDTIMPER_LEN   ((uint16_t)0)
444 #define         HFA384x_RID_CNFWDSADDR1_LEN     ((uint16_t)6)
445 #define         HFA384x_RID_CNFWDSADDR2_LEN     ((uint16_t)6)
446 #define         HFA384x_RID_CNFWDSADDR3_LEN     ((uint16_t)6)
447 #define         HFA384x_RID_CNFWDSADDR4_LEN     ((uint16_t)6)
448 #define         HFA384x_RID_CNFWDSADDR5_LEN     ((uint16_t)6)
449 #define         HFA384x_RID_CNFWDSADDR6_LEN     ((uint16_t)6)
450 #define         HFA384x_RID_CNFMCASTPMBUFF_LEN  ((uint16_t)0)
451 #define         HFA384x_RID_CNFAUTHENTICATION_LEN ((uint16_t)sizeof(uint16_t))
452 #define         HFA384x_RID_CNFMAXSLEEPDUR_LEN  ((uint16_t)0)
453
454 /*--------------------------------------------------------------------
455 Configuration RIDs: Network Parameters, Dynamic Configuration Entities
456 --------------------------------------------------------------------*/
457 #define         HFA384x_RID_GROUPADDR           ((uint16_t)0xFC80)
458 #define         HFA384x_RID_CREATEIBSS          ((uint16_t)0xFC81)
459 #define         HFA384x_RID_FRAGTHRESH          ((uint16_t)0xFC82)
460 #define         HFA384x_RID_RTSTHRESH           ((uint16_t)0xFC83)
461 #define         HFA384x_RID_TXRATECNTL          ((uint16_t)0xFC84)
462 #define         HFA384x_RID_PROMISCMODE         ((uint16_t)0xFC85)
463 #define         HFA384x_RID_FRAGTHRESH0         ((uint16_t)0xFC90)
464 #define         HFA384x_RID_FRAGTHRESH1         ((uint16_t)0xFC91)
465 #define         HFA384x_RID_FRAGTHRESH2         ((uint16_t)0xFC92)
466 #define         HFA384x_RID_FRAGTHRESH3         ((uint16_t)0xFC93)
467 #define         HFA384x_RID_FRAGTHRESH4         ((uint16_t)0xFC94)
468 #define         HFA384x_RID_FRAGTHRESH5         ((uint16_t)0xFC95)
469 #define         HFA384x_RID_FRAGTHRESH6         ((uint16_t)0xFC96)
470 #define         HFA384x_RID_RTSTHRESH0          ((uint16_t)0xFC97)
471 #define         HFA384x_RID_RTSTHRESH1          ((uint16_t)0xFC98)
472 #define         HFA384x_RID_RTSTHRESH2          ((uint16_t)0xFC99)
473 #define         HFA384x_RID_RTSTHRESH3          ((uint16_t)0xFC9A)
474 #define         HFA384x_RID_RTSTHRESH4          ((uint16_t)0xFC9B)
475 #define         HFA384x_RID_RTSTHRESH5          ((uint16_t)0xFC9C)
476 #define         HFA384x_RID_RTSTHRESH6          ((uint16_t)0xFC9D)
477 #define         HFA384x_RID_TXRATECNTL0         ((uint16_t)0xFC9E)
478 #define         HFA384x_RID_TXRATECNTL1         ((uint16_t)0xFC9F)
479 #define         HFA384x_RID_TXRATECNTL2         ((uint16_t)0xFCA0)
480 #define         HFA384x_RID_TXRATECNTL3         ((uint16_t)0xFCA1)
481 #define         HFA384x_RID_TXRATECNTL4         ((uint16_t)0xFCA2)
482 #define         HFA384x_RID_TXRATECNTL5         ((uint16_t)0xFCA3)
483 #define         HFA384x_RID_TXRATECNTL6         ((uint16_t)0xFCA4)
484
485 /*--------------------------------------------------------------------
486 Configuration RID Lengths: Network Param, Dynamic Config Entities
487   This is the length of JUST the DATA part of the RID (does not
488   include the len or code fields)
489 --------------------------------------------------------------------*/
490 /* TODO: fill in the rest of these */
491 #define         HFA384x_RID_GROUPADDR_LEN       ((uint16_t)16 * WLAN_ADDR_LEN)
492 #define         HFA384x_RID_CREATEIBSS_LEN      ((uint16_t)0)
493 #define         HFA384x_RID_FRAGTHRESH_LEN      ((uint16_t)0)
494 #define         HFA384x_RID_RTSTHRESH_LEN       ((uint16_t)0)
495 #define         HFA384x_RID_TXRATECNTL_LEN      ((uint16_t)4)
496 #define         HFA384x_RID_PROMISCMODE_LEN     ((uint16_t)2)
497 #define         HFA384x_RID_FRAGTHRESH0_LEN     ((uint16_t)0)
498 #define         HFA384x_RID_FRAGTHRESH1_LEN     ((uint16_t)0)
499 #define         HFA384x_RID_FRAGTHRESH2_LEN     ((uint16_t)0)
500 #define         HFA384x_RID_FRAGTHRESH3_LEN     ((uint16_t)0)
501 #define         HFA384x_RID_FRAGTHRESH4_LEN     ((uint16_t)0)
502 #define         HFA384x_RID_FRAGTHRESH5_LEN     ((uint16_t)0)
503 #define         HFA384x_RID_FRAGTHRESH6_LEN     ((uint16_t)0)
504 #define         HFA384x_RID_RTSTHRESH0_LEN      ((uint16_t)0)
505 #define         HFA384x_RID_RTSTHRESH1_LEN      ((uint16_t)0)
506 #define         HFA384x_RID_RTSTHRESH2_LEN      ((uint16_t)0)
507 #define         HFA384x_RID_RTSTHRESH3_LEN      ((uint16_t)0)
508 #define         HFA384x_RID_RTSTHRESH4_LEN      ((uint16_t)0)
509 #define         HFA384x_RID_RTSTHRESH5_LEN      ((uint16_t)0)
510 #define         HFA384x_RID_RTSTHRESH6_LEN      ((uint16_t)0)
511 #define         HFA384x_RID_TXRATECNTL0_LEN     ((uint16_t)0)
512 #define         HFA384x_RID_TXRATECNTL1_LEN     ((uint16_t)0)
513 #define         HFA384x_RID_TXRATECNTL2_LEN     ((uint16_t)0)
514 #define         HFA384x_RID_TXRATECNTL3_LEN     ((uint16_t)0)
515 #define         HFA384x_RID_TXRATECNTL4_LEN     ((uint16_t)0)
516 #define         HFA384x_RID_TXRATECNTL5_LEN     ((uint16_t)0)
517 #define         HFA384x_RID_TXRATECNTL6_LEN     ((uint16_t)0)
518
519 /*--------------------------------------------------------------------
520 Configuration RIDs: Behavior Parameters
521 --------------------------------------------------------------------*/
522 #define         HFA384x_RID_ITICKTIME           ((uint16_t)0xFCE0)
523
524 /*--------------------------------------------------------------------
525 Configuration RID Lengths: Behavior Parameters
526   This is the length of JUST the DATA part of the RID (does not
527   include the len or code fields)
528 --------------------------------------------------------------------*/
529 #define         HFA384x_RID_ITICKTIME_LEN       ((uint16_t)2)
530
531 /*----------------------------------------------------------------------
532 Information RIDs: NIC Information
533 --------------------------------------------------------------------*/
534 #define         HFA384x_RID_MAXLOADTIME         ((uint16_t)0xFD00)
535 #define         HFA384x_RID_DOWNLOADBUFFER      ((uint16_t)0xFD01)
536 #define         HFA384x_RID_PRIIDENTITY         ((uint16_t)0xFD02)
537 #define         HFA384x_RID_PRISUPRANGE         ((uint16_t)0xFD03)
538 #define         HFA384x_RID_PRI_CFIACTRANGES    ((uint16_t)0xFD04)
539 #define         HFA384x_RID_NICSERIALNUMBER     ((uint16_t)0xFD0A)
540 #define         HFA384x_RID_NICIDENTITY         ((uint16_t)0xFD0B)
541 #define         HFA384x_RID_MFISUPRANGE         ((uint16_t)0xFD0C)
542 #define         HFA384x_RID_CFISUPRANGE         ((uint16_t)0xFD0D)
543 #define         HFA384x_RID_CHANNELLIST         ((uint16_t)0xFD10)
544 #define         HFA384x_RID_REGULATORYDOMAINS   ((uint16_t)0xFD11)
545 #define         HFA384x_RID_TEMPTYPE            ((uint16_t)0xFD12)
546 #define         HFA384x_RID_CIS                 ((uint16_t)0xFD13)
547 #define         HFA384x_RID_STAIDENTITY         ((uint16_t)0xFD20)
548 #define         HFA384x_RID_STASUPRANGE         ((uint16_t)0xFD21)
549 #define         HFA384x_RID_STA_MFIACTRANGES    ((uint16_t)0xFD22)
550 #define         HFA384x_RID_STA_CFIACTRANGES    ((uint16_t)0xFD23)
551 #define         HFA384x_RID_BUILDSEQ            ((uint16_t)0xFFFE)
552 #define         HFA384x_RID_FWID                ((uint16_t)0xFFFF)
553
554 /*----------------------------------------------------------------------
555 Information RID Lengths: NIC Information
556   This is the length of JUST the DATA part of the RID (does not
557   include the len or code fields)
558 --------------------------------------------------------------------*/
559 #define         HFA384x_RID_MAXLOADTIME_LEN             ((uint16_t)0)
560 #define         HFA384x_RID_DOWNLOADBUFFER_LEN          ((uint16_t)sizeof(hfa384x_downloadbuffer_t))
561 #define         HFA384x_RID_PRIIDENTITY_LEN             ((uint16_t)8)
562 #define         HFA384x_RID_PRISUPRANGE_LEN             ((uint16_t)10)
563 #define         HFA384x_RID_CFIACTRANGES_LEN            ((uint16_t)10)
564 #define         HFA384x_RID_NICSERIALNUMBER_LEN         ((uint16_t)12)
565 #define         HFA384x_RID_NICIDENTITY_LEN             ((uint16_t)8)
566 #define         HFA384x_RID_MFISUPRANGE_LEN             ((uint16_t)10)
567 #define         HFA384x_RID_CFISUPRANGE_LEN             ((uint16_t)10)
568 #define         HFA384x_RID_CHANNELLIST_LEN             ((uint16_t)0)
569 #define         HFA384x_RID_REGULATORYDOMAINS_LEN       ((uint16_t)12)
570 #define         HFA384x_RID_TEMPTYPE_LEN                ((uint16_t)0)
571 #define         HFA384x_RID_CIS_LEN                     ((uint16_t)480)
572 #define         HFA384x_RID_STAIDENTITY_LEN             ((uint16_t)8)
573 #define         HFA384x_RID_STASUPRANGE_LEN             ((uint16_t)10)
574 #define         HFA384x_RID_MFIACTRANGES_LEN            ((uint16_t)10)
575 #define         HFA384x_RID_CFIACTRANGES2_LEN           ((uint16_t)10)
576 #define         HFA384x_RID_BUILDSEQ_LEN                ((uint16_t)sizeof(hfa384x_BuildSeq_t))
577 #define         HFA384x_RID_FWID_LEN                    ((uint16_t)sizeof(hfa384x_FWID_t))
578
579 /*--------------------------------------------------------------------
580 Information RIDs:  MAC Information
581 --------------------------------------------------------------------*/
582 #define         HFA384x_RID_PORTSTATUS          ((uint16_t)0xFD40)
583 #define         HFA384x_RID_CURRENTSSID         ((uint16_t)0xFD41)
584 #define         HFA384x_RID_CURRENTBSSID        ((uint16_t)0xFD42)
585 #define         HFA384x_RID_COMMSQUALITY        ((uint16_t)0xFD43)
586 #define         HFA384x_RID_CURRENTTXRATE       ((uint16_t)0xFD44)
587 #define         HFA384x_RID_CURRENTBCNint       ((uint16_t)0xFD45)
588 #define         HFA384x_RID_CURRENTSCALETHRESH  ((uint16_t)0xFD46)
589 #define         HFA384x_RID_PROTOCOLRSPTIME     ((uint16_t)0xFD47)
590 #define         HFA384x_RID_SHORTRETRYLIMIT     ((uint16_t)0xFD48)
591 #define         HFA384x_RID_LONGRETRYLIMIT      ((uint16_t)0xFD49)
592 #define         HFA384x_RID_MAXTXLIFETIME       ((uint16_t)0xFD4A)
593 #define         HFA384x_RID_MAXRXLIFETIME       ((uint16_t)0xFD4B)
594 #define         HFA384x_RID_CFPOLLABLE          ((uint16_t)0xFD4C)
595 #define         HFA384x_RID_AUTHALGORITHMS      ((uint16_t)0xFD4D)
596 #define         HFA384x_RID_PRIVACYOPTIMP       ((uint16_t)0xFD4F)
597 #define         HFA384x_RID_DBMCOMMSQUALITY     ((uint16_t)0xFD51)
598 #define         HFA384x_RID_CURRENTTXRATE1      ((uint16_t)0xFD80)
599 #define         HFA384x_RID_CURRENTTXRATE2      ((uint16_t)0xFD81)
600 #define         HFA384x_RID_CURRENTTXRATE3      ((uint16_t)0xFD82)
601 #define         HFA384x_RID_CURRENTTXRATE4      ((uint16_t)0xFD83)
602 #define         HFA384x_RID_CURRENTTXRATE5      ((uint16_t)0xFD84)
603 #define         HFA384x_RID_CURRENTTXRATE6      ((uint16_t)0xFD85)
604 #define         HFA384x_RID_OWNMACADDRESS       ((uint16_t)0xFD86)
605 // #define      HFA384x_RID_PCFINFO             ((uint16_t)0xFD87)
606 #define         HFA384x_RID_SCANRESULTS         ((uint16_t)0xFD88) // NEW
607 #define         HFA384x_RID_HOSTSCANRESULTS     ((uint16_t)0xFD89) // NEW
608 #define         HFA384x_RID_AUTHENTICATIONUSED  ((uint16_t)0xFD8A) // NEW
609 #define         HFA384x_RID_ASSOCIATEFAILURE    ((uint16_t)0xFD8D) // 1.8.0
610
611 /*--------------------------------------------------------------------
612 Information RID Lengths:  MAC Information
613   This is the length of JUST the DATA part of the RID (does not
614   include the len or code fields)
615 --------------------------------------------------------------------*/
616 #define         HFA384x_RID_PORTSTATUS_LEN              ((uint16_t)0)
617 #define         HFA384x_RID_CURRENTSSID_LEN             ((uint16_t)34)
618 #define         HFA384x_RID_CURRENTBSSID_LEN            ((uint16_t)WLAN_BSSID_LEN)
619 #define         HFA384x_RID_COMMSQUALITY_LEN            ((uint16_t)sizeof(hfa384x_commsquality_t))
620 #define         HFA384x_RID_DBMCOMMSQUALITY_LEN         ((uint16_t)sizeof(hfa384x_dbmcommsquality_t))
621 #define         HFA384x_RID_CURRENTTXRATE_LEN           ((uint16_t)0)
622 #define         HFA384x_RID_CURRENTBCNINT_LEN           ((uint16_t)0)
623 #define         HFA384x_RID_STACURSCALETHRESH_LEN       ((uint16_t)12)
624 #define         HFA384x_RID_APCURSCALETHRESH_LEN        ((uint16_t)6)
625 #define         HFA384x_RID_PROTOCOLRSPTIME_LEN         ((uint16_t)0)
626 #define         HFA384x_RID_SHORTRETRYLIMIT_LEN         ((uint16_t)0)
627 #define         HFA384x_RID_LONGRETRYLIMIT_LEN          ((uint16_t)0)
628 #define         HFA384x_RID_MAXTXLIFETIME_LEN           ((uint16_t)0)
629 #define         HFA384x_RID_MAXRXLIFETIME_LEN           ((uint16_t)0)
630 #define         HFA384x_RID_CFPOLLABLE_LEN              ((uint16_t)0)
631 #define         HFA384x_RID_AUTHALGORITHMS_LEN          ((uint16_t)4)
632 #define         HFA384x_RID_PRIVACYOPTIMP_LEN           ((uint16_t)0)
633 #define         HFA384x_RID_CURRENTTXRATE1_LEN          ((uint16_t)0)
634 #define         HFA384x_RID_CURRENTTXRATE2_LEN          ((uint16_t)0)
635 #define         HFA384x_RID_CURRENTTXRATE3_LEN          ((uint16_t)0)
636 #define         HFA384x_RID_CURRENTTXRATE4_LEN          ((uint16_t)0)
637 #define         HFA384x_RID_CURRENTTXRATE5_LEN          ((uint16_t)0)
638 #define         HFA384x_RID_CURRENTTXRATE6_LEN          ((uint16_t)0)
639 #define         HFA384x_RID_OWNMACADDRESS_LEN           ((uint16_t)6)
640 #define         HFA384x_RID_PCFINFO_LEN                 ((uint16_t)6)
641 #define         HFA384x_RID_CNFAPPCFINFO_LEN            ((uint16_t)sizeof(hfa384x_PCFInfo_data_t))
642 #define         HFA384x_RID_SCANREQUEST_LEN             ((uint16_t)sizeof(hfa384x_ScanRequest_data_t))
643 #define         HFA384x_RID_JOINREQUEST_LEN             ((uint16_t)sizeof(hfa384x_JoinRequest_data_t))
644 #define         HFA384x_RID_AUTHENTICATESTA_LEN         ((uint16_t)sizeof(hfa384x_authenticateStation_data_t))
645 #define         HFA384x_RID_CHANNELINFOREQUEST_LEN      ((uint16_t)sizeof(hfa384x_ChannelInfoRequest_data_t))
646 /*--------------------------------------------------------------------
647 Information RIDs:  Modem Information
648 --------------------------------------------------------------------*/
649 #define         HFA384x_RID_PHYTYPE             ((uint16_t)0xFDC0)
650 #define         HFA384x_RID_CURRENTCHANNEL      ((uint16_t)0xFDC1)
651 #define         HFA384x_RID_CURRENTPOWERSTATE   ((uint16_t)0xFDC2)
652 #define         HFA384x_RID_CCAMODE             ((uint16_t)0xFDC3)
653 #define         HFA384x_RID_SUPPORTEDDATARATES  ((uint16_t)0xFDC6)
654 #define         HFA384x_RID_LFOSTATUS           ((uint16_t)0xFDC7) // 1.7.1
655
656 /*--------------------------------------------------------------------
657 Information RID Lengths:  Modem Information
658   This is the length of JUST the DATA part of the RID (does not
659   include the len or code fields)
660 --------------------------------------------------------------------*/
661 #define         HFA384x_RID_PHYTYPE_LEN                 ((uint16_t)0)
662 #define         HFA384x_RID_CURRENTCHANNEL_LEN          ((uint16_t)0)
663 #define         HFA384x_RID_CURRENTPOWERSTATE_LEN       ((uint16_t)0)
664 #define         HFA384x_RID_CCAMODE_LEN                 ((uint16_t)0)
665 #define         HFA384x_RID_SUPPORTEDDATARATES_LEN      ((uint16_t)10)
666
667 /*--------------------------------------------------------------------
668 API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
669 --------------------------------------------------------------------*/
670 #define         HFA384x_RID_CNFWEPDEFAULTKEYID  ((uint16_t)0xFC23)
671 #define         HFA384x_RID_CNFWEPDEFAULTKEY0   ((uint16_t)0xFC24)
672 #define         HFA384x_RID_CNFWEPDEFAULTKEY1   ((uint16_t)0xFC25)
673 #define         HFA384x_RID_CNFWEPDEFAULTKEY2   ((uint16_t)0xFC26)
674 #define         HFA384x_RID_CNFWEPDEFAULTKEY3   ((uint16_t)0xFC27)
675 #define         HFA384x_RID_CNFWEPFLAGS         ((uint16_t)0xFC28)
676 #define         HFA384x_RID_CNFWEPKEYMAPTABLE   ((uint16_t)0xFC29)
677 #define         HFA384x_RID_CNFAUTHENTICATION   ((uint16_t)0xFC2A)
678 #define         HFA384x_RID_CNFMAXASSOCSTATIONS ((uint16_t)0xFC2B)
679 #define         HFA384x_RID_CNFTXCONTROL        ((uint16_t)0xFC2C)
680 #define         HFA384x_RID_CNFROAMINGMODE      ((uint16_t)0xFC2D)
681 #define         HFA384x_RID_CNFHOSTAUTHASSOC    ((uint16_t)0xFC2E)
682 #define         HFA384x_RID_CNFRCVCRCERROR      ((uint16_t)0xFC30)
683 // #define              HFA384x_RID_CNFMMLIFE           ((uint16_t)0xFC31)
684 #define         HFA384x_RID_CNFALTRETRYCNT      ((uint16_t)0xFC32)
685 #define         HFA384x_RID_CNFAPBCNint         ((uint16_t)0xFC33)
686 #define         HFA384x_RID_CNFAPPCFINFO        ((uint16_t)0xFC34)
687 #define         HFA384x_RID_CNFSTAPCFINFO       ((uint16_t)0xFC35)
688 #define         HFA384x_RID_CNFPRIORITYQUSAGE   ((uint16_t)0xFC37)
689 #define         HFA384x_RID_CNFTIMCTRL          ((uint16_t)0xFC40)
690 #define         HFA384x_RID_CNFTHIRTY2TALLY     ((uint16_t)0xFC42)
691 #define         HFA384x_RID_CNFENHSECURITY      ((uint16_t)0xFC43)
692 #define         HFA384x_RID_CNFDBMADJUST        ((uint16_t)0xFC46) // NEW
693 #define         HFA384x_RID_CNFWPADATA          ((uint16_t)0xFC48) // 1.7.0
694 #define         HFA384x_RID_CNFPROPOGATIONDELAY ((uint16_t)0xFC49) // 1.7.6
695 #define         HFA384x_RID_CNFSHORTPREAMBLE    ((uint16_t)0xFCB0)
696 #define         HFA384x_RID_CNFEXCLONGPREAMBLE  ((uint16_t)0xFCB1)
697 #define         HFA384x_RID_CNFAUTHRSPTIMEOUT   ((uint16_t)0xFCB2)
698 #define         HFA384x_RID_CNFBASICRATES       ((uint16_t)0xFCB3)
699 #define         HFA384x_RID_CNFSUPPRATES        ((uint16_t)0xFCB4)
700 #define         HFA384x_RID_CNFFALLBACKCTRL     ((uint16_t)0xFCB5) // NEW
701 #define         HFA384x_RID_WEPKEYSTATUS        ((uint16_t)0xFCB6) // NEW
702 #define         HFA384x_RID_WEPKEYMAPINDEX      ((uint16_t)0xFCB7) // NEW
703 #define         HFA384x_RID_BROADCASTKEYID      ((uint16_t)0xFCB8) // NEW
704 #define         HFA384x_RID_ENTSECFLAGEYID      ((uint16_t)0xFCB9) // NEW
705 #define         HFA384x_RID_CNFPASSIVESCANCTRL  ((uint16_t)0xFCBA) // NEW STA
706 #define         HFA384x_RID_CNFWPAHANDLING      ((uint16_t)0xFCBB) // 1.7.0
707 #define         HFA384x_RID_MDCCONTROL          ((uint16_t)0xFCBC) // 1.7.0/1.4.0
708 #define         HFA384x_RID_MDCCOUNTRY          ((uint16_t)0xFCBD) // 1.7.0/1.4.0
709 #define         HFA384x_RID_TXPOWERMAX          ((uint16_t)0xFCBE) // 1.7.0/1.4.0
710 #define         HFA384x_RID_CNFLFOENBLED        ((uint16_t)0xFCBF) // 1.6.3
711 #define         HFA384x_RID_CAPINFO             ((uint16_t)0xFCC0) // 1.7.0/1.3.7
712 #define         HFA384x_RID_LISTENINTERVAL      ((uint16_t)0xFCC1) // 1.7.0/1.3.7
713 #define         HFA384x_RID_DIVERSITYENABLED    ((uint16_t)0xFCC2) // 1.7.0/1.3.7
714 #define         HFA384x_RID_LED_CONTROL         ((uint16_t)0xFCC4) // 1.7.6
715 #define         HFA384x_RID_HFO_DELAY           ((uint16_t)0xFCC5) // 1.7.6
716 #define         HFA384x_RID_DISSALOWEDBSSID     ((uint16_t)0xFCC6) // 1.8.0
717 #define         HFA384x_RID_SCANREQUEST         ((uint16_t)0xFCE1)
718 #define         HFA384x_RID_JOINREQUEST         ((uint16_t)0xFCE2)
719 #define         HFA384x_RID_AUTHENTICATESTA     ((uint16_t)0xFCE3)
720 #define         HFA384x_RID_CHANNELINFOREQUEST  ((uint16_t)0xFCE4)
721 #define         HFA384x_RID_HOSTSCAN            ((uint16_t)0xFCE5) // NEW STA
722 #define         HFA384x_RID_ASSOCIATESTA        ((uint16_t)0xFCE6)
723
724 #define         HFA384x_RID_CNFWEPDEFAULTKEY_LEN        ((uint16_t)6)
725 #define         HFA384x_RID_CNFWEP128DEFAULTKEY_LEN     ((uint16_t)14)
726 #define         HFA384x_RID_CNFPRIOQUSAGE_LEN           ((uint16_t)4)
727 /*--------------------------------------------------------------------
728 PD Record codes
729 --------------------------------------------------------------------*/
730 #define HFA384x_PDR_PCB_PARTNUM         ((uint16_t)0x0001)
731 #define HFA384x_PDR_PDAVER              ((uint16_t)0x0002)
732 #define HFA384x_PDR_NIC_SERIAL          ((uint16_t)0x0003)
733 #define HFA384x_PDR_MKK_MEASUREMENTS    ((uint16_t)0x0004)
734 #define HFA384x_PDR_NIC_RAMSIZE         ((uint16_t)0x0005)
735 #define HFA384x_PDR_MFISUPRANGE         ((uint16_t)0x0006)
736 #define HFA384x_PDR_CFISUPRANGE         ((uint16_t)0x0007)
737 #define HFA384x_PDR_NICID               ((uint16_t)0x0008)
738 //#define HFA384x_PDR_REFDAC_MEASUREMENTS       ((uint16_t)0x0010)
739 //#define HFA384x_PDR_VGDAC_MEASUREMENTS        ((uint16_t)0x0020)
740 //#define HFA384x_PDR_LEVEL_COMP_MEASUREMENTS   ((uint16_t)0x0030)
741 //#define HFA384x_PDR_MODEM_TRIMDAC_MEASUREMENTS        ((uint16_t)0x0040)
742 //#define HFA384x_PDR_COREGA_HACK               ((uint16_t)0x00ff)
743 #define HFA384x_PDR_MAC_ADDRESS         ((uint16_t)0x0101)
744 //#define HFA384x_PDR_MKK_CALLNAME      ((uint16_t)0x0102)
745 #define HFA384x_PDR_REGDOMAIN           ((uint16_t)0x0103)
746 #define HFA384x_PDR_ALLOWED_CHANNEL     ((uint16_t)0x0104)
747 #define HFA384x_PDR_DEFAULT_CHANNEL     ((uint16_t)0x0105)
748 //#define HFA384x_PDR_PRIVACY_OPTION    ((uint16_t)0x0106)
749 #define HFA384x_PDR_TEMPTYPE            ((uint16_t)0x0107)
750 //#define HFA384x_PDR_REFDAC_SETUP      ((uint16_t)0x0110)
751 //#define HFA384x_PDR_VGDAC_SETUP               ((uint16_t)0x0120)
752 //#define HFA384x_PDR_LEVEL_COMP_SETUP  ((uint16_t)0x0130)
753 //#define HFA384x_PDR_TRIMDAC_SETUP     ((uint16_t)0x0140)
754 #define HFA384x_PDR_IFR_SETTING         ((uint16_t)0x0200)
755 #define HFA384x_PDR_RFR_SETTING         ((uint16_t)0x0201)
756 #define HFA384x_PDR_HFA3861_BASELINE    ((uint16_t)0x0202)
757 #define HFA384x_PDR_HFA3861_SHADOW      ((uint16_t)0x0203)
758 #define HFA384x_PDR_HFA3861_IFRF        ((uint16_t)0x0204)
759 #define HFA384x_PDR_HFA3861_CHCALSP     ((uint16_t)0x0300)
760 #define HFA384x_PDR_HFA3861_CHCALI      ((uint16_t)0x0301)
761 #define HFA384x_PDR_MAX_TX_POWER        ((uint16_t)0x0302)
762 #define HFA384x_PDR_MASTER_CHAN_LIST    ((uint16_t)0x0303)
763 #define HFA384x_PDR_3842_NIC_CONFIG     ((uint16_t)0x0400)
764 #define HFA384x_PDR_USB_ID              ((uint16_t)0x0401)
765 #define HFA384x_PDR_PCI_ID              ((uint16_t)0x0402)
766 #define HFA384x_PDR_PCI_IFCONF          ((uint16_t)0x0403)
767 #define HFA384x_PDR_PCI_PMCONF          ((uint16_t)0x0404)
768 #define HFA384x_PDR_RFENRGY             ((uint16_t)0x0406)
769 #define HFA384x_PDR_USB_POWER_TYPE      ((uint16_t)0x0407)
770 //#define HFA384x_PDR_UNKNOWN408                ((uint16_t)0x0408)
771 #define HFA384x_PDR_USB_MAX_POWER       ((uint16_t)0x0409)
772 #define HFA384x_PDR_USB_MANUFACTURER    ((uint16_t)0x0410)
773 #define HFA384x_PDR_USB_PRODUCT         ((uint16_t)0x0411)
774 #define HFA384x_PDR_ANT_DIVERSITY       ((uint16_t)0x0412)
775 #define HFA384x_PDR_HFO_DELAY           ((uint16_t)0x0413)
776 #define HFA384x_PDR_SCALE_THRESH        ((uint16_t)0x0414)
777
778 #define HFA384x_PDR_HFA3861_MANF_TESTSP ((uint16_t)0x0900)
779 #define HFA384x_PDR_HFA3861_MANF_TESTI  ((uint16_t)0x0901)
780 #define HFA384x_PDR_END_OF_PDA          ((uint16_t)0x0000)
781
782
783 /*=============================================================*/
784 /*------ Macros -----------------------------------------------*/
785
786 /*--- Register ID macros ------------------------*/
787
788 #define         HFA384x_CMD             HFA384x_CMD_OFF
789 #define         HFA384x_PARAM0          HFA384x_PARAM0_OFF
790 #define         HFA384x_PARAM1          HFA384x_PARAM1_OFF
791 #define         HFA384x_PARAM2          HFA384x_PARAM2_OFF
792 #define         HFA384x_STATUS          HFA384x_STATUS_OFF
793 #define         HFA384x_RESP0           HFA384x_RESP0_OFF
794 #define         HFA384x_RESP1           HFA384x_RESP1_OFF
795 #define         HFA384x_RESP2           HFA384x_RESP2_OFF
796 #define         HFA384x_INFOFID         HFA384x_INFOFID_OFF
797 #define         HFA384x_RXFID           HFA384x_RXFID_OFF
798 #define         HFA384x_ALLOCFID        HFA384x_ALLOCFID_OFF
799 #define         HFA384x_TXCOMPLFID      HFA384x_TXCOMPLFID_OFF
800 #define         HFA384x_SELECT0         HFA384x_SELECT0_OFF
801 #define         HFA384x_OFFSET0         HFA384x_OFFSET0_OFF
802 #define         HFA384x_DATA0           HFA384x_DATA0_OFF
803 #define         HFA384x_SELECT1         HFA384x_SELECT1_OFF
804 #define         HFA384x_OFFSET1         HFA384x_OFFSET1_OFF
805 #define         HFA384x_DATA1           HFA384x_DATA1_OFF
806 #define         HFA384x_EVSTAT          HFA384x_EVSTAT_OFF
807 #define         HFA384x_INTEN           HFA384x_INTEN_OFF
808 #define         HFA384x_EVACK           HFA384x_EVACK_OFF
809 #define         HFA384x_CONTROL         HFA384x_CONTROL_OFF
810 #define         HFA384x_SWSUPPORT0      HFA384x_SWSUPPORT0_OFF
811 #define         HFA384x_SWSUPPORT1      HFA384x_SWSUPPORT1_OFF
812 #define         HFA384x_SWSUPPORT2      HFA384x_SWSUPPORT2_OFF
813 #define         HFA384x_AUXPAGE         HFA384x_AUXPAGE_OFF
814 #define         HFA384x_AUXOFFSET       HFA384x_AUXOFFSET_OFF
815 #define         HFA384x_AUXDATA         HFA384x_AUXDATA_OFF
816 #define         HFA384x_PCICOR          HFA384x_PCICOR_OFF
817 #define         HFA384x_PCIHCR          HFA384x_PCIHCR_OFF
818
819
820 /*--- Register Test/Get/Set Field macros ------------------------*/
821
822 #define         HFA384x_CMD_ISBUSY(value)               ((uint16_t)(((uint16_t)value) & HFA384x_CMD_BUSY))
823 #define         HFA384x_CMD_AINFO_GET(value)            ((uint16_t)(((uint16_t)(value) & HFA384x_CMD_AINFO) >> 8))
824 #define         HFA384x_CMD_AINFO_SET(value)            ((uint16_t)((uint16_t)(value) << 8))
825 #define         HFA384x_CMD_MACPORT_GET(value)          ((uint16_t)(HFA384x_CMD_AINFO_GET((uint16_t)(value) & HFA384x_CMD_MACPORT)))
826 #define         HFA384x_CMD_MACPORT_SET(value)          ((uint16_t)HFA384x_CMD_AINFO_SET(value))
827 #define         HFA384x_CMD_ISRECL(value)               ((uint16_t)(HFA384x_CMD_AINFO_GET((uint16_t)(value) & HFA384x_CMD_RECL)))
828 #define         HFA384x_CMD_RECL_SET(value)             ((uint16_t)HFA384x_CMD_AINFO_SET(value))
829 #define         HFA384x_CMD_QOS_GET(value)              ((uint16_t((((uint16_t)(value))&((uint16_t)0x3000)) >> 12))
830 #define         HFA384x_CMD_QOS_SET(value)              ((uint16_t)((((uint16_t)(value)) << 12) & 0x3000))
831 #define         HFA384x_CMD_ISWRITE(value)              ((uint16_t)(HFA384x_CMD_AINFO_GET((uint16_t)(value) & HFA384x_CMD_WRITE)))
832 #define         HFA384x_CMD_WRITE_SET(value)            ((uint16_t)HFA384x_CMD_AINFO_SET((uint16_t)value))
833 #define         HFA384x_CMD_PROGMODE_GET(value)         ((uint16_t)(HFA384x_CMD_AINFO_GET((uint16_t)(value) & HFA384x_CMD_PROGMODE)))
834 #define         HFA384x_CMD_PROGMODE_SET(value)         ((uint16_t)HFA384x_CMD_AINFO_SET((uint16_t)value))
835 #define         HFA384x_CMD_CMDCODE_GET(value)          ((uint16_t)(((uint16_t)(value)) & HFA384x_CMD_CMDCODE))
836 #define         HFA384x_CMD_CMDCODE_SET(value)          ((uint16_t)(value))
837
838 #define         HFA384x_STATUS_RESULT_GET(value)        ((uint16_t)((((uint16_t)(value)) & HFA384x_STATUS_RESULT) >> 8))
839 #define         HFA384x_STATUS_RESULT_SET(value)        (((uint16_t)(value)) << 8)
840 #define         HFA384x_STATUS_CMDCODE_GET(value)       (((uint16_t)(value)) & HFA384x_STATUS_CMDCODE)
841 #define         HFA384x_STATUS_CMDCODE_SET(value)       ((uint16_t)(value))
842
843 #define         HFA384x_OFFSET_ISBUSY(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_OFFSET_BUSY))
844 #define         HFA384x_OFFSET_ISERR(value)             ((uint16_t)(((uint16_t)(value)) & HFA384x_OFFSET_ERR))
845 #define         HFA384x_OFFSET_DATAOFF_GET(value)       ((uint16_t)(((uint16_t)(value)) & HFA384x_OFFSET_DATAOFF))
846 #define         HFA384x_OFFSET_DATAOFF_SET(value)       ((uint16_t)(value))
847
848 #define         HFA384x_EVSTAT_ISTICK(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_TICK))
849 #define         HFA384x_EVSTAT_ISWTERR(value)           ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_WTERR))
850 #define         HFA384x_EVSTAT_ISINFDROP(value)         ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_INFDROP))
851 #define         HFA384x_EVSTAT_ISINFO(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_INFO))
852 #define         HFA384x_EVSTAT_ISDTIM(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_DTIM))
853 #define         HFA384x_EVSTAT_ISCMD(value)             ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_CMD))
854 #define         HFA384x_EVSTAT_ISALLOC(value)           ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_ALLOC))
855 #define         HFA384x_EVSTAT_ISTXEXC(value)           ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_TXEXC))
856 #define         HFA384x_EVSTAT_ISTX(value)              ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_TX))
857 #define         HFA384x_EVSTAT_ISRX(value)              ((uint16_t)(((uint16_t)(value)) & HFA384x_EVSTAT_RX))
858
859 #define         HFA384x_EVSTAT_ISBAP_OP(value)          ((uint16_t)(((uint16_t)(value)) & HFA384x_INT_BAP_OP))
860
861 #define         HFA384x_INTEN_ISTICK(value)             ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_TICK))
862 #define         HFA384x_INTEN_TICK_SET(value)           ((uint16_t)(((uint16_t)(value)) << 15))
863 #define         HFA384x_INTEN_ISWTERR(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_WTERR))
864 #define         HFA384x_INTEN_WTERR_SET(value)          ((uint16_t)(((uint16_t)(value)) << 14))
865 #define         HFA384x_INTEN_ISINFDROP(value)          ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_INFDROP))
866 #define         HFA384x_INTEN_INFDROP_SET(value)        ((uint16_t)(((uint16_t)(value)) << 13))
867 #define         HFA384x_INTEN_ISINFO(value)             ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_INFO))
868 #define         HFA384x_INTEN_INFO_SET(value)           ((uint16_t)(((uint16_t)(value)) << 7))
869 #define         HFA384x_INTEN_ISDTIM(value)             ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_DTIM))
870 #define         HFA384x_INTEN_DTIM_SET(value)           ((uint16_t)(((uint16_t)(value)) << 5))
871 #define         HFA384x_INTEN_ISCMD(value)              ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_CMD))
872 #define         HFA384x_INTEN_CMD_SET(value)            ((uint16_t)(((uint16_t)(value)) << 4))
873 #define         HFA384x_INTEN_ISALLOC(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_ALLOC))
874 #define         HFA384x_INTEN_ALLOC_SET(value)          ((uint16_t)(((uint16_t)(value)) << 3))
875 #define         HFA384x_INTEN_ISTXEXC(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_TXEXC))
876 #define         HFA384x_INTEN_TXEXC_SET(value)          ((uint16_t)(((uint16_t)(value)) << 2))
877 #define         HFA384x_INTEN_ISTX(value)               ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_TX))
878 #define         HFA384x_INTEN_TX_SET(value)             ((uint16_t)(((uint16_t)(value)) << 1))
879 #define         HFA384x_INTEN_ISRX(value)               ((uint16_t)(((uint16_t)(value)) & HFA384x_INTEN_RX))
880 #define         HFA384x_INTEN_RX_SET(value)             ((uint16_t)(((uint16_t)(value)) << 0))
881
882 #define         HFA384x_EVACK_ISTICK(value)             ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_TICK))
883 #define         HFA384x_EVACK_TICK_SET(value)           ((uint16_t)(((uint16_t)(value)) << 15))
884 #define         HFA384x_EVACK_ISWTERR(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_WTERR))
885 #define         HFA384x_EVACK_WTERR_SET(value)          ((uint16_t)(((uint16_t)(value)) << 14))
886 #define         HFA384x_EVACK_ISINFDROP(value)          ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_INFDROP))
887 #define         HFA384x_EVACK_INFDROP_SET(value)        ((uint16_t)(((uint16_t)(value)) << 13))
888 #define         HFA384x_EVACK_ISINFO(value)             ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_INFO))
889 #define         HFA384x_EVACK_INFO_SET(value)           ((uint16_t)(((uint16_t)(value)) << 7))
890 #define         HFA384x_EVACK_ISDTIM(value)             ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_DTIM))
891 #define         HFA384x_EVACK_DTIM_SET(value)           ((uint16_t)(((uint16_t)(value)) << 5))
892 #define         HFA384x_EVACK_ISCMD(value)              ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_CMD))
893 #define         HFA384x_EVACK_CMD_SET(value)            ((uint16_t)(((uint16_t)(value)) << 4))
894 #define         HFA384x_EVACK_ISALLOC(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_ALLOC))
895 #define         HFA384x_EVACK_ALLOC_SET(value)          ((uint16_t)(((uint16_t)(value)) << 3))
896 #define         HFA384x_EVACK_ISTXEXC(value)            ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_TXEXC))
897 #define         HFA384x_EVACK_TXEXC_SET(value)          ((uint16_t)(((uint16_t)(value)) << 2))
898 #define         HFA384x_EVACK_ISTX(value)               ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_TX))
899 #define         HFA384x_EVACK_TX_SET(value)             ((uint16_t)(((uint16_t)(value)) << 1))
900 #define         HFA384x_EVACK_ISRX(value)               ((uint16_t)(((uint16_t)(value)) & HFA384x_EVACK_RX))
901 #define         HFA384x_EVACK_RX_SET(value)             ((uint16_t)(((uint16_t)(value)) << 0))
902
903 #define         HFA384x_CONTROL_AUXEN_SET(value)        ((uint16_t)(((uint16_t)(value)) << 14))
904 #define         HFA384x_CONTROL_AUXEN_GET(value)        ((uint16_t)(((uint16_t)(value)) >> 14))
905
906 /* Byte Order */
907 #ifdef __KERNEL__
908 #define hfa384x2host_16(n)      (__le16_to_cpu((uint16_t)(n)))
909 #define hfa384x2host_32(n)      (__le32_to_cpu((uint32_t)(n)))
910 #define host2hfa384x_16(n)      (__cpu_to_le16((uint16_t)(n)))
911 #define host2hfa384x_32(n)      (__cpu_to_le32((uint32_t)(n)))
912 #endif
913
914 /* Host Maintained State Info */
915 #define HFA384x_STATE_PREINIT   0
916 #define HFA384x_STATE_INIT      1
917 #define HFA384x_STATE_RUNNING   2
918
919 /*=============================================================*/
920 /*------ Types and their related constants --------------------*/
921
922 #define HFA384x_HOSTAUTHASSOC_HOSTAUTH   BIT0
923 #define HFA384x_HOSTAUTHASSOC_HOSTASSOC  BIT1
924
925 #define HFA384x_WHAHANDLING_DISABLED     0
926 #define HFA384x_WHAHANDLING_PASSTHROUGH  BIT1
927
928 /*-------------------------------------------------------------*/
929 /* Commonly used basic types */
930 typedef struct hfa384x_bytestr
931 {
932         uint16_t        len;
933         uint8_t data[0];
934 } __WLAN_ATTRIB_PACK__ hfa384x_bytestr_t;
935
936 typedef struct hfa384x_bytestr32
937 {
938         uint16_t        len;
939         uint8_t data[32];
940 } __WLAN_ATTRIB_PACK__ hfa384x_bytestr32_t;
941
942 /*--------------------------------------------------------------------
943 Configuration Record Structures:
944         Network Parameters, Static Configuration Entities
945 --------------------------------------------------------------------*/
946 /* Prototype structure: all configuration record structures start with
947 these members */
948
949 typedef struct hfa384x_record
950 {
951         uint16_t        reclen;
952         uint16_t        rid;
953 } __WLAN_ATTRIB_PACK__ hfa384x_rec_t;
954
955 typedef struct hfa384x_record16
956 {
957         uint16_t        reclen;
958         uint16_t        rid;
959         uint16_t        val;
960 } __WLAN_ATTRIB_PACK__ hfa384x_rec16_t;
961
962 typedef struct hfa384x_record32
963 {
964         uint16_t        reclen;
965         uint16_t        rid;
966         uint32_t        val;
967 } __WLAN_ATTRIB_PACK__ hfa384x_rec32;
968
969 /*-- Hardware/Firmware Component Information ----------*/
970 typedef struct hfa384x_compident
971 {
972         uint16_t        id;
973         uint16_t        variant;
974         uint16_t        major;
975         uint16_t        minor;
976 } __WLAN_ATTRIB_PACK__ hfa384x_compident_t;
977
978 typedef struct hfa384x_caplevel
979 {
980         uint16_t        role;
981         uint16_t        id;
982         uint16_t        variant;
983         uint16_t        bottom;
984         uint16_t        top;
985 } __WLAN_ATTRIB_PACK__ hfa384x_caplevel_t;
986
987 /*-- Configuration Record: cnfPortType --*/
988 typedef struct hfa384x_cnfPortType
989 {
990         uint16_t        cnfPortType;
991 } __WLAN_ATTRIB_PACK__ hfa384x_cnfPortType_t;
992
993 /*-- Configuration Record: cnfOwnMACAddress --*/
994 typedef struct hfa384x_cnfOwnMACAddress
995 {
996         uint8_t cnfOwnMACAddress[6];
997 } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnMACAddress_t;
998
999 /*-- Configuration Record: cnfDesiredSSID --*/
1000 typedef struct hfa384x_cnfDesiredSSID
1001 {
1002         uint8_t cnfDesiredSSID[34];
1003 } __WLAN_ATTRIB_PACK__ hfa384x_cnfDesiredSSID_t;
1004
1005 /*-- Configuration Record: cnfOwnChannel --*/
1006 typedef struct hfa384x_cnfOwnChannel
1007 {
1008         uint16_t        cnfOwnChannel;
1009 } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnChannel_t;
1010
1011 /*-- Configuration Record: cnfOwnSSID --*/
1012 typedef struct hfa384x_cnfOwnSSID
1013 {
1014         uint8_t cnfOwnSSID[34];
1015 } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnSSID_t;
1016
1017 /*-- Configuration Record: cnfOwnATIMWindow --*/
1018 typedef struct hfa384x_cnfOwnATIMWindow
1019 {
1020         uint16_t        cnfOwnATIMWindow;
1021 } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnATIMWindow_t;
1022
1023 /*-- Configuration Record: cnfSystemScale --*/
1024 typedef struct hfa384x_cnfSystemScale
1025 {
1026         uint16_t        cnfSystemScale;
1027 } __WLAN_ATTRIB_PACK__ hfa384x_cnfSystemScale_t;
1028
1029 /*-- Configuration Record: cnfMaxDataLength --*/
1030 typedef struct hfa384x_cnfMaxDataLength
1031 {
1032         uint16_t        cnfMaxDataLength;
1033 } __WLAN_ATTRIB_PACK__ hfa384x_cnfMaxDataLength_t;
1034
1035 /*-- Configuration Record: cnfWDSAddress --*/
1036 typedef struct hfa384x_cnfWDSAddress
1037 {
1038         uint8_t cnfWDSAddress[6];
1039 } __WLAN_ATTRIB_PACK__ hfa384x_cnfWDSAddress_t;
1040
1041 /*-- Configuration Record: cnfPMEnabled --*/
1042 typedef struct hfa384x_cnfPMEnabled
1043 {
1044         uint16_t        cnfPMEnabled;
1045 } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMEnabled_t;
1046
1047 /*-- Configuration Record: cnfPMEPS --*/
1048 typedef struct hfa384x_cnfPMEPS
1049 {
1050         uint16_t        cnfPMEPS;
1051 } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMEPS_t;
1052
1053 /*-- Configuration Record: cnfMulticastReceive --*/
1054 typedef struct hfa384x_cnfMulticastReceive
1055 {
1056         uint16_t        cnfMulticastReceive;
1057 } __WLAN_ATTRIB_PACK__ hfa384x_cnfMulticastReceive_t;
1058
1059 /*-- Configuration Record: cnfAuthentication --*/
1060 #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM    0x0001
1061 #define HFA384x_CNFAUTHENTICATION_SHAREDKEY     0x0002
1062 #define HFA384x_CNFAUTHENTICATION_LEAP          0x0004
1063
1064 /*-- Configuration Record: cnfMaxSleepDuration --*/
1065 typedef struct hfa384x_cnfMaxSleepDuration
1066 {
1067         uint16_t        cnfMaxSleepDuration;
1068 } __WLAN_ATTRIB_PACK__ hfa384x_cnfMaxSleepDuration_t;
1069
1070 /*-- Configuration Record: cnfPMHoldoverDuration --*/
1071 typedef struct hfa384x_cnfPMHoldoverDuration
1072 {
1073         uint16_t        cnfPMHoldoverDuration;
1074 } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMHoldoverDuration_t;
1075
1076 /*-- Configuration Record: cnfOwnName --*/
1077 typedef struct hfa384x_cnfOwnName
1078 {
1079         uint8_t cnfOwnName[34];
1080 } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnName_t;
1081
1082 /*-- Configuration Record: cnfOwnDTIMPeriod --*/
1083 typedef struct hfa384x_cnfOwnDTIMPeriod
1084 {
1085         uint16_t        cnfOwnDTIMPeriod;
1086 } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnDTIMPeriod_t;
1087
1088 /*-- Configuration Record: cnfWDSAddress --*/
1089 typedef struct hfa384x_cnfWDSAddressN
1090 {
1091         uint8_t cnfWDSAddress[6];
1092 } __WLAN_ATTRIB_PACK__ hfa384x_cnfWDSAddressN_t;
1093
1094 /*-- Configuration Record: cnfMulticastPMBuffering --*/
1095 typedef struct hfa384x_cnfMulticastPMBuffering
1096 {
1097         uint16_t        cnfMulticastPMBuffering;
1098 } __WLAN_ATTRIB_PACK__ hfa384x_cnfMulticastPMBuffering_t;
1099
1100 /*--------------------------------------------------------------------
1101 Configuration Record Structures:
1102         Network Parameters, Dynamic Configuration Entities
1103 --------------------------------------------------------------------*/
1104
1105 /*-- Configuration Record: GroupAddresses --*/
1106 typedef struct hfa384x_GroupAddresses
1107 {
1108         uint8_t MACAddress[16][6];
1109 } __WLAN_ATTRIB_PACK__ hfa384x_GroupAddresses_t;
1110
1111 /*-- Configuration Record: CreateIBSS --*/
1112 typedef struct hfa384x_CreateIBSS
1113 {
1114         uint16_t        CreateIBSS;
1115 } __WLAN_ATTRIB_PACK__ hfa384x_CreateIBSS_t;
1116
1117 #define HFA384x_CREATEIBSS_JOINCREATEIBSS          0
1118 #define HFA384x_CREATEIBSS_JOINESS_JOINCREATEIBSS  1
1119 #define HFA384x_CREATEIBSS_JOINIBSS                2
1120 #define HFA384x_CREATEIBSS_JOINESS_JOINIBSS        3
1121
1122 /*-- Configuration Record: FragmentationThreshold --*/
1123 typedef struct hfa384x_FragmentationThreshold
1124 {
1125         uint16_t        FragmentationThreshold;
1126 } __WLAN_ATTRIB_PACK__ hfa384x_FragmentationThreshold_t;
1127
1128 /*-- Configuration Record: RTSThreshold --*/
1129 typedef struct hfa384x_RTSThreshold
1130 {
1131         uint16_t        RTSThreshold;
1132 } __WLAN_ATTRIB_PACK__ hfa384x_RTSThreshold_t;
1133
1134 /*-- Configuration Record: TxRateControl --*/
1135 typedef struct hfa384x_TxRateControl
1136 {
1137         uint16_t        TxRateControl;
1138 } __WLAN_ATTRIB_PACK__ hfa384x_TxRateControl_t;
1139
1140 /*-- Configuration Record: PromiscuousMode --*/
1141 typedef struct hfa384x_PromiscuousMode
1142 {
1143         uint16_t        PromiscuousMode;
1144 } __WLAN_ATTRIB_PACK__ hfa384x_PromiscuousMode_t;
1145
1146 /*-- Configuration Record: ScanRequest (data portion only) --*/
1147 typedef struct hfa384x_ScanRequest_data
1148 {
1149         uint16_t        channelList;
1150         uint16_t        txRate;
1151 } __WLAN_ATTRIB_PACK__ hfa384x_ScanRequest_data_t;
1152
1153 /*-- Configuration Record: HostScanRequest (data portion only) --*/
1154 typedef struct hfa384x_HostScanRequest_data
1155 {
1156         uint16_t        channelList;
1157         uint16_t        txRate;
1158         hfa384x_bytestr32_t ssid;
1159 } __WLAN_ATTRIB_PACK__ hfa384x_HostScanRequest_data_t;
1160
1161 /*-- Configuration Record: JoinRequest (data portion only) --*/
1162 typedef struct hfa384x_JoinRequest_data
1163 {
1164         uint8_t bssid[WLAN_BSSID_LEN];
1165         uint16_t        channel;
1166 } __WLAN_ATTRIB_PACK__ hfa384x_JoinRequest_data_t;
1167
1168 /*-- Configuration Record: authenticateStation (data portion only) --*/
1169 typedef struct hfa384x_authenticateStation_data
1170 {
1171         uint8_t address[WLAN_ADDR_LEN];
1172         uint16_t        status;
1173         uint16_t        algorithm;
1174 } __WLAN_ATTRIB_PACK__ hfa384x_authenticateStation_data_t;
1175
1176 /*-- Configuration Record: associateStation (data portion only) --*/
1177 typedef struct hfa384x_associateStation_data
1178 {
1179         uint8_t address[WLAN_ADDR_LEN];
1180         uint16_t        status;
1181         uint16_t        type;
1182 } __WLAN_ATTRIB_PACK__ hfa384x_associateStation_data_t;
1183
1184 /*-- Configuration Record: ChannelInfoRequest (data portion only) --*/
1185 typedef struct hfa384x_ChannelInfoRequest_data
1186 {
1187         uint16_t        channelList;
1188         uint16_t        channelDwellTime;
1189 } __WLAN_ATTRIB_PACK__ hfa384x_ChannelInfoRequest_data_t;
1190
1191 /*-- Configuration Record: WEPKeyMapping (data portion only) --*/
1192 typedef struct hfa384x_WEPKeyMapping
1193 {
1194         uint8_t address[WLAN_ADDR_LEN];
1195         uint16_t        key_index;
1196         uint8_t         key[16];
1197         uint8_t         mic_transmit_key[4];
1198         uint8_t         mic_receive_key[4];
1199 } __WLAN_ATTRIB_PACK__ hfa384x_WEPKeyMapping_t;
1200
1201 /*-- Configuration Record: WPAData       (data portion only) --*/
1202 typedef struct hfa384x_WPAData
1203 {
1204         uint16_t        datalen;
1205         uint8_t         data[0]; // max 80
1206 } __WLAN_ATTRIB_PACK__ hfa384x_WPAData_t;
1207
1208 /*--------------------------------------------------------------------
1209 Configuration Record Structures: Behavior Parameters
1210 --------------------------------------------------------------------*/
1211
1212 /*-- Configuration Record: TickTime --*/
1213 typedef struct hfa384x_TickTime
1214 {
1215         uint16_t        TickTime;
1216 } __WLAN_ATTRIB_PACK__ hfa384x_TickTime_t;
1217
1218 /*--------------------------------------------------------------------
1219 Information Record Structures: NIC Information
1220 --------------------------------------------------------------------*/
1221
1222 /*-- Information Record: MaxLoadTime --*/
1223 typedef struct hfa384x_MaxLoadTime
1224 {
1225         uint16_t        MaxLoadTime;
1226 } __WLAN_ATTRIB_PACK__ hfa384x_MaxLoadTime_t;
1227
1228 /*-- Information Record: DownLoadBuffer --*/
1229 /* NOTE: The page and offset are in AUX format */
1230 typedef struct hfa384x_downloadbuffer
1231 {
1232         uint16_t        page;
1233         uint16_t        offset;
1234         uint16_t        len;
1235 } __WLAN_ATTRIB_PACK__ hfa384x_downloadbuffer_t;
1236
1237 /*-- Information Record: PRIIdentity --*/
1238 typedef struct hfa384x_PRIIdentity
1239 {
1240         uint16_t        PRICompID;
1241         uint16_t        PRIVariant;
1242         uint16_t        PRIMajorVersion;
1243         uint16_t        PRIMinorVersion;
1244 } __WLAN_ATTRIB_PACK__ hfa384x_PRIIdentity_t;
1245
1246 /*-- Information Record: PRISupRange --*/
1247 typedef struct hfa384x_PRISupRange
1248 {
1249         uint16_t        PRIRole;
1250         uint16_t        PRIID;
1251         uint16_t        PRIVariant;
1252         uint16_t        PRIBottom;
1253         uint16_t        PRITop;
1254 } __WLAN_ATTRIB_PACK__ hfa384x_PRISupRange_t;
1255
1256 /*-- Information Record: CFIActRanges --*/
1257 typedef struct hfa384x_CFIActRanges
1258 {
1259         uint16_t        CFIRole;
1260         uint16_t        CFIID;
1261         uint16_t        CFIVariant;
1262         uint16_t        CFIBottom;
1263         uint16_t        CFITop;
1264 } __WLAN_ATTRIB_PACK__ hfa384x_CFIActRanges_t;
1265
1266 /*-- Information Record: NICSerialNumber --*/
1267 typedef struct hfa384x_NICSerialNumber
1268 {
1269         uint8_t NICSerialNumber[12];
1270 } __WLAN_ATTRIB_PACK__ hfa384x_NICSerialNumber_t;
1271
1272 /*-- Information Record: NICIdentity --*/
1273 typedef struct hfa384x_NICIdentity
1274 {
1275         uint16_t        NICCompID;
1276         uint16_t        NICVariant;
1277         uint16_t        NICMajorVersion;
1278         uint16_t        NICMinorVersion;
1279 } __WLAN_ATTRIB_PACK__ hfa384x_NICIdentity_t;
1280
1281 /*-- Information Record: MFISupRange --*/
1282 typedef struct hfa384x_MFISupRange
1283 {
1284         uint16_t        MFIRole;
1285         uint16_t        MFIID;
1286         uint16_t        MFIVariant;
1287         uint16_t        MFIBottom;
1288         uint16_t        MFITop;
1289 } __WLAN_ATTRIB_PACK__ hfa384x_MFISupRange_t;
1290
1291 /*-- Information Record: CFISupRange --*/
1292 typedef struct hfa384x_CFISupRange
1293 {
1294         uint16_t        CFIRole;
1295         uint16_t        CFIID;
1296         uint16_t        CFIVariant;
1297         uint16_t        CFIBottom;
1298         uint16_t        CFITop;
1299 } __WLAN_ATTRIB_PACK__ hfa384x_CFISupRange_t;
1300
1301 /*-- Information Record: BUILDSEQ:BuildSeq --*/
1302 typedef struct hfa384x_BuildSeq {
1303         uint16_t        primary;
1304         uint16_t        secondary;
1305 } __WLAN_ATTRIB_PACK__ hfa384x_BuildSeq_t;
1306
1307 /*-- Information Record: FWID --*/
1308 #define HFA384x_FWID_LEN        14
1309 typedef struct hfa384x_FWID {
1310         uint8_t primary[HFA384x_FWID_LEN];
1311         uint8_t secondary[HFA384x_FWID_LEN];
1312 } __WLAN_ATTRIB_PACK__ hfa384x_FWID_t;
1313
1314 /*-- Information Record: ChannelList --*/
1315 typedef struct hfa384x_ChannelList
1316 {
1317         uint16_t        ChannelList;
1318 } __WLAN_ATTRIB_PACK__ hfa384x_ChannelList_t;
1319
1320 /*-- Information Record: RegulatoryDomains --*/
1321 typedef struct hfa384x_RegulatoryDomains
1322 {
1323         uint8_t RegulatoryDomains[12];
1324 } __WLAN_ATTRIB_PACK__ hfa384x_RegulatoryDomains_t;
1325
1326 /*-- Information Record: TempType --*/
1327 typedef struct hfa384x_TempType
1328 {
1329         uint16_t        TempType;
1330 } __WLAN_ATTRIB_PACK__ hfa384x_TempType_t;
1331
1332 /*-- Information Record: CIS --*/
1333 typedef struct hfa384x_CIS
1334 {
1335         uint8_t CIS[480];
1336 } __WLAN_ATTRIB_PACK__ hfa384x_CIS_t;
1337
1338 /*-- Information Record: STAIdentity --*/
1339 typedef struct hfa384x_STAIdentity
1340 {
1341         uint16_t        STACompID;
1342         uint16_t        STAVariant;
1343         uint16_t        STAMajorVersion;
1344         uint16_t        STAMinorVersion;
1345 } __WLAN_ATTRIB_PACK__ hfa384x_STAIdentity_t;
1346
1347 /*-- Information Record: STASupRange --*/
1348 typedef struct hfa384x_STASupRange
1349 {
1350         uint16_t        STARole;
1351         uint16_t        STAID;
1352         uint16_t        STAVariant;
1353         uint16_t        STABottom;
1354         uint16_t        STATop;
1355 } __WLAN_ATTRIB_PACK__ hfa384x_STASupRange_t;
1356
1357 /*-- Information Record: MFIActRanges --*/
1358 typedef struct hfa384x_MFIActRanges
1359 {
1360         uint16_t        MFIRole;
1361         uint16_t        MFIID;
1362         uint16_t        MFIVariant;
1363         uint16_t        MFIBottom;
1364         uint16_t        MFITop;
1365 } __WLAN_ATTRIB_PACK__ hfa384x_MFIActRanges_t;
1366
1367 /*--------------------------------------------------------------------
1368 Information Record Structures: NIC Information
1369 --------------------------------------------------------------------*/
1370
1371 /*-- Information Record: PortStatus --*/
1372 typedef struct hfa384x_PortStatus
1373 {
1374         uint16_t        PortStatus;
1375 } __WLAN_ATTRIB_PACK__ hfa384x_PortStatus_t;
1376
1377 #define HFA384x_PSTATUS_DISABLED        ((uint16_t)1)
1378 #define HFA384x_PSTATUS_SEARCHING       ((uint16_t)2)
1379 #define HFA384x_PSTATUS_CONN_IBSS       ((uint16_t)3)
1380 #define HFA384x_PSTATUS_CONN_ESS        ((uint16_t)4)
1381 #define HFA384x_PSTATUS_OUTOFRANGE      ((uint16_t)5)
1382 #define HFA384x_PSTATUS_CONN_WDS        ((uint16_t)6)
1383
1384 /*-- Information Record: CurrentSSID --*/
1385 typedef struct hfa384x_CurrentSSID
1386 {
1387         uint8_t CurrentSSID[34];
1388 } __WLAN_ATTRIB_PACK__ hfa384x_CurrentSSID_t;
1389
1390 /*-- Information Record: CurrentBSSID --*/
1391 typedef struct hfa384x_CurrentBSSID
1392 {
1393         uint8_t CurrentBSSID[6];
1394 } __WLAN_ATTRIB_PACK__ hfa384x_CurrentBSSID_t;
1395
1396 /*-- Information Record: commsquality --*/
1397 typedef struct hfa384x_commsquality
1398 {
1399         uint16_t        CQ_currBSS;
1400         uint16_t        ASL_currBSS;
1401         uint16_t        ANL_currFC;
1402 } __WLAN_ATTRIB_PACK__ hfa384x_commsquality_t;
1403
1404 /*-- Information Record: dmbcommsquality --*/
1405 typedef struct hfa384x_dbmcommsquality
1406 {
1407         uint16_t        CQdbm_currBSS;
1408         uint16_t        ASLdbm_currBSS;
1409         uint16_t        ANLdbm_currFC;
1410 } __WLAN_ATTRIB_PACK__ hfa384x_dbmcommsquality_t;
1411
1412 /*-- Information Record: CurrentTxRate --*/
1413 typedef struct hfa384x_CurrentTxRate
1414 {
1415         uint16_t        CurrentTxRate;
1416 } __WLAN_ATTRIB_PACK__ hfa384x_CurrentTxRate_t;
1417
1418 /*-- Information Record: CurrentBeaconInterval --*/
1419 typedef struct hfa384x_CurrentBeaconInterval
1420 {
1421         uint16_t        CurrentBeaconInterval;
1422 } __WLAN_ATTRIB_PACK__ hfa384x_CurrentBeaconInterval_t;
1423
1424 /*-- Information Record: CurrentScaleThresholds --*/
1425 typedef struct hfa384x_CurrentScaleThresholds
1426 {
1427         uint16_t        EnergyDetectThreshold;
1428         uint16_t        CarrierDetectThreshold;
1429         uint16_t        DeferDetectThreshold;
1430         uint16_t        CellSearchThreshold; /* Stations only */
1431         uint16_t        DeadSpotThreshold; /* Stations only */
1432 } __WLAN_ATTRIB_PACK__ hfa384x_CurrentScaleThresholds_t;
1433
1434 /*-- Information Record: ProtocolRspTime --*/
1435 typedef struct hfa384x_ProtocolRspTime
1436 {
1437         uint16_t        ProtocolRspTime;
1438 } __WLAN_ATTRIB_PACK__ hfa384x_ProtocolRspTime_t;
1439
1440 /*-- Information Record: ShortRetryLimit --*/
1441 typedef struct hfa384x_ShortRetryLimit
1442 {
1443         uint16_t        ShortRetryLimit;
1444 } __WLAN_ATTRIB_PACK__ hfa384x_ShortRetryLimit_t;
1445
1446 /*-- Information Record: LongRetryLimit --*/
1447 typedef struct hfa384x_LongRetryLimit
1448 {
1449         uint16_t        LongRetryLimit;
1450 } __WLAN_ATTRIB_PACK__ hfa384x_LongRetryLimit_t;
1451
1452 /*-- Information Record: MaxTransmitLifetime --*/
1453 typedef struct hfa384x_MaxTransmitLifetime
1454 {
1455         uint16_t        MaxTransmitLifetime;
1456 } __WLAN_ATTRIB_PACK__ hfa384x_MaxTransmitLifetime_t;
1457
1458 /*-- Information Record: MaxReceiveLifetime --*/
1459 typedef struct hfa384x_MaxReceiveLifetime
1460 {
1461         uint16_t        MaxReceiveLifetime;
1462 } __WLAN_ATTRIB_PACK__ hfa384x_MaxReceiveLifetime_t;
1463
1464 /*-- Information Record: CFPollable --*/
1465 typedef struct hfa384x_CFPollable
1466 {
1467         uint16_t        CFPollable;
1468 } __WLAN_ATTRIB_PACK__ hfa384x_CFPollable_t;
1469
1470 /*-- Information Record: AuthenticationAlgorithms --*/
1471 typedef struct hfa384x_AuthenticationAlgorithms
1472 {
1473         uint16_t        AuthenticationType;
1474         uint16_t        TypeEnabled;
1475 } __WLAN_ATTRIB_PACK__ hfa384x_AuthenticationAlgorithms_t;
1476
1477 /*-- Information Record: AuthenticationAlgorithms
1478 (data only --*/
1479 typedef struct hfa384x_AuthenticationAlgorithms_data
1480 {
1481         uint16_t        AuthenticationType;
1482         uint16_t        TypeEnabled;
1483 } __WLAN_ATTRIB_PACK__ hfa384x_AuthenticationAlgorithms_data_t;
1484
1485 /*-- Information Record: PrivacyOptionImplemented --*/
1486 typedef struct hfa384x_PrivacyOptionImplemented
1487 {
1488         uint16_t        PrivacyOptionImplemented;
1489 } __WLAN_ATTRIB_PACK__ hfa384x_PrivacyOptionImplemented_t;
1490
1491 /*-- Information Record: OwnMACAddress --*/
1492 typedef struct hfa384x_OwnMACAddress
1493 {
1494         uint8_t OwnMACAddress[6];
1495 } __WLAN_ATTRIB_PACK__ hfa384x_OwnMACAddress_t;
1496
1497 /*-- Information Record: PCFInfo --*/
1498 typedef struct hfa384x_PCFInfo
1499 {
1500         uint16_t        MediumOccupancyLimit;
1501         uint16_t        CFPPeriod;
1502         uint16_t        CFPMaxDuration;
1503         uint16_t        CFPFlags;
1504 } __WLAN_ATTRIB_PACK__ hfa384x_PCFInfo_t;
1505
1506 /*-- Information Record: PCFInfo (data portion only) --*/
1507 typedef struct hfa384x_PCFInfo_data
1508 {
1509         uint16_t        MediumOccupancyLimit;
1510         uint16_t        CFPPeriod;
1511         uint16_t        CFPMaxDuration;
1512         uint16_t        CFPFlags;
1513 } __WLAN_ATTRIB_PACK__ hfa384x_PCFInfo_data_t;
1514
1515 /*--------------------------------------------------------------------
1516 Information Record Structures: Modem Information Records
1517 --------------------------------------------------------------------*/
1518
1519 /*-- Information Record: PHYType --*/
1520 typedef struct hfa384x_PHYType
1521 {
1522         uint16_t        PHYType;
1523 } __WLAN_ATTRIB_PACK__ hfa384x_PHYType_t;
1524
1525 /*-- Information Record: CurrentChannel --*/
1526 typedef struct hfa384x_CurrentChannel
1527 {
1528         uint16_t        CurrentChannel;
1529 } __WLAN_ATTRIB_PACK__ hfa384x_CurrentChannel_t;
1530
1531 /*-- Information Record: CurrentPowerState --*/
1532 typedef struct hfa384x_CurrentPowerState
1533 {
1534         uint16_t        CurrentPowerState;
1535 } __WLAN_ATTRIB_PACK__ hfa384x_CurrentPowerState_t;
1536
1537 /*-- Information Record: CCAMode --*/
1538 typedef struct hfa384x_CCAMode
1539 {
1540         uint16_t        CCAMode;
1541 } __WLAN_ATTRIB_PACK__ hfa384x_CCAMode_t;
1542
1543 /*-- Information Record: SupportedDataRates --*/
1544 typedef struct hfa384x_SupportedDataRates
1545 {
1546         uint8_t SupportedDataRates[10];
1547 } __WLAN_ATTRIB_PACK__ hfa384x_SupportedDataRates_t;
1548
1549 /*-- Information Record: LFOStatus --*/
1550 typedef struct hfa384x_LFOStatus
1551 {
1552         uint16_t  TestResults;
1553         uint16_t  LFOResult;
1554         uint16_t  VRHFOResult;
1555 } __WLAN_ATTRIB_PACK__ hfa384x_LFOStatus_t;
1556
1557 #define HFA384x_TESTRESULT_ALLPASSED    BIT0
1558 #define HFA384x_TESTRESULT_LFO_FAIL     BIT1
1559 #define HFA384x_TESTRESULT_VR_HF0_FAIL  BIT2
1560 #define HFA384x_HOST_FIRM_COORDINATE    BIT7
1561 #define HFA384x_TESTRESULT_COORDINATE   BIT15
1562
1563 /*-- Information Record: LEDControl --*/
1564 typedef struct hfa384x_LEDControl
1565 {
1566         uint16_t  searching_on;
1567         uint16_t  searching_off;
1568         uint16_t  assoc_on;
1569         uint16_t  assoc_off;
1570         uint16_t  activity;
1571 } __WLAN_ATTRIB_PACK__ hfa384x_LEDControl_t;
1572
1573 /*--------------------------------------------------------------------
1574                  FRAME DESCRIPTORS AND FRAME STRUCTURES
1575
1576 FRAME DESCRIPTORS: Offsets
1577
1578 ----------------------------------------------------------------------
1579 Control Info (offset 44-51)
1580 --------------------------------------------------------------------*/
1581 #define         HFA384x_FD_STATUS_OFF                   ((uint16_t)0x44)
1582 #define         HFA384x_FD_TIME_OFF                     ((uint16_t)0x46)
1583 #define         HFA384x_FD_SWSUPPORT_OFF                ((uint16_t)0x4A)
1584 #define         HFA384x_FD_SILENCE_OFF                  ((uint16_t)0x4A)
1585 #define         HFA384x_FD_SIGNAL_OFF                   ((uint16_t)0x4B)
1586 #define         HFA384x_FD_RATE_OFF                     ((uint16_t)0x4C)
1587 #define         HFA384x_FD_RXFLOW_OFF                   ((uint16_t)0x4D)
1588 #define         HFA384x_FD_RESERVED_OFF                 ((uint16_t)0x4E)
1589 #define         HFA384x_FD_TXCONTROL_OFF                ((uint16_t)0x50)
1590 /*--------------------------------------------------------------------
1591 802.11 Header (offset 52-6B)
1592 --------------------------------------------------------------------*/
1593 #define         HFA384x_FD_FRAMECONTROL_OFF             ((uint16_t)0x52)
1594 #define         HFA384x_FD_DURATIONID_OFF               ((uint16_t)0x54)
1595 #define         HFA384x_FD_ADDRESS1_OFF                 ((uint16_t)0x56)
1596 #define         HFA384x_FD_ADDRESS2_OFF                 ((uint16_t)0x5C)
1597 #define         HFA384x_FD_ADDRESS3_OFF                 ((uint16_t)0x62)
1598 #define         HFA384x_FD_SEQCONTROL_OFF               ((uint16_t)0x68)
1599 #define         HFA384x_FD_ADDRESS4_OFF                 ((uint16_t)0x6A)
1600 #define         HFA384x_FD_DATALEN_OFF                  ((uint16_t)0x70)
1601 /*--------------------------------------------------------------------
1602 802.3 Header (offset 72-7F)
1603 --------------------------------------------------------------------*/
1604 #define         HFA384x_FD_DESTADDRESS_OFF              ((uint16_t)0x72)
1605 #define         HFA384x_FD_SRCADDRESS_OFF               ((uint16_t)0x78)
1606 #define         HFA384x_FD_DATALENGTH_OFF               ((uint16_t)0x7E)
1607
1608 /*--------------------------------------------------------------------
1609 FRAME STRUCTURES: Communication Frames
1610 ----------------------------------------------------------------------
1611 Communication Frames: Transmit Frames
1612 --------------------------------------------------------------------*/
1613 /*-- Communication Frame: Transmit Frame Structure --*/
1614 typedef struct hfa384x_tx_frame
1615 {
1616         uint16_t        status;
1617         uint16_t        reserved1;
1618         uint16_t        reserved2;
1619         uint32_t        sw_support;
1620         uint8_t tx_retrycount;
1621         uint8_t   tx_rate;
1622         uint16_t        tx_control;
1623
1624         /*-- 802.11 Header Information --*/
1625
1626         uint16_t        frame_control;
1627         uint16_t        duration_id;
1628         uint8_t address1[6];
1629         uint8_t address2[6];
1630         uint8_t address3[6];
1631         uint16_t        sequence_control;
1632         uint8_t address4[6];
1633         uint16_t        data_len; /* little endian format */
1634
1635         /*-- 802.3 Header Information --*/
1636
1637         uint8_t dest_addr[6];
1638         uint8_t src_addr[6];
1639         uint16_t        data_length; /* big endian format */
1640 } __WLAN_ATTRIB_PACK__ hfa384x_tx_frame_t;
1641 /*--------------------------------------------------------------------
1642 Communication Frames: Field Masks for Transmit Frames
1643 --------------------------------------------------------------------*/
1644 /*-- Status Field --*/
1645 #define         HFA384x_TXSTATUS_ACKERR                 ((uint16_t)BIT5)
1646 #define         HFA384x_TXSTATUS_FORMERR                ((uint16_t)BIT3)
1647 #define         HFA384x_TXSTATUS_DISCON                 ((uint16_t)BIT2)
1648 #define         HFA384x_TXSTATUS_AGEDERR                ((uint16_t)BIT1)
1649 #define         HFA384x_TXSTATUS_RETRYERR               ((uint16_t)BIT0)
1650 /*-- Transmit Control Field --*/
1651 #define         HFA384x_TX_CFPOLL                       ((uint16_t)BIT12)
1652 #define         HFA384x_TX_PRST                         ((uint16_t)BIT11)
1653 #define         HFA384x_TX_MACPORT                      ((uint16_t)(BIT10 | BIT9 | BIT8))
1654 #define         HFA384x_TX_NOENCRYPT                    ((uint16_t)BIT7)
1655 #define         HFA384x_TX_RETRYSTRAT                   ((uint16_t)(BIT6 | BIT5))
1656 #define         HFA384x_TX_STRUCTYPE                    ((uint16_t)(BIT4 | BIT3))
1657 #define         HFA384x_TX_TXEX                         ((uint16_t)BIT2)
1658 #define         HFA384x_TX_TXOK                         ((uint16_t)BIT1)
1659 /*--------------------------------------------------------------------
1660 Communication Frames: Test/Get/Set Field Values for Transmit Frames
1661 --------------------------------------------------------------------*/
1662 /*-- Status Field --*/
1663 #define HFA384x_TXSTATUS_ISERROR(v)     \
1664         (((uint16_t)(v))&\
1665         (HFA384x_TXSTATUS_ACKERR|HFA384x_TXSTATUS_FORMERR|\
1666         HFA384x_TXSTATUS_DISCON|HFA384x_TXSTATUS_AGEDERR|\
1667         HFA384x_TXSTATUS_RETRYERR))
1668
1669 #define HFA384x_TXSTATUS_ISACKERR(v)    ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_ACKERR))
1670 #define HFA384x_TXSTATUS_ISFORMERR(v)   ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_FORMERR))
1671 #define HFA384x_TXSTATUS_ISDISCON(v)    ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_DISCON))
1672 #define HFA384x_TXSTATUS_ISAGEDERR(v)   ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_AGEDERR))
1673 #define HFA384x_TXSTATUS_ISRETRYERR(v)  ((uint16_t)(((uint16_t)(v)) & HFA384x_TXSTATUS_RETRYERR))
1674
1675 #define HFA384x_TX_GET(v,m,s)           ((((uint16_t)(v))&((uint16_t)(m)))>>((uint16_t)(s)))
1676 #define HFA384x_TX_SET(v,m,s)           ((((uint16_t)(v))<<((uint16_t)(s)))&((uint16_t)(m)))
1677
1678 #define HFA384x_TX_CFPOLL_GET(v)        HFA384x_TX_GET(v, HFA384x_TX_CFPOLL,12)
1679 #define HFA384x_TX_CFPOLL_SET(v)        HFA384x_TX_SET(v, HFA384x_TX_CFPOLL,12)
1680 #define HFA384x_TX_PRST_GET(v)          HFA384x_TX_GET(v, HFA384x_TX_PRST,11)
1681 #define HFA384x_TX_PRST_SET(v)          HFA384x_TX_SET(v, HFA384x_TX_PRST,11)
1682 #define HFA384x_TX_MACPORT_GET(v)       HFA384x_TX_GET(v, HFA384x_TX_MACPORT, 8)
1683 #define HFA384x_TX_MACPORT_SET(v)       HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
1684 #define HFA384x_TX_NOENCRYPT_GET(v)     HFA384x_TX_GET(v, HFA384x_TX_NOENCRYPT, 7)
1685 #define HFA384x_TX_NOENCRYPT_SET(v)     HFA384x_TX_SET(v, HFA384x_TX_NOENCRYPT, 7)
1686 #define HFA384x_TX_RETRYSTRAT_GET(v)    HFA384x_TX_GET(v, HFA384x_TX_RETRYSTRAT, 5)
1687 #define HFA384x_TX_RETRYSTRAT_SET(v)    HFA384x_TX_SET(v, HFA384x_TX_RETRYSTRAT, 5)
1688 #define HFA384x_TX_STRUCTYPE_GET(v)     HFA384x_TX_GET(v, HFA384x_TX_STRUCTYPE, 3)
1689 #define HFA384x_TX_STRUCTYPE_SET(v)     HFA384x_TX_SET(v, HFA384x_TX_STRUCTYPE, 3)
1690 #define HFA384x_TX_TXEX_GET(v)          HFA384x_TX_GET(v, HFA384x_TX_TXEX, 2)
1691 #define HFA384x_TX_TXEX_SET(v)          HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
1692 #define HFA384x_TX_TXOK_GET(v)          HFA384x_TX_GET(v, HFA384x_TX_TXOK, 1)
1693 #define HFA384x_TX_TXOK_SET(v)          HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
1694 /*--------------------------------------------------------------------
1695 Communication Frames: Receive Frames
1696 --------------------------------------------------------------------*/
1697 /*-- Communication Frame: Receive Frame Structure --*/
1698 typedef struct hfa384x_rx_frame
1699 {
1700         /*-- MAC rx descriptor (hfa384x byte order) --*/
1701         uint16_t        status;
1702         uint32_t        time;
1703         uint8_t silence;
1704         uint8_t signal;
1705         uint8_t rate;
1706         uint8_t rx_flow;
1707         uint16_t        reserved1;
1708         uint16_t        reserved2;
1709
1710         /*-- 802.11 Header Information (802.11 byte order) --*/
1711         uint16_t        frame_control;
1712         uint16_t        duration_id;
1713         uint8_t address1[6];
1714         uint8_t address2[6];
1715         uint8_t address3[6];
1716         uint16_t        sequence_control;
1717         uint8_t address4[6];
1718         uint16_t        data_len; /* hfa384x (little endian) format */
1719
1720         /*-- 802.3 Header Information --*/
1721         uint8_t dest_addr[6];
1722         uint8_t src_addr[6];
1723         uint16_t        data_length; /* IEEE? (big endian) format */
1724 } __WLAN_ATTRIB_PACK__ hfa384x_rx_frame_t;
1725 /*--------------------------------------------------------------------
1726 Communication Frames: Field Masks for Receive Frames
1727 --------------------------------------------------------------------*/
1728 /*-- Offsets --------*/
1729 #define         HFA384x_RX_DATA_LEN_OFF                 ((uint16_t)44)
1730 #define         HFA384x_RX_80211HDR_OFF                 ((uint16_t)14)
1731 #define         HFA384x_RX_DATA_OFF                     ((uint16_t)60)
1732
1733 /*-- Status Fields --*/
1734 #define         HFA384x_RXSTATUS_MSGTYPE                ((uint16_t)(BIT15 | BIT14 | BIT13))
1735 #define         HFA384x_RXSTATUS_MACPORT                ((uint16_t)(BIT10 | BIT9 | BIT8))
1736 #define         HFA384x_RXSTATUS_UNDECR                 ((uint16_t)BIT1)
1737 #define         HFA384x_RXSTATUS_FCSERR                 ((uint16_t)BIT0)
1738 /*--------------------------------------------------------------------
1739 Communication Frames: Test/Get/Set Field Values for Receive Frames
1740 --------------------------------------------------------------------*/
1741 #define         HFA384x_RXSTATUS_MSGTYPE_GET(value)     ((uint16_t)((((uint16_t)(value)) & HFA384x_RXSTATUS_MSGTYPE) >> 13))
1742 #define         HFA384x_RXSTATUS_MSGTYPE_SET(value)     ((uint16_t)(((uint16_t)(value)) << 13))
1743 #define         HFA384x_RXSTATUS_MACPORT_GET(value)     ((uint16_t)((((uint16_t)(value)) & HFA384x_RXSTATUS_MACPORT) >> 8))
1744 #define         HFA384x_RXSTATUS_MACPORT_SET(value)     ((uint16_t)(((uint16_t)(value)) << 8))
1745 #define         HFA384x_RXSTATUS_ISUNDECR(value)        ((uint16_t)(((uint16_t)(value)) & HFA384x_RXSTATUS_UNDECR))
1746 #define         HFA384x_RXSTATUS_ISFCSERR(value)        ((uint16_t)(((uint16_t)(value)) & HFA384x_RXSTATUS_FCSERR))
1747 /*--------------------------------------------------------------------
1748  FRAME STRUCTURES: Information Types and Information Frame Structures
1749 ----------------------------------------------------------------------
1750 Information Types
1751 --------------------------------------------------------------------*/
1752 #define         HFA384x_IT_HANDOVERADDR                 ((uint16_t)0xF000UL)
1753 #define         HFA384x_IT_HANDOVERDEAUTHADDRESS        ((uint16_t)0xF001UL)//AP 1.3.7
1754 #define         HFA384x_IT_COMMTALLIES                  ((uint16_t)0xF100UL)
1755 #define         HFA384x_IT_SCANRESULTS                  ((uint16_t)0xF101UL)
1756 #define         HFA384x_IT_CHINFORESULTS                ((uint16_t)0xF102UL)
1757 #define         HFA384x_IT_HOSTSCANRESULTS              ((uint16_t)0xF103UL)
1758 #define         HFA384x_IT_LINKSTATUS                   ((uint16_t)0xF200UL)
1759 #define         HFA384x_IT_ASSOCSTATUS                  ((uint16_t)0xF201UL)
1760 #define         HFA384x_IT_AUTHREQ                      ((uint16_t)0xF202UL)
1761 #define         HFA384x_IT_PSUSERCNT                    ((uint16_t)0xF203UL)
1762 #define         HFA384x_IT_KEYIDCHANGED                 ((uint16_t)0xF204UL)
1763 #define         HFA384x_IT_ASSOCREQ                     ((uint16_t)0xF205UL)
1764 #define         HFA384x_IT_MICFAILURE                   ((uint16_t)0xF206UL)
1765
1766 /*--------------------------------------------------------------------
1767 Information Frames Structures
1768 ----------------------------------------------------------------------
1769 Information Frames: Notification Frame Structures
1770 --------------------------------------------------------------------*/
1771 /*--  Notification Frame,MAC Mgmt: Handover Address --*/
1772 typedef struct hfa384x_HandoverAddr
1773 {
1774         uint16_t        framelen;
1775         uint16_t        infotype;
1776         uint8_t handover_addr[WLAN_BSSID_LEN];
1777 } __WLAN_ATTRIB_PACK__ hfa384x_HandoverAddr_t;
1778
1779 /*--  Inquiry Frame, Diagnose: Communication Tallies --*/
1780 typedef struct hfa384x_CommTallies16
1781 {
1782         uint16_t        txunicastframes;
1783         uint16_t        txmulticastframes;
1784         uint16_t        txfragments;
1785         uint16_t        txunicastoctets;
1786         uint16_t        txmulticastoctets;
1787         uint16_t        txdeferredtrans;
1788         uint16_t        txsingleretryframes;
1789         uint16_t        txmultipleretryframes;
1790         uint16_t        txretrylimitexceeded;
1791         uint16_t        txdiscards;
1792         uint16_t        rxunicastframes;
1793         uint16_t        rxmulticastframes;
1794         uint16_t        rxfragments;
1795         uint16_t        rxunicastoctets;
1796         uint16_t        rxmulticastoctets;
1797         uint16_t        rxfcserrors;
1798         uint16_t        rxdiscardsnobuffer;
1799         uint16_t        txdiscardswrongsa;
1800         uint16_t        rxdiscardswepundecr;
1801         uint16_t        rxmsginmsgfrag;
1802         uint16_t        rxmsginbadmsgfrag;
1803 } __WLAN_ATTRIB_PACK__ hfa384x_CommTallies16_t;
1804
1805 typedef struct hfa384x_CommTallies32
1806 {
1807         uint32_t        txunicastframes;
1808         uint32_t        txmulticastframes;
1809         uint32_t        txfragments;
1810         uint32_t        txunicastoctets;
1811         uint32_t        txmulticastoctets;
1812         uint32_t        txdeferredtrans;
1813         uint32_t        txsingleretryframes;
1814         uint32_t        txmultipleretryframes;
1815         uint32_t        txretrylimitexceeded;
1816         uint32_t        txdiscards;
1817         uint32_t        rxunicastframes;
1818         uint32_t        rxmulticastframes;
1819         uint32_t        rxfragments;
1820         uint32_t        rxunicastoctets;
1821         uint32_t        rxmulticastoctets;
1822         uint32_t        rxfcserrors;
1823         uint32_t        rxdiscardsnobuffer;
1824         uint32_t        txdiscardswrongsa;
1825         uint32_t        rxdiscardswepundecr;
1826         uint32_t        rxmsginmsgfrag;
1827         uint32_t        rxmsginbadmsgfrag;
1828 } __WLAN_ATTRIB_PACK__ hfa384x_CommTallies32_t;
1829
1830 /*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
1831 typedef struct hfa384x_ScanResultSub
1832 {
1833         uint16_t        chid;
1834         uint16_t        anl;
1835         uint16_t        sl;
1836         uint8_t bssid[WLAN_BSSID_LEN];
1837         uint16_t        bcnint;
1838         uint16_t        capinfo;
1839         hfa384x_bytestr32_t     ssid;
1840         uint8_t supprates[10]; /* 802.11 info element */
1841         uint16_t        proberesp_rate;
1842 } __WLAN_ATTRIB_PACK__ hfa384x_ScanResultSub_t;
1843
1844 typedef struct hfa384x_ScanResult
1845 {
1846         uint16_t        rsvd;
1847         uint16_t        scanreason;
1848         hfa384x_ScanResultSub_t
1849                 result[HFA384x_SCANRESULT_MAX];
1850 } __WLAN_ATTRIB_PACK__ hfa384x_ScanResult_t;
1851
1852 /*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
1853 typedef struct hfa384x_ChInfoResultSub
1854 {
1855         uint16_t        chid;
1856         uint16_t        anl;
1857         uint16_t        pnl;
1858         uint16_t        active;
1859 } __WLAN_ATTRIB_PACK__ hfa384x_ChInfoResultSub_t;
1860
1861 #define HFA384x_CHINFORESULT_BSSACTIVE  BIT0
1862 #define HFA384x_CHINFORESULT_PCFACTIVE  BIT1
1863
1864 typedef struct hfa384x_ChInfoResult
1865 {
1866         uint16_t        scanchannels;
1867         hfa384x_ChInfoResultSub_t
1868                 result[HFA384x_CHINFORESULT_MAX];
1869 } __WLAN_ATTRIB_PACK__ hfa384x_ChInfoResult_t;
1870
1871 /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
1872 typedef struct hfa384x_HScanResultSub
1873 {
1874         uint16_t        chid;
1875         uint16_t        anl;
1876         uint16_t        sl;
1877         uint8_t bssid[WLAN_BSSID_LEN];
1878         uint16_t        bcnint;
1879         uint16_t        capinfo;
1880         hfa384x_bytestr32_t     ssid;
1881         uint8_t supprates[10]; /* 802.11 info element */
1882         uint16_t        proberesp_rate;
1883         uint16_t        atim;
1884 } __WLAN_ATTRIB_PACK__ hfa384x_HScanResultSub_t;
1885
1886 typedef struct hfa384x_HScanResult
1887 {
1888         uint16_t        nresult;
1889         uint16_t        rsvd;
1890         hfa384x_HScanResultSub_t
1891                 result[HFA384x_HSCANRESULT_MAX];
1892 } __WLAN_ATTRIB_PACK__ hfa384x_HScanResult_t;
1893
1894 /*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
1895
1896 #define HFA384x_LINK_NOTCONNECTED       ((uint16_t)0)
1897 #define HFA384x_LINK_CONNECTED          ((uint16_t)1)
1898 #define HFA384x_LINK_DISCONNECTED       ((uint16_t)2)
1899 #define HFA384x_LINK_AP_CHANGE          ((uint16_t)3)
1900 #define HFA384x_LINK_AP_OUTOFRANGE      ((uint16_t)4)
1901 #define HFA384x_LINK_AP_INRANGE         ((uint16_t)5)
1902 #define HFA384x_LINK_ASSOCFAIL          ((uint16_t)6)
1903
1904 typedef struct hfa384x_LinkStatus
1905 {
1906         uint16_t        linkstatus;
1907 } __WLAN_ATTRIB_PACK__ hfa384x_LinkStatus_t;
1908
1909
1910 /*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
1911
1912 #define HFA384x_ASSOCSTATUS_STAASSOC    ((uint16_t)1)
1913 #define HFA384x_ASSOCSTATUS_REASSOC     ((uint16_t)2)
1914 #define HFA384x_ASSOCSTATUS_DISASSOC    ((uint16_t)3)
1915 #define HFA384x_ASSOCSTATUS_ASSOCFAIL   ((uint16_t)4)
1916 #define HFA384x_ASSOCSTATUS_AUTHFAIL    ((uint16_t)5)
1917
1918 typedef struct hfa384x_AssocStatus
1919 {
1920         uint16_t        assocstatus;
1921         uint8_t sta_addr[WLAN_ADDR_LEN];
1922         /* old_ap_addr is only valid if assocstatus == 2 */
1923         uint8_t old_ap_addr[WLAN_ADDR_LEN];
1924         uint16_t        reason;
1925         uint16_t        reserved;
1926 } __WLAN_ATTRIB_PACK__ hfa384x_AssocStatus_t;
1927
1928 /*--  Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
1929
1930 typedef struct hfa384x_AuthRequest
1931 {
1932         uint8_t sta_addr[WLAN_ADDR_LEN];
1933         uint16_t        algorithm;
1934 } __WLAN_ATTRIB_PACK__ hfa384x_AuthReq_t;
1935
1936 /*--  Unsolicited Frame, MAC Mgmt: AssocRequest (AP Only) --*/
1937
1938 typedef struct hfa384x_AssocRequest
1939 {
1940         uint8_t sta_addr[WLAN_ADDR_LEN];
1941         uint16_t        type;
1942         uint8_t   wpa_data[80];
1943 } __WLAN_ATTRIB_PACK__ hfa384x_AssocReq_t;
1944
1945
1946 #define HFA384x_ASSOCREQ_TYPE_ASSOC     0
1947 #define HFA384x_ASSOCREQ_TYPE_REASSOC   1
1948
1949 /*--  Unsolicited Frame, MAC Mgmt: MIC Failure  (AP Only) --*/
1950
1951 typedef struct hfa384x_MicFailure
1952 {
1953         uint8_t sender[WLAN_ADDR_LEN];
1954         uint8_t dest[WLAN_ADDR_LEN];
1955 } __WLAN_ATTRIB_PACK__ hfa384x_MicFailure_t;
1956
1957 /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
1958
1959 typedef struct hfa384x_PSUserCount
1960 {
1961         uint16_t        usercnt;
1962 } __WLAN_ATTRIB_PACK__ hfa384x_PSUserCount_t;
1963
1964 typedef struct hfa384x_KeyIDChanged
1965 {
1966         uint8_t sta_addr[WLAN_ADDR_LEN];
1967         uint16_t        keyid;
1968 } __WLAN_ATTRIB_PACK__ hfa384x_KeyIDChanged_t;
1969
1970 /*--  Collection of all Inf frames ---------------*/
1971 typedef union hfa384x_infodata {
1972         hfa384x_CommTallies16_t commtallies16;
1973         hfa384x_CommTallies32_t commtallies32;
1974         hfa384x_ScanResult_t    scanresult;
1975         hfa384x_ChInfoResult_t  chinforesult;
1976         hfa384x_HScanResult_t   hscanresult;
1977         hfa384x_LinkStatus_t    linkstatus;
1978         hfa384x_AssocStatus_t   assocstatus;
1979         hfa384x_AuthReq_t       authreq;
1980         hfa384x_PSUserCount_t   psusercnt;
1981         hfa384x_KeyIDChanged_t  keyidchanged;
1982 } __WLAN_ATTRIB_PACK__ hfa384x_infodata_t;
1983
1984 typedef struct hfa384x_InfFrame
1985 {
1986         uint16_t                        framelen;
1987         uint16_t                        infotype;
1988         hfa384x_infodata_t      info;
1989 } __WLAN_ATTRIB_PACK__ hfa384x_InfFrame_t;
1990
1991 #if (WLAN_HOSTIF == WLAN_USB)
1992 /*--------------------------------------------------------------------
1993 USB Packet structures and constants.
1994 --------------------------------------------------------------------*/
1995
1996 /* Should be sent to the ctrlout endpoint */
1997 #define HFA384x_USB_ENBULKIN    6
1998
1999 /* Should be sent to the bulkout endpoint */
2000 #define HFA384x_USB_TXFRM       0
2001 #define HFA384x_USB_CMDREQ      1
2002 #define HFA384x_USB_WRIDREQ     2
2003 #define HFA384x_USB_RRIDREQ     3
2004 #define HFA384x_USB_WMEMREQ     4
2005 #define HFA384x_USB_RMEMREQ     5
2006
2007 /* Received from the bulkin endpoint */
2008 #define HFA384x_USB_ISFRM(a)    (!((a) & 0x8000))
2009 #define HFA384x_USB_ISTXFRM(a)  (((a) & 0x9000) == 0x1000)
2010 #define HFA384x_USB_ISRXFRM(a)  (!((a) & 0x9000))
2011 #define HFA384x_USB_INFOFRM     0x8000
2012 #define HFA384x_USB_CMDRESP     0x8001
2013 #define HFA384x_USB_WRIDRESP    0x8002
2014 #define HFA384x_USB_RRIDRESP    0x8003
2015 #define HFA384x_USB_WMEMRESP    0x8004
2016 #define HFA384x_USB_RMEMRESP    0x8005
2017 #define HFA384x_USB_BUFAVAIL    0x8006
2018 #define HFA384x_USB_ERROR       0x8007
2019
2020 /*------------------------------------*/
2021 /* Request (bulk OUT) packet contents */
2022
2023 typedef struct hfa384x_usb_txfrm {
2024         hfa384x_tx_frame_t      desc;
2025         uint8_t                 data[WLAN_DATA_MAXLEN];
2026 } __WLAN_ATTRIB_PACK__ hfa384x_usb_txfrm_t;
2027
2028 typedef struct hfa384x_usb_cmdreq {
2029         uint16_t                type;
2030         uint16_t                cmd;
2031         uint16_t                parm0;
2032         uint16_t                parm1;
2033         uint16_t                parm2;
2034         uint8_t         pad[54];
2035 } __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdreq_t;
2036
2037 typedef struct hfa384x_usb_wridreq {
2038         uint16_t                type;
2039         uint16_t                frmlen;
2040         uint16_t                rid;
2041         uint8_t         data[HFA384x_RIDDATA_MAXLEN];
2042 } __WLAN_ATTRIB_PACK__ hfa384x_usb_wridreq_t;
2043
2044 typedef struct hfa384x_usb_rridreq {
2045         uint16_t                type;
2046         uint16_t                frmlen;
2047         uint16_t                rid;
2048         uint8_t         pad[58];
2049 } __WLAN_ATTRIB_PACK__ hfa384x_usb_rridreq_t;
2050
2051 typedef struct hfa384x_usb_wmemreq {
2052         uint16_t                type;
2053         uint16_t                frmlen;
2054         uint16_t                offset;
2055         uint16_t                page;
2056         uint8_t         data[HFA384x_USB_RWMEM_MAXLEN];
2057 } __WLAN_ATTRIB_PACK__ hfa384x_usb_wmemreq_t;
2058
2059 typedef struct hfa384x_usb_rmemreq {
2060         uint16_t                type;
2061         uint16_t                frmlen;
2062         uint16_t                offset;
2063         uint16_t                page;
2064         uint8_t         pad[56];
2065 } __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemreq_t;
2066
2067 /*------------------------------------*/
2068 /* Response (bulk IN) packet contents */
2069
2070 typedef struct hfa384x_usb_rxfrm {
2071         hfa384x_rx_frame_t      desc;
2072         uint8_t                 data[WLAN_DATA_MAXLEN];
2073 } __WLAN_ATTRIB_PACK__ hfa384x_usb_rxfrm_t;
2074
2075 typedef struct hfa384x_usb_infofrm {
2076         uint16_t                        type;
2077         hfa384x_InfFrame_t      info;
2078 } __WLAN_ATTRIB_PACK__ hfa384x_usb_infofrm_t;
2079
2080 typedef struct hfa384x_usb_statusresp {
2081         uint16_t                type;
2082         uint16_t                status;
2083         uint16_t                resp0;
2084         uint16_t                resp1;
2085         uint16_t                resp2;
2086 } __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdresp_t;
2087
2088 typedef hfa384x_usb_cmdresp_t hfa384x_usb_wridresp_t;
2089
2090 typedef struct hfa384x_usb_rridresp {
2091         uint16_t                type;
2092         uint16_t                frmlen;
2093         uint16_t                rid;
2094         uint8_t         data[HFA384x_RIDDATA_MAXLEN];
2095 } __WLAN_ATTRIB_PACK__ hfa384x_usb_rridresp_t;
2096
2097 typedef hfa384x_usb_cmdresp_t hfa384x_usb_wmemresp_t;
2098
2099 typedef struct hfa384x_usb_rmemresp {
2100         uint16_t                type;
2101         uint16_t                frmlen;
2102         uint8_t         data[HFA384x_USB_RWMEM_MAXLEN];
2103 } __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemresp_t;
2104
2105 typedef struct hfa384x_usb_bufavail {
2106         uint16_t                type;
2107         uint16_t                frmlen;
2108 } __WLAN_ATTRIB_PACK__ hfa384x_usb_bufavail_t;
2109
2110 typedef struct hfa384x_usb_error {
2111         uint16_t                type;
2112         uint16_t                errortype;
2113 } __WLAN_ATTRIB_PACK__ hfa384x_usb_error_t;
2114
2115 /*----------------------------------------------------------*/
2116 /* Unions for packaging all the known packet types together */
2117
2118 typedef union hfa384x_usbout {
2119         uint16_t                        type;
2120         hfa384x_usb_txfrm_t     txfrm;
2121         hfa384x_usb_cmdreq_t    cmdreq;
2122         hfa384x_usb_wridreq_t   wridreq;
2123         hfa384x_usb_rridreq_t   rridreq;
2124         hfa384x_usb_wmemreq_t   wmemreq;
2125         hfa384x_usb_rmemreq_t   rmemreq;
2126 } __WLAN_ATTRIB_PACK__ hfa384x_usbout_t;
2127
2128 typedef union hfa384x_usbin {
2129         uint16_t                        type;
2130         hfa384x_usb_rxfrm_t     rxfrm;
2131         hfa384x_usb_txfrm_t     txfrm;
2132         hfa384x_usb_infofrm_t   infofrm;
2133         hfa384x_usb_cmdresp_t   cmdresp;
2134         hfa384x_usb_wridresp_t  wridresp;
2135         hfa384x_usb_rridresp_t  rridresp;
2136         hfa384x_usb_wmemresp_t  wmemresp;
2137         hfa384x_usb_rmemresp_t  rmemresp;
2138         hfa384x_usb_bufavail_t  bufavail;
2139         hfa384x_usb_error_t     usberror;
2140         uint8_t                 boguspad[3000];
2141 } __WLAN_ATTRIB_PACK__ hfa384x_usbin_t;
2142
2143 #endif /* WLAN_USB */
2144
2145 /*--------------------------------------------------------------------
2146 PD record structures.
2147 --------------------------------------------------------------------*/
2148
2149 typedef struct hfa384x_pdr_pcb_partnum
2150 {
2151         uint8_t num[8];
2152 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_pcb_partnum_t;
2153
2154 typedef struct hfa384x_pdr_pcb_tracenum
2155 {
2156         uint8_t num[8];
2157 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_pcb_tracenum_t;
2158
2159 typedef struct hfa384x_pdr_nic_serial
2160 {
2161         uint8_t num[12];
2162 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_serial_t;
2163
2164 typedef struct hfa384x_pdr_mkk_measurements
2165 {
2166         double  carrier_freq;
2167         double  occupied_band;
2168         double  power_density;
2169         double  tx_spur_f1;
2170         double  tx_spur_f2;
2171         double  tx_spur_f3;
2172         double  tx_spur_f4;
2173         double  tx_spur_l1;
2174         double  tx_spur_l2;
2175         double  tx_spur_l3;
2176         double  tx_spur_l4;
2177         double  rx_spur_f1;
2178         double  rx_spur_f2;
2179         double  rx_spur_l1;
2180         double  rx_spur_l2;
2181 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mkk_measurements_t;
2182
2183 typedef struct hfa384x_pdr_nic_ramsize
2184 {
2185         uint8_t size[12]; /* units of KB */
2186 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_ramsize_t;
2187
2188 typedef struct hfa384x_pdr_mfisuprange
2189 {
2190         uint16_t        id;
2191         uint16_t        variant;
2192         uint16_t        bottom;
2193         uint16_t        top;
2194 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mfisuprange_t;
2195
2196 typedef struct hfa384x_pdr_cfisuprange
2197 {
2198         uint16_t        id;
2199         uint16_t        variant;
2200         uint16_t        bottom;
2201         uint16_t        top;
2202 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_cfisuprange_t;
2203
2204 typedef struct hfa384x_pdr_nicid
2205 {
2206         uint16_t        id;
2207         uint16_t        variant;
2208         uint16_t        major;
2209         uint16_t        minor;
2210 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nicid_t;
2211
2212
2213 typedef struct hfa384x_pdr_refdac_measurements
2214 {
2215         uint16_t        value[0];
2216 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_refdac_measurements_t;
2217
2218 typedef struct hfa384x_pdr_vgdac_measurements
2219 {
2220         uint16_t        value[0];
2221 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_vgdac_measurements_t;
2222
2223 typedef struct hfa384x_pdr_level_comp_measurements
2224 {
2225         uint16_t        value[0];
2226 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_level_compc_measurements_t;
2227
2228 typedef struct hfa384x_pdr_mac_address
2229 {
2230         uint8_t addr[6];
2231 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mac_address_t;
2232
2233 typedef struct hfa384x_pdr_mkk_callname
2234 {
2235         uint8_t callname[8];
2236 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mkk_callname_t;
2237
2238 typedef struct hfa384x_pdr_regdomain
2239 {
2240         uint16_t        numdomains;
2241         uint16_t        domain[5];
2242 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_regdomain_t;
2243
2244 typedef struct hfa384x_pdr_allowed_channel
2245 {
2246         uint16_t        ch_bitmap;
2247 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_allowed_channel_t;
2248
2249 typedef struct hfa384x_pdr_default_channel
2250 {
2251         uint16_t        channel;
2252 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_default_channel_t;
2253
2254 typedef struct hfa384x_pdr_privacy_option
2255 {
2256         uint16_t        available;
2257 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_privacy_option_t;
2258
2259 typedef struct hfa384x_pdr_temptype
2260 {
2261         uint16_t        type;
2262 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_temptype_t;
2263
2264 typedef struct hfa384x_pdr_refdac_setup
2265 {
2266         uint16_t        ch_value[14];
2267 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_refdac_setup_t;
2268
2269 typedef struct hfa384x_pdr_vgdac_setup
2270 {
2271         uint16_t        ch_value[14];
2272 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_vgdac_setup_t;
2273
2274 typedef struct hfa384x_pdr_level_comp_setup
2275 {
2276         uint16_t        ch_value[14];
2277 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_level_comp_setup_t;
2278
2279 typedef struct hfa384x_pdr_trimdac_setup
2280 {
2281         uint16_t        trimidac;
2282         uint16_t        trimqdac;
2283 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_trimdac_setup_t;
2284
2285 typedef struct hfa384x_pdr_ifr_setting
2286 {
2287         uint16_t        value[3];
2288 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_ifr_setting_t;
2289
2290 typedef struct hfa384x_pdr_rfr_setting
2291 {
2292         uint16_t        value[3];
2293 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_rfr_setting_t;
2294
2295 typedef struct hfa384x_pdr_hfa3861_baseline
2296 {
2297         uint16_t        value[50];
2298 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_baseline_t;
2299
2300 typedef struct hfa384x_pdr_hfa3861_shadow
2301 {
2302         uint32_t        value[32];
2303 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_shadow_t;
2304
2305 typedef struct hfa384x_pdr_hfa3861_ifrf
2306 {
2307         uint32_t        value[20];
2308 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_ifrf_t;
2309
2310 typedef struct hfa384x_pdr_hfa3861_chcalsp
2311 {
2312         uint16_t        value[14];
2313 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_chcalsp_t;
2314
2315 typedef struct hfa384x_pdr_hfa3861_chcali
2316 {
2317         uint16_t        value[17];
2318 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_chcali_t;
2319
2320 typedef struct hfa384x_pdr_hfa3861_nic_config
2321 {
2322         uint16_t        config_bitmap;
2323 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_config_t;
2324
2325 typedef struct hfa384x_pdr_hfo_delay
2326 {
2327         uint8_t   hfo_delay;
2328 } __WLAN_ATTRIB_PACK__ hfa384x_hfo_delay_t;
2329
2330 typedef struct hfa384x_pdr_hfa3861_manf_testsp
2331 {
2332         uint16_t        value[30];
2333 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_manf_testsp_t;
2334
2335 typedef struct hfa384x_pdr_hfa3861_manf_testi
2336 {
2337         uint16_t        value[30];
2338 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_manf_testi_t;
2339
2340 typedef struct hfa384x_end_of_pda
2341 {
2342         uint16_t        crc;
2343 } __WLAN_ATTRIB_PACK__ hfa384x_pdr_end_of_pda_t;
2344
2345 typedef struct hfa384x_pdrec
2346 {
2347         uint16_t        len; /* in words */
2348         uint16_t        code;
2349         union pdr {
2350         hfa384x_pdr_pcb_partnum_t       pcb_partnum;
2351         hfa384x_pdr_pcb_tracenum_t      pcb_tracenum;
2352         hfa384x_pdr_nic_serial_t        nic_serial;
2353         hfa384x_pdr_mkk_measurements_t  mkk_measurements;
2354         hfa384x_pdr_nic_ramsize_t       nic_ramsize;
2355         hfa384x_pdr_mfisuprange_t       mfisuprange;
2356         hfa384x_pdr_cfisuprange_t       cfisuprange;
2357         hfa384x_pdr_nicid_t             nicid;
2358         hfa384x_pdr_refdac_measurements_t       refdac_measurements;
2359         hfa384x_pdr_vgdac_measurements_t        vgdac_measurements;
2360         hfa384x_pdr_level_compc_measurements_t  level_compc_measurements;
2361         hfa384x_pdr_mac_address_t       mac_address;
2362         hfa384x_pdr_mkk_callname_t      mkk_callname;
2363         hfa384x_pdr_regdomain_t         regdomain;
2364         hfa384x_pdr_allowed_channel_t   allowed_channel;
2365         hfa384x_pdr_default_channel_t   default_channel;
2366         hfa384x_pdr_privacy_option_t    privacy_option;
2367         hfa384x_pdr_temptype_t          temptype;
2368         hfa384x_pdr_refdac_setup_t      refdac_setup;
2369         hfa384x_pdr_vgdac_setup_t       vgdac_setup;
2370         hfa384x_pdr_level_comp_setup_t  level_comp_setup;
2371         hfa384x_pdr_trimdac_setup_t     trimdac_setup;
2372         hfa384x_pdr_ifr_setting_t       ifr_setting;
2373         hfa384x_pdr_rfr_setting_t       rfr_setting;
2374         hfa384x_pdr_hfa3861_baseline_t  hfa3861_baseline;
2375         hfa384x_pdr_hfa3861_shadow_t    hfa3861_shadow;
2376         hfa384x_pdr_hfa3861_ifrf_t      hfa3861_ifrf;
2377         hfa384x_pdr_hfa3861_chcalsp_t   hfa3861_chcalsp;
2378         hfa384x_pdr_hfa3861_chcali_t    hfa3861_chcali;
2379         hfa384x_pdr_nic_config_t        nic_config;
2380         hfa384x_hfo_delay_t             hfo_delay;
2381         hfa384x_pdr_hfa3861_manf_testsp_t       hfa3861_manf_testsp;
2382         hfa384x_pdr_hfa3861_manf_testi_t        hfa3861_manf_testi;
2383         hfa384x_pdr_end_of_pda_t        end_of_pda;
2384
2385         } data;
2386 } __WLAN_ATTRIB_PACK__ hfa384x_pdrec_t;
2387
2388
2389 #ifdef __KERNEL__
2390 /*--------------------------------------------------------------------
2391 ---  MAC state structure, argument to all functions --
2392 ---  Also, a collection of support types --
2393 --------------------------------------------------------------------*/
2394 typedef struct hfa384x_statusresult
2395 {
2396         uint16_t        status;
2397         uint16_t        resp0;
2398         uint16_t        resp1;
2399         uint16_t        resp2;
2400 } hfa384x_cmdresult_t;
2401
2402 #if (WLAN_HOSTIF == WLAN_USB)
2403
2404 /* USB Control Exchange (CTLX):
2405  *  A queue of the structure below is maintained for all of the
2406  *  Request/Response type USB packets supported by Prism2.
2407  */
2408 /* The following hfa384x_* structures are arguments to
2409  * the usercb() for the different CTLX types.
2410  */
2411 typedef hfa384x_cmdresult_t hfa384x_wridresult_t;
2412 typedef hfa384x_cmdresult_t hfa384x_wmemresult_t;
2413
2414 typedef struct hfa384x_rridresult
2415 {
2416         uint16_t                rid;
2417         const void      *riddata;
2418         unsigned int            riddata_len;
2419 } hfa384x_rridresult_t;
2420
2421 enum ctlx_state {
2422         CTLX_START = 0, /* Start state, not queued */
2423
2424         CTLX_COMPLETE,  /* CTLX successfully completed */
2425         CTLX_REQ_FAILED,        /* OUT URB completed w/ error */
2426
2427         CTLX_PENDING,           /* Queued, data valid */
2428         CTLX_REQ_SUBMITTED,     /* OUT URB submitted */
2429         CTLX_REQ_COMPLETE,      /* OUT URB complete */
2430         CTLX_RESP_COMPLETE      /* IN URB received */
2431 };
2432 typedef enum ctlx_state  CTLX_STATE;
2433
2434 struct hfa384x_usbctlx;
2435 struct hfa384x;
2436
2437 typedef void (*ctlx_cmdcb_t)( struct hfa384x*, const struct hfa384x_usbctlx* );
2438
2439 typedef void (*ctlx_usercb_t)(
2440         struct hfa384x  *hw,
2441         void            *ctlxresult,
2442         void            *usercb_data);
2443
2444 typedef struct hfa384x_usbctlx
2445 {
2446         struct list_head        list;
2447
2448         size_t                  outbufsize;
2449         hfa384x_usbout_t        outbuf;         /* pkt buf for OUT */
2450         hfa384x_usbin_t         inbuf;          /* pkt buf for IN(a copy) */
2451
2452         CTLX_STATE              state;          /* Tracks running state */
2453
2454         struct completion       done;
2455         volatile int            reapable;       /* Food for the reaper task */
2456
2457         ctlx_cmdcb_t            cmdcb;          /* Async command callback */
2458         ctlx_usercb_t           usercb;         /* Async user callback, */
2459         void                    *usercb_data;   /*  at CTLX completion  */
2460
2461         int                     variant;        /* Identifies cmd variant */
2462 } hfa384x_usbctlx_t;
2463
2464 typedef struct hfa384x_usbctlxq
2465 {
2466         spinlock_t              lock;
2467         struct list_head        pending;
2468         struct list_head        active;
2469         struct list_head        completing;
2470         struct list_head        reapable;
2471 } hfa384x_usbctlxq_t;
2472 #endif
2473
2474 typedef struct hfa484x_metacmd
2475 {
2476         uint16_t                cmd;
2477
2478         uint16_t          parm0;
2479         uint16_t          parm1;
2480         uint16_t          parm2;
2481
2482 #if 0 //XXX cmd irq stuff
2483         uint16_t          bulkid;         /* what RID/FID to copy down. */
2484         int             bulklen;        /* how much to copy from BAP */
2485         char            *bulkdata;      /* And to where? */
2486 #endif
2487
2488         hfa384x_cmdresult_t result;
2489 } hfa384x_metacmd_t;
2490
2491 #define MAX_PRISM2_GRP_ADDR     16
2492 #define MAX_GRP_ADDR            32
2493 #define WLAN_COMMENT_MAX        80  /* Max. length of user comment string. */
2494
2495 #define MM_SAT_PCF              (BIT14)
2496 #define MM_GCSD_PCF             (BIT15)
2497 #define MM_GCSD_PCF_EB          (BIT14 | BIT15)
2498
2499 #define WLAN_STATE_STOPPED      0   /* Network is not active. */
2500 #define WLAN_STATE_STARTED      1   /* Network has been started. */
2501
2502 #define WLAN_AUTH_MAX           60  /* Max. # of authenticated stations. */
2503 #define WLAN_ACCESS_MAX         60  /* Max. # of stations in an access list. */
2504 #define WLAN_ACCESS_NONE        0   /* No stations may be authenticated. */
2505 #define WLAN_ACCESS_ALL         1   /* All stations may be authenticated. */
2506 #define WLAN_ACCESS_ALLOW       2   /* Authenticate only "allowed" stations. */
2507 #define WLAN_ACCESS_DENY        3   /* Do not authenticate "denied" stations. */
2508
2509 /* XXX These are going away ASAP */
2510 typedef struct prism2sta_authlist
2511 {
2512         unsigned int    cnt;
2513         uint8_t addr[WLAN_AUTH_MAX][WLAN_ADDR_LEN];
2514         uint8_t assoc[WLAN_AUTH_MAX];
2515 } prism2sta_authlist_t;
2516
2517 typedef struct prism2sta_accesslist
2518 {
2519         unsigned int    modify;
2520         unsigned int    cnt;
2521         uint8_t addr[WLAN_ACCESS_MAX][WLAN_ADDR_LEN];
2522         unsigned int    cnt1;
2523         uint8_t addr1[WLAN_ACCESS_MAX][WLAN_ADDR_LEN];
2524 } prism2sta_accesslist_t;
2525
2526 typedef struct hfa384x
2527 {
2528 #if (WLAN_HOSTIF != WLAN_USB)
2529         /* Resource config */
2530         uint32_t                        iobase;
2531         char                    __iomem *membase;
2532         uint32_t                        irq;
2533 #else
2534         /* USB support data */
2535         struct usb_device       *usb;
2536         struct urb              rx_urb;
2537         struct sk_buff          *rx_urb_skb;
2538         struct urb              tx_urb;
2539         struct urb              ctlx_urb;
2540         hfa384x_usbout_t        txbuff;
2541         hfa384x_usbctlxq_t      ctlxq;
2542         struct timer_list       reqtimer;
2543         struct timer_list       resptimer;
2544
2545         struct timer_list       throttle;
2546
2547         struct tasklet_struct   reaper_bh;
2548         struct tasklet_struct   completion_bh;
2549
2550         struct work_struct      usb_work;
2551
2552         unsigned long           usb_flags;
2553 #define THROTTLE_RX     0
2554 #define THROTTLE_TX     1
2555 #define WORK_RX_HALT    2
2556 #define WORK_TX_HALT    3
2557 #define WORK_RX_RESUME  4
2558 #define WORK_TX_RESUME  5
2559
2560         unsigned short          req_timer_done:1;
2561         unsigned short          resp_timer_done:1;
2562
2563         int                     endp_in;
2564         int                     endp_out;
2565 #endif /* !USB */
2566
2567 #if (WLAN_HOSTIF == WLAN_PCMCIA)
2568 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16)
2569         struct pcmcia_device *pdev;
2570 #else
2571         dev_link_t      *link;
2572 #endif
2573         dev_node_t      node;
2574 #endif
2575
2576         int                     sniff_fcs;
2577         int                     sniff_channel;
2578         int                     sniff_truncate;
2579         int                     sniffhdr;
2580
2581         wait_queue_head_t cmdq;         /* wait queue itself */
2582
2583         /* Controller state */
2584         uint32_t                state;
2585         uint32_t                isap;
2586         uint8_t         port_enabled[HFA384x_NUMPORTS_MAX];
2587 #if (WLAN_HOSTIF != WLAN_USB)
2588         unsigned int            auxen;
2589         unsigned int            isram16;
2590 #endif /* !USB */
2591
2592         /* Download support */
2593         unsigned int                            dlstate;
2594         hfa384x_downloadbuffer_t        bufinfo;
2595         uint16_t                                dltimeout;
2596
2597 #if (WLAN_HOSTIF != WLAN_USB)
2598         spinlock_t      cmdlock;
2599         volatile int    cmdflag;        /* wait queue flag */
2600         hfa384x_metacmd_t *cmddata;      /* for our async callback */
2601
2602         /* BAP support */
2603         spinlock_t      baplock;
2604         struct tasklet_struct   bap_tasklet;
2605
2606         /* MAC buffer ids */
2607         uint16_t          txfid_head;
2608         uint16_t          txfid_tail;
2609         unsigned int            txfid_N;
2610         uint16_t          txfid_queue[HFA384x_DRVR_FIDSTACKLEN_MAX];
2611         uint16_t                        infofid;
2612         struct semaphore        infofid_sem;
2613 #endif /* !USB */
2614
2615         int                          scanflag;    /* to signal scan comlete */
2616         int                          join_ap;        /* are we joined to a specific ap */
2617         int                          join_retries;   /* number of join retries till we fail */
2618         hfa384x_JoinRequest_data_t   joinreq;        /* join request saved data */
2619
2620         wlandevice_t            *wlandev;
2621         /* Timer to allow for the deferred processing of linkstatus messages */
2622         struct work_struct      link_bh;
2623
2624         struct work_struct      commsqual_bh;
2625         hfa384x_commsquality_t  qual;
2626         struct timer_list       commsqual_timer;
2627
2628         uint16_t link_status;
2629         uint16_t link_status_new;
2630         struct sk_buff_head        authq;
2631
2632         /* And here we have stuff that used to be in priv */
2633
2634         /* State variables */
2635         unsigned int            presniff_port_type;
2636         uint16_t                presniff_wepflags;
2637         uint32_t                dot11_desired_bss_type;
2638         int             ap;     /* AP flag: 0 - Station, 1 - Access Point. */
2639
2640         int             dbmadjust;
2641
2642         /* Group Addresses - right now, there are up to a total
2643         of MAX_GRP_ADDR group addresses */
2644         uint8_t         dot11_grp_addr[MAX_GRP_ADDR][WLAN_ADDR_LEN];
2645         unsigned int            dot11_grpcnt;
2646
2647         /* Component Identities */
2648         hfa384x_compident_t     ident_nic;
2649         hfa384x_compident_t     ident_pri_fw;
2650         hfa384x_compident_t     ident_sta_fw;
2651         hfa384x_compident_t     ident_ap_fw;
2652         uint16_t                        mm_mods;
2653
2654         /* Supplier compatibility ranges */
2655         hfa384x_caplevel_t      cap_sup_mfi;
2656         hfa384x_caplevel_t      cap_sup_cfi;
2657         hfa384x_caplevel_t      cap_sup_pri;
2658         hfa384x_caplevel_t      cap_sup_sta;
2659         hfa384x_caplevel_t      cap_sup_ap;
2660
2661         /* Actor compatibility ranges */
2662         hfa384x_caplevel_t      cap_act_pri_cfi; /* pri f/w to controller interface */
2663         hfa384x_caplevel_t      cap_act_sta_cfi; /* sta f/w to controller interface */
2664         hfa384x_caplevel_t      cap_act_sta_mfi; /* sta f/w to modem interface */
2665         hfa384x_caplevel_t      cap_act_ap_cfi;  /* ap f/w to controller interface */
2666         hfa384x_caplevel_t      cap_act_ap_mfi;  /* ap f/w to modem interface */
2667
2668         uint32_t                        psusercount;  /* Power save user count. */
2669         hfa384x_CommTallies32_t tallies;      /* Communication tallies. */
2670         uint8_t                 comment[WLAN_COMMENT_MAX+1]; /* User comment */
2671
2672         /* Channel Info request results (AP only) */
2673         struct {
2674                 atomic_t                done;
2675                 uint8_t                 count;
2676                 hfa384x_ChInfoResult_t  results;
2677         } channel_info;
2678
2679         hfa384x_InfFrame_t      *scanresults;
2680
2681
2682         prism2sta_authlist_t    authlist;     /* Authenticated station list. */
2683         unsigned int                    accessmode;   /* Access mode. */
2684         prism2sta_accesslist_t  allow;        /* Allowed station list. */
2685         prism2sta_accesslist_t  deny;         /* Denied station list. */
2686
2687 } hfa384x_t;
2688
2689 /*=============================================================*/
2690 /*--- Function Declarations -----------------------------------*/
2691 /*=============================================================*/
2692 #if (WLAN_HOSTIF == WLAN_USB)
2693 void
2694 hfa384x_create(
2695         hfa384x_t *hw,
2696         struct usb_device *usb);
2697 #else
2698 void
2699 hfa384x_create(
2700         hfa384x_t *hw,
2701         unsigned int irq,
2702         uint32_t iobase,
2703         uint8_t __iomem *membase);
2704 #endif
2705
2706 void hfa384x_destroy(hfa384x_t *hw);
2707
2708 irqreturn_t
2709 hfa384x_INTerrupt(int irq, void *dev_id PT_REGS);
2710 int
2711 hfa384x_corereset( hfa384x_t *hw, int holdtime, int settletime, int genesis);
2712 int
2713 hfa384x_drvr_chinforesults( hfa384x_t *hw);
2714 int
2715 hfa384x_drvr_commtallies( hfa384x_t *hw);
2716 int
2717 hfa384x_drvr_disable(hfa384x_t *hw, uint16_t macport);
2718 int
2719 hfa384x_drvr_enable(hfa384x_t *hw, uint16_t macport);
2720 int
2721 hfa384x_drvr_flashdl_enable(hfa384x_t *hw);
2722 int
2723 hfa384x_drvr_flashdl_disable(hfa384x_t *hw);
2724 int
2725 hfa384x_drvr_flashdl_write(hfa384x_t *hw, uint32_t daddr, void* buf, uint32_t len);
2726 int
2727 hfa384x_drvr_getconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len);
2728 int
2729 hfa384x_drvr_handover( hfa384x_t *hw, uint8_t *addr);
2730 int
2731 hfa384x_drvr_hostscanresults( hfa384x_t *hw);
2732 int
2733 hfa384x_drvr_low_level(hfa384x_t *hw, hfa384x_metacmd_t *cmd);
2734 int
2735 hfa384x_drvr_mmi_read(hfa384x_t *hw, uint32_t address, uint32_t *result);
2736 int
2737 hfa384x_drvr_mmi_write(hfa384x_t *hw, uint32_t address, uint32_t data);
2738 int
2739 hfa384x_drvr_ramdl_enable(hfa384x_t *hw, uint32_t exeaddr);
2740 int
2741 hfa384x_drvr_ramdl_disable(hfa384x_t *hw);
2742 int
2743 hfa384x_drvr_ramdl_write(hfa384x_t *hw, uint32_t daddr, void* buf, uint32_t len);
2744 int
2745 hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len);
2746 int
2747 hfa384x_drvr_scanresults( hfa384x_t *hw);
2748
2749 int
2750 hfa384x_drvr_setconfig(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len);
2751
2752 static inline int
2753 hfa384x_drvr_getconfig16(hfa384x_t *hw, uint16_t rid, void *val)
2754 {
2755         int             result = 0;
2756         result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint16_t));
2757         if ( result == 0 ) {
2758                 *((uint16_t*)val) = hfa384x2host_16(*((uint16_t*)val));
2759         }
2760         return result;
2761 }
2762
2763 static inline int
2764 hfa384x_drvr_getconfig32(hfa384x_t *hw, uint16_t rid, void *val)
2765 {
2766         int             result = 0;
2767
2768         result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(uint32_t));
2769         if ( result == 0 ) {
2770                 *((uint32_t*)val) = hfa384x2host_32(*((uint32_t*)val));
2771         }
2772
2773         return result;
2774 }
2775
2776 static inline int
2777 hfa384x_drvr_setconfig16(hfa384x_t *hw, uint16_t rid, uint16_t val)
2778 {
2779         uint16_t value = host2hfa384x_16(val);
2780         return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
2781 }
2782
2783 static inline int
2784 hfa384x_drvr_setconfig32(hfa384x_t *hw, uint16_t rid, uint32_t val)
2785 {
2786         uint32_t value = host2hfa384x_32(val);
2787         return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
2788 }
2789
2790 #if (WLAN_HOSTIF == WLAN_USB)
2791 int
2792 hfa384x_drvr_getconfig_async(hfa384x_t     *hw,
2793                               uint16_t        rid,
2794                               ctlx_usercb_t usercb,
2795                               void          *usercb_data);
2796
2797 int
2798 hfa384x_drvr_setconfig_async(hfa384x_t *hw,
2799                               uint16_t rid,
2800                               void *buf,
2801                               uint16_t len,
2802                               ctlx_usercb_t usercb,
2803                               void *usercb_data);
2804 #else
2805 static inline int
2806 hfa384x_drvr_setconfig_async(hfa384x_t *hw, uint16_t rid, void *buf, uint16_t len,
2807                              void *ptr1, void *ptr2)
2808 {
2809          (void)ptr1;
2810          (void)ptr2;
2811          return hfa384x_drvr_setconfig(hw, rid, buf, len);
2812 }
2813 #endif
2814
2815 static inline int
2816 hfa384x_drvr_setconfig16_async(hfa384x_t *hw, uint16_t rid, uint16_t val)
2817 {
2818         uint16_t value = host2hfa384x_16(val);
2819         return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
2820                                             NULL , NULL);
2821 }
2822
2823 static inline int
2824 hfa384x_drvr_setconfig32_async(hfa384x_t *hw, uint16_t rid, uint32_t val)
2825 {
2826         uint32_t value = host2hfa384x_32(val);
2827         return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
2828                                             NULL , NULL);
2829 }
2830
2831
2832 int
2833 hfa384x_drvr_start(hfa384x_t *hw);
2834 int
2835 hfa384x_drvr_stop(hfa384x_t *hw);
2836 int
2837 hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep);
2838 void
2839 hfa384x_tx_timeout(wlandevice_t *wlandev);
2840
2841 int
2842 hfa384x_cmd_initialize(hfa384x_t *hw);
2843 int
2844 hfa384x_cmd_enable(hfa384x_t *hw, uint16_t macport);
2845 int
2846 hfa384x_cmd_disable(hfa384x_t *hw, uint16_t macport);
2847 int
2848 hfa384x_cmd_diagnose(hfa384x_t *hw);
2849 int
2850 hfa384x_cmd_allocate(hfa384x_t *hw, uint16_t len);
2851 int
2852 hfa384x_cmd_transmit(hfa384x_t *hw, uint16_t reclaim, uint16_t qos, uint16_t fid);
2853 int
2854 hfa384x_cmd_clearpersist(hfa384x_t *hw, uint16_t fid);
2855 int
2856 hfa384x_cmd_notify(hfa384x_t *hw, uint16_t reclaim, uint16_t fid, void *buf, uint16_t len);
2857 int
2858 hfa384x_cmd_inquire(hfa384x_t *hw, uint16_t fid);
2859 int
2860 hfa384x_cmd_access(hfa384x_t *hw, uint16_t write, uint16_t rid, void *buf, uint16_t len);
2861 int
2862 hfa384x_cmd_monitor(hfa384x_t *hw, uint16_t enable);
2863 int
2864 hfa384x_cmd_download(
2865         hfa384x_t *hw,
2866         uint16_t mode,
2867         uint16_t lowaddr,
2868         uint16_t highaddr,
2869         uint16_t codelen);
2870 int
2871 hfa384x_cmd_aux_enable(hfa384x_t *hw, int force);
2872 int
2873 hfa384x_cmd_aux_disable(hfa384x_t *hw);
2874 int
2875 hfa384x_copy_from_bap(
2876         hfa384x_t *hw,
2877         uint16_t        bap,
2878         uint16_t        id,
2879         uint16_t        offset,
2880         void    *buf,
2881         unsigned int    len);
2882 int
2883 hfa384x_copy_to_bap(
2884         hfa384x_t *hw,
2885         uint16_t        bap,
2886         uint16_t        id,
2887         uint16_t        offset,
2888         void    *buf,
2889         unsigned int    len);
2890 void
2891 hfa384x_copy_from_aux(
2892         hfa384x_t *hw,
2893         uint32_t        cardaddr,
2894         uint32_t        auxctl,
2895         void    *buf,
2896         unsigned int    len);
2897 void
2898 hfa384x_copy_to_aux(
2899         hfa384x_t *hw,
2900         uint32_t        cardaddr,
2901         uint32_t        auxctl,
2902         void    *buf,
2903         unsigned int    len);
2904
2905 #if (WLAN_HOSTIF != WLAN_USB)
2906
2907 /*
2908    HFA384x is a LITTLE ENDIAN part.
2909
2910    the get/setreg functions implicitly byte-swap the data to LE.
2911    the _noswap variants do not perform a byte-swap on the data.
2912 */
2913
2914 static inline uint16_t
2915 __hfa384x_getreg(hfa384x_t *hw, unsigned int reg);
2916
2917 static inline void
2918 __hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg);
2919
2920 static inline uint16_t
2921 __hfa384x_getreg_noswap(hfa384x_t *hw, unsigned int reg);
2922
2923 static inline void
2924 __hfa384x_setreg_noswap(hfa384x_t *hw, uint16_t val, unsigned int reg);
2925
2926 #ifdef REVERSE_ENDIAN
2927 #define hfa384x_getreg __hfa384x_getreg_noswap
2928 #define hfa384x_setreg __hfa384x_setreg_noswap
2929 #define hfa384x_getreg_noswap __hfa384x_getreg
2930 #define hfa384x_setreg_noswap __hfa384x_setreg
2931 #else
2932 #define hfa384x_getreg __hfa384x_getreg
2933 #define hfa384x_setreg __hfa384x_setreg
2934 #define hfa384x_getreg_noswap __hfa384x_getreg_noswap
2935 #define hfa384x_setreg_noswap __hfa384x_setreg_noswap
2936 #endif
2937
2938 /*----------------------------------------------------------------
2939 * hfa384x_getreg
2940 *
2941 * Retrieve the value of one of the MAC registers.  Done here
2942 * because different PRISM2 MAC parts use different buses and such.
2943 * NOTE: This function returns the value in HOST ORDER!!!!!!
2944 *
2945 * Arguments:
2946 *       hw         MAC part structure
2947 *       reg        Register identifier (offset for I/O based i/f)
2948 *
2949 * Returns:
2950 *       Value from the register in HOST ORDER!!!!
2951 ----------------------------------------------------------------*/
2952 static inline uint16_t
2953 __hfa384x_getreg(hfa384x_t *hw, unsigned int reg)
2954 {
2955 /*      printk(KERN_DEBUG "Reading from 0x%0x\n", hw->membase + reg); */
2956 #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX))
2957         return wlan_inw_le16_to_cpu(hw->iobase+reg);
2958 #elif (WLAN_HOSTIF == WLAN_PCI)
2959         return __le16_to_cpu(readw(hw->membase + reg));
2960 #endif
2961 }
2962
2963 /*----------------------------------------------------------------
2964 * hfa384x_setreg
2965 *
2966 * Set the value of one of the MAC registers.  Done here
2967 * because different PRISM2 MAC parts use different buses and such.
2968 * NOTE: This function assumes the value is in HOST ORDER!!!!!!
2969 *
2970 * Arguments:
2971 *       hw      MAC part structure
2972 *       val     Value, in HOST ORDER!!, to put in the register
2973 *       reg     Register identifier (offset for I/O based i/f)
2974 *
2975 * Returns:
2976 *       Nothing
2977 ----------------------------------------------------------------*/
2978 static inline void
2979 __hfa384x_setreg(hfa384x_t *hw, uint16_t val, unsigned int reg)
2980 {
2981 #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX))
2982         wlan_outw_cpu_to_le16( val, hw->iobase + reg);
2983         return;
2984 #elif (WLAN_HOSTIF == WLAN_PCI)
2985         writew(__cpu_to_le16(val), hw->membase + reg);
2986         return;
2987 #endif
2988 }
2989
2990
2991 /*----------------------------------------------------------------
2992 * hfa384x_getreg_noswap
2993 *
2994 * Retrieve the value of one of the MAC registers.  Done here
2995 * because different PRISM2 MAC parts use different buses and such.
2996 *
2997 * Arguments:
2998 *       hw         MAC part structure
2999 *       reg        Register identifier (offset for I/O based i/f)
3000 *
3001 * Returns:
3002 *       Value from the register.
3003 ----------------------------------------------------------------*/
3004 static inline uint16_t
3005 __hfa384x_getreg_noswap(hfa384x_t *hw, unsigned int reg)
3006 {
3007 #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX))
3008         return wlan_inw(hw->iobase+reg);
3009 #elif (WLAN_HOSTIF == WLAN_PCI)
3010         return readw(hw->membase + reg);
3011 #endif
3012 }
3013
3014
3015 /*----------------------------------------------------------------
3016 * hfa384x_setreg_noswap
3017 *
3018 * Set the value of one of the MAC registers.  Done here
3019 * because different PRISM2 MAC parts use different buses and such.
3020 *
3021 * Arguments:
3022 *       hw      MAC part structure
3023 *       val     Value to put in the register
3024 *       reg     Register identifier (offset for I/O based i/f)
3025 *
3026 * Returns:
3027 *       Nothing
3028 ----------------------------------------------------------------*/
3029 static inline void
3030 __hfa384x_setreg_noswap(hfa384x_t *hw, uint16_t val, unsigned int reg)
3031 {
3032 #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX))
3033         wlan_outw( val, hw->iobase + reg);
3034         return;
3035 #elif (WLAN_HOSTIF == WLAN_PCI)
3036         writew(val, hw->membase + reg);
3037         return;
3038 #endif
3039 }
3040
3041
3042 static inline void hfa384x_events_all(hfa384x_t *hw)
3043 {
3044         hfa384x_setreg(hw,
3045                        HFA384x_INT_NORMAL
3046 #ifdef CMD_IRQ
3047                        | HFA384x_INTEN_CMD_SET(1)
3048 #endif
3049                        ,
3050                        HFA384x_INTEN);
3051
3052 }
3053
3054 static inline void hfa384x_events_nobap(hfa384x_t *hw)
3055 {
3056         hfa384x_setreg(hw,
3057                         (HFA384x_INT_NORMAL & ~HFA384x_INT_BAP_OP)
3058 #ifdef CMD_IRQ
3059                        | HFA384x_INTEN_CMD_SET(1)
3060 #endif
3061                        ,
3062                        HFA384x_INTEN);
3063
3064 }
3065
3066 #endif /* WLAN_HOSTIF != WLAN_USB */
3067 #endif /* __KERNEL__ */
3068
3069 #endif  /* _HFA384x_H */