100b3ed16SGreg Kroah-Hartman /* hfa384x.h
200b3ed16SGreg Kroah-Hartman *
300b3ed16SGreg Kroah-Hartman * Defines the constants and data structures for the hfa384x
400b3ed16SGreg Kroah-Hartman *
500b3ed16SGreg Kroah-Hartman * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
600b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
700b3ed16SGreg Kroah-Hartman *
800b3ed16SGreg Kroah-Hartman * linux-wlan
900b3ed16SGreg Kroah-Hartman *
1000b3ed16SGreg Kroah-Hartman *   The contents of this file are subject to the Mozilla Public
1100b3ed16SGreg Kroah-Hartman *   License Version 1.1 (the "License"); you may not use this file
1200b3ed16SGreg Kroah-Hartman *   except in compliance with the License. You may obtain a copy of
1300b3ed16SGreg Kroah-Hartman *   the License at http://www.mozilla.org/MPL/
1400b3ed16SGreg Kroah-Hartman *
1500b3ed16SGreg Kroah-Hartman *   Software distributed under the License is distributed on an "AS
1600b3ed16SGreg Kroah-Hartman *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
1700b3ed16SGreg Kroah-Hartman *   implied. See the License for the specific language governing
1800b3ed16SGreg Kroah-Hartman *   rights and limitations under the License.
1900b3ed16SGreg Kroah-Hartman *
2000b3ed16SGreg Kroah-Hartman *   Alternatively, the contents of this file may be used under the
2100b3ed16SGreg Kroah-Hartman *   terms of the GNU Public License version 2 (the "GPL"), in which
2200b3ed16SGreg Kroah-Hartman *   case the provisions of the GPL are applicable instead of the
2300b3ed16SGreg Kroah-Hartman *   above.  If you wish to allow the use of your version of this file
2400b3ed16SGreg Kroah-Hartman *   only under the terms of the GPL and not to allow others to use
2500b3ed16SGreg Kroah-Hartman *   your version of this file under the MPL, indicate your decision
2600b3ed16SGreg Kroah-Hartman *   by deleting the provisions above and replace them with the notice
2700b3ed16SGreg Kroah-Hartman *   and other provisions required by the GPL.  If you do not delete
2800b3ed16SGreg Kroah-Hartman *   the provisions above, a recipient may use your version of this
2900b3ed16SGreg Kroah-Hartman *   file under either the MPL or the GPL.
3000b3ed16SGreg Kroah-Hartman *
3100b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
3200b3ed16SGreg Kroah-Hartman *
3300b3ed16SGreg Kroah-Hartman * Inquiries regarding the linux-wlan Open Source project can be
3400b3ed16SGreg Kroah-Hartman * made directly to:
3500b3ed16SGreg Kroah-Hartman *
3600b3ed16SGreg Kroah-Hartman * AbsoluteValue Systems Inc.
3700b3ed16SGreg Kroah-Hartman * info@linux-wlan.com
3800b3ed16SGreg Kroah-Hartman * http://www.linux-wlan.com
3900b3ed16SGreg Kroah-Hartman *
4000b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
4100b3ed16SGreg Kroah-Hartman *
4200b3ed16SGreg Kroah-Hartman * Portions of the development of this software were funded by
4300b3ed16SGreg Kroah-Hartman * Intersil Corporation as part of PRISM(R) chipset product development.
4400b3ed16SGreg Kroah-Hartman *
4500b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
4600b3ed16SGreg Kroah-Hartman *
4700b3ed16SGreg Kroah-Hartman *   [Implementation and usage notes]
4800b3ed16SGreg Kroah-Hartman *
4900b3ed16SGreg Kroah-Hartman *   [References]
5000b3ed16SGreg Kroah-Hartman *	CW10 Programmer's Manual v1.5
5100b3ed16SGreg Kroah-Hartman *	IEEE 802.11 D10.0
5200b3ed16SGreg Kroah-Hartman *
5300b3ed16SGreg Kroah-Hartman * --------------------------------------------------------------------
5400b3ed16SGreg Kroah-Hartman */
5500b3ed16SGreg Kroah-Hartman 
5600b3ed16SGreg Kroah-Hartman #ifndef _HFA384x_H
5700b3ed16SGreg Kroah-Hartman #define _HFA384x_H
5800b3ed16SGreg Kroah-Hartman 
5900b3ed16SGreg Kroah-Hartman /*=============================================================*/
6000b3ed16SGreg Kroah-Hartman #define HFA384x_FIRMWARE_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
6100b3ed16SGreg Kroah-Hartman 
6228b17a4bSMoritz Muehlenhoff #include <linux/if_ether.h>
6328b17a4bSMoritz Muehlenhoff 
6400b3ed16SGreg Kroah-Hartman /*------ Constants --------------------------------------------*/
6500b3ed16SGreg Kroah-Hartman /*--- Mins & Maxs -----------------------------------*/
66aaad4303SSolomon Peachy #define		HFA384x_PORTID_MAX		((u16)7)
67aaad4303SSolomon Peachy #define		HFA384x_NUMPORTS_MAX		((u16)(HFA384x_PORTID_MAX+1))
68aaad4303SSolomon Peachy #define		HFA384x_PDR_LEN_MAX		((u16)512)	/* in bytes, from EK */
69aaad4303SSolomon Peachy #define		HFA384x_PDA_LEN_MAX		((u16)1024)	/* in bytes, from EK */
70aaad4303SSolomon Peachy #define		HFA384x_SCANRESULT_MAX		((u16)31)
71aaad4303SSolomon Peachy #define		HFA384x_HSCANRESULT_MAX		((u16)31)
72aaad4303SSolomon Peachy #define		HFA384x_CHINFORESULT_MAX	((u16)16)
7300b3ed16SGreg Kroah-Hartman #define		HFA384x_RID_GUESSING_MAXLEN	2048  /* I'm not really sure */
7400b3ed16SGreg Kroah-Hartman #define		HFA384x_RIDDATA_MAXLEN		HFA384x_RID_GUESSING_MAXLEN
7500b3ed16SGreg Kroah-Hartman #define		HFA384x_USB_RWMEM_MAXLEN	2048
7600b3ed16SGreg Kroah-Hartman 
7700b3ed16SGreg Kroah-Hartman /*--- Support Constants -----------------------------*/
78aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_IBSS			((u16)0)
79aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_BSS			((u16)1)
80aaad4303SSolomon Peachy #define		HFA384x_PORTTYPE_PSUEDOIBSS		((u16)3)
817f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_PRIVINVOKED		((u16)BIT(0))
827f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_EXCLUDE		((u16)BIT(1))
837f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_TXCRYPT	((u16)BIT(4))
847f6e0e44SMoritz Muehlenhoff #define		HFA384x_WEPFLAGS_DISABLE_RXCRYPT	((u16)BIT(7))
85aaad4303SSolomon Peachy #define 	HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM	((u16)3)
86aaad4303SSolomon Peachy #define 	HFA384x_PORTSTATUS_DISABLED		((u16)1)
87aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_1			((u16)1)
88aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_2			((u16)2)
89aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_5dot5			((u16)4)
90aaad4303SSolomon Peachy #define		HFA384x_RATEBIT_11			((u16)8)
9100b3ed16SGreg Kroah-Hartman 
9200b3ed16SGreg Kroah-Hartman /*--- MAC Internal memory constants and macros ------*/
9300b3ed16SGreg Kroah-Hartman /* masks and macros used to manipulate MAC internal memory addresses. */
9400b3ed16SGreg Kroah-Hartman /* MAC internal memory addresses are 23 bit quantities.  The MAC uses
9500b3ed16SGreg Kroah-Hartman  * a paged address space where the upper 16 bits are the page number
9600b3ed16SGreg Kroah-Hartman  * and the lower 7 bits are the offset.  There are various Host API
9700b3ed16SGreg Kroah-Hartman  * elements that require two 16-bit quantities to specify a MAC
9800b3ed16SGreg Kroah-Hartman  * internal memory address.  Unfortunately, some of the API's use a
9900b3ed16SGreg Kroah-Hartman  * page/offset format where the offset value is JUST the lower seven
10000b3ed16SGreg Kroah-Hartman  * bits and the page is  the remaining 16 bits.  Some of the API's
10100b3ed16SGreg Kroah-Hartman  * assume that the 23 bit address has been split at the 16th bit.  We
10200b3ed16SGreg Kroah-Hartman  * refer to these two formats as AUX format and CMD format.  The
10300b3ed16SGreg Kroah-Hartman  * macros below help handle some of this.
10400b3ed16SGreg Kroah-Hartman  */
10500b3ed16SGreg Kroah-Hartman 
10600b3ed16SGreg Kroah-Hartman /* Mask bits for discarding unwanted pieces in a flat address */
10700b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_PAGE_MASK	(0x007fff80)
10800b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_AUX_OFF_MASK	(0x0000007f)
10900b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_PAGE_MASK	(0xffff0000)
11000b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_FLAT_CMD_OFF_MASK	(0x0000ffff)
11100b3ed16SGreg Kroah-Hartman 
11200b3ed16SGreg Kroah-Hartman /* Mask bits for discarding unwanted pieces in AUX format 16-bit address parts */
11300b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_PAGE_MASK	(0xffff)
11400b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_OFF_MASK	(0x007f)
11500b3ed16SGreg Kroah-Hartman 
11600b3ed16SGreg Kroah-Hartman /* Make a 32-bit flat address from AUX format 16-bit page and offset */
11700b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_AUX_MKFLAT(p,o)	\
118aaad4303SSolomon Peachy 		(((u32)(((u16)(p))&HFA384x_ADDR_AUX_PAGE_MASK)) <<7) | \
119aaad4303SSolomon Peachy 		((u32)(((u16)(o))&HFA384x_ADDR_AUX_OFF_MASK))
12000b3ed16SGreg Kroah-Hartman 
12100b3ed16SGreg Kroah-Hartman /* Make CMD format offset and page from a 32-bit flat address */
12200b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKPAGE(f) \
123aaad4303SSolomon Peachy 		((u16)((((u32)(f))&HFA384x_ADDR_FLAT_CMD_PAGE_MASK)>>16))
12400b3ed16SGreg Kroah-Hartman #define		HFA384x_ADDR_CMD_MKOFF(f) \
125aaad4303SSolomon Peachy 		((u16)(((u32)(f))&HFA384x_ADDR_FLAT_CMD_OFF_MASK))
12600b3ed16SGreg Kroah-Hartman 
12700b3ed16SGreg Kroah-Hartman 
12800b3ed16SGreg Kroah-Hartman /*--- Controller Memory addresses -------------------*/
12900b3ed16SGreg Kroah-Hartman #define		HFA3842_PDA_BASE	(0x007f0000UL)
13000b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BASE	(0x003f0000UL)
13100b3ed16SGreg Kroah-Hartman #define		HFA3841_PDA_BOGUS_BASE	(0x00390000UL)
13200b3ed16SGreg Kroah-Hartman 
13300b3ed16SGreg Kroah-Hartman /*--- Driver Download states  -----------------------*/
13400b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_DISABLED		0
13500b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_RAMENABLED		1
13600b3ed16SGreg Kroah-Hartman #define		HFA384x_DLSTATE_FLASHENABLED		2
13700b3ed16SGreg Kroah-Hartman 
13800b3ed16SGreg Kroah-Hartman /*--- Register Field Masks --------------------------*/
1397f6e0e44SMoritz Muehlenhoff #define		HFA384x_CMD_AINFO		((u16)(BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10) | BIT(9) | BIT(8)))
1407f6e0e44SMoritz Muehlenhoff #define		HFA384x_CMD_MACPORT		((u16)(BIT(10) | BIT(9) | BIT(8)))
1417f6e0e44SMoritz Muehlenhoff #define		HFA384x_CMD_PROGMODE		((u16)(BIT(9) | BIT(8)))
1427f6e0e44SMoritz Muehlenhoff #define		HFA384x_CMD_CMDCODE		((u16)(BIT(5) | BIT(4) | BIT(3) | BIT(2) | BIT(1) | BIT(0)))
14300b3ed16SGreg Kroah-Hartman 
1447f6e0e44SMoritz Muehlenhoff #define		HFA384x_STATUS_RESULT		((u16)(BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10) | BIT(9) | BIT(8)))
14500b3ed16SGreg Kroah-Hartman 
14600b3ed16SGreg Kroah-Hartman /*--- Command Code Constants --------------------------*/
14700b3ed16SGreg Kroah-Hartman /*--- Controller Commands --------------------------*/
148aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INIT		((u16)0x00)
149aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_ENABLE		((u16)0x01)
150aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DISABLE		((u16)0x02)
15100b3ed16SGreg Kroah-Hartman 
15200b3ed16SGreg Kroah-Hartman /*--- Regulate Commands --------------------------*/
153aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_INQ		((u16)0x11)
15400b3ed16SGreg Kroah-Hartman 
15500b3ed16SGreg Kroah-Hartman /*--- Configure Commands --------------------------*/
156aaad4303SSolomon Peachy #define		HFA384x_CMDCODE_DOWNLD		((u16)0x22)
15700b3ed16SGreg Kroah-Hartman 
15800b3ed16SGreg Kroah-Hartman /*--- Debugging Commands -----------------------------*/
159aaad4303SSolomon Peachy #define 	HFA384x_CMDCODE_MONITOR		((u16)(0x38))
160aaad4303SSolomon Peachy #define		HFA384x_MONITOR_ENABLE		((u16)(0x0b))
161aaad4303SSolomon Peachy #define		HFA384x_MONITOR_DISABLE		((u16)(0x0f))
16200b3ed16SGreg Kroah-Hartman 
16300b3ed16SGreg Kroah-Hartman /*--- Result Codes --------------------------*/
164aaad4303SSolomon Peachy #define		HFA384x_CMD_ERR			((u16)(0x7F))
16500b3ed16SGreg Kroah-Hartman 
16600b3ed16SGreg Kroah-Hartman /*--- Programming Modes --------------------------
16700b3ed16SGreg Kroah-Hartman 	MODE 0: Disable programming
16800b3ed16SGreg Kroah-Hartman 	MODE 1: Enable volatile memory programming
16900b3ed16SGreg Kroah-Hartman 	MODE 2: Enable non-volatile memory programming
17000b3ed16SGreg Kroah-Hartman 	MODE 3: Program non-volatile memory section
17100b3ed16SGreg Kroah-Hartman --------------------------------------------------*/
172aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_DISABLE	((u16)0x00)
173aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_RAM		((u16)0x01)
174aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NV		((u16)0x02)
175aaad4303SSolomon Peachy #define		HFA384x_PROGMODE_NVWRITE	((u16)0x03)
17600b3ed16SGreg Kroah-Hartman 
17700b3ed16SGreg Kroah-Hartman /*--- Record ID Constants --------------------------*/
17800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
17900b3ed16SGreg Kroah-Hartman Configuration RIDs: Network Parameters, Static Configuration Entities
18000b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
181aaad4303SSolomon Peachy #define		HFA384x_RID_CNFPORTTYPE		((u16)0xFC00)
182aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR	((u16)0xFC01)
183aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID	((u16)0xFC02)
184aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNCHANNEL	((u16)0xFC03)
185aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID		((u16)0xFC04)
186aaad4303SSolomon Peachy #define		HFA384x_RID_CNFMAXDATALEN	((u16)0xFC07)
18700b3ed16SGreg Kroah-Hartman 
18800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
18900b3ed16SGreg Kroah-Hartman Configuration RID lengths: Network Params, Static Config Entities
19000b3ed16SGreg Kroah-Hartman   This is the length of JUST the DATA part of the RID (does not
19100b3ed16SGreg Kroah-Hartman   include the len or code fields)
19200b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
193aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNMACADDR_LEN	((u16)6)
194aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDESIREDSSID_LEN	((u16)34)
195aaad4303SSolomon Peachy #define		HFA384x_RID_CNFOWNSSID_LEN	((u16)34)
19600b3ed16SGreg Kroah-Hartman 
19700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
19800b3ed16SGreg Kroah-Hartman Configuration RIDs: Network Parameters, Dynamic Configuration Entities
19900b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
200aaad4303SSolomon Peachy #define		HFA384x_RID_CREATEIBSS		((u16)0xFC81)
201aaad4303SSolomon Peachy #define		HFA384x_RID_FRAGTHRESH		((u16)0xFC82)
202aaad4303SSolomon Peachy #define		HFA384x_RID_RTSTHRESH		((u16)0xFC83)
203aaad4303SSolomon Peachy #define		HFA384x_RID_TXRATECNTL		((u16)0xFC84)
204aaad4303SSolomon Peachy #define		HFA384x_RID_PROMISCMODE		((u16)0xFC85)
20500b3ed16SGreg Kroah-Hartman 
20600b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
20700b3ed16SGreg Kroah-Hartman Information RIDs: NIC Information
20800b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
209aaad4303SSolomon Peachy #define		HFA384x_RID_MAXLOADTIME		((u16)0xFD00)
210aaad4303SSolomon Peachy #define		HFA384x_RID_DOWNLOADBUFFER	((u16)0xFD01)
211aaad4303SSolomon Peachy #define		HFA384x_RID_PRIIDENTITY		((u16)0xFD02)
212aaad4303SSolomon Peachy #define		HFA384x_RID_PRISUPRANGE		((u16)0xFD03)
213aaad4303SSolomon Peachy #define		HFA384x_RID_PRI_CFIACTRANGES	((u16)0xFD04)
214aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER	((u16)0xFD0A)
215aaad4303SSolomon Peachy #define		HFA384x_RID_NICIDENTITY		((u16)0xFD0B)
216aaad4303SSolomon Peachy #define		HFA384x_RID_MFISUPRANGE		((u16)0xFD0C)
217aaad4303SSolomon Peachy #define		HFA384x_RID_CFISUPRANGE		((u16)0xFD0D)
218aaad4303SSolomon Peachy #define		HFA384x_RID_STAIDENTITY		((u16)0xFD20)
219aaad4303SSolomon Peachy #define		HFA384x_RID_STASUPRANGE		((u16)0xFD21)
220aaad4303SSolomon Peachy #define		HFA384x_RID_STA_MFIACTRANGES	((u16)0xFD22)
221aaad4303SSolomon Peachy #define		HFA384x_RID_STA_CFIACTRANGES	((u16)0xFD23)
22200b3ed16SGreg Kroah-Hartman 
22300b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------------------
22400b3ed16SGreg Kroah-Hartman Information RID Lengths: NIC Information
22500b3ed16SGreg Kroah-Hartman   This is the length of JUST the DATA part of the RID (does not
22600b3ed16SGreg Kroah-Hartman   include the len or code fields)
22700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
228aaad4303SSolomon Peachy #define		HFA384x_RID_NICSERIALNUMBER_LEN		((u16)12)
22900b3ed16SGreg Kroah-Hartman 
23000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
23100b3ed16SGreg Kroah-Hartman Information RIDs:  MAC Information
23200b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
233aaad4303SSolomon Peachy #define		HFA384x_RID_PORTSTATUS		((u16)0xFD40)
234aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTSSID		((u16)0xFD41)
235aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTBSSID	((u16)0xFD42)
236aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTTXRATE	((u16)0xFD44)
237aaad4303SSolomon Peachy #define		HFA384x_RID_SHORTRETRYLIMIT	((u16)0xFD48)
238aaad4303SSolomon Peachy #define		HFA384x_RID_LONGRETRYLIMIT	((u16)0xFD49)
239aaad4303SSolomon Peachy #define		HFA384x_RID_MAXTXLIFETIME	((u16)0xFD4A)
240aaad4303SSolomon Peachy #define		HFA384x_RID_PRIVACYOPTIMP	((u16)0xFD4F)
241aaad4303SSolomon Peachy #define		HFA384x_RID_DBMCOMMSQUALITY	((u16)0xFD51)
24200b3ed16SGreg Kroah-Hartman 
24300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
24400b3ed16SGreg Kroah-Hartman Information RID Lengths:  MAC Information
24500b3ed16SGreg Kroah-Hartman   This is the length of JUST the DATA part of the RID (does not
24600b3ed16SGreg Kroah-Hartman   include the len or code fields)
24700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
248aaad4303SSolomon Peachy #define		HFA384x_RID_DBMCOMMSQUALITY_LEN		((u16)sizeof(hfa384x_dbmcommsquality_t))
249aaad4303SSolomon Peachy #define		HFA384x_RID_JOINREQUEST_LEN		((u16)sizeof(hfa384x_JoinRequest_data_t))
25040a67411SMoritz Muehlenhoff 
25100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
25200b3ed16SGreg Kroah-Hartman Information RIDs:  Modem Information
25300b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
254aaad4303SSolomon Peachy #define		HFA384x_RID_CURRENTCHANNEL	((u16)0xFDC1)
25500b3ed16SGreg Kroah-Hartman 
25600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
25700b3ed16SGreg Kroah-Hartman API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
25800b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
259aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEYID	((u16)0xFC23)
260aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY0	((u16)0xFC24)
261aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY1	((u16)0xFC25)
262aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY2	((u16)0xFC26)
263aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY3	((u16)0xFC27)
264aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPFLAGS		((u16)0xFC28)
265aaad4303SSolomon Peachy #define		HFA384x_RID_CNFAUTHENTICATION	((u16)0xFC2A)
266aaad4303SSolomon Peachy #define		HFA384x_RID_CNFROAMINGMODE	((u16)0xFC2D)
267aaad4303SSolomon Peachy #define		HFA384x_RID_CNFAPBCNint		((u16)0xFC33)
268aaad4303SSolomon Peachy #define		HFA384x_RID_CNFDBMADJUST  	((u16)0xFC46) // NEW
269aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWPADATA       	((u16)0xFC48) // 1.7.0
270aaad4303SSolomon Peachy #define		HFA384x_RID_CNFBASICRATES	((u16)0xFCB3)
271aaad4303SSolomon Peachy #define		HFA384x_RID_CNFSUPPRATES	((u16)0xFCB4)
272aaad4303SSolomon Peachy #define		HFA384x_RID_CNFPASSIVESCANCTRL	((u16)0xFCBA) // NEW STA
273aaad4303SSolomon Peachy #define		HFA384x_RID_TXPOWERMAX        	((u16)0xFCBE) // 1.7.0/1.4.0
274aaad4303SSolomon Peachy #define		HFA384x_RID_JOINREQUEST		((u16)0xFCE2)
275aaad4303SSolomon Peachy #define		HFA384x_RID_AUTHENTICATESTA	((u16)0xFCE3)
276aaad4303SSolomon Peachy #define		HFA384x_RID_HOSTSCAN          	((u16)0xFCE5) // NEW STA
27700b3ed16SGreg Kroah-Hartman 
278aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEPDEFAULTKEY_LEN	((u16)6)
279aaad4303SSolomon Peachy #define		HFA384x_RID_CNFWEP128DEFAULTKEY_LEN	((u16)14)
28040a67411SMoritz Muehlenhoff 
28100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
28200b3ed16SGreg Kroah-Hartman PD Record codes
28300b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
284aaad4303SSolomon Peachy #define HFA384x_PDR_PCB_PARTNUM		((u16)0x0001)
285aaad4303SSolomon Peachy #define HFA384x_PDR_PDAVER		((u16)0x0002)
286aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_SERIAL		((u16)0x0003)
287aaad4303SSolomon Peachy #define HFA384x_PDR_MKK_MEASUREMENTS	((u16)0x0004)
288aaad4303SSolomon Peachy #define HFA384x_PDR_NIC_RAMSIZE		((u16)0x0005)
289aaad4303SSolomon Peachy #define HFA384x_PDR_MFISUPRANGE		((u16)0x0006)
290aaad4303SSolomon Peachy #define HFA384x_PDR_CFISUPRANGE		((u16)0x0007)
291aaad4303SSolomon Peachy #define HFA384x_PDR_NICID		((u16)0x0008)
292aaad4303SSolomon Peachy #define HFA384x_PDR_MAC_ADDRESS		((u16)0x0101)
293aaad4303SSolomon Peachy #define HFA384x_PDR_REGDOMAIN		((u16)0x0103)
294aaad4303SSolomon Peachy #define HFA384x_PDR_ALLOWED_CHANNEL	((u16)0x0104)
295aaad4303SSolomon Peachy #define HFA384x_PDR_DEFAULT_CHANNEL	((u16)0x0105)
296aaad4303SSolomon Peachy #define HFA384x_PDR_TEMPTYPE		((u16)0x0107)
297aaad4303SSolomon Peachy #define HFA384x_PDR_IFR_SETTING		((u16)0x0200)
298aaad4303SSolomon Peachy #define HFA384x_PDR_RFR_SETTING		((u16)0x0201)
299aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_BASELINE	((u16)0x0202)
300aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_SHADOW	((u16)0x0203)
301aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_IFRF	((u16)0x0204)
302aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALSP	((u16)0x0300)
303aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_CHCALI	((u16)0x0301)
304aaad4303SSolomon Peachy #define HFA384x_PDR_MAX_TX_POWER  	((u16)0x0302)
305aaad4303SSolomon Peachy #define HFA384x_PDR_MASTER_CHAN_LIST	((u16)0x0303)
306aaad4303SSolomon Peachy #define HFA384x_PDR_3842_NIC_CONFIG	((u16)0x0400)
307aaad4303SSolomon Peachy #define HFA384x_PDR_USB_ID		((u16)0x0401)
308aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_ID		((u16)0x0402)
309aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_IFCONF		((u16)0x0403)
310aaad4303SSolomon Peachy #define HFA384x_PDR_PCI_PMCONF		((u16)0x0404)
311aaad4303SSolomon Peachy #define HFA384x_PDR_RFENRGY		((u16)0x0406)
312aaad4303SSolomon Peachy #define HFA384x_PDR_USB_POWER_TYPE      ((u16)0x0407)
313aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MAX_POWER	((u16)0x0409)
314aaad4303SSolomon Peachy #define HFA384x_PDR_USB_MANUFACTURER	((u16)0x0410)
315aaad4303SSolomon Peachy #define HFA384x_PDR_USB_PRODUCT  	((u16)0x0411)
316aaad4303SSolomon Peachy #define HFA384x_PDR_ANT_DIVERSITY   	((u16)0x0412)
317aaad4303SSolomon Peachy #define HFA384x_PDR_HFO_DELAY       	((u16)0x0413)
318aaad4303SSolomon Peachy #define HFA384x_PDR_SCALE_THRESH 	((u16)0x0414)
31900b3ed16SGreg Kroah-Hartman 
320aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTSP	((u16)0x0900)
321aaad4303SSolomon Peachy #define HFA384x_PDR_HFA3861_MANF_TESTI	((u16)0x0901)
322aaad4303SSolomon Peachy #define HFA384x_PDR_END_OF_PDA		((u16)0x0000)
32300b3ed16SGreg Kroah-Hartman 
32400b3ed16SGreg Kroah-Hartman 
32500b3ed16SGreg Kroah-Hartman /*=============================================================*/
32600b3ed16SGreg Kroah-Hartman /*------ Macros -----------------------------------------------*/
32700b3ed16SGreg Kroah-Hartman 
32800b3ed16SGreg Kroah-Hartman /*--- Register Test/Get/Set Field macros ------------------------*/
32900b3ed16SGreg Kroah-Hartman 
330aaad4303SSolomon Peachy #define		HFA384x_CMD_AINFO_SET(value)		((u16)((u16)(value) << 8))
331aaad4303SSolomon Peachy #define		HFA384x_CMD_MACPORT_SET(value)		((u16)HFA384x_CMD_AINFO_SET(value))
332aaad4303SSolomon Peachy #define		HFA384x_CMD_PROGMODE_SET(value)		((u16)HFA384x_CMD_AINFO_SET((u16)value))
333aaad4303SSolomon Peachy #define		HFA384x_CMD_CMDCODE_SET(value)		((u16)(value))
33400b3ed16SGreg Kroah-Hartman 
335aaad4303SSolomon Peachy #define		HFA384x_STATUS_RESULT_SET(value)	(((u16)(value)) << 8)
33600b3ed16SGreg Kroah-Hartman 
33700b3ed16SGreg Kroah-Hartman /* Byte Order */
33800b3ed16SGreg Kroah-Hartman #ifdef __KERNEL__
339aaad4303SSolomon Peachy #define hfa384x2host_16(n)	(__le16_to_cpu((u16)(n)))
340aaad4303SSolomon Peachy #define hfa384x2host_32(n)	(__le32_to_cpu((u32)(n)))
341aaad4303SSolomon Peachy #define host2hfa384x_16(n)	(__cpu_to_le16((u16)(n)))
342aaad4303SSolomon Peachy #define host2hfa384x_32(n)	(__cpu_to_le32((u32)(n)))
34300b3ed16SGreg Kroah-Hartman #endif
34400b3ed16SGreg Kroah-Hartman 
34500b3ed16SGreg Kroah-Hartman /* Host Maintained State Info */
34600b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_PREINIT	0
34700b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_INIT	1
34800b3ed16SGreg Kroah-Hartman #define HFA384x_STATE_RUNNING	2
34900b3ed16SGreg Kroah-Hartman 
35000b3ed16SGreg Kroah-Hartman /*=============================================================*/
35100b3ed16SGreg Kroah-Hartman /*------ Types and their related constants --------------------*/
35200b3ed16SGreg Kroah-Hartman 
35300b3ed16SGreg Kroah-Hartman /*-------------------------------------------------------------*/
35400b3ed16SGreg Kroah-Hartman /* Commonly used basic types */
35500b3ed16SGreg Kroah-Hartman typedef struct hfa384x_bytestr
35600b3ed16SGreg Kroah-Hartman {
357aaad4303SSolomon Peachy 	u16	len;
358aaad4303SSolomon Peachy 	u8	data[0];
3599cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_bytestr_t;
36000b3ed16SGreg Kroah-Hartman 
36100b3ed16SGreg Kroah-Hartman typedef struct hfa384x_bytestr32
36200b3ed16SGreg Kroah-Hartman {
363aaad4303SSolomon Peachy 	u16	len;
364aaad4303SSolomon Peachy 	u8	data[32];
3659cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_bytestr32_t;
36600b3ed16SGreg Kroah-Hartman 
36700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
36800b3ed16SGreg Kroah-Hartman Configuration Record Structures:
36900b3ed16SGreg Kroah-Hartman 	Network Parameters, Static Configuration Entities
37000b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
37100b3ed16SGreg Kroah-Hartman 
37200b3ed16SGreg Kroah-Hartman /*-- Hardware/Firmware Component Information ----------*/
37300b3ed16SGreg Kroah-Hartman typedef struct hfa384x_compident
37400b3ed16SGreg Kroah-Hartman {
375aaad4303SSolomon Peachy 	u16	id;
376aaad4303SSolomon Peachy 	u16	variant;
377aaad4303SSolomon Peachy 	u16	major;
378aaad4303SSolomon Peachy 	u16	minor;
3799cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_compident_t;
38000b3ed16SGreg Kroah-Hartman 
38100b3ed16SGreg Kroah-Hartman typedef struct hfa384x_caplevel
38200b3ed16SGreg Kroah-Hartman {
383aaad4303SSolomon Peachy 	u16	role;
384aaad4303SSolomon Peachy 	u16	id;
385aaad4303SSolomon Peachy 	u16	variant;
386aaad4303SSolomon Peachy 	u16	bottom;
387aaad4303SSolomon Peachy 	u16	top;
3889cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_caplevel_t;
38900b3ed16SGreg Kroah-Hartman 
39000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: cnfAuthentication --*/
39100b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM	0x0001
39200b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_SHAREDKEY	0x0002
39300b3ed16SGreg Kroah-Hartman #define HFA384x_CNFAUTHENTICATION_LEAP     	0x0004
39400b3ed16SGreg Kroah-Hartman 
39500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
39600b3ed16SGreg Kroah-Hartman Configuration Record Structures:
39700b3ed16SGreg Kroah-Hartman 	Network Parameters, Dynamic Configuration Entities
39800b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
39900b3ed16SGreg Kroah-Hartman 
40000b3ed16SGreg Kroah-Hartman #define HFA384x_CREATEIBSS_JOINCREATEIBSS          0
40100b3ed16SGreg Kroah-Hartman 
40200b3ed16SGreg Kroah-Hartman /*-- Configuration Record: HostScanRequest (data portion only) --*/
40300b3ed16SGreg Kroah-Hartman typedef struct hfa384x_HostScanRequest_data
40400b3ed16SGreg Kroah-Hartman {
405aaad4303SSolomon Peachy 	u16	channelList;
406aaad4303SSolomon Peachy 	u16	txRate;
40700b3ed16SGreg Kroah-Hartman 	hfa384x_bytestr32_t ssid;
4089cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_HostScanRequest_data_t;
40900b3ed16SGreg Kroah-Hartman 
41000b3ed16SGreg Kroah-Hartman /*-- Configuration Record: JoinRequest (data portion only) --*/
41100b3ed16SGreg Kroah-Hartman typedef struct hfa384x_JoinRequest_data
41200b3ed16SGreg Kroah-Hartman {
413aaad4303SSolomon Peachy 	u8	bssid[WLAN_BSSID_LEN];
414aaad4303SSolomon Peachy 	u16	channel;
4159cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_JoinRequest_data_t;
41600b3ed16SGreg Kroah-Hartman 
41700b3ed16SGreg Kroah-Hartman /*-- Configuration Record: authenticateStation (data portion only) --*/
41800b3ed16SGreg Kroah-Hartman typedef struct hfa384x_authenticateStation_data
41900b3ed16SGreg Kroah-Hartman {
42028b17a4bSMoritz Muehlenhoff 	u8	address[ETH_ALEN];
421aaad4303SSolomon Peachy 	u16	status;
422aaad4303SSolomon Peachy 	u16	algorithm;
4239cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_authenticateStation_data_t;
42400b3ed16SGreg Kroah-Hartman 
42500b3ed16SGreg Kroah-Hartman /*-- Configuration Record: WPAData       (data portion only) --*/
42600b3ed16SGreg Kroah-Hartman typedef struct hfa384x_WPAData
42700b3ed16SGreg Kroah-Hartman {
428aaad4303SSolomon Peachy 	u16	datalen;
429aaad4303SSolomon Peachy         u8 	data[0]; // max 80
4309cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_WPAData_t;
43100b3ed16SGreg Kroah-Hartman 
43200b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
43300b3ed16SGreg Kroah-Hartman Information Record Structures: NIC Information
43400b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
43500b3ed16SGreg Kroah-Hartman 
43600b3ed16SGreg Kroah-Hartman /*-- Information Record: DownLoadBuffer --*/
43700b3ed16SGreg Kroah-Hartman /* NOTE: The page and offset are in AUX format */
43800b3ed16SGreg Kroah-Hartman typedef struct hfa384x_downloadbuffer
43900b3ed16SGreg Kroah-Hartman {
440aaad4303SSolomon Peachy 	u16	page;
441aaad4303SSolomon Peachy 	u16	offset;
442aaad4303SSolomon Peachy 	u16	len;
4439cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_downloadbuffer_t;
44400b3ed16SGreg Kroah-Hartman 
44500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
44600b3ed16SGreg Kroah-Hartman Information Record Structures: NIC Information
44700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
44800b3ed16SGreg Kroah-Hartman 
449aaad4303SSolomon Peachy #define HFA384x_PSTATUS_CONN_IBSS	((u16)3)
45000b3ed16SGreg Kroah-Hartman 
45100b3ed16SGreg Kroah-Hartman /*-- Information Record: commsquality --*/
45200b3ed16SGreg Kroah-Hartman typedef struct hfa384x_commsquality
45300b3ed16SGreg Kroah-Hartman {
454aaad4303SSolomon Peachy 	u16	CQ_currBSS;
455aaad4303SSolomon Peachy 	u16	ASL_currBSS;
456aaad4303SSolomon Peachy 	u16	ANL_currFC;
4579cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_commsquality_t;
45800b3ed16SGreg Kroah-Hartman 
45900b3ed16SGreg Kroah-Hartman /*-- Information Record: dmbcommsquality --*/
46000b3ed16SGreg Kroah-Hartman typedef struct hfa384x_dbmcommsquality
46100b3ed16SGreg Kroah-Hartman {
462aaad4303SSolomon Peachy 	u16	CQdbm_currBSS;
463aaad4303SSolomon Peachy 	u16	ASLdbm_currBSS;
464aaad4303SSolomon Peachy 	u16	ANLdbm_currFC;
4659cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_dbmcommsquality_t;
46600b3ed16SGreg Kroah-Hartman 
46700b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
46800b3ed16SGreg Kroah-Hartman FRAME STRUCTURES: Communication Frames
46900b3ed16SGreg Kroah-Hartman ----------------------------------------------------------------------
47000b3ed16SGreg Kroah-Hartman Communication Frames: Transmit Frames
47100b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
47200b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Transmit Frame Structure --*/
47300b3ed16SGreg Kroah-Hartman typedef struct hfa384x_tx_frame
47400b3ed16SGreg Kroah-Hartman {
475aaad4303SSolomon Peachy 	u16	status;
476aaad4303SSolomon Peachy 	u16	reserved1;
477aaad4303SSolomon Peachy 	u16	reserved2;
478aaad4303SSolomon Peachy 	u32	sw_support;
479aaad4303SSolomon Peachy 	u8	tx_retrycount;
480aaad4303SSolomon Peachy 	u8   tx_rate;
481aaad4303SSolomon Peachy 	u16	tx_control;
48200b3ed16SGreg Kroah-Hartman 
48300b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information --*/
48400b3ed16SGreg Kroah-Hartman 
485aaad4303SSolomon Peachy 	u16	frame_control;
486aaad4303SSolomon Peachy 	u16	duration_id;
487aaad4303SSolomon Peachy 	u8	address1[6];
488aaad4303SSolomon Peachy 	u8	address2[6];
489aaad4303SSolomon Peachy 	u8	address3[6];
490aaad4303SSolomon Peachy 	u16	sequence_control;
491aaad4303SSolomon Peachy 	u8	address4[6];
492aaad4303SSolomon Peachy 	u16	data_len; /* little endian format */
49300b3ed16SGreg Kroah-Hartman 
49400b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
49500b3ed16SGreg Kroah-Hartman 
496aaad4303SSolomon Peachy 	u8	dest_addr[6];
497aaad4303SSolomon Peachy 	u8	src_addr[6];
498aaad4303SSolomon Peachy 	u16	data_length; /* big endian format */
4999cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_tx_frame_t;
50000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
50100b3ed16SGreg Kroah-Hartman Communication Frames: Field Masks for Transmit Frames
50200b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
50300b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
5047f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_ACKERR			((u16)BIT(5))
5057f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_FORMERR		((u16)BIT(3))
5067f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_DISCON			((u16)BIT(2))
5077f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_AGEDERR		((u16)BIT(1))
5087f6e0e44SMoritz Muehlenhoff #define		HFA384x_TXSTATUS_RETRYERR		((u16)BIT(0))
50900b3ed16SGreg Kroah-Hartman /*-- Transmit Control Field --*/
5107f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_MACPORT			((u16)(BIT(10) | BIT(9) | BIT(8)))
5117f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_STRUCTYPE			((u16)(BIT(4) | BIT(3)))
5127f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXEX				((u16)BIT(2))
5137f6e0e44SMoritz Muehlenhoff #define		HFA384x_TX_TXOK				((u16)BIT(1))
51400b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
51500b3ed16SGreg Kroah-Hartman Communication Frames: Test/Get/Set Field Values for Transmit Frames
51600b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
51700b3ed16SGreg Kroah-Hartman /*-- Status Field --*/
51800b3ed16SGreg Kroah-Hartman #define HFA384x_TXSTATUS_ISERROR(v)	\
519aaad4303SSolomon Peachy 	(((u16)(v))&\
52000b3ed16SGreg Kroah-Hartman 	(HFA384x_TXSTATUS_ACKERR|HFA384x_TXSTATUS_FORMERR|\
52100b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_DISCON|HFA384x_TXSTATUS_AGEDERR|\
52200b3ed16SGreg Kroah-Hartman 	HFA384x_TXSTATUS_RETRYERR))
52300b3ed16SGreg Kroah-Hartman 
524aaad4303SSolomon Peachy #define	HFA384x_TX_SET(v,m,s)		((((u16)(v))<<((u16)(s)))&((u16)(m)))
52500b3ed16SGreg Kroah-Hartman 
52600b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_MACPORT_SET(v)	HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8)
52700b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_STRUCTYPE_SET(v)	HFA384x_TX_SET(v, HFA384x_TX_STRUCTYPE, 3)
52800b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXEX_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2)
52900b3ed16SGreg Kroah-Hartman #define	HFA384x_TX_TXOK_SET(v)		HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1)
53000b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
53100b3ed16SGreg Kroah-Hartman Communication Frames: Receive Frames
53200b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
53300b3ed16SGreg Kroah-Hartman /*-- Communication Frame: Receive Frame Structure --*/
53400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_rx_frame
53500b3ed16SGreg Kroah-Hartman {
53600b3ed16SGreg Kroah-Hartman 	/*-- MAC rx descriptor (hfa384x byte order) --*/
537aaad4303SSolomon Peachy 	u16	status;
538aaad4303SSolomon Peachy 	u32	time;
539aaad4303SSolomon Peachy 	u8	silence;
540aaad4303SSolomon Peachy 	u8	signal;
541aaad4303SSolomon Peachy 	u8	rate;
542aaad4303SSolomon Peachy 	u8	rx_flow;
543aaad4303SSolomon Peachy 	u16	reserved1;
544aaad4303SSolomon Peachy 	u16	reserved2;
54500b3ed16SGreg Kroah-Hartman 
54600b3ed16SGreg Kroah-Hartman 	/*-- 802.11 Header Information (802.11 byte order) --*/
547aaad4303SSolomon Peachy 	u16	frame_control;
548aaad4303SSolomon Peachy 	u16	duration_id;
549aaad4303SSolomon Peachy 	u8	address1[6];
550aaad4303SSolomon Peachy 	u8	address2[6];
551aaad4303SSolomon Peachy 	u8	address3[6];
552aaad4303SSolomon Peachy 	u16	sequence_control;
553aaad4303SSolomon Peachy 	u8	address4[6];
554aaad4303SSolomon Peachy 	u16	data_len; /* hfa384x (little endian) format */
55500b3ed16SGreg Kroah-Hartman 
55600b3ed16SGreg Kroah-Hartman 	/*-- 802.3 Header Information --*/
557aaad4303SSolomon Peachy 	u8	dest_addr[6];
558aaad4303SSolomon Peachy 	u8	src_addr[6];
559aaad4303SSolomon Peachy 	u16	data_length; /* IEEE? (big endian) format */
5609cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_rx_frame_t;
56100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
56200b3ed16SGreg Kroah-Hartman Communication Frames: Field Masks for Receive Frames
56300b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
56400b3ed16SGreg Kroah-Hartman 
56500b3ed16SGreg Kroah-Hartman /*-- Status Fields --*/
5667f6e0e44SMoritz Muehlenhoff #define		HFA384x_RXSTATUS_MACPORT		((u16)(BIT(10) | BIT(9) | BIT(8)))
5677f6e0e44SMoritz Muehlenhoff #define		HFA384x_RXSTATUS_FCSERR			((u16)BIT(0))
56800b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
56900b3ed16SGreg Kroah-Hartman Communication Frames: Test/Get/Set Field Values for Receive Frames
57000b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
571aaad4303SSolomon Peachy #define		HFA384x_RXSTATUS_MACPORT_GET(value)	((u16)((((u16)(value)) & HFA384x_RXSTATUS_MACPORT) >> 8))
572aaad4303SSolomon Peachy #define		HFA384x_RXSTATUS_ISFCSERR(value)	((u16)(((u16)(value)) & HFA384x_RXSTATUS_FCSERR))
57300b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
57400b3ed16SGreg Kroah-Hartman  FRAME STRUCTURES: Information Types and Information Frame Structures
57500b3ed16SGreg Kroah-Hartman ----------------------------------------------------------------------
57600b3ed16SGreg Kroah-Hartman Information Types
57700b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
578aaad4303SSolomon Peachy #define		HFA384x_IT_HANDOVERADDR			((u16)0xF000UL)
579aaad4303SSolomon Peachy #define		HFA384x_IT_COMMTALLIES			((u16)0xF100UL)
580aaad4303SSolomon Peachy #define		HFA384x_IT_SCANRESULTS			((u16)0xF101UL)
581aaad4303SSolomon Peachy #define		HFA384x_IT_CHINFORESULTS		((u16)0xF102UL)
582aaad4303SSolomon Peachy #define		HFA384x_IT_HOSTSCANRESULTS		((u16)0xF103UL)
583aaad4303SSolomon Peachy #define		HFA384x_IT_LINKSTATUS			((u16)0xF200UL)
584aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCSTATUS			((u16)0xF201UL)
585aaad4303SSolomon Peachy #define		HFA384x_IT_AUTHREQ			((u16)0xF202UL)
586aaad4303SSolomon Peachy #define		HFA384x_IT_PSUSERCNT			((u16)0xF203UL)
587aaad4303SSolomon Peachy #define		HFA384x_IT_KEYIDCHANGED			((u16)0xF204UL)
588aaad4303SSolomon Peachy #define		HFA384x_IT_ASSOCREQ    			((u16)0xF205UL)
589aaad4303SSolomon Peachy #define		HFA384x_IT_MICFAILURE  			((u16)0xF206UL)
59000b3ed16SGreg Kroah-Hartman 
59100b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
59200b3ed16SGreg Kroah-Hartman Information Frames Structures
59300b3ed16SGreg Kroah-Hartman ----------------------------------------------------------------------
59400b3ed16SGreg Kroah-Hartman Information Frames: Notification Frame Structures
59500b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
59600b3ed16SGreg Kroah-Hartman 
59700b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Communication Tallies --*/
59800b3ed16SGreg Kroah-Hartman typedef struct hfa384x_CommTallies16
59900b3ed16SGreg Kroah-Hartman {
600aaad4303SSolomon Peachy 	u16	txunicastframes;
601aaad4303SSolomon Peachy 	u16	txmulticastframes;
602aaad4303SSolomon Peachy 	u16	txfragments;
603aaad4303SSolomon Peachy 	u16	txunicastoctets;
604aaad4303SSolomon Peachy 	u16	txmulticastoctets;
605aaad4303SSolomon Peachy 	u16	txdeferredtrans;
606aaad4303SSolomon Peachy 	u16	txsingleretryframes;
607aaad4303SSolomon Peachy 	u16	txmultipleretryframes;
608aaad4303SSolomon Peachy 	u16	txretrylimitexceeded;
609aaad4303SSolomon Peachy 	u16	txdiscards;
610aaad4303SSolomon Peachy 	u16	rxunicastframes;
611aaad4303SSolomon Peachy 	u16	rxmulticastframes;
612aaad4303SSolomon Peachy 	u16	rxfragments;
613aaad4303SSolomon Peachy 	u16	rxunicastoctets;
614aaad4303SSolomon Peachy 	u16	rxmulticastoctets;
615aaad4303SSolomon Peachy 	u16	rxfcserrors;
616aaad4303SSolomon Peachy 	u16	rxdiscardsnobuffer;
617aaad4303SSolomon Peachy 	u16	txdiscardswrongsa;
618aaad4303SSolomon Peachy 	u16	rxdiscardswepundecr;
619aaad4303SSolomon Peachy 	u16	rxmsginmsgfrag;
620aaad4303SSolomon Peachy 	u16	rxmsginbadmsgfrag;
6219cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_CommTallies16_t;
62200b3ed16SGreg Kroah-Hartman 
62300b3ed16SGreg Kroah-Hartman typedef struct hfa384x_CommTallies32
62400b3ed16SGreg Kroah-Hartman {
625aaad4303SSolomon Peachy 	u32	txunicastframes;
626aaad4303SSolomon Peachy 	u32	txmulticastframes;
627aaad4303SSolomon Peachy 	u32	txfragments;
628aaad4303SSolomon Peachy 	u32	txunicastoctets;
629aaad4303SSolomon Peachy 	u32	txmulticastoctets;
630aaad4303SSolomon Peachy 	u32	txdeferredtrans;
631aaad4303SSolomon Peachy 	u32	txsingleretryframes;
632aaad4303SSolomon Peachy 	u32	txmultipleretryframes;
633aaad4303SSolomon Peachy 	u32	txretrylimitexceeded;
634aaad4303SSolomon Peachy 	u32	txdiscards;
635aaad4303SSolomon Peachy 	u32	rxunicastframes;
636aaad4303SSolomon Peachy 	u32	rxmulticastframes;
637aaad4303SSolomon Peachy 	u32	rxfragments;
638aaad4303SSolomon Peachy 	u32	rxunicastoctets;
639aaad4303SSolomon Peachy 	u32	rxmulticastoctets;
640aaad4303SSolomon Peachy 	u32	rxfcserrors;
641aaad4303SSolomon Peachy 	u32	rxdiscardsnobuffer;
642aaad4303SSolomon Peachy 	u32	txdiscardswrongsa;
643aaad4303SSolomon Peachy 	u32	rxdiscardswepundecr;
644aaad4303SSolomon Peachy 	u32	rxmsginmsgfrag;
645aaad4303SSolomon Peachy 	u32	rxmsginbadmsgfrag;
6469cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_CommTallies32_t;
64700b3ed16SGreg Kroah-Hartman 
64800b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Scan Results & Subfields--*/
64900b3ed16SGreg Kroah-Hartman typedef struct hfa384x_ScanResultSub
65000b3ed16SGreg Kroah-Hartman {
651aaad4303SSolomon Peachy 	u16	chid;
652aaad4303SSolomon Peachy 	u16	anl;
653aaad4303SSolomon Peachy 	u16	sl;
654aaad4303SSolomon Peachy 	u8	bssid[WLAN_BSSID_LEN];
655aaad4303SSolomon Peachy 	u16	bcnint;
656aaad4303SSolomon Peachy 	u16	capinfo;
65700b3ed16SGreg Kroah-Hartman 	hfa384x_bytestr32_t	ssid;
658aaad4303SSolomon Peachy 	u8	supprates[10]; /* 802.11 info element */
659aaad4303SSolomon Peachy 	u16	proberesp_rate;
6609cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_ScanResultSub_t;
66100b3ed16SGreg Kroah-Hartman 
66200b3ed16SGreg Kroah-Hartman typedef struct hfa384x_ScanResult
66300b3ed16SGreg Kroah-Hartman {
664aaad4303SSolomon Peachy 	u16	rsvd;
665aaad4303SSolomon Peachy 	u16	scanreason;
66600b3ed16SGreg Kroah-Hartman 	hfa384x_ScanResultSub_t
66700b3ed16SGreg Kroah-Hartman 		result[HFA384x_SCANRESULT_MAX];
6689cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_ScanResult_t;
66900b3ed16SGreg Kroah-Hartman 
67000b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
67100b3ed16SGreg Kroah-Hartman typedef struct hfa384x_ChInfoResultSub
67200b3ed16SGreg Kroah-Hartman {
673aaad4303SSolomon Peachy 	u16	chid;
674aaad4303SSolomon Peachy 	u16	anl;
675aaad4303SSolomon Peachy 	u16	pnl;
676aaad4303SSolomon Peachy 	u16	active;
6779cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_ChInfoResultSub_t;
67800b3ed16SGreg Kroah-Hartman 
6797f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_BSSACTIVE	BIT(0)
6807f6e0e44SMoritz Muehlenhoff #define HFA384x_CHINFORESULT_PCFACTIVE	BIT(1)
68100b3ed16SGreg Kroah-Hartman 
68200b3ed16SGreg Kroah-Hartman typedef struct hfa384x_ChInfoResult
68300b3ed16SGreg Kroah-Hartman {
684aaad4303SSolomon Peachy 	u16	scanchannels;
68500b3ed16SGreg Kroah-Hartman 	hfa384x_ChInfoResultSub_t
68600b3ed16SGreg Kroah-Hartman 		result[HFA384x_CHINFORESULT_MAX];
6879cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_ChInfoResult_t;
68800b3ed16SGreg Kroah-Hartman 
68900b3ed16SGreg Kroah-Hartman /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
69000b3ed16SGreg Kroah-Hartman typedef struct hfa384x_HScanResultSub
69100b3ed16SGreg Kroah-Hartman {
692aaad4303SSolomon Peachy 	u16	chid;
693aaad4303SSolomon Peachy 	u16	anl;
694aaad4303SSolomon Peachy 	u16	sl;
695aaad4303SSolomon Peachy 	u8	bssid[WLAN_BSSID_LEN];
696aaad4303SSolomon Peachy 	u16	bcnint;
697aaad4303SSolomon Peachy 	u16	capinfo;
69800b3ed16SGreg Kroah-Hartman 	hfa384x_bytestr32_t	ssid;
699aaad4303SSolomon Peachy 	u8	supprates[10]; /* 802.11 info element */
700aaad4303SSolomon Peachy 	u16	proberesp_rate;
701aaad4303SSolomon Peachy 	u16	atim;
7029cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_HScanResultSub_t;
70300b3ed16SGreg Kroah-Hartman 
70400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_HScanResult
70500b3ed16SGreg Kroah-Hartman {
706aaad4303SSolomon Peachy 	u16	nresult;
707aaad4303SSolomon Peachy 	u16	rsvd;
70800b3ed16SGreg Kroah-Hartman 	hfa384x_HScanResultSub_t
70900b3ed16SGreg Kroah-Hartman 		result[HFA384x_HSCANRESULT_MAX];
7109cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_HScanResult_t;
71100b3ed16SGreg Kroah-Hartman 
71200b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: LinkStatus --*/
71300b3ed16SGreg Kroah-Hartman 
714aaad4303SSolomon Peachy #define HFA384x_LINK_NOTCONNECTED	((u16)0)
715aaad4303SSolomon Peachy #define HFA384x_LINK_CONNECTED		((u16)1)
716aaad4303SSolomon Peachy #define HFA384x_LINK_DISCONNECTED	((u16)2)
717aaad4303SSolomon Peachy #define HFA384x_LINK_AP_CHANGE		((u16)3)
718aaad4303SSolomon Peachy #define HFA384x_LINK_AP_OUTOFRANGE	((u16)4)
719aaad4303SSolomon Peachy #define HFA384x_LINK_AP_INRANGE		((u16)5)
720aaad4303SSolomon Peachy #define HFA384x_LINK_ASSOCFAIL		((u16)6)
72100b3ed16SGreg Kroah-Hartman 
72200b3ed16SGreg Kroah-Hartman typedef struct hfa384x_LinkStatus
72300b3ed16SGreg Kroah-Hartman {
724aaad4303SSolomon Peachy 	u16	linkstatus;
7259cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_LinkStatus_t;
72600b3ed16SGreg Kroah-Hartman 
72700b3ed16SGreg Kroah-Hartman 
72800b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/
72900b3ed16SGreg Kroah-Hartman 
730aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_STAASSOC	((u16)1)
731aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_REASSOC	((u16)2)
732aaad4303SSolomon Peachy #define HFA384x_ASSOCSTATUS_AUTHFAIL	((u16)5)
73300b3ed16SGreg Kroah-Hartman 
73400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_AssocStatus
73500b3ed16SGreg Kroah-Hartman {
736aaad4303SSolomon Peachy 	u16	assocstatus;
73728b17a4bSMoritz Muehlenhoff 	u8	sta_addr[ETH_ALEN];
73800b3ed16SGreg Kroah-Hartman 	/* old_ap_addr is only valid if assocstatus == 2 */
73928b17a4bSMoritz Muehlenhoff 	u8	old_ap_addr[ETH_ALEN];
740aaad4303SSolomon Peachy 	u16	reason;
741aaad4303SSolomon Peachy 	u16	reserved;
7429cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_AssocStatus_t;
74300b3ed16SGreg Kroah-Hartman 
74400b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/
74500b3ed16SGreg Kroah-Hartman 
74600b3ed16SGreg Kroah-Hartman typedef struct hfa384x_AuthRequest
74700b3ed16SGreg Kroah-Hartman {
74828b17a4bSMoritz Muehlenhoff 	u8	sta_addr[ETH_ALEN];
749aaad4303SSolomon Peachy 	u16	algorithm;
7509cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_AuthReq_t;
75100b3ed16SGreg Kroah-Hartman 
75200b3ed16SGreg Kroah-Hartman /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
75300b3ed16SGreg Kroah-Hartman 
75400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_PSUserCount
75500b3ed16SGreg Kroah-Hartman {
756aaad4303SSolomon Peachy 	u16	usercnt;
7579cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_PSUserCount_t;
75800b3ed16SGreg Kroah-Hartman 
75900b3ed16SGreg Kroah-Hartman typedef struct hfa384x_KeyIDChanged
76000b3ed16SGreg Kroah-Hartman {
76128b17a4bSMoritz Muehlenhoff 	u8	sta_addr[ETH_ALEN];
762aaad4303SSolomon Peachy 	u16	keyid;
7639cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_KeyIDChanged_t;
76400b3ed16SGreg Kroah-Hartman 
76500b3ed16SGreg Kroah-Hartman /*--  Collection of all Inf frames ---------------*/
76600b3ed16SGreg Kroah-Hartman typedef union hfa384x_infodata {
76700b3ed16SGreg Kroah-Hartman 	hfa384x_CommTallies16_t	commtallies16;
76800b3ed16SGreg Kroah-Hartman 	hfa384x_CommTallies32_t	commtallies32;
76900b3ed16SGreg Kroah-Hartman 	hfa384x_ScanResult_t	scanresult;
77000b3ed16SGreg Kroah-Hartman 	hfa384x_ChInfoResult_t	chinforesult;
77100b3ed16SGreg Kroah-Hartman 	hfa384x_HScanResult_t	hscanresult;
77200b3ed16SGreg Kroah-Hartman 	hfa384x_LinkStatus_t	linkstatus;
77300b3ed16SGreg Kroah-Hartman 	hfa384x_AssocStatus_t	assocstatus;
77400b3ed16SGreg Kroah-Hartman 	hfa384x_AuthReq_t	authreq;
77500b3ed16SGreg Kroah-Hartman 	hfa384x_PSUserCount_t	psusercnt;
77600b3ed16SGreg Kroah-Hartman 	hfa384x_KeyIDChanged_t  keyidchanged;
7779cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_infodata_t;
77800b3ed16SGreg Kroah-Hartman 
77900b3ed16SGreg Kroah-Hartman typedef struct hfa384x_InfFrame
78000b3ed16SGreg Kroah-Hartman {
781aaad4303SSolomon Peachy 	u16			framelen;
782aaad4303SSolomon Peachy 	u16			infotype;
78300b3ed16SGreg Kroah-Hartman 	hfa384x_infodata_t	info;
7849cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_InfFrame_t;
78500b3ed16SGreg Kroah-Hartman 
78600b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
78700b3ed16SGreg Kroah-Hartman USB Packet structures and constants.
78800b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
78900b3ed16SGreg Kroah-Hartman 
79000b3ed16SGreg Kroah-Hartman /* Should be sent to the bulkout endpoint */
79100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_TXFRM	0
79200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDREQ	1
79300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDREQ	2
79400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDREQ	3
79500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMREQ	4
79600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMREQ	5
79700b3ed16SGreg Kroah-Hartman 
79800b3ed16SGreg Kroah-Hartman /* Received from the bulkin endpoint */
79900b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISTXFRM(a)	(((a) & 0x9000) == 0x1000)
80000b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ISRXFRM(a)	(!((a) & 0x9000))
80100b3ed16SGreg Kroah-Hartman #define HFA384x_USB_INFOFRM	0x8000
80200b3ed16SGreg Kroah-Hartman #define HFA384x_USB_CMDRESP	0x8001
80300b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WRIDRESP	0x8002
80400b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RRIDRESP	0x8003
80500b3ed16SGreg Kroah-Hartman #define HFA384x_USB_WMEMRESP	0x8004
80600b3ed16SGreg Kroah-Hartman #define HFA384x_USB_RMEMRESP	0x8005
80700b3ed16SGreg Kroah-Hartman #define HFA384x_USB_BUFAVAIL	0x8006
80800b3ed16SGreg Kroah-Hartman #define HFA384x_USB_ERROR	0x8007
80900b3ed16SGreg Kroah-Hartman 
81000b3ed16SGreg Kroah-Hartman /*------------------------------------*/
81100b3ed16SGreg Kroah-Hartman /* Request (bulk OUT) packet contents */
81200b3ed16SGreg Kroah-Hartman 
81300b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_txfrm {
81400b3ed16SGreg Kroah-Hartman 	hfa384x_tx_frame_t	desc;
815aaad4303SSolomon Peachy 	u8			data[WLAN_DATA_MAXLEN];
8169cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_txfrm_t;
81700b3ed16SGreg Kroah-Hartman 
81800b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_cmdreq {
819aaad4303SSolomon Peachy 	u16		type;
820aaad4303SSolomon Peachy 	u16		cmd;
821aaad4303SSolomon Peachy 	u16		parm0;
822aaad4303SSolomon Peachy 	u16		parm1;
823aaad4303SSolomon Peachy 	u16		parm2;
824aaad4303SSolomon Peachy 	u8		pad[54];
8259cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_cmdreq_t;
82600b3ed16SGreg Kroah-Hartman 
82700b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_wridreq {
828aaad4303SSolomon Peachy 	u16		type;
829aaad4303SSolomon Peachy 	u16		frmlen;
830aaad4303SSolomon Peachy 	u16		rid;
831aaad4303SSolomon Peachy 	u8		data[HFA384x_RIDDATA_MAXLEN];
8329cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_wridreq_t;
83300b3ed16SGreg Kroah-Hartman 
83400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rridreq {
835aaad4303SSolomon Peachy 	u16		type;
836aaad4303SSolomon Peachy 	u16		frmlen;
837aaad4303SSolomon Peachy 	u16		rid;
838aaad4303SSolomon Peachy 	u8		pad[58];
8399cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_rridreq_t;
84000b3ed16SGreg Kroah-Hartman 
84100b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_wmemreq {
842aaad4303SSolomon Peachy 	u16		type;
843aaad4303SSolomon Peachy 	u16		frmlen;
844aaad4303SSolomon Peachy 	u16		offset;
845aaad4303SSolomon Peachy 	u16		page;
846aaad4303SSolomon Peachy 	u8		data[HFA384x_USB_RWMEM_MAXLEN];
8479cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_wmemreq_t;
84800b3ed16SGreg Kroah-Hartman 
84900b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rmemreq {
850aaad4303SSolomon Peachy 	u16		type;
851aaad4303SSolomon Peachy 	u16		frmlen;
852aaad4303SSolomon Peachy 	u16		offset;
853aaad4303SSolomon Peachy 	u16		page;
854aaad4303SSolomon Peachy 	u8		pad[56];
8559cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_rmemreq_t;
85600b3ed16SGreg Kroah-Hartman 
85700b3ed16SGreg Kroah-Hartman /*------------------------------------*/
85800b3ed16SGreg Kroah-Hartman /* Response (bulk IN) packet contents */
85900b3ed16SGreg Kroah-Hartman 
86000b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rxfrm {
86100b3ed16SGreg Kroah-Hartman 	hfa384x_rx_frame_t	desc;
862aaad4303SSolomon Peachy 	u8			data[WLAN_DATA_MAXLEN];
8639cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_rxfrm_t;
86400b3ed16SGreg Kroah-Hartman 
86500b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_infofrm {
866aaad4303SSolomon Peachy 	u16			type;
86700b3ed16SGreg Kroah-Hartman 	hfa384x_InfFrame_t	info;
8689cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_infofrm_t;
86900b3ed16SGreg Kroah-Hartman 
87000b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_statusresp {
871aaad4303SSolomon Peachy 	u16		type;
872aaad4303SSolomon Peachy 	u16		status;
873aaad4303SSolomon Peachy 	u16		resp0;
874aaad4303SSolomon Peachy 	u16		resp1;
875aaad4303SSolomon Peachy 	u16		resp2;
8769cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_cmdresp_t;
87700b3ed16SGreg Kroah-Hartman 
87800b3ed16SGreg Kroah-Hartman typedef hfa384x_usb_cmdresp_t hfa384x_usb_wridresp_t;
87900b3ed16SGreg Kroah-Hartman 
88000b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rridresp {
881aaad4303SSolomon Peachy 	u16		type;
882aaad4303SSolomon Peachy 	u16		frmlen;
883aaad4303SSolomon Peachy 	u16		rid;
884aaad4303SSolomon Peachy 	u8		data[HFA384x_RIDDATA_MAXLEN];
8859cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_rridresp_t;
88600b3ed16SGreg Kroah-Hartman 
88700b3ed16SGreg Kroah-Hartman typedef hfa384x_usb_cmdresp_t hfa384x_usb_wmemresp_t;
88800b3ed16SGreg Kroah-Hartman 
88900b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_rmemresp {
890aaad4303SSolomon Peachy 	u16		type;
891aaad4303SSolomon Peachy 	u16		frmlen;
892aaad4303SSolomon Peachy 	u8		data[HFA384x_USB_RWMEM_MAXLEN];
8939cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_rmemresp_t;
89400b3ed16SGreg Kroah-Hartman 
89500b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_bufavail {
896aaad4303SSolomon Peachy 	u16		type;
897aaad4303SSolomon Peachy 	u16		frmlen;
8989cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_bufavail_t;
89900b3ed16SGreg Kroah-Hartman 
90000b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usb_error {
901aaad4303SSolomon Peachy 	u16		type;
902aaad4303SSolomon Peachy 	u16		errortype;
9039cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usb_error_t;
90400b3ed16SGreg Kroah-Hartman 
90500b3ed16SGreg Kroah-Hartman /*----------------------------------------------------------*/
90600b3ed16SGreg Kroah-Hartman /* Unions for packaging all the known packet types together */
90700b3ed16SGreg Kroah-Hartman 
90800b3ed16SGreg Kroah-Hartman typedef union hfa384x_usbout {
909aaad4303SSolomon Peachy 	u16			type;
91000b3ed16SGreg Kroah-Hartman 	hfa384x_usb_txfrm_t	txfrm;
91100b3ed16SGreg Kroah-Hartman 	hfa384x_usb_cmdreq_t	cmdreq;
91200b3ed16SGreg Kroah-Hartman 	hfa384x_usb_wridreq_t	wridreq;
91300b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rridreq_t	rridreq;
91400b3ed16SGreg Kroah-Hartman 	hfa384x_usb_wmemreq_t	wmemreq;
91500b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rmemreq_t	rmemreq;
9169cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usbout_t;
91700b3ed16SGreg Kroah-Hartman 
91800b3ed16SGreg Kroah-Hartman typedef union hfa384x_usbin {
919aaad4303SSolomon Peachy 	u16			type;
92000b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rxfrm_t	rxfrm;
92100b3ed16SGreg Kroah-Hartman 	hfa384x_usb_txfrm_t	txfrm;
92200b3ed16SGreg Kroah-Hartman 	hfa384x_usb_infofrm_t	infofrm;
92300b3ed16SGreg Kroah-Hartman 	hfa384x_usb_cmdresp_t	cmdresp;
92400b3ed16SGreg Kroah-Hartman 	hfa384x_usb_wridresp_t	wridresp;
92500b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rridresp_t	rridresp;
92600b3ed16SGreg Kroah-Hartman 	hfa384x_usb_wmemresp_t	wmemresp;
92700b3ed16SGreg Kroah-Hartman 	hfa384x_usb_rmemresp_t	rmemresp;
92800b3ed16SGreg Kroah-Hartman 	hfa384x_usb_bufavail_t	bufavail;
92900b3ed16SGreg Kroah-Hartman 	hfa384x_usb_error_t	usberror;
930aaad4303SSolomon Peachy 	u8			boguspad[3000];
9319cba46dcSMoritz Muehlenhoff } __attribute__((packed)) hfa384x_usbin_t;
93200b3ed16SGreg Kroah-Hartman 
93300b3ed16SGreg Kroah-Hartman 
93400b3ed16SGreg Kroah-Hartman #ifdef __KERNEL__
93500b3ed16SGreg Kroah-Hartman /*--------------------------------------------------------------------
93600b3ed16SGreg Kroah-Hartman ---  MAC state structure, argument to all functions --
93700b3ed16SGreg Kroah-Hartman ---  Also, a collection of support types --
93800b3ed16SGreg Kroah-Hartman --------------------------------------------------------------------*/
93900b3ed16SGreg Kroah-Hartman typedef struct hfa384x_statusresult
94000b3ed16SGreg Kroah-Hartman {
941aaad4303SSolomon Peachy 	u16	status;
942aaad4303SSolomon Peachy 	u16	resp0;
943aaad4303SSolomon Peachy 	u16	resp1;
944aaad4303SSolomon Peachy 	u16	resp2;
94500b3ed16SGreg Kroah-Hartman } hfa384x_cmdresult_t;
94600b3ed16SGreg Kroah-Hartman 
94700b3ed16SGreg Kroah-Hartman /* USB Control Exchange (CTLX):
94800b3ed16SGreg Kroah-Hartman  *  A queue of the structure below is maintained for all of the
94900b3ed16SGreg Kroah-Hartman  *  Request/Response type USB packets supported by Prism2.
95000b3ed16SGreg Kroah-Hartman  */
95100b3ed16SGreg Kroah-Hartman /* The following hfa384x_* structures are arguments to
95200b3ed16SGreg Kroah-Hartman  * the usercb() for the different CTLX types.
95300b3ed16SGreg Kroah-Hartman  */
95400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_rridresult
95500b3ed16SGreg Kroah-Hartman {
956aaad4303SSolomon Peachy 	u16		rid;
95700b3ed16SGreg Kroah-Hartman 	const void	*riddata;
958aaad4303SSolomon Peachy 	unsigned int		riddata_len;
95900b3ed16SGreg Kroah-Hartman } hfa384x_rridresult_t;
96000b3ed16SGreg Kroah-Hartman 
96100b3ed16SGreg Kroah-Hartman enum ctlx_state {
96200b3ed16SGreg Kroah-Hartman 	CTLX_START = 0,	/* Start state, not queued */
96300b3ed16SGreg Kroah-Hartman 
96400b3ed16SGreg Kroah-Hartman 	CTLX_COMPLETE,	/* CTLX successfully completed */
96500b3ed16SGreg Kroah-Hartman 	CTLX_REQ_FAILED,	/* OUT URB completed w/ error */
96600b3ed16SGreg Kroah-Hartman 
96700b3ed16SGreg Kroah-Hartman 	CTLX_PENDING,		/* Queued, data valid */
96800b3ed16SGreg Kroah-Hartman 	CTLX_REQ_SUBMITTED,	/* OUT URB submitted */
96900b3ed16SGreg Kroah-Hartman 	CTLX_REQ_COMPLETE,	/* OUT URB complete */
97000b3ed16SGreg Kroah-Hartman 	CTLX_RESP_COMPLETE	/* IN URB received */
97100b3ed16SGreg Kroah-Hartman };
97200b3ed16SGreg Kroah-Hartman typedef enum ctlx_state  CTLX_STATE;
97300b3ed16SGreg Kroah-Hartman 
97400b3ed16SGreg Kroah-Hartman struct hfa384x_usbctlx;
97500b3ed16SGreg Kroah-Hartman struct hfa384x;
97600b3ed16SGreg Kroah-Hartman 
97700b3ed16SGreg Kroah-Hartman typedef void (*ctlx_cmdcb_t)( struct hfa384x*, const struct hfa384x_usbctlx* );
97800b3ed16SGreg Kroah-Hartman 
97900b3ed16SGreg Kroah-Hartman typedef void (*ctlx_usercb_t)(
98000b3ed16SGreg Kroah-Hartman 	struct hfa384x	*hw,
98100b3ed16SGreg Kroah-Hartman 	void		*ctlxresult,
98200b3ed16SGreg Kroah-Hartman 	void		*usercb_data);
98300b3ed16SGreg Kroah-Hartman 
98400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usbctlx
98500b3ed16SGreg Kroah-Hartman {
98600b3ed16SGreg Kroah-Hartman 	struct list_head	list;
98700b3ed16SGreg Kroah-Hartman 
98800b3ed16SGreg Kroah-Hartman 	size_t			outbufsize;
98900b3ed16SGreg Kroah-Hartman 	hfa384x_usbout_t	outbuf;		/* pkt buf for OUT */
99000b3ed16SGreg Kroah-Hartman 	hfa384x_usbin_t		inbuf;		/* pkt buf for IN(a copy) */
99100b3ed16SGreg Kroah-Hartman 
99200b3ed16SGreg Kroah-Hartman 	CTLX_STATE		state;		/* Tracks running state */
99300b3ed16SGreg Kroah-Hartman 
99400b3ed16SGreg Kroah-Hartman 	struct completion	done;
99500b3ed16SGreg Kroah-Hartman 	volatile int		reapable;	/* Food for the reaper task */
99600b3ed16SGreg Kroah-Hartman 
99700b3ed16SGreg Kroah-Hartman 	ctlx_cmdcb_t		cmdcb;		/* Async command callback */
99800b3ed16SGreg Kroah-Hartman 	ctlx_usercb_t		usercb;		/* Async user callback, */
99900b3ed16SGreg Kroah-Hartman 	void			*usercb_data;	/*  at CTLX completion  */
100000b3ed16SGreg Kroah-Hartman 
100100b3ed16SGreg Kroah-Hartman 	int			variant;	/* Identifies cmd variant */
100200b3ed16SGreg Kroah-Hartman } hfa384x_usbctlx_t;
100300b3ed16SGreg Kroah-Hartman 
100400b3ed16SGreg Kroah-Hartman typedef struct hfa384x_usbctlxq
100500b3ed16SGreg Kroah-Hartman {
100600b3ed16SGreg Kroah-Hartman 	spinlock_t		lock;
100700b3ed16SGreg Kroah-Hartman 	struct list_head	pending;
100800b3ed16SGreg Kroah-Hartman 	struct list_head	active;
100900b3ed16SGreg Kroah-Hartman 	struct list_head	completing;
101000b3ed16SGreg Kroah-Hartman 	struct list_head	reapable;
101100b3ed16SGreg Kroah-Hartman } hfa384x_usbctlxq_t;
101200b3ed16SGreg Kroah-Hartman 
101300b3ed16SGreg Kroah-Hartman typedef struct hfa484x_metacmd
101400b3ed16SGreg Kroah-Hartman {
1015aaad4303SSolomon Peachy 	u16		cmd;
101600b3ed16SGreg Kroah-Hartman 
1017aaad4303SSolomon Peachy 	u16          parm0;
1018aaad4303SSolomon Peachy 	u16          parm1;
1019aaad4303SSolomon Peachy 	u16          parm2;
102000b3ed16SGreg Kroah-Hartman 
102100b3ed16SGreg Kroah-Hartman 	hfa384x_cmdresult_t result;
102200b3ed16SGreg Kroah-Hartman } hfa384x_metacmd_t;
102300b3ed16SGreg Kroah-Hartman 
102400b3ed16SGreg Kroah-Hartman #define	MAX_GRP_ADDR		32
102500b3ed16SGreg Kroah-Hartman #define WLAN_COMMENT_MAX	80  /* Max. length of user comment string. */
102600b3ed16SGreg Kroah-Hartman 
102700b3ed16SGreg Kroah-Hartman #define WLAN_AUTH_MAX           60  /* Max. # of authenticated stations. */
102800b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_MAX		60  /* Max. # of stations in an access list. */
102900b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_NONE	0   /* No stations may be authenticated. */
103000b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALL		1   /* All stations may be authenticated. */
103100b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_ALLOW	2   /* Authenticate only "allowed" stations. */
103200b3ed16SGreg Kroah-Hartman #define WLAN_ACCESS_DENY	3   /* Do not authenticate "denied" stations. */
103300b3ed16SGreg Kroah-Hartman 
103400b3ed16SGreg Kroah-Hartman /* XXX These are going away ASAP */
103500b3ed16SGreg Kroah-Hartman typedef struct prism2sta_authlist
103600b3ed16SGreg Kroah-Hartman {
1037aaad4303SSolomon Peachy 	unsigned int	cnt;
103828b17a4bSMoritz Muehlenhoff 	u8	addr[WLAN_AUTH_MAX][ETH_ALEN];
1039aaad4303SSolomon Peachy 	u8	assoc[WLAN_AUTH_MAX];
104000b3ed16SGreg Kroah-Hartman } prism2sta_authlist_t;
104100b3ed16SGreg Kroah-Hartman 
104200b3ed16SGreg Kroah-Hartman typedef struct prism2sta_accesslist
104300b3ed16SGreg Kroah-Hartman {
1044aaad4303SSolomon Peachy 	unsigned int	modify;
1045aaad4303SSolomon Peachy 	unsigned int	cnt;
104628b17a4bSMoritz Muehlenhoff 	u8	addr[WLAN_ACCESS_MAX][ETH_ALEN];
1047aaad4303SSolomon Peachy 	unsigned int	cnt1;
104828b17a4bSMoritz Muehlenhoff 	u8	addr1[WLAN_ACCESS_MAX][ETH_ALEN];
104900b3ed16SGreg Kroah-Hartman } prism2sta_accesslist_t;
105000b3ed16SGreg Kroah-Hartman 
105100b3ed16SGreg Kroah-Hartman typedef struct hfa384x
105200b3ed16SGreg Kroah-Hartman {
105300b3ed16SGreg Kroah-Hartman 	/* USB support data */
105400b3ed16SGreg Kroah-Hartman 	struct usb_device	*usb;
105500b3ed16SGreg Kroah-Hartman 	struct urb		rx_urb;
105600b3ed16SGreg Kroah-Hartman 	struct sk_buff		*rx_urb_skb;
105700b3ed16SGreg Kroah-Hartman 	struct urb		tx_urb;
105800b3ed16SGreg Kroah-Hartman 	struct urb		ctlx_urb;
105900b3ed16SGreg Kroah-Hartman 	hfa384x_usbout_t	txbuff;
106000b3ed16SGreg Kroah-Hartman 	hfa384x_usbctlxq_t	ctlxq;
106100b3ed16SGreg Kroah-Hartman 	struct timer_list	reqtimer;
106200b3ed16SGreg Kroah-Hartman 	struct timer_list	resptimer;
106300b3ed16SGreg Kroah-Hartman 
106400b3ed16SGreg Kroah-Hartman 	struct timer_list	throttle;
106500b3ed16SGreg Kroah-Hartman 
106600b3ed16SGreg Kroah-Hartman 	struct tasklet_struct	reaper_bh;
106700b3ed16SGreg Kroah-Hartman 	struct tasklet_struct	completion_bh;
106800b3ed16SGreg Kroah-Hartman 
106900b3ed16SGreg Kroah-Hartman 	struct work_struct	usb_work;
107000b3ed16SGreg Kroah-Hartman 
107100b3ed16SGreg Kroah-Hartman 	unsigned long		usb_flags;
107200b3ed16SGreg Kroah-Hartman #define THROTTLE_RX	0
107300b3ed16SGreg Kroah-Hartman #define THROTTLE_TX	1
107400b3ed16SGreg Kroah-Hartman #define WORK_RX_HALT	2
107500b3ed16SGreg Kroah-Hartman #define WORK_TX_HALT	3
107600b3ed16SGreg Kroah-Hartman #define WORK_RX_RESUME	4
107700b3ed16SGreg Kroah-Hartman #define WORK_TX_RESUME	5
107800b3ed16SGreg Kroah-Hartman 
107900b3ed16SGreg Kroah-Hartman 	unsigned short		req_timer_done:1;
108000b3ed16SGreg Kroah-Hartman 	unsigned short		resp_timer_done:1;
108100b3ed16SGreg Kroah-Hartman 
108200b3ed16SGreg Kroah-Hartman 	int                     endp_in;
108300b3ed16SGreg Kroah-Hartman 	int                     endp_out;
108400b3ed16SGreg Kroah-Hartman 
108500b3ed16SGreg Kroah-Hartman 	int                     sniff_fcs;
108600b3ed16SGreg Kroah-Hartman 	int                     sniff_channel;
108700b3ed16SGreg Kroah-Hartman 	int                     sniff_truncate;
108800b3ed16SGreg Kroah-Hartman 	int                     sniffhdr;
108900b3ed16SGreg Kroah-Hartman 
109000b3ed16SGreg Kroah-Hartman 	wait_queue_head_t cmdq;	        /* wait queue itself */
109100b3ed16SGreg Kroah-Hartman 
109200b3ed16SGreg Kroah-Hartman 	/* Controller state */
1093aaad4303SSolomon Peachy 	u32		state;
1094aaad4303SSolomon Peachy 	u32		isap;
1095aaad4303SSolomon Peachy 	u8		port_enabled[HFA384x_NUMPORTS_MAX];
109600b3ed16SGreg Kroah-Hartman 
109700b3ed16SGreg Kroah-Hartman 	/* Download support */
1098aaad4303SSolomon Peachy 	unsigned int				dlstate;
109900b3ed16SGreg Kroah-Hartman 	hfa384x_downloadbuffer_t	bufinfo;
1100aaad4303SSolomon Peachy 	u16				dltimeout;
110100b3ed16SGreg Kroah-Hartman 
110200b3ed16SGreg Kroah-Hartman 	int                          scanflag;    /* to signal scan comlete */
110300b3ed16SGreg Kroah-Hartman 	int                          join_ap;        /* are we joined to a specific ap */
110400b3ed16SGreg Kroah-Hartman 	int                          join_retries;   /* number of join retries till we fail */
110500b3ed16SGreg Kroah-Hartman 	hfa384x_JoinRequest_data_t   joinreq;        /* join request saved data */
110600b3ed16SGreg Kroah-Hartman 
110700b3ed16SGreg Kroah-Hartman 	wlandevice_t            *wlandev;
110800b3ed16SGreg Kroah-Hartman 	/* Timer to allow for the deferred processing of linkstatus messages */
110900b3ed16SGreg Kroah-Hartman 	struct work_struct 	link_bh;
111000b3ed16SGreg Kroah-Hartman 
111100b3ed16SGreg Kroah-Hartman         struct work_struct      commsqual_bh;
111200b3ed16SGreg Kroah-Hartman 	hfa384x_commsquality_t  qual;
111300b3ed16SGreg Kroah-Hartman 	struct timer_list	commsqual_timer;
111400b3ed16SGreg Kroah-Hartman 
1115aaad4303SSolomon Peachy 	u16 link_status;
1116aaad4303SSolomon Peachy 	u16 link_status_new;
111700b3ed16SGreg Kroah-Hartman 	struct sk_buff_head        authq;
111800b3ed16SGreg Kroah-Hartman 
111900b3ed16SGreg Kroah-Hartman 	/* And here we have stuff that used to be in priv */
112000b3ed16SGreg Kroah-Hartman 
112100b3ed16SGreg Kroah-Hartman 	/* State variables */
1122aaad4303SSolomon Peachy 	unsigned int		presniff_port_type;
1123aaad4303SSolomon Peachy 	u16		presniff_wepflags;
1124aaad4303SSolomon Peachy 	u32		dot11_desired_bss_type;
112500b3ed16SGreg Kroah-Hartman 
112600b3ed16SGreg Kroah-Hartman 	int             dbmadjust;
112700b3ed16SGreg Kroah-Hartman 
112800b3ed16SGreg Kroah-Hartman 	/* Group Addresses - right now, there are up to a total
112900b3ed16SGreg Kroah-Hartman 	of MAX_GRP_ADDR group addresses */
113028b17a4bSMoritz Muehlenhoff 	u8		dot11_grp_addr[MAX_GRP_ADDR][ETH_ALEN];
1131aaad4303SSolomon Peachy 	unsigned int		dot11_grpcnt;
113200b3ed16SGreg Kroah-Hartman 
113300b3ed16SGreg Kroah-Hartman 	/* Component Identities */
113400b3ed16SGreg Kroah-Hartman 	hfa384x_compident_t	ident_nic;
113500b3ed16SGreg Kroah-Hartman 	hfa384x_compident_t	ident_pri_fw;
113600b3ed16SGreg Kroah-Hartman 	hfa384x_compident_t	ident_sta_fw;
113700b3ed16SGreg Kroah-Hartman 	hfa384x_compident_t	ident_ap_fw;
1138aaad4303SSolomon Peachy 	u16			mm_mods;
113900b3ed16SGreg Kroah-Hartman 
114000b3ed16SGreg Kroah-Hartman 	/* Supplier compatibility ranges */
114100b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_sup_mfi;
114200b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_sup_cfi;
114300b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_sup_pri;
114400b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_sup_sta;
114500b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_sup_ap;
114600b3ed16SGreg Kroah-Hartman 
114700b3ed16SGreg Kroah-Hartman 	/* Actor compatibility ranges */
114800b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_act_pri_cfi; /* pri f/w to controller interface */
114900b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_act_sta_cfi; /* sta f/w to controller interface */
115000b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_act_sta_mfi; /* sta f/w to modem interface */
115100b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_act_ap_cfi;  /* ap f/w to controller interface */
115200b3ed16SGreg Kroah-Hartman 	hfa384x_caplevel_t	cap_act_ap_mfi;  /* ap f/w to modem interface */
115300b3ed16SGreg Kroah-Hartman 
1154aaad4303SSolomon Peachy 	u32			psusercount;  /* Power save user count. */
115500b3ed16SGreg Kroah-Hartman 	hfa384x_CommTallies32_t	tallies;      /* Communication tallies. */
1156aaad4303SSolomon Peachy 	u8			comment[WLAN_COMMENT_MAX+1]; /* User comment */
115700b3ed16SGreg Kroah-Hartman 
115800b3ed16SGreg Kroah-Hartman 	/* Channel Info request results (AP only) */
115900b3ed16SGreg Kroah-Hartman 	struct {
116000b3ed16SGreg Kroah-Hartman 		atomic_t		done;
1161aaad4303SSolomon Peachy 		u8			count;
116200b3ed16SGreg Kroah-Hartman 		hfa384x_ChInfoResult_t	results;
116300b3ed16SGreg Kroah-Hartman 	} channel_info;
116400b3ed16SGreg Kroah-Hartman 
116500b3ed16SGreg Kroah-Hartman 	hfa384x_InfFrame_t      *scanresults;
116600b3ed16SGreg Kroah-Hartman 
116700b3ed16SGreg Kroah-Hartman 
116800b3ed16SGreg Kroah-Hartman         prism2sta_authlist_t	authlist;     /* Authenticated station list. */
1169aaad4303SSolomon Peachy 	unsigned int			accessmode;   /* Access mode. */
117000b3ed16SGreg Kroah-Hartman         prism2sta_accesslist_t	allow;        /* Allowed station list. */
117100b3ed16SGreg Kroah-Hartman         prism2sta_accesslist_t	deny;         /* Denied station list. */
117200b3ed16SGreg Kroah-Hartman 
117300b3ed16SGreg Kroah-Hartman } hfa384x_t;
117400b3ed16SGreg Kroah-Hartman 
117500b3ed16SGreg Kroah-Hartman /*=============================================================*/
117600b3ed16SGreg Kroah-Hartman /*--- Function Declarations -----------------------------------*/
117700b3ed16SGreg Kroah-Hartman /*=============================================================*/
117800b3ed16SGreg Kroah-Hartman void
117900b3ed16SGreg Kroah-Hartman hfa384x_create(
118000b3ed16SGreg Kroah-Hartman 	hfa384x_t *hw,
118100b3ed16SGreg Kroah-Hartman 	struct usb_device *usb);
118200b3ed16SGreg Kroah-Hartman 
118300b3ed16SGreg Kroah-Hartman void hfa384x_destroy(hfa384x_t *hw);
118400b3ed16SGreg Kroah-Hartman 
118500b3ed16SGreg Kroah-Hartman int
118600b3ed16SGreg Kroah-Hartman hfa384x_corereset( hfa384x_t *hw, int holdtime, int settletime, int genesis);
118700b3ed16SGreg Kroah-Hartman int
118800b3ed16SGreg Kroah-Hartman hfa384x_drvr_commtallies( hfa384x_t *hw);
118900b3ed16SGreg Kroah-Hartman int
1190aaad4303SSolomon Peachy hfa384x_drvr_disable(hfa384x_t *hw, u16 macport);
119100b3ed16SGreg Kroah-Hartman int
1192aaad4303SSolomon Peachy hfa384x_drvr_enable(hfa384x_t *hw, u16 macport);
119300b3ed16SGreg Kroah-Hartman int
119400b3ed16SGreg Kroah-Hartman hfa384x_drvr_flashdl_enable(hfa384x_t *hw);
119500b3ed16SGreg Kroah-Hartman int
119600b3ed16SGreg Kroah-Hartman hfa384x_drvr_flashdl_disable(hfa384x_t *hw);
119700b3ed16SGreg Kroah-Hartman int
1198aaad4303SSolomon Peachy hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void* buf, u32 len);
119900b3ed16SGreg Kroah-Hartman int
1200aaad4303SSolomon Peachy hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len);
120100b3ed16SGreg Kroah-Hartman int
1202aaad4303SSolomon Peachy hfa384x_drvr_handover( hfa384x_t *hw, u8 *addr);
120300b3ed16SGreg Kroah-Hartman int
1204aaad4303SSolomon Peachy hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr);
120500b3ed16SGreg Kroah-Hartman int
120600b3ed16SGreg Kroah-Hartman hfa384x_drvr_ramdl_disable(hfa384x_t *hw);
120700b3ed16SGreg Kroah-Hartman int
1208aaad4303SSolomon Peachy hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void* buf, u32 len);
120900b3ed16SGreg Kroah-Hartman int
1210aaad4303SSolomon Peachy hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len);
121100b3ed16SGreg Kroah-Hartman 
121200b3ed16SGreg Kroah-Hartman int
1213aaad4303SSolomon Peachy hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len);
121400b3ed16SGreg Kroah-Hartman 
121500b3ed16SGreg Kroah-Hartman static inline int
1216aaad4303SSolomon Peachy hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val)
121700b3ed16SGreg Kroah-Hartman {
121800b3ed16SGreg Kroah-Hartman 	int		result = 0;
1219aaad4303SSolomon Peachy 	result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
122000b3ed16SGreg Kroah-Hartman 	if ( result == 0 ) {
1221aaad4303SSolomon Peachy 		*((u16*)val) = hfa384x2host_16(*((u16*)val));
122200b3ed16SGreg Kroah-Hartman 	}
122300b3ed16SGreg Kroah-Hartman 	return result;
122400b3ed16SGreg Kroah-Hartman }
122500b3ed16SGreg Kroah-Hartman 
122600b3ed16SGreg Kroah-Hartman static inline int
1227aaad4303SSolomon Peachy hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val)
122800b3ed16SGreg Kroah-Hartman {
1229aaad4303SSolomon Peachy 	u16 value = host2hfa384x_16(val);
123000b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
123100b3ed16SGreg Kroah-Hartman }
123200b3ed16SGreg Kroah-Hartman 
123300b3ed16SGreg Kroah-Hartman int
123400b3ed16SGreg Kroah-Hartman hfa384x_drvr_getconfig_async(hfa384x_t     *hw,
1235aaad4303SSolomon Peachy                               u16        rid,
123600b3ed16SGreg Kroah-Hartman                               ctlx_usercb_t usercb,
123700b3ed16SGreg Kroah-Hartman                               void          *usercb_data);
123800b3ed16SGreg Kroah-Hartman 
123900b3ed16SGreg Kroah-Hartman int
124000b3ed16SGreg Kroah-Hartman hfa384x_drvr_setconfig_async(hfa384x_t *hw,
1241aaad4303SSolomon Peachy                               u16 rid,
124200b3ed16SGreg Kroah-Hartman                               void *buf,
1243aaad4303SSolomon Peachy                               u16 len,
124400b3ed16SGreg Kroah-Hartman                               ctlx_usercb_t usercb,
124500b3ed16SGreg Kroah-Hartman                               void *usercb_data);
124600b3ed16SGreg Kroah-Hartman 
124700b3ed16SGreg Kroah-Hartman static inline int
1248aaad4303SSolomon Peachy hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val)
124900b3ed16SGreg Kroah-Hartman {
1250aaad4303SSolomon Peachy 	u16 value = host2hfa384x_16(val);
125100b3ed16SGreg Kroah-Hartman 	return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
125200b3ed16SGreg Kroah-Hartman 					    NULL , NULL);
125300b3ed16SGreg Kroah-Hartman }
125400b3ed16SGreg Kroah-Hartman 
125500b3ed16SGreg Kroah-Hartman int
125600b3ed16SGreg Kroah-Hartman hfa384x_drvr_start(hfa384x_t *hw);
125700b3ed16SGreg Kroah-Hartman int
125800b3ed16SGreg Kroah-Hartman hfa384x_drvr_stop(hfa384x_t *hw);
125900b3ed16SGreg Kroah-Hartman int
126000b3ed16SGreg Kroah-Hartman hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep);
126100b3ed16SGreg Kroah-Hartman void
126200b3ed16SGreg Kroah-Hartman hfa384x_tx_timeout(wlandevice_t *wlandev);
126300b3ed16SGreg Kroah-Hartman 
126400b3ed16SGreg Kroah-Hartman int
126500b3ed16SGreg Kroah-Hartman hfa384x_cmd_initialize(hfa384x_t *hw);
126600b3ed16SGreg Kroah-Hartman int
1267aaad4303SSolomon Peachy hfa384x_cmd_enable(hfa384x_t *hw, u16 macport);
126800b3ed16SGreg Kroah-Hartman int
1269aaad4303SSolomon Peachy hfa384x_cmd_disable(hfa384x_t *hw, u16 macport);
127000b3ed16SGreg Kroah-Hartman int
1271aaad4303SSolomon Peachy hfa384x_cmd_allocate(hfa384x_t *hw, u16 len);
127200b3ed16SGreg Kroah-Hartman int
1273aaad4303SSolomon Peachy hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable);
127400b3ed16SGreg Kroah-Hartman int
127500b3ed16SGreg Kroah-Hartman hfa384x_cmd_download(
127600b3ed16SGreg Kroah-Hartman 	hfa384x_t *hw,
1277aaad4303SSolomon Peachy 	u16 mode,
1278aaad4303SSolomon Peachy 	u16 lowaddr,
1279aaad4303SSolomon Peachy 	u16 highaddr,
1280aaad4303SSolomon Peachy 	u16 codelen);
128100b3ed16SGreg Kroah-Hartman void
128200b3ed16SGreg Kroah-Hartman hfa384x_copy_from_aux(
128300b3ed16SGreg Kroah-Hartman 	hfa384x_t *hw,
1284aaad4303SSolomon Peachy 	u32	cardaddr,
1285aaad4303SSolomon Peachy 	u32	auxctl,
128600b3ed16SGreg Kroah-Hartman 	void	*buf,
1287aaad4303SSolomon Peachy 	unsigned int	len);
128800b3ed16SGreg Kroah-Hartman void
128900b3ed16SGreg Kroah-Hartman hfa384x_copy_to_aux(
129000b3ed16SGreg Kroah-Hartman 	hfa384x_t *hw,
1291aaad4303SSolomon Peachy 	u32	cardaddr,
1292aaad4303SSolomon Peachy 	u32	auxctl,
129300b3ed16SGreg Kroah-Hartman 	void	*buf,
1294aaad4303SSolomon Peachy 	unsigned int	len);
129500b3ed16SGreg Kroah-Hartman 
129600b3ed16SGreg Kroah-Hartman #endif /* __KERNEL__ */
129700b3ed16SGreg Kroah-Hartman 
129800b3ed16SGreg Kroah-Hartman #endif  /* _HFA384x_H */
1299