Commit | Line | Data |
---|---|---|
00b3ed16 GKH |
1 | /* 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 | #ifndef _HFA384x_H | |
57 | #define _HFA384x_H | |
58 | ||
e573aaa4 | 59 | #define HFA384x_FIRMWARE_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) |
00b3ed16 | 60 | |
28b17a4b MM |
61 | #include <linux/if_ether.h> |
62 | ||
00b3ed16 | 63 | /*--- Mins & Maxs -----------------------------------*/ |
71508ee4 AG |
64 | #define HFA384x_PORTID_MAX ((u16)7) |
65 | #define HFA384x_NUMPORTS_MAX ((u16)(HFA384x_PORTID_MAX+1)) | |
66 | #define HFA384x_PDR_LEN_MAX ((u16)512) /* in bytes, from EK */ | |
67 | #define HFA384x_PDA_RECS_MAX ((u16)200) /* a guess */ | |
68 | #define HFA384x_PDA_LEN_MAX ((u16)1024) /* in bytes, from EK*/ | |
69 | #define HFA384x_SCANRESULT_MAX ((u16)31) | |
70 | #define HFA384x_HSCANRESULT_MAX ((u16)31) | |
71 | #define HFA384x_CHINFORESULT_MAX ((u16)16) | |
72 | #define HFA384x_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */ | |
73 | #define HFA384x_RIDDATA_MAXLEN HFA384x_RID_GUESSING_MAXLEN | |
74 | #define HFA384x_USB_RWMEM_MAXLEN 2048 | |
00b3ed16 GKH |
75 | |
76 | /*--- Support Constants -----------------------------*/ | |
aaad4303 SP |
77 | #define HFA384x_PORTTYPE_IBSS ((u16)0) |
78 | #define HFA384x_PORTTYPE_BSS ((u16)1) | |
aaad4303 | 79 | #define HFA384x_PORTTYPE_PSUEDOIBSS ((u16)3) |
7f6e0e44 MM |
80 | #define HFA384x_WEPFLAGS_PRIVINVOKED ((u16)BIT(0)) |
81 | #define HFA384x_WEPFLAGS_EXCLUDE ((u16)BIT(1)) | |
82 | #define HFA384x_WEPFLAGS_DISABLE_TXCRYPT ((u16)BIT(4)) | |
83 | #define HFA384x_WEPFLAGS_DISABLE_RXCRYPT ((u16)BIT(7)) | |
aaad4303 SP |
84 | #define HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM ((u16)3) |
85 | #define HFA384x_PORTSTATUS_DISABLED ((u16)1) | |
aaad4303 SP |
86 | #define HFA384x_RATEBIT_1 ((u16)1) |
87 | #define HFA384x_RATEBIT_2 ((u16)2) | |
88 | #define HFA384x_RATEBIT_5dot5 ((u16)4) | |
89 | #define HFA384x_RATEBIT_11 ((u16)8) | |
00b3ed16 | 90 | |
00b3ed16 GKH |
91 | /*--- MAC Internal memory constants and macros ------*/ |
92 | /* masks and macros used to manipulate MAC internal memory addresses. */ | |
93 | /* MAC internal memory addresses are 23 bit quantities. The MAC uses | |
94 | * a paged address space where the upper 16 bits are the page number | |
95 | * and the lower 7 bits are the offset. There are various Host API | |
96 | * elements that require two 16-bit quantities to specify a MAC | |
97 | * internal memory address. Unfortunately, some of the API's use a | |
98 | * page/offset format where the offset value is JUST the lower seven | |
99 | * bits and the page is the remaining 16 bits. Some of the API's | |
100 | * assume that the 23 bit address has been split at the 16th bit. We | |
101 | * refer to these two formats as AUX format and CMD format. The | |
102 | * macros below help handle some of this. | |
103 | */ | |
104 | ||
00b3ed16 GKH |
105 | /* Mask bits for discarding unwanted pieces in a flat address */ |
106 | #define HFA384x_ADDR_FLAT_AUX_PAGE_MASK (0x007fff80) | |
107 | #define HFA384x_ADDR_FLAT_AUX_OFF_MASK (0x0000007f) | |
108 | #define HFA384x_ADDR_FLAT_CMD_PAGE_MASK (0xffff0000) | |
109 | #define HFA384x_ADDR_FLAT_CMD_OFF_MASK (0x0000ffff) | |
110 | ||
e573aaa4 MM |
111 | /* Mask bits for discarding unwanted pieces in AUX format |
112 | 16-bit address parts */ | |
00b3ed16 GKH |
113 | #define HFA384x_ADDR_AUX_PAGE_MASK (0xffff) |
114 | #define HFA384x_ADDR_AUX_OFF_MASK (0x007f) | |
115 | ||
00b3ed16 | 116 | /* Make a 32-bit flat address from AUX format 16-bit page and offset */ |
e573aaa4 | 117 | #define HFA384x_ADDR_AUX_MKFLAT(p, o) \ |
5dd8acc8 SK |
118 | ((((u32)(((u16)(p))&HFA384x_ADDR_AUX_PAGE_MASK)) << 7) | \ |
119 | ((u32)(((u16)(o))&HFA384x_ADDR_AUX_OFF_MASK))) | |
00b3ed16 | 120 | |
00b3ed16 GKH |
121 | /* Make CMD format offset and page from a 32-bit flat address */ |
122 | #define HFA384x_ADDR_CMD_MKPAGE(f) \ | |
aaad4303 | 123 | ((u16)((((u32)(f))&HFA384x_ADDR_FLAT_CMD_PAGE_MASK)>>16)) |
00b3ed16 | 124 | #define HFA384x_ADDR_CMD_MKOFF(f) \ |
aaad4303 | 125 | ((u16)(((u32)(f))&HFA384x_ADDR_FLAT_CMD_OFF_MASK)) |
00b3ed16 | 126 | |
00b3ed16 GKH |
127 | /*--- Controller Memory addresses -------------------*/ |
128 | #define HFA3842_PDA_BASE (0x007f0000UL) | |
129 | #define HFA3841_PDA_BASE (0x003f0000UL) | |
130 | #define HFA3841_PDA_BOGUS_BASE (0x00390000UL) | |
131 | ||
132 | /*--- Driver Download states -----------------------*/ | |
133 | #define HFA384x_DLSTATE_DISABLED 0 | |
134 | #define HFA384x_DLSTATE_RAMENABLED 1 | |
135 | #define HFA384x_DLSTATE_FLASHENABLED 2 | |
00b3ed16 | 136 | |
00b3ed16 | 137 | /*--- Register Field Masks --------------------------*/ |
71508ee4 AG |
138 | #define HFA384x_CMD_AINFO ((u16)(BIT(14) | BIT(13) \ |
139 | | BIT(12) | BIT(11) \ | |
140 | | BIT(10) | BIT(9) \ | |
141 | | BIT(8))) | |
142 | #define HFA384x_CMD_MACPORT ((u16)(BIT(10) | BIT(9) | \ | |
143 | BIT(8))) | |
7f6e0e44 | 144 | #define HFA384x_CMD_PROGMODE ((u16)(BIT(9) | BIT(8))) |
71508ee4 AG |
145 | #define HFA384x_CMD_CMDCODE ((u16)(BIT(5) | BIT(4) | \ |
146 | BIT(3) | BIT(2) | \ | |
147 | BIT(1) | BIT(0))) | |
7f6e0e44 | 148 | |
71508ee4 AG |
149 | #define HFA384x_STATUS_RESULT ((u16)(BIT(14) | BIT(13) \ |
150 | | BIT(12) | BIT(11) \ | |
151 | | BIT(10) | BIT(9) \ | |
152 | | BIT(8))) | |
7f6e0e44 | 153 | |
00b3ed16 GKH |
154 | /*--- Command Code Constants --------------------------*/ |
155 | /*--- Controller Commands --------------------------*/ | |
aaad4303 SP |
156 | #define HFA384x_CMDCODE_INIT ((u16)0x00) |
157 | #define HFA384x_CMDCODE_ENABLE ((u16)0x01) | |
158 | #define HFA384x_CMDCODE_DISABLE ((u16)0x02) | |
00b3ed16 GKH |
159 | |
160 | /*--- Regulate Commands --------------------------*/ | |
aaad4303 | 161 | #define HFA384x_CMDCODE_INQ ((u16)0x11) |
00b3ed16 GKH |
162 | |
163 | /*--- Configure Commands --------------------------*/ | |
aaad4303 | 164 | #define HFA384x_CMDCODE_DOWNLD ((u16)0x22) |
00b3ed16 GKH |
165 | |
166 | /*--- Debugging Commands -----------------------------*/ | |
aaad4303 SP |
167 | #define HFA384x_CMDCODE_MONITOR ((u16)(0x38)) |
168 | #define HFA384x_MONITOR_ENABLE ((u16)(0x0b)) | |
169 | #define HFA384x_MONITOR_DISABLE ((u16)(0x0f)) | |
00b3ed16 GKH |
170 | |
171 | /*--- Result Codes --------------------------*/ | |
aaad4303 | 172 | #define HFA384x_CMD_ERR ((u16)(0x7F)) |
00b3ed16 GKH |
173 | |
174 | /*--- Programming Modes -------------------------- | |
175 | MODE 0: Disable programming | |
176 | MODE 1: Enable volatile memory programming | |
177 | MODE 2: Enable non-volatile memory programming | |
178 | MODE 3: Program non-volatile memory section | |
179 | --------------------------------------------------*/ | |
aaad4303 SP |
180 | #define HFA384x_PROGMODE_DISABLE ((u16)0x00) |
181 | #define HFA384x_PROGMODE_RAM ((u16)0x01) | |
182 | #define HFA384x_PROGMODE_NV ((u16)0x02) | |
183 | #define HFA384x_PROGMODE_NVWRITE ((u16)0x03) | |
00b3ed16 | 184 | |
00b3ed16 GKH |
185 | /*--- Record ID Constants --------------------------*/ |
186 | /*-------------------------------------------------------------------- | |
187 | Configuration RIDs: Network Parameters, Static Configuration Entities | |
188 | --------------------------------------------------------------------*/ | |
aaad4303 SP |
189 | #define HFA384x_RID_CNFPORTTYPE ((u16)0xFC00) |
190 | #define HFA384x_RID_CNFOWNMACADDR ((u16)0xFC01) | |
191 | #define HFA384x_RID_CNFDESIREDSSID ((u16)0xFC02) | |
192 | #define HFA384x_RID_CNFOWNCHANNEL ((u16)0xFC03) | |
193 | #define HFA384x_RID_CNFOWNSSID ((u16)0xFC04) | |
aaad4303 | 194 | #define HFA384x_RID_CNFMAXDATALEN ((u16)0xFC07) |
00b3ed16 GKH |
195 | |
196 | /*-------------------------------------------------------------------- | |
197 | Configuration RID lengths: Network Params, Static Config Entities | |
198 | This is the length of JUST the DATA part of the RID (does not | |
199 | include the len or code fields) | |
200 | --------------------------------------------------------------------*/ | |
aaad4303 SP |
201 | #define HFA384x_RID_CNFOWNMACADDR_LEN ((u16)6) |
202 | #define HFA384x_RID_CNFDESIREDSSID_LEN ((u16)34) | |
aaad4303 | 203 | #define HFA384x_RID_CNFOWNSSID_LEN ((u16)34) |
00b3ed16 GKH |
204 | |
205 | /*-------------------------------------------------------------------- | |
206 | Configuration RIDs: Network Parameters, Dynamic Configuration Entities | |
207 | --------------------------------------------------------------------*/ | |
aaad4303 SP |
208 | #define HFA384x_RID_CREATEIBSS ((u16)0xFC81) |
209 | #define HFA384x_RID_FRAGTHRESH ((u16)0xFC82) | |
210 | #define HFA384x_RID_RTSTHRESH ((u16)0xFC83) | |
211 | #define HFA384x_RID_TXRATECNTL ((u16)0xFC84) | |
212 | #define HFA384x_RID_PROMISCMODE ((u16)0xFC85) | |
00b3ed16 GKH |
213 | |
214 | /*---------------------------------------------------------------------- | |
215 | Information RIDs: NIC Information | |
216 | --------------------------------------------------------------------*/ | |
aaad4303 SP |
217 | #define HFA384x_RID_MAXLOADTIME ((u16)0xFD00) |
218 | #define HFA384x_RID_DOWNLOADBUFFER ((u16)0xFD01) | |
219 | #define HFA384x_RID_PRIIDENTITY ((u16)0xFD02) | |
220 | #define HFA384x_RID_PRISUPRANGE ((u16)0xFD03) | |
221 | #define HFA384x_RID_PRI_CFIACTRANGES ((u16)0xFD04) | |
222 | #define HFA384x_RID_NICSERIALNUMBER ((u16)0xFD0A) | |
223 | #define HFA384x_RID_NICIDENTITY ((u16)0xFD0B) | |
224 | #define HFA384x_RID_MFISUPRANGE ((u16)0xFD0C) | |
225 | #define HFA384x_RID_CFISUPRANGE ((u16)0xFD0D) | |
aaad4303 SP |
226 | #define HFA384x_RID_STAIDENTITY ((u16)0xFD20) |
227 | #define HFA384x_RID_STASUPRANGE ((u16)0xFD21) | |
228 | #define HFA384x_RID_STA_MFIACTRANGES ((u16)0xFD22) | |
229 | #define HFA384x_RID_STA_CFIACTRANGES ((u16)0xFD23) | |
00b3ed16 GKH |
230 | |
231 | /*---------------------------------------------------------------------- | |
232 | Information RID Lengths: NIC Information | |
233 | This is the length of JUST the DATA part of the RID (does not | |
234 | include the len or code fields) | |
235 | --------------------------------------------------------------------*/ | |
aaad4303 | 236 | #define HFA384x_RID_NICSERIALNUMBER_LEN ((u16)12) |
00b3ed16 GKH |
237 | |
238 | /*-------------------------------------------------------------------- | |
239 | Information RIDs: MAC Information | |
240 | --------------------------------------------------------------------*/ | |
aaad4303 SP |
241 | #define HFA384x_RID_PORTSTATUS ((u16)0xFD40) |
242 | #define HFA384x_RID_CURRENTSSID ((u16)0xFD41) | |
243 | #define HFA384x_RID_CURRENTBSSID ((u16)0xFD42) | |
aaad4303 | 244 | #define HFA384x_RID_CURRENTTXRATE ((u16)0xFD44) |
aaad4303 SP |
245 | #define HFA384x_RID_SHORTRETRYLIMIT ((u16)0xFD48) |
246 | #define HFA384x_RID_LONGRETRYLIMIT ((u16)0xFD49) | |
247 | #define HFA384x_RID_MAXTXLIFETIME ((u16)0xFD4A) | |
aaad4303 SP |
248 | #define HFA384x_RID_PRIVACYOPTIMP ((u16)0xFD4F) |
249 | #define HFA384x_RID_DBMCOMMSQUALITY ((u16)0xFD51) | |
00b3ed16 GKH |
250 | |
251 | /*-------------------------------------------------------------------- | |
252 | Information RID Lengths: MAC Information | |
253 | This is the length of JUST the DATA part of the RID (does not | |
254 | include the len or code fields) | |
255 | --------------------------------------------------------------------*/ | |
71508ee4 AG |
256 | #define HFA384x_RID_DBMCOMMSQUALITY_LEN \ |
257 | ((u16) sizeof(hfa384x_dbmcommsquality_t)) | |
258 | #define HFA384x_RID_JOINREQUEST_LEN \ | |
259 | ((u16)sizeof(hfa384x_JoinRequest_data_t)) | |
40a67411 | 260 | |
00b3ed16 GKH |
261 | /*-------------------------------------------------------------------- |
262 | Information RIDs: Modem Information | |
263 | --------------------------------------------------------------------*/ | |
aaad4303 | 264 | #define HFA384x_RID_CURRENTCHANNEL ((u16)0xFDC1) |
00b3ed16 GKH |
265 | |
266 | /*-------------------------------------------------------------------- | |
267 | API ENHANCEMENTS (NOT ALREADY IMPLEMENTED) | |
268 | --------------------------------------------------------------------*/ | |
aaad4303 SP |
269 | #define HFA384x_RID_CNFWEPDEFAULTKEYID ((u16)0xFC23) |
270 | #define HFA384x_RID_CNFWEPDEFAULTKEY0 ((u16)0xFC24) | |
271 | #define HFA384x_RID_CNFWEPDEFAULTKEY1 ((u16)0xFC25) | |
272 | #define HFA384x_RID_CNFWEPDEFAULTKEY2 ((u16)0xFC26) | |
273 | #define HFA384x_RID_CNFWEPDEFAULTKEY3 ((u16)0xFC27) | |
274 | #define HFA384x_RID_CNFWEPFLAGS ((u16)0xFC28) | |
aaad4303 | 275 | #define HFA384x_RID_CNFAUTHENTICATION ((u16)0xFC2A) |
aaad4303 | 276 | #define HFA384x_RID_CNFROAMINGMODE ((u16)0xFC2D) |
aaad4303 | 277 | #define HFA384x_RID_CNFAPBCNint ((u16)0xFC33) |
e573aaa4 MM |
278 | #define HFA384x_RID_CNFDBMADJUST ((u16)0xFC46) |
279 | #define HFA384x_RID_CNFWPADATA ((u16)0xFC48) | |
aaad4303 SP |
280 | #define HFA384x_RID_CNFBASICRATES ((u16)0xFCB3) |
281 | #define HFA384x_RID_CNFSUPPRATES ((u16)0xFCB4) | |
e573aaa4 MM |
282 | #define HFA384x_RID_CNFPASSIVESCANCTRL ((u16)0xFCBA) |
283 | #define HFA384x_RID_TXPOWERMAX ((u16)0xFCBE) | |
aaad4303 SP |
284 | #define HFA384x_RID_JOINREQUEST ((u16)0xFCE2) |
285 | #define HFA384x_RID_AUTHENTICATESTA ((u16)0xFCE3) | |
e573aaa4 | 286 | #define HFA384x_RID_HOSTSCAN ((u16)0xFCE5) |
aaad4303 SP |
287 | |
288 | #define HFA384x_RID_CNFWEPDEFAULTKEY_LEN ((u16)6) | |
289 | #define HFA384x_RID_CNFWEP128DEFAULTKEY_LEN ((u16)14) | |
40a67411 | 290 | |
00b3ed16 GKH |
291 | /*-------------------------------------------------------------------- |
292 | PD Record codes | |
293 | --------------------------------------------------------------------*/ | |
aaad4303 SP |
294 | #define HFA384x_PDR_PCB_PARTNUM ((u16)0x0001) |
295 | #define HFA384x_PDR_PDAVER ((u16)0x0002) | |
296 | #define HFA384x_PDR_NIC_SERIAL ((u16)0x0003) | |
297 | #define HFA384x_PDR_MKK_MEASUREMENTS ((u16)0x0004) | |
298 | #define HFA384x_PDR_NIC_RAMSIZE ((u16)0x0005) | |
299 | #define HFA384x_PDR_MFISUPRANGE ((u16)0x0006) | |
300 | #define HFA384x_PDR_CFISUPRANGE ((u16)0x0007) | |
301 | #define HFA384x_PDR_NICID ((u16)0x0008) | |
aaad4303 | 302 | #define HFA384x_PDR_MAC_ADDRESS ((u16)0x0101) |
aaad4303 SP |
303 | #define HFA384x_PDR_REGDOMAIN ((u16)0x0103) |
304 | #define HFA384x_PDR_ALLOWED_CHANNEL ((u16)0x0104) | |
305 | #define HFA384x_PDR_DEFAULT_CHANNEL ((u16)0x0105) | |
aaad4303 | 306 | #define HFA384x_PDR_TEMPTYPE ((u16)0x0107) |
aaad4303 SP |
307 | #define HFA384x_PDR_IFR_SETTING ((u16)0x0200) |
308 | #define HFA384x_PDR_RFR_SETTING ((u16)0x0201) | |
309 | #define HFA384x_PDR_HFA3861_BASELINE ((u16)0x0202) | |
310 | #define HFA384x_PDR_HFA3861_SHADOW ((u16)0x0203) | |
311 | #define HFA384x_PDR_HFA3861_IFRF ((u16)0x0204) | |
312 | #define HFA384x_PDR_HFA3861_CHCALSP ((u16)0x0300) | |
313 | #define HFA384x_PDR_HFA3861_CHCALI ((u16)0x0301) | |
314 | #define HFA384x_PDR_MAX_TX_POWER ((u16)0x0302) | |
315 | #define HFA384x_PDR_MASTER_CHAN_LIST ((u16)0x0303) | |
316 | #define HFA384x_PDR_3842_NIC_CONFIG ((u16)0x0400) | |
317 | #define HFA384x_PDR_USB_ID ((u16)0x0401) | |
318 | #define HFA384x_PDR_PCI_ID ((u16)0x0402) | |
319 | #define HFA384x_PDR_PCI_IFCONF ((u16)0x0403) | |
320 | #define HFA384x_PDR_PCI_PMCONF ((u16)0x0404) | |
321 | #define HFA384x_PDR_RFENRGY ((u16)0x0406) | |
322 | #define HFA384x_PDR_USB_POWER_TYPE ((u16)0x0407) | |
aaad4303 SP |
323 | #define HFA384x_PDR_USB_MAX_POWER ((u16)0x0409) |
324 | #define HFA384x_PDR_USB_MANUFACTURER ((u16)0x0410) | |
325 | #define HFA384x_PDR_USB_PRODUCT ((u16)0x0411) | |
326 | #define HFA384x_PDR_ANT_DIVERSITY ((u16)0x0412) | |
327 | #define HFA384x_PDR_HFO_DELAY ((u16)0x0413) | |
328 | #define HFA384x_PDR_SCALE_THRESH ((u16)0x0414) | |
329 | ||
330 | #define HFA384x_PDR_HFA3861_MANF_TESTSP ((u16)0x0900) | |
331 | #define HFA384x_PDR_HFA3861_MANF_TESTI ((u16)0x0901) | |
332 | #define HFA384x_PDR_END_OF_PDA ((u16)0x0000) | |
00b3ed16 | 333 | |
00b3ed16 GKH |
334 | /*--- Register Test/Get/Set Field macros ------------------------*/ |
335 | ||
71508ee4 AG |
336 | #define HFA384x_CMD_AINFO_SET(value) ((u16)((u16)(value) << 8)) |
337 | #define HFA384x_CMD_MACPORT_SET(value) \ | |
338 | ((u16)HFA384x_CMD_AINFO_SET(value)) | |
339 | #define HFA384x_CMD_PROGMODE_SET(value) \ | |
340 | ((u16)HFA384x_CMD_AINFO_SET((u16)value)) | |
aaad4303 SP |
341 | #define HFA384x_CMD_CMDCODE_SET(value) ((u16)(value)) |
342 | ||
aaad4303 | 343 | #define HFA384x_STATUS_RESULT_SET(value) (((u16)(value)) << 8) |
acb7e242 | 344 | |
00b3ed16 GKH |
345 | /* Host Maintained State Info */ |
346 | #define HFA384x_STATE_PREINIT 0 | |
347 | #define HFA384x_STATE_INIT 1 | |
348 | #define HFA384x_STATE_RUNNING 2 | |
349 | ||
00b3ed16 GKH |
350 | /*-------------------------------------------------------------*/ |
351 | /* Commonly used basic types */ | |
e573aaa4 MM |
352 | typedef struct hfa384x_bytestr { |
353 | u16 len; | |
354 | u8 data[0]; | |
355 | } __attribute__ ((packed)) hfa384x_bytestr_t; | |
00b3ed16 | 356 | |
e573aaa4 MM |
357 | typedef struct hfa384x_bytestr32 { |
358 | u16 len; | |
359 | u8 data[32]; | |
360 | } __attribute__ ((packed)) hfa384x_bytestr32_t; | |
00b3ed16 GKH |
361 | |
362 | /*-------------------------------------------------------------------- | |
363 | Configuration Record Structures: | |
364 | Network Parameters, Static Configuration Entities | |
365 | --------------------------------------------------------------------*/ | |
00b3ed16 GKH |
366 | |
367 | /*-- Hardware/Firmware Component Information ----------*/ | |
e573aaa4 MM |
368 | typedef struct hfa384x_compident { |
369 | u16 id; | |
370 | u16 variant; | |
371 | u16 major; | |
372 | u16 minor; | |
373 | } __attribute__ ((packed)) hfa384x_compident_t; | |
374 | ||
375 | typedef struct hfa384x_caplevel { | |
376 | u16 role; | |
377 | u16 id; | |
378 | u16 variant; | |
379 | u16 bottom; | |
380 | u16 top; | |
381 | } __attribute__ ((packed)) hfa384x_caplevel_t; | |
00b3ed16 | 382 | |
00b3ed16 GKH |
383 | /*-- Configuration Record: cnfAuthentication --*/ |
384 | #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM 0x0001 | |
385 | #define HFA384x_CNFAUTHENTICATION_SHAREDKEY 0x0002 | |
386 | #define HFA384x_CNFAUTHENTICATION_LEAP 0x0004 | |
387 | ||
00b3ed16 GKH |
388 | /*-------------------------------------------------------------------- |
389 | Configuration Record Structures: | |
390 | Network Parameters, Dynamic Configuration Entities | |
391 | --------------------------------------------------------------------*/ | |
392 | ||
00b3ed16 | 393 | #define HFA384x_CREATEIBSS_JOINCREATEIBSS 0 |
00b3ed16 GKH |
394 | |
395 | /*-- Configuration Record: HostScanRequest (data portion only) --*/ | |
e573aaa4 MM |
396 | typedef struct hfa384x_HostScanRequest_data { |
397 | u16 channelList; | |
398 | u16 txRate; | |
00b3ed16 | 399 | hfa384x_bytestr32_t ssid; |
e573aaa4 | 400 | } __attribute__ ((packed)) hfa384x_HostScanRequest_data_t; |
00b3ed16 GKH |
401 | |
402 | /*-- Configuration Record: JoinRequest (data portion only) --*/ | |
e573aaa4 MM |
403 | typedef struct hfa384x_JoinRequest_data { |
404 | u8 bssid[WLAN_BSSID_LEN]; | |
405 | u16 channel; | |
406 | } __attribute__ ((packed)) hfa384x_JoinRequest_data_t; | |
00b3ed16 GKH |
407 | |
408 | /*-- Configuration Record: authenticateStation (data portion only) --*/ | |
e573aaa4 MM |
409 | typedef struct hfa384x_authenticateStation_data { |
410 | u8 address[ETH_ALEN]; | |
411 | u16 status; | |
412 | u16 algorithm; | |
413 | } __attribute__ ((packed)) hfa384x_authenticateStation_data_t; | |
00b3ed16 | 414 | |
00b3ed16 | 415 | /*-- Configuration Record: WPAData (data portion only) --*/ |
e573aaa4 MM |
416 | typedef struct hfa384x_WPAData { |
417 | u16 datalen; | |
5dd8acc8 | 418 | u8 data[0]; /* max 80 */ |
e573aaa4 | 419 | } __attribute__ ((packed)) hfa384x_WPAData_t; |
00b3ed16 | 420 | |
00b3ed16 GKH |
421 | /*-------------------------------------------------------------------- |
422 | Information Record Structures: NIC Information | |
423 | --------------------------------------------------------------------*/ | |
424 | ||
00b3ed16 GKH |
425 | /*-- Information Record: DownLoadBuffer --*/ |
426 | /* NOTE: The page and offset are in AUX format */ | |
e573aaa4 MM |
427 | typedef struct hfa384x_downloadbuffer { |
428 | u16 page; | |
429 | u16 offset; | |
430 | u16 len; | |
431 | } __attribute__ ((packed)) hfa384x_downloadbuffer_t; | |
00b3ed16 | 432 | |
00b3ed16 GKH |
433 | /*-------------------------------------------------------------------- |
434 | Information Record Structures: NIC Information | |
435 | --------------------------------------------------------------------*/ | |
436 | ||
aaad4303 | 437 | #define HFA384x_PSTATUS_CONN_IBSS ((u16)3) |
00b3ed16 GKH |
438 | |
439 | /*-- Information Record: commsquality --*/ | |
e573aaa4 MM |
440 | typedef struct hfa384x_commsquality { |
441 | u16 CQ_currBSS; | |
442 | u16 ASL_currBSS; | |
443 | u16 ANL_currFC; | |
444 | } __attribute__ ((packed)) hfa384x_commsquality_t; | |
00b3ed16 GKH |
445 | |
446 | /*-- Information Record: dmbcommsquality --*/ | |
e573aaa4 MM |
447 | typedef struct hfa384x_dbmcommsquality { |
448 | u16 CQdbm_currBSS; | |
449 | u16 ASLdbm_currBSS; | |
450 | u16 ANLdbm_currFC; | |
451 | } __attribute__ ((packed)) hfa384x_dbmcommsquality_t; | |
00b3ed16 | 452 | |
00b3ed16 GKH |
453 | /*-------------------------------------------------------------------- |
454 | FRAME STRUCTURES: Communication Frames | |
455 | ---------------------------------------------------------------------- | |
456 | Communication Frames: Transmit Frames | |
457 | --------------------------------------------------------------------*/ | |
458 | /*-- Communication Frame: Transmit Frame Structure --*/ | |
e573aaa4 MM |
459 | typedef struct hfa384x_tx_frame { |
460 | u16 status; | |
461 | u16 reserved1; | |
462 | u16 reserved2; | |
463 | u32 sw_support; | |
464 | u8 tx_retrycount; | |
465 | u8 tx_rate; | |
466 | u16 tx_control; | |
00b3ed16 GKH |
467 | |
468 | /*-- 802.11 Header Information --*/ | |
469 | ||
e573aaa4 MM |
470 | u16 frame_control; |
471 | u16 duration_id; | |
472 | u8 address1[6]; | |
473 | u8 address2[6]; | |
474 | u8 address3[6]; | |
475 | u16 sequence_control; | |
476 | u8 address4[6]; | |
477 | u16 data_len; /* little endian format */ | |
00b3ed16 GKH |
478 | |
479 | /*-- 802.3 Header Information --*/ | |
480 | ||
e573aaa4 MM |
481 | u8 dest_addr[6]; |
482 | u8 src_addr[6]; | |
483 | u16 data_length; /* big endian format */ | |
484 | } __attribute__ ((packed)) hfa384x_tx_frame_t; | |
00b3ed16 GKH |
485 | /*-------------------------------------------------------------------- |
486 | Communication Frames: Field Masks for Transmit Frames | |
487 | --------------------------------------------------------------------*/ | |
488 | /*-- Status Field --*/ | |
7f6e0e44 MM |
489 | #define HFA384x_TXSTATUS_ACKERR ((u16)BIT(5)) |
490 | #define HFA384x_TXSTATUS_FORMERR ((u16)BIT(3)) | |
491 | #define HFA384x_TXSTATUS_DISCON ((u16)BIT(2)) | |
492 | #define HFA384x_TXSTATUS_AGEDERR ((u16)BIT(1)) | |
493 | #define HFA384x_TXSTATUS_RETRYERR ((u16)BIT(0)) | |
00b3ed16 | 494 | /*-- Transmit Control Field --*/ |
71508ee4 AG |
495 | #define HFA384x_TX_MACPORT ((u16)(BIT(10) | \ |
496 | BIT(9) | BIT(8))) | |
7f6e0e44 MM |
497 | #define HFA384x_TX_STRUCTYPE ((u16)(BIT(4) | BIT(3))) |
498 | #define HFA384x_TX_TXEX ((u16)BIT(2)) | |
499 | #define HFA384x_TX_TXOK ((u16)BIT(1)) | |
00b3ed16 GKH |
500 | /*-------------------------------------------------------------------- |
501 | Communication Frames: Test/Get/Set Field Values for Transmit Frames | |
502 | --------------------------------------------------------------------*/ | |
503 | /*-- Status Field --*/ | |
504 | #define HFA384x_TXSTATUS_ISERROR(v) \ | |
aaad4303 | 505 | (((u16)(v))&\ |
00b3ed16 GKH |
506 | (HFA384x_TXSTATUS_ACKERR|HFA384x_TXSTATUS_FORMERR|\ |
507 | HFA384x_TXSTATUS_DISCON|HFA384x_TXSTATUS_AGEDERR|\ | |
508 | HFA384x_TXSTATUS_RETRYERR)) | |
509 | ||
e573aaa4 | 510 | #define HFA384x_TX_SET(v, m, s) ((((u16)(v))<<((u16)(s)))&((u16)(m))) |
00b3ed16 | 511 | |
00b3ed16 | 512 | #define HFA384x_TX_MACPORT_SET(v) HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8) |
71508ee4 AG |
513 | #define HFA384x_TX_STRUCTYPE_SET(v) HFA384x_TX_SET(v, \ |
514 | HFA384x_TX_STRUCTYPE, 3) | |
00b3ed16 | 515 | #define HFA384x_TX_TXEX_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2) |
00b3ed16 GKH |
516 | #define HFA384x_TX_TXOK_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1) |
517 | /*-------------------------------------------------------------------- | |
518 | Communication Frames: Receive Frames | |
519 | --------------------------------------------------------------------*/ | |
520 | /*-- Communication Frame: Receive Frame Structure --*/ | |
e573aaa4 | 521 | typedef struct hfa384x_rx_frame { |
00b3ed16 | 522 | /*-- MAC rx descriptor (hfa384x byte order) --*/ |
e573aaa4 MM |
523 | u16 status; |
524 | u32 time; | |
525 | u8 silence; | |
526 | u8 signal; | |
527 | u8 rate; | |
528 | u8 rx_flow; | |
529 | u16 reserved1; | |
530 | u16 reserved2; | |
00b3ed16 GKH |
531 | |
532 | /*-- 802.11 Header Information (802.11 byte order) --*/ | |
e573aaa4 MM |
533 | u16 frame_control; |
534 | u16 duration_id; | |
535 | u8 address1[6]; | |
536 | u8 address2[6]; | |
537 | u8 address3[6]; | |
538 | u16 sequence_control; | |
539 | u8 address4[6]; | |
540 | u16 data_len; /* hfa384x (little endian) format */ | |
00b3ed16 GKH |
541 | |
542 | /*-- 802.3 Header Information --*/ | |
e573aaa4 MM |
543 | u8 dest_addr[6]; |
544 | u8 src_addr[6]; | |
545 | u16 data_length; /* IEEE? (big endian) format */ | |
546 | } __attribute__ ((packed)) hfa384x_rx_frame_t; | |
00b3ed16 GKH |
547 | /*-------------------------------------------------------------------- |
548 | Communication Frames: Field Masks for Receive Frames | |
549 | --------------------------------------------------------------------*/ | |
00b3ed16 GKH |
550 | |
551 | /*-- Status Fields --*/ | |
71508ee4 AG |
552 | #define HFA384x_RXSTATUS_MACPORT ((u16)(BIT(10) | \ |
553 | BIT(9) | \ | |
554 | BIT(8))) | |
7f6e0e44 | 555 | #define HFA384x_RXSTATUS_FCSERR ((u16)BIT(0)) |
00b3ed16 GKH |
556 | /*-------------------------------------------------------------------- |
557 | Communication Frames: Test/Get/Set Field Values for Receive Frames | |
558 | --------------------------------------------------------------------*/ | |
71508ee4 AG |
559 | #define HFA384x_RXSTATUS_MACPORT_GET(value) ((u16)((((u16)(value)) \ |
560 | & HFA384x_RXSTATUS_MACPORT) >> 8)) | |
561 | #define HFA384x_RXSTATUS_ISFCSERR(value) ((u16)(((u16)(value)) \ | |
562 | & HFA384x_RXSTATUS_FCSERR)) | |
00b3ed16 GKH |
563 | /*-------------------------------------------------------------------- |
564 | FRAME STRUCTURES: Information Types and Information Frame Structures | |
565 | ---------------------------------------------------------------------- | |
566 | Information Types | |
567 | --------------------------------------------------------------------*/ | |
aaad4303 | 568 | #define HFA384x_IT_HANDOVERADDR ((u16)0xF000UL) |
aaad4303 SP |
569 | #define HFA384x_IT_COMMTALLIES ((u16)0xF100UL) |
570 | #define HFA384x_IT_SCANRESULTS ((u16)0xF101UL) | |
571 | #define HFA384x_IT_CHINFORESULTS ((u16)0xF102UL) | |
572 | #define HFA384x_IT_HOSTSCANRESULTS ((u16)0xF103UL) | |
573 | #define HFA384x_IT_LINKSTATUS ((u16)0xF200UL) | |
574 | #define HFA384x_IT_ASSOCSTATUS ((u16)0xF201UL) | |
575 | #define HFA384x_IT_AUTHREQ ((u16)0xF202UL) | |
576 | #define HFA384x_IT_PSUSERCNT ((u16)0xF203UL) | |
577 | #define HFA384x_IT_KEYIDCHANGED ((u16)0xF204UL) | |
578 | #define HFA384x_IT_ASSOCREQ ((u16)0xF205UL) | |
579 | #define HFA384x_IT_MICFAILURE ((u16)0xF206UL) | |
00b3ed16 GKH |
580 | |
581 | /*-------------------------------------------------------------------- | |
582 | Information Frames Structures | |
583 | ---------------------------------------------------------------------- | |
584 | Information Frames: Notification Frame Structures | |
585 | --------------------------------------------------------------------*/ | |
00b3ed16 GKH |
586 | |
587 | /*-- Inquiry Frame, Diagnose: Communication Tallies --*/ | |
e573aaa4 MM |
588 | typedef struct hfa384x_CommTallies16 { |
589 | u16 txunicastframes; | |
590 | u16 txmulticastframes; | |
591 | u16 txfragments; | |
592 | u16 txunicastoctets; | |
593 | u16 txmulticastoctets; | |
594 | u16 txdeferredtrans; | |
595 | u16 txsingleretryframes; | |
596 | u16 txmultipleretryframes; | |
597 | u16 txretrylimitexceeded; | |
598 | u16 txdiscards; | |
599 | u16 rxunicastframes; | |
600 | u16 rxmulticastframes; | |
601 | u16 rxfragments; | |
602 | u16 rxunicastoctets; | |
603 | u16 rxmulticastoctets; | |
604 | u16 rxfcserrors; | |
605 | u16 rxdiscardsnobuffer; | |
606 | u16 txdiscardswrongsa; | |
607 | u16 rxdiscardswepundecr; | |
608 | u16 rxmsginmsgfrag; | |
609 | u16 rxmsginbadmsgfrag; | |
610 | } __attribute__ ((packed)) hfa384x_CommTallies16_t; | |
611 | ||
612 | typedef struct hfa384x_CommTallies32 { | |
613 | u32 txunicastframes; | |
614 | u32 txmulticastframes; | |
615 | u32 txfragments; | |
616 | u32 txunicastoctets; | |
617 | u32 txmulticastoctets; | |
618 | u32 txdeferredtrans; | |
619 | u32 txsingleretryframes; | |
620 | u32 txmultipleretryframes; | |
621 | u32 txretrylimitexceeded; | |
622 | u32 txdiscards; | |
623 | u32 rxunicastframes; | |
624 | u32 rxmulticastframes; | |
625 | u32 rxfragments; | |
626 | u32 rxunicastoctets; | |
627 | u32 rxmulticastoctets; | |
628 | u32 rxfcserrors; | |
629 | u32 rxdiscardsnobuffer; | |
630 | u32 txdiscardswrongsa; | |
631 | u32 rxdiscardswepundecr; | |
632 | u32 rxmsginmsgfrag; | |
633 | u32 rxmsginbadmsgfrag; | |
634 | } __attribute__ ((packed)) hfa384x_CommTallies32_t; | |
00b3ed16 GKH |
635 | |
636 | /*-- Inquiry Frame, Diagnose: Scan Results & Subfields--*/ | |
e573aaa4 MM |
637 | typedef struct hfa384x_ScanResultSub { |
638 | u16 chid; | |
639 | u16 anl; | |
640 | u16 sl; | |
641 | u8 bssid[WLAN_BSSID_LEN]; | |
642 | u16 bcnint; | |
643 | u16 capinfo; | |
644 | hfa384x_bytestr32_t ssid; | |
645 | u8 supprates[10]; /* 802.11 info element */ | |
646 | u16 proberesp_rate; | |
647 | } __attribute__ ((packed)) hfa384x_ScanResultSub_t; | |
648 | ||
649 | typedef struct hfa384x_ScanResult { | |
650 | u16 rsvd; | |
651 | u16 scanreason; | |
75f49e07 | 652 | hfa384x_ScanResultSub_t result[HFA384x_SCANRESULT_MAX]; |
e573aaa4 | 653 | } __attribute__ ((packed)) hfa384x_ScanResult_t; |
00b3ed16 GKH |
654 | |
655 | /*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/ | |
e573aaa4 MM |
656 | typedef struct hfa384x_ChInfoResultSub { |
657 | u16 chid; | |
658 | u16 anl; | |
659 | u16 pnl; | |
660 | u16 active; | |
661 | } __attribute__ ((packed)) hfa384x_ChInfoResultSub_t; | |
00b3ed16 | 662 | |
7f6e0e44 MM |
663 | #define HFA384x_CHINFORESULT_BSSACTIVE BIT(0) |
664 | #define HFA384x_CHINFORESULT_PCFACTIVE BIT(1) | |
00b3ed16 | 665 | |
e573aaa4 MM |
666 | typedef struct hfa384x_ChInfoResult { |
667 | u16 scanchannels; | |
75f49e07 | 668 | hfa384x_ChInfoResultSub_t result[HFA384x_CHINFORESULT_MAX]; |
e573aaa4 | 669 | } __attribute__ ((packed)) hfa384x_ChInfoResult_t; |
00b3ed16 GKH |
670 | |
671 | /*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/ | |
e573aaa4 MM |
672 | typedef struct hfa384x_HScanResultSub { |
673 | u16 chid; | |
674 | u16 anl; | |
675 | u16 sl; | |
676 | u8 bssid[WLAN_BSSID_LEN]; | |
677 | u16 bcnint; | |
678 | u16 capinfo; | |
679 | hfa384x_bytestr32_t ssid; | |
680 | u8 supprates[10]; /* 802.11 info element */ | |
681 | u16 proberesp_rate; | |
682 | u16 atim; | |
683 | } __attribute__ ((packed)) hfa384x_HScanResultSub_t; | |
684 | ||
685 | typedef struct hfa384x_HScanResult { | |
686 | u16 nresult; | |
687 | u16 rsvd; | |
75f49e07 | 688 | hfa384x_HScanResultSub_t result[HFA384x_HSCANRESULT_MAX]; |
e573aaa4 | 689 | } __attribute__ ((packed)) hfa384x_HScanResult_t; |
00b3ed16 GKH |
690 | |
691 | /*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/ | |
692 | ||
aaad4303 SP |
693 | #define HFA384x_LINK_NOTCONNECTED ((u16)0) |
694 | #define HFA384x_LINK_CONNECTED ((u16)1) | |
695 | #define HFA384x_LINK_DISCONNECTED ((u16)2) | |
696 | #define HFA384x_LINK_AP_CHANGE ((u16)3) | |
697 | #define HFA384x_LINK_AP_OUTOFRANGE ((u16)4) | |
698 | #define HFA384x_LINK_AP_INRANGE ((u16)5) | |
699 | #define HFA384x_LINK_ASSOCFAIL ((u16)6) | |
00b3ed16 | 700 | |
e573aaa4 MM |
701 | typedef struct hfa384x_LinkStatus { |
702 | u16 linkstatus; | |
703 | } __attribute__ ((packed)) hfa384x_LinkStatus_t; | |
00b3ed16 GKH |
704 | |
705 | /*-- Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/ | |
706 | ||
aaad4303 SP |
707 | #define HFA384x_ASSOCSTATUS_STAASSOC ((u16)1) |
708 | #define HFA384x_ASSOCSTATUS_REASSOC ((u16)2) | |
aaad4303 | 709 | #define HFA384x_ASSOCSTATUS_AUTHFAIL ((u16)5) |
00b3ed16 | 710 | |
e573aaa4 MM |
711 | typedef struct hfa384x_AssocStatus { |
712 | u16 assocstatus; | |
713 | u8 sta_addr[ETH_ALEN]; | |
00b3ed16 | 714 | /* old_ap_addr is only valid if assocstatus == 2 */ |
e573aaa4 MM |
715 | u8 old_ap_addr[ETH_ALEN]; |
716 | u16 reason; | |
717 | u16 reserved; | |
718 | } __attribute__ ((packed)) hfa384x_AssocStatus_t; | |
00b3ed16 GKH |
719 | |
720 | /*-- Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/ | |
721 | ||
e573aaa4 MM |
722 | typedef struct hfa384x_AuthRequest { |
723 | u8 sta_addr[ETH_ALEN]; | |
724 | u16 algorithm; | |
725 | } __attribute__ ((packed)) hfa384x_AuthReq_t; | |
00b3ed16 | 726 | |
00b3ed16 GKH |
727 | /*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/ |
728 | ||
e573aaa4 MM |
729 | typedef struct hfa384x_PSUserCount { |
730 | u16 usercnt; | |
731 | } __attribute__ ((packed)) hfa384x_PSUserCount_t; | |
00b3ed16 | 732 | |
e573aaa4 MM |
733 | typedef struct hfa384x_KeyIDChanged { |
734 | u8 sta_addr[ETH_ALEN]; | |
735 | u16 keyid; | |
736 | } __attribute__ ((packed)) hfa384x_KeyIDChanged_t; | |
00b3ed16 GKH |
737 | |
738 | /*-- Collection of all Inf frames ---------------*/ | |
739 | typedef union hfa384x_infodata { | |
e573aaa4 MM |
740 | hfa384x_CommTallies16_t commtallies16; |
741 | hfa384x_CommTallies32_t commtallies32; | |
742 | hfa384x_ScanResult_t scanresult; | |
743 | hfa384x_ChInfoResult_t chinforesult; | |
744 | hfa384x_HScanResult_t hscanresult; | |
745 | hfa384x_LinkStatus_t linkstatus; | |
746 | hfa384x_AssocStatus_t assocstatus; | |
747 | hfa384x_AuthReq_t authreq; | |
748 | hfa384x_PSUserCount_t psusercnt; | |
749 | hfa384x_KeyIDChanged_t keyidchanged; | |
750 | } __attribute__ ((packed)) hfa384x_infodata_t; | |
751 | ||
752 | typedef struct hfa384x_InfFrame { | |
753 | u16 framelen; | |
754 | u16 infotype; | |
755 | hfa384x_infodata_t info; | |
756 | } __attribute__ ((packed)) hfa384x_InfFrame_t; | |
00b3ed16 | 757 | |
00b3ed16 GKH |
758 | /*-------------------------------------------------------------------- |
759 | USB Packet structures and constants. | |
760 | --------------------------------------------------------------------*/ | |
761 | ||
00b3ed16 GKH |
762 | /* Should be sent to the bulkout endpoint */ |
763 | #define HFA384x_USB_TXFRM 0 | |
764 | #define HFA384x_USB_CMDREQ 1 | |
765 | #define HFA384x_USB_WRIDREQ 2 | |
766 | #define HFA384x_USB_RRIDREQ 3 | |
767 | #define HFA384x_USB_WMEMREQ 4 | |
768 | #define HFA384x_USB_RMEMREQ 5 | |
769 | ||
770 | /* Received from the bulkin endpoint */ | |
00b3ed16 GKH |
771 | #define HFA384x_USB_ISTXFRM(a) (((a) & 0x9000) == 0x1000) |
772 | #define HFA384x_USB_ISRXFRM(a) (!((a) & 0x9000)) | |
773 | #define HFA384x_USB_INFOFRM 0x8000 | |
774 | #define HFA384x_USB_CMDRESP 0x8001 | |
775 | #define HFA384x_USB_WRIDRESP 0x8002 | |
776 | #define HFA384x_USB_RRIDRESP 0x8003 | |
777 | #define HFA384x_USB_WMEMRESP 0x8004 | |
778 | #define HFA384x_USB_RMEMRESP 0x8005 | |
779 | #define HFA384x_USB_BUFAVAIL 0x8006 | |
780 | #define HFA384x_USB_ERROR 0x8007 | |
781 | ||
782 | /*------------------------------------*/ | |
783 | /* Request (bulk OUT) packet contents */ | |
784 | ||
785 | typedef struct hfa384x_usb_txfrm { | |
e573aaa4 MM |
786 | hfa384x_tx_frame_t desc; |
787 | u8 data[WLAN_DATA_MAXLEN]; | |
788 | } __attribute__ ((packed)) hfa384x_usb_txfrm_t; | |
00b3ed16 GKH |
789 | |
790 | typedef struct hfa384x_usb_cmdreq { | |
e573aaa4 MM |
791 | u16 type; |
792 | u16 cmd; | |
793 | u16 parm0; | |
794 | u16 parm1; | |
795 | u16 parm2; | |
796 | u8 pad[54]; | |
797 | } __attribute__ ((packed)) hfa384x_usb_cmdreq_t; | |
00b3ed16 GKH |
798 | |
799 | typedef struct hfa384x_usb_wridreq { | |
e573aaa4 MM |
800 | u16 type; |
801 | u16 frmlen; | |
802 | u16 rid; | |
803 | u8 data[HFA384x_RIDDATA_MAXLEN]; | |
804 | } __attribute__ ((packed)) hfa384x_usb_wridreq_t; | |
00b3ed16 GKH |
805 | |
806 | typedef struct hfa384x_usb_rridreq { | |
e573aaa4 MM |
807 | u16 type; |
808 | u16 frmlen; | |
809 | u16 rid; | |
810 | u8 pad[58]; | |
811 | } __attribute__ ((packed)) hfa384x_usb_rridreq_t; | |
00b3ed16 GKH |
812 | |
813 | typedef struct hfa384x_usb_wmemreq { | |
e573aaa4 MM |
814 | u16 type; |
815 | u16 frmlen; | |
816 | u16 offset; | |
817 | u16 page; | |
818 | u8 data[HFA384x_USB_RWMEM_MAXLEN]; | |
819 | } __attribute__ ((packed)) hfa384x_usb_wmemreq_t; | |
00b3ed16 GKH |
820 | |
821 | typedef struct hfa384x_usb_rmemreq { | |
e573aaa4 MM |
822 | u16 type; |
823 | u16 frmlen; | |
824 | u16 offset; | |
825 | u16 page; | |
826 | u8 pad[56]; | |
827 | } __attribute__ ((packed)) hfa384x_usb_rmemreq_t; | |
00b3ed16 GKH |
828 | |
829 | /*------------------------------------*/ | |
830 | /* Response (bulk IN) packet contents */ | |
831 | ||
832 | typedef struct hfa384x_usb_rxfrm { | |
e573aaa4 MM |
833 | hfa384x_rx_frame_t desc; |
834 | u8 data[WLAN_DATA_MAXLEN]; | |
835 | } __attribute__ ((packed)) hfa384x_usb_rxfrm_t; | |
00b3ed16 GKH |
836 | |
837 | typedef struct hfa384x_usb_infofrm { | |
e573aaa4 MM |
838 | u16 type; |
839 | hfa384x_InfFrame_t info; | |
840 | } __attribute__ ((packed)) hfa384x_usb_infofrm_t; | |
00b3ed16 GKH |
841 | |
842 | typedef struct hfa384x_usb_statusresp { | |
e573aaa4 MM |
843 | u16 type; |
844 | u16 status; | |
845 | u16 resp0; | |
846 | u16 resp1; | |
847 | u16 resp2; | |
848 | } __attribute__ ((packed)) hfa384x_usb_cmdresp_t; | |
00b3ed16 GKH |
849 | |
850 | typedef hfa384x_usb_cmdresp_t hfa384x_usb_wridresp_t; | |
851 | ||
852 | typedef struct hfa384x_usb_rridresp { | |
e573aaa4 MM |
853 | u16 type; |
854 | u16 frmlen; | |
855 | u16 rid; | |
856 | u8 data[HFA384x_RIDDATA_MAXLEN]; | |
857 | } __attribute__ ((packed)) hfa384x_usb_rridresp_t; | |
00b3ed16 GKH |
858 | |
859 | typedef hfa384x_usb_cmdresp_t hfa384x_usb_wmemresp_t; | |
860 | ||
861 | typedef struct hfa384x_usb_rmemresp { | |
e573aaa4 MM |
862 | u16 type; |
863 | u16 frmlen; | |
864 | u8 data[HFA384x_USB_RWMEM_MAXLEN]; | |
865 | } __attribute__ ((packed)) hfa384x_usb_rmemresp_t; | |
00b3ed16 GKH |
866 | |
867 | typedef struct hfa384x_usb_bufavail { | |
e573aaa4 MM |
868 | u16 type; |
869 | u16 frmlen; | |
870 | } __attribute__ ((packed)) hfa384x_usb_bufavail_t; | |
00b3ed16 GKH |
871 | |
872 | typedef struct hfa384x_usb_error { | |
e573aaa4 MM |
873 | u16 type; |
874 | u16 errortype; | |
875 | } __attribute__ ((packed)) hfa384x_usb_error_t; | |
00b3ed16 GKH |
876 | |
877 | /*----------------------------------------------------------*/ | |
878 | /* Unions for packaging all the known packet types together */ | |
879 | ||
880 | typedef union hfa384x_usbout { | |
e573aaa4 MM |
881 | u16 type; |
882 | hfa384x_usb_txfrm_t txfrm; | |
883 | hfa384x_usb_cmdreq_t cmdreq; | |
884 | hfa384x_usb_wridreq_t wridreq; | |
885 | hfa384x_usb_rridreq_t rridreq; | |
886 | hfa384x_usb_wmemreq_t wmemreq; | |
887 | hfa384x_usb_rmemreq_t rmemreq; | |
888 | } __attribute__ ((packed)) hfa384x_usbout_t; | |
00b3ed16 GKH |
889 | |
890 | typedef union hfa384x_usbin { | |
e573aaa4 MM |
891 | u16 type; |
892 | hfa384x_usb_rxfrm_t rxfrm; | |
893 | hfa384x_usb_txfrm_t txfrm; | |
894 | hfa384x_usb_infofrm_t infofrm; | |
895 | hfa384x_usb_cmdresp_t cmdresp; | |
896 | hfa384x_usb_wridresp_t wridresp; | |
897 | hfa384x_usb_rridresp_t rridresp; | |
898 | hfa384x_usb_wmemresp_t wmemresp; | |
899 | hfa384x_usb_rmemresp_t rmemresp; | |
900 | hfa384x_usb_bufavail_t bufavail; | |
901 | hfa384x_usb_error_t usberror; | |
902 | u8 boguspad[3000]; | |
903 | } __attribute__ ((packed)) hfa384x_usbin_t; | |
00b3ed16 | 904 | |
76e3e7c4 KR |
905 | /*-------------------------------------------------------------------- |
906 | PD record structures. | |
907 | --------------------------------------------------------------------*/ | |
908 | ||
75f49e07 MT |
909 | typedef struct hfa384x_pdr_pcb_partnum { |
910 | u8 num[8]; | |
76e3e7c4 KR |
911 | } __attribute__ ((packed)) hfa384x_pdr_pcb_partnum_t; |
912 | ||
75f49e07 MT |
913 | typedef struct hfa384x_pdr_pcb_tracenum { |
914 | u8 num[8]; | |
76e3e7c4 KR |
915 | } __attribute__ ((packed)) hfa384x_pdr_pcb_tracenum_t; |
916 | ||
75f49e07 MT |
917 | typedef struct hfa384x_pdr_nic_serial { |
918 | u8 num[12]; | |
76e3e7c4 KR |
919 | } __attribute__ ((packed)) hfa384x_pdr_nic_serial_t; |
920 | ||
75f49e07 MT |
921 | typedef struct hfa384x_pdr_mkk_measurements { |
922 | double carrier_freq; | |
923 | double occupied_band; | |
924 | double power_density; | |
925 | double tx_spur_f1; | |
926 | double tx_spur_f2; | |
927 | double tx_spur_f3; | |
928 | double tx_spur_f4; | |
929 | double tx_spur_l1; | |
930 | double tx_spur_l2; | |
931 | double tx_spur_l3; | |
932 | double tx_spur_l4; | |
933 | double rx_spur_f1; | |
934 | double rx_spur_f2; | |
935 | double rx_spur_l1; | |
936 | double rx_spur_l2; | |
76e3e7c4 KR |
937 | } __attribute__ ((packed)) hfa384x_pdr_mkk_measurements_t; |
938 | ||
75f49e07 MT |
939 | typedef struct hfa384x_pdr_nic_ramsize { |
940 | u8 size[12]; /* units of KB */ | |
76e3e7c4 KR |
941 | } __attribute__ ((packed)) hfa384x_pdr_nic_ramsize_t; |
942 | ||
75f49e07 MT |
943 | typedef struct hfa384x_pdr_mfisuprange { |
944 | u16 id; | |
945 | u16 variant; | |
946 | u16 bottom; | |
947 | u16 top; | |
76e3e7c4 KR |
948 | } __attribute__ ((packed)) hfa384x_pdr_mfisuprange_t; |
949 | ||
75f49e07 MT |
950 | typedef struct hfa384x_pdr_cfisuprange { |
951 | u16 id; | |
952 | u16 variant; | |
953 | u16 bottom; | |
954 | u16 top; | |
76e3e7c4 KR |
955 | } __attribute__ ((packed)) hfa384x_pdr_cfisuprange_t; |
956 | ||
75f49e07 MT |
957 | typedef struct hfa384x_pdr_nicid { |
958 | u16 id; | |
959 | u16 variant; | |
960 | u16 major; | |
961 | u16 minor; | |
76e3e7c4 KR |
962 | } __attribute__ ((packed)) hfa384x_pdr_nicid_t; |
963 | ||
75f49e07 MT |
964 | typedef struct hfa384x_pdr_refdac_measurements { |
965 | u16 value[0]; | |
76e3e7c4 KR |
966 | } __attribute__ ((packed)) hfa384x_pdr_refdac_measurements_t; |
967 | ||
75f49e07 MT |
968 | typedef struct hfa384x_pdr_vgdac_measurements { |
969 | u16 value[0]; | |
76e3e7c4 KR |
970 | } __attribute__ ((packed)) hfa384x_pdr_vgdac_measurements_t; |
971 | ||
75f49e07 MT |
972 | typedef struct hfa384x_pdr_level_comp_measurements { |
973 | u16 value[0]; | |
76e3e7c4 KR |
974 | } __attribute__ ((packed)) hfa384x_pdr_level_compc_measurements_t; |
975 | ||
75f49e07 MT |
976 | typedef struct hfa384x_pdr_mac_address { |
977 | u8 addr[6]; | |
76e3e7c4 KR |
978 | } __attribute__ ((packed)) hfa384x_pdr_mac_address_t; |
979 | ||
75f49e07 MT |
980 | typedef struct hfa384x_pdr_mkk_callname { |
981 | u8 callname[8]; | |
76e3e7c4 KR |
982 | } __attribute__ ((packed)) hfa384x_pdr_mkk_callname_t; |
983 | ||
75f49e07 MT |
984 | typedef struct hfa384x_pdr_regdomain { |
985 | u16 numdomains; | |
986 | u16 domain[5]; | |
76e3e7c4 KR |
987 | } __attribute__ ((packed)) hfa384x_pdr_regdomain_t; |
988 | ||
75f49e07 MT |
989 | typedef struct hfa384x_pdr_allowed_channel { |
990 | u16 ch_bitmap; | |
76e3e7c4 KR |
991 | } __attribute__ ((packed)) hfa384x_pdr_allowed_channel_t; |
992 | ||
75f49e07 MT |
993 | typedef struct hfa384x_pdr_default_channel { |
994 | u16 channel; | |
76e3e7c4 KR |
995 | } __attribute__ ((packed)) hfa384x_pdr_default_channel_t; |
996 | ||
75f49e07 MT |
997 | typedef struct hfa384x_pdr_privacy_option { |
998 | u16 available; | |
76e3e7c4 KR |
999 | } __attribute__ ((packed)) hfa384x_pdr_privacy_option_t; |
1000 | ||
75f49e07 MT |
1001 | typedef struct hfa384x_pdr_temptype { |
1002 | u16 type; | |
76e3e7c4 KR |
1003 | } __attribute__ ((packed)) hfa384x_pdr_temptype_t; |
1004 | ||
75f49e07 MT |
1005 | typedef struct hfa384x_pdr_refdac_setup { |
1006 | u16 ch_value[14]; | |
76e3e7c4 KR |
1007 | } __attribute__ ((packed)) hfa384x_pdr_refdac_setup_t; |
1008 | ||
75f49e07 MT |
1009 | typedef struct hfa384x_pdr_vgdac_setup { |
1010 | u16 ch_value[14]; | |
76e3e7c4 KR |
1011 | } __attribute__ ((packed)) hfa384x_pdr_vgdac_setup_t; |
1012 | ||
75f49e07 MT |
1013 | typedef struct hfa384x_pdr_level_comp_setup { |
1014 | u16 ch_value[14]; | |
76e3e7c4 KR |
1015 | } __attribute__ ((packed)) hfa384x_pdr_level_comp_setup_t; |
1016 | ||
75f49e07 MT |
1017 | typedef struct hfa384x_pdr_trimdac_setup { |
1018 | u16 trimidac; | |
1019 | u16 trimqdac; | |
76e3e7c4 KR |
1020 | } __attribute__ ((packed)) hfa384x_pdr_trimdac_setup_t; |
1021 | ||
75f49e07 MT |
1022 | typedef struct hfa384x_pdr_ifr_setting { |
1023 | u16 value[3]; | |
76e3e7c4 KR |
1024 | } __attribute__ ((packed)) hfa384x_pdr_ifr_setting_t; |
1025 | ||
75f49e07 MT |
1026 | typedef struct hfa384x_pdr_rfr_setting { |
1027 | u16 value[3]; | |
76e3e7c4 KR |
1028 | } __attribute__ ((packed)) hfa384x_pdr_rfr_setting_t; |
1029 | ||
75f49e07 MT |
1030 | typedef struct hfa384x_pdr_hfa3861_baseline { |
1031 | u16 value[50]; | |
76e3e7c4 KR |
1032 | } __attribute__ ((packed)) hfa384x_pdr_hfa3861_baseline_t; |
1033 | ||
75f49e07 MT |
1034 | typedef struct hfa384x_pdr_hfa3861_shadow { |
1035 | u32 value[32]; | |
76e3e7c4 KR |
1036 | } __attribute__ ((packed)) hfa384x_pdr_hfa3861_shadow_t; |
1037 | ||
75f49e07 MT |
1038 | typedef struct hfa384x_pdr_hfa3861_ifrf { |
1039 | u32 value[20]; | |
76e3e7c4 KR |
1040 | } __attribute__ ((packed)) hfa384x_pdr_hfa3861_ifrf_t; |
1041 | ||
75f49e07 MT |
1042 | typedef struct hfa384x_pdr_hfa3861_chcalsp { |
1043 | u16 value[14]; | |
76e3e7c4 KR |
1044 | } __attribute__ ((packed)) hfa384x_pdr_hfa3861_chcalsp_t; |
1045 | ||
75f49e07 MT |
1046 | typedef struct hfa384x_pdr_hfa3861_chcali { |
1047 | u16 value[17]; | |
76e3e7c4 KR |
1048 | } __attribute__ ((packed)) hfa384x_pdr_hfa3861_chcali_t; |
1049 | ||
75f49e07 MT |
1050 | typedef struct hfa384x_pdr_hfa3861_nic_config { |
1051 | u16 config_bitmap; | |
76e3e7c4 KR |
1052 | } __attribute__ ((packed)) hfa384x_pdr_nic_config_t; |
1053 | ||
75f49e07 MT |
1054 | typedef struct hfa384x_pdr_hfo_delay { |
1055 | u8 hfo_delay; | |
76e3e7c4 KR |
1056 | } __attribute__ ((packed)) hfa384x_hfo_delay_t; |
1057 | ||
75f49e07 MT |
1058 | typedef struct hfa384x_pdr_hfa3861_manf_testsp { |
1059 | u16 value[30]; | |
76e3e7c4 KR |
1060 | } __attribute__ ((packed)) hfa384x_pdr_hfa3861_manf_testsp_t; |
1061 | ||
75f49e07 MT |
1062 | typedef struct hfa384x_pdr_hfa3861_manf_testi { |
1063 | u16 value[30]; | |
76e3e7c4 KR |
1064 | } __attribute__ ((packed)) hfa384x_pdr_hfa3861_manf_testi_t; |
1065 | ||
75f49e07 MT |
1066 | typedef struct hfa384x_end_of_pda { |
1067 | u16 crc; | |
76e3e7c4 KR |
1068 | } __attribute__ ((packed)) hfa384x_pdr_end_of_pda_t; |
1069 | ||
75f49e07 MT |
1070 | typedef struct hfa384x_pdrec { |
1071 | u16 len; /* in words */ | |
1072 | u16 code; | |
76e3e7c4 | 1073 | union pdr { |
75f49e07 MT |
1074 | hfa384x_pdr_pcb_partnum_t pcb_partnum; |
1075 | hfa384x_pdr_pcb_tracenum_t pcb_tracenum; | |
1076 | hfa384x_pdr_nic_serial_t nic_serial; | |
1077 | hfa384x_pdr_mkk_measurements_t mkk_measurements; | |
1078 | hfa384x_pdr_nic_ramsize_t nic_ramsize; | |
1079 | hfa384x_pdr_mfisuprange_t mfisuprange; | |
1080 | hfa384x_pdr_cfisuprange_t cfisuprange; | |
1081 | hfa384x_pdr_nicid_t nicid; | |
1082 | hfa384x_pdr_refdac_measurements_t refdac_measurements; | |
1083 | hfa384x_pdr_vgdac_measurements_t vgdac_measurements; | |
1084 | hfa384x_pdr_level_compc_measurements_t level_compc_measurements; | |
1085 | hfa384x_pdr_mac_address_t mac_address; | |
1086 | hfa384x_pdr_mkk_callname_t mkk_callname; | |
1087 | hfa384x_pdr_regdomain_t regdomain; | |
1088 | hfa384x_pdr_allowed_channel_t allowed_channel; | |
1089 | hfa384x_pdr_default_channel_t default_channel; | |
1090 | hfa384x_pdr_privacy_option_t privacy_option; | |
1091 | hfa384x_pdr_temptype_t temptype; | |
1092 | hfa384x_pdr_refdac_setup_t refdac_setup; | |
1093 | hfa384x_pdr_vgdac_setup_t vgdac_setup; | |
1094 | hfa384x_pdr_level_comp_setup_t level_comp_setup; | |
1095 | hfa384x_pdr_trimdac_setup_t trimdac_setup; | |
1096 | hfa384x_pdr_ifr_setting_t ifr_setting; | |
1097 | hfa384x_pdr_rfr_setting_t rfr_setting; | |
1098 | hfa384x_pdr_hfa3861_baseline_t hfa3861_baseline; | |
1099 | hfa384x_pdr_hfa3861_shadow_t hfa3861_shadow; | |
1100 | hfa384x_pdr_hfa3861_ifrf_t hfa3861_ifrf; | |
1101 | hfa384x_pdr_hfa3861_chcalsp_t hfa3861_chcalsp; | |
1102 | hfa384x_pdr_hfa3861_chcali_t hfa3861_chcali; | |
1103 | hfa384x_pdr_nic_config_t nic_config; | |
1104 | hfa384x_hfo_delay_t hfo_delay; | |
1105 | hfa384x_pdr_hfa3861_manf_testsp_t hfa3861_manf_testsp; | |
1106 | hfa384x_pdr_hfa3861_manf_testi_t hfa3861_manf_testi; | |
1107 | hfa384x_pdr_end_of_pda_t end_of_pda; | |
76e3e7c4 KR |
1108 | |
1109 | } data; | |
1110 | } __attribute__ ((packed)) hfa384x_pdrec_t; | |
1111 | ||
00b3ed16 GKH |
1112 | #ifdef __KERNEL__ |
1113 | /*-------------------------------------------------------------------- | |
1114 | --- MAC state structure, argument to all functions -- | |
1115 | --- Also, a collection of support types -- | |
1116 | --------------------------------------------------------------------*/ | |
e573aaa4 MM |
1117 | typedef struct hfa384x_statusresult { |
1118 | u16 status; | |
1119 | u16 resp0; | |
1120 | u16 resp1; | |
1121 | u16 resp2; | |
00b3ed16 GKH |
1122 | } hfa384x_cmdresult_t; |
1123 | ||
00b3ed16 GKH |
1124 | /* USB Control Exchange (CTLX): |
1125 | * A queue of the structure below is maintained for all of the | |
1126 | * Request/Response type USB packets supported by Prism2. | |
1127 | */ | |
1128 | /* The following hfa384x_* structures are arguments to | |
1129 | * the usercb() for the different CTLX types. | |
1130 | */ | |
e573aaa4 MM |
1131 | typedef struct hfa384x_rridresult { |
1132 | u16 rid; | |
1133 | const void *riddata; | |
1134 | unsigned int riddata_len; | |
00b3ed16 GKH |
1135 | } hfa384x_rridresult_t; |
1136 | ||
1137 | enum ctlx_state { | |
e573aaa4 | 1138 | CTLX_START = 0, /* Start state, not queued */ |
00b3ed16 | 1139 | |
e573aaa4 | 1140 | CTLX_COMPLETE, /* CTLX successfully completed */ |
00b3ed16 GKH |
1141 | CTLX_REQ_FAILED, /* OUT URB completed w/ error */ |
1142 | ||
1143 | CTLX_PENDING, /* Queued, data valid */ | |
1144 | CTLX_REQ_SUBMITTED, /* OUT URB submitted */ | |
1145 | CTLX_REQ_COMPLETE, /* OUT URB complete */ | |
1146 | CTLX_RESP_COMPLETE /* IN URB received */ | |
1147 | }; | |
e573aaa4 | 1148 | typedef enum ctlx_state CTLX_STATE; |
00b3ed16 GKH |
1149 | |
1150 | struct hfa384x_usbctlx; | |
1151 | struct hfa384x; | |
1152 | ||
e573aaa4 | 1153 | typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *); |
00b3ed16 | 1154 | |
5dd8acc8 | 1155 | typedef void (*ctlx_usercb_t) (struct hfa384x *hw, |
e573aaa4 | 1156 | void *ctlxresult, void *usercb_data); |
00b3ed16 | 1157 | |
e573aaa4 MM |
1158 | typedef struct hfa384x_usbctlx { |
1159 | struct list_head list; | |
00b3ed16 | 1160 | |
e573aaa4 MM |
1161 | size_t outbufsize; |
1162 | hfa384x_usbout_t outbuf; /* pkt buf for OUT */ | |
1163 | hfa384x_usbin_t inbuf; /* pkt buf for IN(a copy) */ | |
00b3ed16 | 1164 | |
e573aaa4 | 1165 | CTLX_STATE state; /* Tracks running state */ |
00b3ed16 | 1166 | |
e573aaa4 MM |
1167 | struct completion done; |
1168 | volatile int reapable; /* Food for the reaper task */ | |
00b3ed16 | 1169 | |
e573aaa4 MM |
1170 | ctlx_cmdcb_t cmdcb; /* Async command callback */ |
1171 | ctlx_usercb_t usercb; /* Async user callback, */ | |
1172 | void *usercb_data; /* at CTLX completion */ | |
00b3ed16 | 1173 | |
e573aaa4 | 1174 | int variant; /* Identifies cmd variant */ |
00b3ed16 GKH |
1175 | } hfa384x_usbctlx_t; |
1176 | ||
e573aaa4 MM |
1177 | typedef struct hfa384x_usbctlxq { |
1178 | spinlock_t lock; | |
1179 | struct list_head pending; | |
1180 | struct list_head active; | |
1181 | struct list_head completing; | |
1182 | struct list_head reapable; | |
00b3ed16 | 1183 | } hfa384x_usbctlxq_t; |
00b3ed16 | 1184 | |
e573aaa4 MM |
1185 | typedef struct hfa484x_metacmd { |
1186 | u16 cmd; | |
00b3ed16 | 1187 | |
e573aaa4 MM |
1188 | u16 parm0; |
1189 | u16 parm1; | |
1190 | u16 parm2; | |
00b3ed16 | 1191 | |
00b3ed16 GKH |
1192 | hfa384x_cmdresult_t result; |
1193 | } hfa384x_metacmd_t; | |
1194 | ||
00b3ed16 | 1195 | #define MAX_GRP_ADDR 32 |
71508ee4 | 1196 | #define WLAN_COMMENT_MAX 80 /* Max. length of user comment string. */ |
00b3ed16 | 1197 | |
71508ee4 AG |
1198 | #define WLAN_AUTH_MAX 60 /* Max. # of authenticated stations. */ |
1199 | #define WLAN_ACCESS_MAX 60 /* Max. # of stations in an access list. */ | |
1200 | #define WLAN_ACCESS_NONE 0 /* No stations may be authenticated. */ | |
1201 | #define WLAN_ACCESS_ALL 1 /* All stations may be authenticated. */ | |
1202 | #define WLAN_ACCESS_ALLOW 2 /* Authenticate only "allowed" stations. */ | |
1203 | #define WLAN_ACCESS_DENY 3 /* Do not authenticate "denied" stations. */ | |
00b3ed16 GKH |
1204 | |
1205 | /* XXX These are going away ASAP */ | |
e573aaa4 MM |
1206 | typedef struct prism2sta_authlist { |
1207 | unsigned int cnt; | |
1208 | u8 addr[WLAN_AUTH_MAX][ETH_ALEN]; | |
1209 | u8 assoc[WLAN_AUTH_MAX]; | |
00b3ed16 GKH |
1210 | } prism2sta_authlist_t; |
1211 | ||
e573aaa4 MM |
1212 | typedef struct prism2sta_accesslist { |
1213 | unsigned int modify; | |
1214 | unsigned int cnt; | |
1215 | u8 addr[WLAN_ACCESS_MAX][ETH_ALEN]; | |
1216 | unsigned int cnt1; | |
1217 | u8 addr1[WLAN_ACCESS_MAX][ETH_ALEN]; | |
00b3ed16 GKH |
1218 | } prism2sta_accesslist_t; |
1219 | ||
e573aaa4 | 1220 | typedef struct hfa384x { |
00b3ed16 | 1221 | /* USB support data */ |
e573aaa4 MM |
1222 | struct usb_device *usb; |
1223 | struct urb rx_urb; | |
1224 | struct sk_buff *rx_urb_skb; | |
1225 | struct urb tx_urb; | |
1226 | struct urb ctlx_urb; | |
1227 | hfa384x_usbout_t txbuff; | |
1228 | hfa384x_usbctlxq_t ctlxq; | |
1229 | struct timer_list reqtimer; | |
1230 | struct timer_list resptimer; | |
00b3ed16 | 1231 | |
e573aaa4 | 1232 | struct timer_list throttle; |
00b3ed16 | 1233 | |
e573aaa4 MM |
1234 | struct tasklet_struct reaper_bh; |
1235 | struct tasklet_struct completion_bh; | |
00b3ed16 | 1236 | |
e573aaa4 | 1237 | struct work_struct usb_work; |
00b3ed16 | 1238 | |
e573aaa4 | 1239 | unsigned long usb_flags; |
00b3ed16 GKH |
1240 | #define THROTTLE_RX 0 |
1241 | #define THROTTLE_TX 1 | |
1242 | #define WORK_RX_HALT 2 | |
1243 | #define WORK_TX_HALT 3 | |
1244 | #define WORK_RX_RESUME 4 | |
1245 | #define WORK_TX_RESUME 5 | |
1246 | ||
e573aaa4 MM |
1247 | unsigned short req_timer_done:1; |
1248 | unsigned short resp_timer_done:1; | |
00b3ed16 | 1249 | |
e573aaa4 MM |
1250 | int endp_in; |
1251 | int endp_out; | |
00b3ed16 | 1252 | |
e573aaa4 MM |
1253 | int sniff_fcs; |
1254 | int sniff_channel; | |
1255 | int sniff_truncate; | |
1256 | int sniffhdr; | |
00b3ed16 | 1257 | |
e573aaa4 | 1258 | wait_queue_head_t cmdq; /* wait queue itself */ |
00b3ed16 GKH |
1259 | |
1260 | /* Controller state */ | |
e573aaa4 MM |
1261 | u32 state; |
1262 | u32 isap; | |
1263 | u8 port_enabled[HFA384x_NUMPORTS_MAX]; | |
00b3ed16 GKH |
1264 | |
1265 | /* Download support */ | |
e573aaa4 MM |
1266 | unsigned int dlstate; |
1267 | hfa384x_downloadbuffer_t bufinfo; | |
1268 | u16 dltimeout; | |
00b3ed16 | 1269 | |
e573aaa4 MM |
1270 | int scanflag; /* to signal scan comlete */ |
1271 | int join_ap; /* are we joined to a specific ap */ | |
1272 | int join_retries; /* number of join retries till we fail */ | |
1273 | hfa384x_JoinRequest_data_t joinreq; /* join request saved data */ | |
00b3ed16 | 1274 | |
e573aaa4 | 1275 | wlandevice_t *wlandev; |
00b3ed16 | 1276 | /* Timer to allow for the deferred processing of linkstatus messages */ |
e573aaa4 | 1277 | struct work_struct link_bh; |
00b3ed16 | 1278 | |
e573aaa4 MM |
1279 | struct work_struct commsqual_bh; |
1280 | hfa384x_commsquality_t qual; | |
1281 | struct timer_list commsqual_timer; | |
00b3ed16 | 1282 | |
aaad4303 SP |
1283 | u16 link_status; |
1284 | u16 link_status_new; | |
e573aaa4 | 1285 | struct sk_buff_head authq; |
00b3ed16 GKH |
1286 | |
1287 | /* And here we have stuff that used to be in priv */ | |
1288 | ||
1289 | /* State variables */ | |
e573aaa4 MM |
1290 | unsigned int presniff_port_type; |
1291 | u16 presniff_wepflags; | |
1292 | u32 dot11_desired_bss_type; | |
00b3ed16 | 1293 | |
e573aaa4 | 1294 | int dbmadjust; |
00b3ed16 GKH |
1295 | |
1296 | /* Group Addresses - right now, there are up to a total | |
e573aaa4 MM |
1297 | of MAX_GRP_ADDR group addresses */ |
1298 | u8 dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN]; | |
1299 | unsigned int dot11_grpcnt; | |
00b3ed16 GKH |
1300 | |
1301 | /* Component Identities */ | |
e573aaa4 MM |
1302 | hfa384x_compident_t ident_nic; |
1303 | hfa384x_compident_t ident_pri_fw; | |
1304 | hfa384x_compident_t ident_sta_fw; | |
1305 | hfa384x_compident_t ident_ap_fw; | |
1306 | u16 mm_mods; | |
00b3ed16 GKH |
1307 | |
1308 | /* Supplier compatibility ranges */ | |
e573aaa4 MM |
1309 | hfa384x_caplevel_t cap_sup_mfi; |
1310 | hfa384x_caplevel_t cap_sup_cfi; | |
1311 | hfa384x_caplevel_t cap_sup_pri; | |
1312 | hfa384x_caplevel_t cap_sup_sta; | |
1313 | hfa384x_caplevel_t cap_sup_ap; | |
00b3ed16 GKH |
1314 | |
1315 | /* Actor compatibility ranges */ | |
71508ee4 AG |
1316 | hfa384x_caplevel_t cap_act_pri_cfi; /* |
1317 | * pri f/w to controller | |
1318 | * interface | |
1319 | */ | |
1320 | ||
1321 | hfa384x_caplevel_t cap_act_sta_cfi; /* | |
1322 | * sta f/w to controller | |
1323 | * interface | |
1324 | */ | |
1325 | ||
e573aaa4 | 1326 | hfa384x_caplevel_t cap_act_sta_mfi; /* sta f/w to modem interface */ |
71508ee4 AG |
1327 | |
1328 | hfa384x_caplevel_t cap_act_ap_cfi; /* | |
1329 | * ap f/w to controller | |
1330 | * interface | |
1331 | */ | |
1332 | ||
e573aaa4 | 1333 | hfa384x_caplevel_t cap_act_ap_mfi; /* ap f/w to modem interface */ |
00b3ed16 | 1334 | |
e573aaa4 MM |
1335 | u32 psusercount; /* Power save user count. */ |
1336 | hfa384x_CommTallies32_t tallies; /* Communication tallies. */ | |
1337 | u8 comment[WLAN_COMMENT_MAX + 1]; /* User comment */ | |
00b3ed16 GKH |
1338 | |
1339 | /* Channel Info request results (AP only) */ | |
1340 | struct { | |
e573aaa4 MM |
1341 | atomic_t done; |
1342 | u8 count; | |
1343 | hfa384x_ChInfoResult_t results; | |
00b3ed16 GKH |
1344 | } channel_info; |
1345 | ||
e573aaa4 | 1346 | hfa384x_InfFrame_t *scanresults; |
00b3ed16 | 1347 | |
e573aaa4 MM |
1348 | prism2sta_authlist_t authlist; /* Authenticated station list. */ |
1349 | unsigned int accessmode; /* Access mode. */ | |
1350 | prism2sta_accesslist_t allow; /* Allowed station list. */ | |
1351 | prism2sta_accesslist_t deny; /* Denied station list. */ | |
00b3ed16 GKH |
1352 | |
1353 | } hfa384x_t; | |
1354 | ||
5dd8acc8 SK |
1355 | void hfa384x_create(hfa384x_t *hw, struct usb_device *usb); |
1356 | void hfa384x_destroy(hfa384x_t *hw); | |
00b3ed16 | 1357 | |
00b3ed16 | 1358 | int |
5dd8acc8 SK |
1359 | hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis); |
1360 | int hfa384x_drvr_commtallies(hfa384x_t *hw); | |
1361 | int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport); | |
1362 | int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport); | |
1363 | int hfa384x_drvr_flashdl_enable(hfa384x_t *hw); | |
1364 | int hfa384x_drvr_flashdl_disable(hfa384x_t *hw); | |
1365 | int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len); | |
1366 | int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len); | |
1367 | int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr); | |
1368 | int hfa384x_drvr_ramdl_disable(hfa384x_t *hw); | |
1369 | int hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len); | |
1370 | int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len); | |
1371 | int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len); | |
1372 | ||
1373 | static inline int hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val) | |
00b3ed16 | 1374 | { |
e573aaa4 | 1375 | int result = 0; |
aaad4303 | 1376 | result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16)); |
e573aaa4 | 1377 | if (result == 0) |
18c7f792 | 1378 | *((u16 *) val) = le16_to_cpu(*((u16 *) val)); |
00b3ed16 GKH |
1379 | return result; |
1380 | } | |
1381 | ||
5dd8acc8 | 1382 | static inline int hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val) |
00b3ed16 | 1383 | { |
18c7f792 | 1384 | u16 value = cpu_to_le16(val); |
00b3ed16 GKH |
1385 | return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value)); |
1386 | } | |
1387 | ||
00b3ed16 | 1388 | int |
5dd8acc8 | 1389 | hfa384x_drvr_getconfig_async(hfa384x_t *hw, |
e573aaa4 | 1390 | u16 rid, ctlx_usercb_t usercb, void *usercb_data); |
00b3ed16 GKH |
1391 | |
1392 | int | |
5dd8acc8 | 1393 | hfa384x_drvr_setconfig_async(hfa384x_t *hw, |
e573aaa4 MM |
1394 | u16 rid, |
1395 | void *buf, | |
1396 | u16 len, ctlx_usercb_t usercb, void *usercb_data); | |
00b3ed16 GKH |
1397 | |
1398 | static inline int | |
5dd8acc8 | 1399 | hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val) |
00b3ed16 | 1400 | { |
18c7f792 | 1401 | u16 value = cpu_to_le16(val); |
00b3ed16 | 1402 | return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), |
e573aaa4 | 1403 | NULL, NULL); |
00b3ed16 GKH |
1404 | } |
1405 | ||
5dd8acc8 SK |
1406 | int hfa384x_drvr_start(hfa384x_t *hw); |
1407 | int hfa384x_drvr_stop(hfa384x_t *hw); | |
00b3ed16 | 1408 | int |
5dd8acc8 SK |
1409 | hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, |
1410 | p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep); | |
1411 | void hfa384x_tx_timeout(wlandevice_t *wlandev); | |
1412 | ||
1413 | int hfa384x_cmd_initialize(hfa384x_t *hw); | |
1414 | int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport); | |
1415 | int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport); | |
1416 | int hfa384x_cmd_allocate(hfa384x_t *hw, u16 len); | |
1417 | int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable); | |
00b3ed16 | 1418 | int |
5dd8acc8 | 1419 | hfa384x_cmd_download(hfa384x_t *hw, |
e573aaa4 | 1420 | u16 mode, u16 lowaddr, u16 highaddr, u16 codelen); |
00b3ed16 | 1421 | |
71508ee4 | 1422 | #endif /*__KERNEL__ */ |
00b3ed16 | 1423 | |
71508ee4 | 1424 | #endif /*_HFA384x_H */ |