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