support different wifi bt chip auto compatible
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / mt5931 / include / nic / wlan_def.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/wlan_def.h#1 $
3 */
4
5 /*! \file   "wlan_def.h"
6     \brief  This file includes the basic definition of WLAN
7
8 */
9
10
11
12 /*
13 ** $Log: wlan_def.h $
14  *
15  * 12 05 2011 cp.wu
16  * [WCXRP00001131] [MT6620 Wi-Fi][Driver][AIS] Implement connect-by-BSSID path
17  * add CONNECT_BY_BSSID policy
18  *
19  * 10 12 2011 wh.su
20  * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP
21  * adding the 802.11w related function and define .
22  *
23  * 06 22 2011 wh.su
24  * [WCXRP00000806] [MT6620 Wi-Fi][Driver] Move the WPA/RSN IE and WAPI IE structure to mac.h and let the sw structure not align at byte
25  * Move the WAPI/RSN IE to mac.h and SW structure not align to byte, 
26  * Notice needed update P2P.ko.
27  *
28  * 04 08 2011 eddie.chen
29  * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma
30  * Fix for sigma
31  *
32  * 03 17 2011 yuche.tsai
33  * NULL
34  * Resize the Secondary Device Type array when WiFi Direct is enabled.
35  *
36  * 01 25 2011 yuche.tsai
37  * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
38  * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role.
39  *
40  * 01 25 2011 yuche.tsai
41  * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
42  * Add new station type MACRO.
43  *
44  * 12 07 2010 cm.chang
45  * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant
46  * 1. Country code is from NVRAM or supplicant
47  * 2. Change band definition in CMD/EVENT.
48  *
49  * 10 11 2010 kevin.huang
50  * [WCXRP00000068] [MT6620 Wi-Fi][Driver][FW] Fix STA RECORD sync issue and remove unused code
51  * Update ENUM_STA_ROLE_INDEX_T by using a fixed base value
52  *
53  * 10 04 2010 cp.wu
54  * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only
55  * remove ENUM_NETWORK_TYPE_T definitions
56  *
57  * 09 14 2010 chinghwa.yu
58  * NULL
59  * Update OP_MODE_BOW and include bow_fsm.h.
60  *
61  * 09 03 2010 kevin.huang
62  * NULL
63  * Refine #include sequence and solve recursive/nested #include issue
64  *
65  * 08 31 2010 kevin.huang
66  * NULL
67  * Use LINK LIST operation to process SCAN result
68  *
69  * 08 29 2010 yuche.tsai
70  * NULL
71  * Change P2P Descriptor List to a pointer and allocate it dynamically to avoid structure corrupt by BssDescriptor free.
72  *
73  * 08 16 2010 kevin.huang
74  * NULL
75  * Refine AAA functions
76  *
77  * 08 12 2010 kevin.huang
78  * NULL
79  * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse()
80  *
81  * 08 12 2010 yuche.tsai
82  * NULL
83  * Add a pointer in BSS Descriptor for P2P Descriptor.
84  *
85  * 08 11 2010 yuche.tsai
86  * NULL
87  * Add an Interface in BSS Descriptor.
88  *
89  * 08 05 2010 yuche.tsai
90  * NULL
91  * Modify data structure for P2P Scan result.
92  *
93  * 07 26 2010 yuche.tsai
94  *
95  * Add an operation mode for P2P device.
96  *
97  * 07 23 2010 cp.wu
98  *
99  * P2P/RSN/WAPI IEs need to be declared with compact structure.
100  *
101  * 07 21 2010 yuche.tsai
102  *
103  * Add for P2P Scan Result Parsing & Saving.
104  *
105  * 07 20 2010 wh.su
106  *
107  * adding the wapi code.
108  *
109  * 07 09 2010 cp.wu
110  *
111  * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection)
112  * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass
113  * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly dropped by returning BUSY
114  *
115  * 07 08 2010 cp.wu
116  *
117  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
118  *
119  * 06 28 2010 cm.chang
120  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
121  * 1st draft code for RLM module
122  *
123  * 06 25 2010 cp.wu
124  * [WPD00003833][MT6620 and MT5931] Driver migration
125  * modify Beacon/ProbeResp to complete parsing,
126  * because host software has looser memory usage restriction
127  *
128  * 06 21 2010 yuche.tsai
129  * [WPD00003839][MT6620 5931][P2P] Feature migration
130  * Add P2P present boolean flag in BSS & Pre-BSS descriptor.
131  *
132  * 06 18 2010 wh.su
133  * [WPD00003840][MT6620 5931] Security migration
134  * migration the security related function from firmware.
135  *
136  * 06 11 2010 cp.wu
137  * [WPD00003833][MT6620 and MT5931] Driver migration
138  * auth.c is migrated.
139  *
140  * 06 11 2010 cp.wu
141  * [WPD00003833][MT6620 and MT5931] Driver migration
142  * 1) migrate assoc.c.
143  * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness
144  * 3) add configuration options for CNM_MEM and RSN modules
145  * 4) add data path for management frames
146  * 5) eliminate rPacketInfo of MSDU_INFO_T
147  *
148  * 06 10 2010 cp.wu
149  * [WPD00003833][MT6620 and MT5931] Driver migration
150  * add buildable & linkable ais_fsm.c
151  *
152  * related reference are still waiting to be resolved
153  *
154  * 06 09 2010 cp.wu
155  * [WPD00003833][MT6620 and MT5931] Driver migration
156  * add definitions for module migration.
157  *
158  * 06 07 2010 cp.wu
159  * [WPD00003833][MT6620 and MT5931] Driver migration
160  * move bss related data types to wlan_def.h to avoid recursive dependency.
161  *
162  * 06 07 2010 cp.wu
163  * [WPD00003833][MT6620 and MT5931] Driver migration
164  * merge wlan_def.h.
165  *
166  * 06 07 2010 cp.wu
167  * [WPD00003833][MT6620 and MT5931] Driver migration
168  * merge cnm_scan.h and hem_mbox.h
169  *
170  * 06 07 2010 cp.wu
171  * [WPD00003833][MT6620 and MT5931] Driver migration
172  * merge wifi_var.h, precomp.h, cnm_timer.h (data type only)
173  *
174  * 06 06 2010 kevin.huang
175  * [WPD00003832][MT6620 5931] Create driver base
176  * [MT6620 5931] Create driver base
177 **  \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:40 GMT mtk01426
178 **  Init for develop
179 **
180 */
181
182 #ifndef _WLAN_DEF_H
183 #define _WLAN_DEF_H
184
185 /*******************************************************************************
186 *                         C O M P I L E R   F L A G S
187 ********************************************************************************
188 */
189
190 /*******************************************************************************
191 *                    E X T E R N A L   R E F E R E N C E S
192 ********************************************************************************
193 */
194
195 /*******************************************************************************
196 *                              C O N S T A N T S
197 ********************************************************************************
198 */
199 /* disconnect reason */
200 #define DISCONNECT_REASON_CODE_RESERVED         0
201 #define DISCONNECT_REASON_CODE_RADIO_LOST       1
202 #define DISCONNECT_REASON_CODE_DEAUTHENTICATED  2
203 #define DISCONNECT_REASON_CODE_DISASSOCIATED    3
204 #define DISCONNECT_REASON_CODE_NEW_CONNECTION   4
205
206 /* The rate definitions */
207 #define TX_MODE_CCK             0x00
208 #define TX_MODE_OFDM            0x40
209 #define TX_MODE_HT_MM           0x80
210 #define TX_MODE_HT_GF           0xC0
211
212 #define RATE_CCK_SHORT_PREAMBLE 0x10
213 #define RATE_OFDM               0x20
214
215 #define PHY_RATE_1M             0x0
216 #define PHY_RATE_2M             0x1
217 #define PHY_RATE_5_5M           0x2
218 #define PHY_RATE_11M            0x3
219 #define PHY_RATE_6M             0xB
220 #define PHY_RATE_9M             0xF
221 #define PHY_RATE_12M            0xA
222 #define PHY_RATE_18M            0xE
223 #define PHY_RATE_24M            0x9
224 #define PHY_RATE_36M            0xD
225 #define PHY_RATE_48M            0x8
226 #define PHY_RATE_54M            0xC
227 #define PHY_RATE_MCS0           0x0
228 #define PHY_RATE_MCS1           0x1
229 #define PHY_RATE_MCS2           0x2
230 #define PHY_RATE_MCS3           0x3
231 #define PHY_RATE_MCS4           0x4
232 #define PHY_RATE_MCS5           0x5
233 #define PHY_RATE_MCS6           0x6
234 #define PHY_RATE_MCS7           0x7
235 #define PHY_RATE_MCS32          0x20
236
237 #define RATE_CCK_1M_LONG        (TX_MODE_CCK | PHY_RATE_1M)
238 #define RATE_CCK_2M_LONG        (TX_MODE_CCK | PHY_RATE_2M)
239 #define RATE_CCK_5_5M_LONG      (TX_MODE_CCK | PHY_RATE_5_5M)
240 #define RATE_CCK_11M_LONG       (TX_MODE_CCK | PHY_RATE_11M)
241 #define RATE_CCK_2M_SHORT       (TX_MODE_CCK | PHY_RATE_2M | RATE_CCK_SHORT_PREAMBLE)
242 #define RATE_CCK_5_5M_SHORT     (TX_MODE_CCK | PHY_RATE_5_5M | RATE_CCK_SHORT_PREAMBLE)
243 #define RATE_CCK_11M_SHORT      (TX_MODE_CCK | PHY_RATE_11M | RATE_CCK_SHORT_PREAMBLE)
244 #define RATE_OFDM_6M            (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_6M)
245 #define RATE_OFDM_9M            (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_9M)
246 #define RATE_OFDM_12M           (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_12M)
247 #define RATE_OFDM_18M           (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_18M)
248 #define RATE_OFDM_24M           (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_24M)
249 #define RATE_OFDM_36M           (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_36M)
250 #define RATE_OFDM_48M           (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_48M)
251 #define RATE_OFDM_54M           (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_54M)
252
253 #define RATE_MM_MCS_0           (TX_MODE_HT_MM | PHY_RATE_MCS0)
254 #define RATE_MM_MCS_1           (TX_MODE_HT_MM | PHY_RATE_MCS1)
255 #define RATE_MM_MCS_2           (TX_MODE_HT_MM | PHY_RATE_MCS2)
256 #define RATE_MM_MCS_3           (TX_MODE_HT_MM | PHY_RATE_MCS3)
257 #define RATE_MM_MCS_4           (TX_MODE_HT_MM | PHY_RATE_MCS4)
258 #define RATE_MM_MCS_5           (TX_MODE_HT_MM | PHY_RATE_MCS5)
259 #define RATE_MM_MCS_6           (TX_MODE_HT_MM | PHY_RATE_MCS6)
260 #define RATE_MM_MCS_7           (TX_MODE_HT_MM | PHY_RATE_MCS7)
261 #define RATE_MM_MCS_32          (TX_MODE_HT_MM | PHY_RATE_MCS32)
262
263 #define RATE_GF_MCS_0           (TX_MODE_HT_GF | PHY_RATE_MCS0)
264 #define RATE_GF_MCS_1           (TX_MODE_HT_GF | PHY_RATE_MCS1)
265 #define RATE_GF_MCS_2           (TX_MODE_HT_GF | PHY_RATE_MCS2)
266 #define RATE_GF_MCS_3           (TX_MODE_HT_GF | PHY_RATE_MCS3)
267 #define RATE_GF_MCS_4           (TX_MODE_HT_GF | PHY_RATE_MCS4)
268 #define RATE_GF_MCS_5           (TX_MODE_HT_GF | PHY_RATE_MCS5)
269 #define RATE_GF_MCS_6           (TX_MODE_HT_GF | PHY_RATE_MCS6)
270 #define RATE_GF_MCS_7           (TX_MODE_HT_GF | PHY_RATE_MCS7)
271 #define RATE_GF_MCS_32          (TX_MODE_HT_GF | PHY_RATE_MCS32)
272
273 #define RATE_TX_MODE_MASK                   BITS(6,7)
274 #define RATE_TX_MODE_OFFSET                 6
275 #define RATE_CODE_GET_TX_MODE(_ucRateCode)  ((_ucRateCode & RATE_TX_MODE_MASK) >> RATE_TX_MODE_OFFSET)
276 #define RATE_PHY_RATE_MASK                  BITS(0,5)
277 #define RATE_PHY_RATE_OFFSET                0
278 #define RATE_CODE_GET_PHY_RATE(_ucRateCode) ((_ucRateCode & RATE_PHY_RATE_MASK) >> RATE_PHY_RATE_OFFSET)
279 #define RATE_PHY_RATE_SHORT_PREAMBLE        BIT(4)
280 #define RATE_CODE_IS_SHORT_PREAMBLE(_ucRateCode)  ((_ucRateCode & RATE_PHY_RATE_SHORT_PREAMBLE)?TRUE:FALSE)
281
282
283 #define CHNL_LIST_SZ_2G         14
284 #define CHNL_LIST_SZ_5G         14
285
286 /*! CNM(STA_RECORD_T) related definition */
287 #define CFG_STA_REC_NUM         20
288
289 /* PHY TYPE bit definitions */
290 #define PHY_TYPE_BIT_HR_DSSS    BIT(PHY_TYPE_HR_DSSS_INDEX) /* HR/DSSS PHY (clause 18) */
291 #define PHY_TYPE_BIT_ERP        BIT(PHY_TYPE_ERP_INDEX)     /* ERP PHY (clause 19) */
292 #define PHY_TYPE_BIT_OFDM       BIT(PHY_TYPE_OFDM_INDEX)    /* OFDM 5 GHz PHY (clause 17) */
293 #define PHY_TYPE_BIT_HT         BIT(PHY_TYPE_HT_INDEX)      /* HT PHY (clause 20) */
294
295
296 /* PHY TYPE set definitions */
297 #define PHY_TYPE_SET_802_11ABGN (PHY_TYPE_BIT_OFDM | \
298                                  PHY_TYPE_BIT_HR_DSSS | \
299                                  PHY_TYPE_BIT_ERP | \
300                                  PHY_TYPE_BIT_HT)
301
302 #define PHY_TYPE_SET_802_11BGN  (PHY_TYPE_BIT_HR_DSSS | \
303                                  PHY_TYPE_BIT_ERP | \
304                                  PHY_TYPE_BIT_HT)
305
306 #define PHY_TYPE_SET_802_11GN   (PHY_TYPE_BIT_ERP | \
307                                  PHY_TYPE_BIT_HT)
308
309 #define PHY_TYPE_SET_802_11AN   (PHY_TYPE_BIT_OFDM | \
310                                  PHY_TYPE_BIT_HT)
311
312 #define PHY_TYPE_SET_802_11ABG  (PHY_TYPE_BIT_OFDM | \
313                                  PHY_TYPE_BIT_HR_DSSS | \
314                                  PHY_TYPE_BIT_ERP)
315
316 #define PHY_TYPE_SET_802_11BG   (PHY_TYPE_BIT_HR_DSSS | \
317                                  PHY_TYPE_BIT_ERP)
318
319 #define PHY_TYPE_SET_802_11A    (PHY_TYPE_BIT_OFDM)
320
321 #define PHY_TYPE_SET_802_11G    (PHY_TYPE_BIT_ERP)
322
323 #define PHY_TYPE_SET_802_11B    (PHY_TYPE_BIT_HR_DSSS)
324
325 #define PHY_TYPE_SET_802_11N    (PHY_TYPE_BIT_HT)
326
327
328 /* Rate set bit definitions */
329 #define RATE_SET_BIT_1M         BIT(RATE_1M_INDEX)      /* Bit 0: 1M */
330 #define RATE_SET_BIT_2M         BIT(RATE_2M_INDEX)      /* Bit 1: 2M */
331 #define RATE_SET_BIT_5_5M       BIT(RATE_5_5M_INDEX)    /* Bit 2: 5.5M */
332 #define RATE_SET_BIT_11M        BIT(RATE_11M_INDEX)     /* Bit 3: 11M */
333 #define RATE_SET_BIT_22M        BIT(RATE_22M_INDEX)     /* Bit 4: 22M */
334 #define RATE_SET_BIT_33M        BIT(RATE_33M_INDEX)     /* Bit 5: 33M */
335 #define RATE_SET_BIT_6M         BIT(RATE_6M_INDEX)      /* Bit 6: 6M */
336 #define RATE_SET_BIT_9M         BIT(RATE_9M_INDEX)      /* Bit 7: 9M */
337 #define RATE_SET_BIT_12M        BIT(RATE_12M_INDEX)     /* Bit 8: 12M */
338 #define RATE_SET_BIT_18M        BIT(RATE_18M_INDEX)     /* Bit 9: 18M */
339 #define RATE_SET_BIT_24M        BIT(RATE_24M_INDEX)     /* Bit 10: 24M */
340 #define RATE_SET_BIT_36M        BIT(RATE_36M_INDEX)     /* Bit 11: 36M */
341 #define RATE_SET_BIT_48M        BIT(RATE_48M_INDEX)     /* Bit 12: 48M */
342 #define RATE_SET_BIT_54M        BIT(RATE_54M_INDEX)     /* Bit 13: 54M */
343 #define RATE_SET_BIT_HT_PHY     BIT(RATE_HT_PHY_INDEX)  /* Bit 14: BSS Selector */
344
345
346 /* Rate set definitions */
347 #define RATE_SET_HR_DSSS            (RATE_SET_BIT_1M | \
348                                      RATE_SET_BIT_2M | \
349                                      RATE_SET_BIT_5_5M | \
350                                      RATE_SET_BIT_11M)
351
352 #define RATE_SET_ERP                (RATE_SET_BIT_1M | \
353                                      RATE_SET_BIT_2M | \
354                                      RATE_SET_BIT_5_5M | \
355                                      RATE_SET_BIT_11M | \
356                                      RATE_SET_BIT_6M | \
357                                      RATE_SET_BIT_9M | \
358                                      RATE_SET_BIT_12M | \
359                                      RATE_SET_BIT_18M | \
360                                      RATE_SET_BIT_24M | \
361                                      RATE_SET_BIT_36M | \
362                                      RATE_SET_BIT_48M | \
363                                      RATE_SET_BIT_54M)
364
365 #define RATE_SET_ERP_P2P            (RATE_SET_BIT_6M | \
366                                      RATE_SET_BIT_9M | \
367                                      RATE_SET_BIT_12M | \
368                                      RATE_SET_BIT_18M | \
369                                      RATE_SET_BIT_24M | \
370                                      RATE_SET_BIT_36M | \
371                                      RATE_SET_BIT_48M | \
372                                      RATE_SET_BIT_54M)
373
374 #define RATE_SET_OFDM               (RATE_SET_BIT_6M | \
375                                      RATE_SET_BIT_9M | \
376                                      RATE_SET_BIT_12M | \
377                                      RATE_SET_BIT_18M | \
378                                      RATE_SET_BIT_24M | \
379                                      RATE_SET_BIT_36M | \
380                                      RATE_SET_BIT_48M | \
381                                      RATE_SET_BIT_54M)
382
383 #define RATE_SET_HT                 (RATE_SET_ERP)
384 //#define RATE_SET_HT                 (RATE_SET_ERP | RATE_SET_BIT_HT_PHY) /* NOTE(Kevin): TBD */
385
386
387 #define RATE_SET_ALL_ABG             RATE_SET_ERP
388
389 #define BASIC_RATE_SET_HR_DSSS      (RATE_SET_BIT_1M | \
390                                      RATE_SET_BIT_2M)
391
392 #define BASIC_RATE_SET_HR_DSSS_ERP  (RATE_SET_BIT_1M | \
393                                      RATE_SET_BIT_2M | \
394                                      RATE_SET_BIT_5_5M | \
395                                      RATE_SET_BIT_11M)
396
397 #define BASIC_RATE_SET_ERP          (RATE_SET_BIT_1M | \
398                                      RATE_SET_BIT_2M | \
399                                      RATE_SET_BIT_5_5M | \
400                                      RATE_SET_BIT_11M | \
401                                      RATE_SET_BIT_6M | \
402                                      RATE_SET_BIT_12M | \
403                                      RATE_SET_BIT_24M)
404
405 #define BASIC_RATE_SET_OFDM         (RATE_SET_BIT_6M | \
406                                      RATE_SET_BIT_12M | \
407                                      RATE_SET_BIT_24M)
408
409 #define BASIC_RATE_SET_ERP_P2P      (RATE_SET_BIT_6M | \
410                                      RATE_SET_BIT_12M | \
411                                      RATE_SET_BIT_24M)
412
413 #define INITIAL_RATE_SET_RCPI_100    RATE_SET_ALL_ABG
414
415 #define INITIAL_RATE_SET_RCPI_80    (RATE_SET_BIT_1M | \
416                                      RATE_SET_BIT_2M | \
417                                      RATE_SET_BIT_5_5M | \
418                                      RATE_SET_BIT_11M | \
419                                      RATE_SET_BIT_6M | \
420                                      RATE_SET_BIT_9M | \
421                                      RATE_SET_BIT_12M | \
422                                      RATE_SET_BIT_24M)
423
424 #define INITIAL_RATE_SET_RCPI_60    (RATE_SET_BIT_1M | \
425                                      RATE_SET_BIT_2M | \
426                                      RATE_SET_BIT_5_5M | \
427                                      RATE_SET_BIT_11M | \
428                                      RATE_SET_BIT_6M)
429
430 #define INITIAL_RATE_SET(_rcpi)     (INITIAL_RATE_SET_ ## _rcpi)
431
432 #define RCPI_100                    100 /* -60 dBm */
433 #define RCPI_80                     80  /* -70 dBm */
434 #define RCPI_60                     60  /* -80 dBm */
435
436
437 /* The number of RCPI records used to calculate their average value */
438 #define MAX_NUM_RCPI_RECORDS        10
439
440 /* The number of RCPI records used to calculate their average value */
441 #define NO_RCPI_RECORDS             -128
442 #define MAX_RCPI_DBM                0
443 #define MIN_RCPI_DBM                -100
444
445
446 #define MAC_TX_RESERVED_FIELD       0 /* NOTE(Kevin): Should defined in tx.h */
447
448 #define MAX_ASSOC_ID                (CFG_STA_REC_NUM)   /* Available AID: 1 ~ 20(STA_REC_NUM) */
449
450
451 #define MAX_DEAUTH_INFO_COUNT       4       /* NOTE(Kevin): Used in auth.c */
452 #define MIN_DEAUTH_INTERVAL_MSEC    500     /* The minimum interval if continuously send Deauth Frame */
453
454 /* Authentication Type */
455 #define AUTH_TYPE_OPEN_SYSTEM                       BIT(AUTH_ALGORITHM_NUM_OPEN_SYSTEM)
456 #define AUTH_TYPE_SHARED_KEY                        BIT(AUTH_ALGORITHM_NUM_SHARED_KEY)
457 #define AUTH_TYPE_FAST_BSS_TRANSITION               BIT(AUTH_ALGORITHM_NUM_FAST_BSS_TRANSITION)
458
459 /* Authentication Retry Limit */
460 #define TX_AUTH_ASSOCI_RETRY_LIMIT                  2
461 #define TX_AUTH_ASSOCI_RETRY_LIMIT_FOR_ROAMING      1
462
463 /* WMM-2.2.1 WMM Information Element */
464 #define ELEM_MAX_LEN_WMM_INFO       7
465
466 /*******************************************************************************
467 *                             D A T A   T Y P E S
468 ********************************************************************************
469 */
470 typedef UINT_16                     PHY_TYPE, *P_PHY_TYPE;
471 typedef UINT_8                      RCPI, *P_RCPI;
472 typedef UINT_8                      ALC_VAL, *P_ALC_VAL;
473
474 typedef enum _ENUM_HW_BSSID_T {
475     BSSID_0 = 0,
476     BSSID_1,
477     BSSID_NUM
478 } ENUM_HW_BSSID_T;
479
480 typedef enum _ENUM_HW_MAC_ADDR_T {
481     MAC_ADDR_0 = 0,
482     MAC_ADDR_1,
483     MAC_ADDR_NUM
484 } ENUM_HW_MAC_ADDR_T;
485
486 typedef enum _ENUM_HW_OP_MODE_T {
487     HW_OP_MODE_STA = 0,
488     HW_OP_MODE_AP,
489     HW_OP_MODE_ADHOC,
490     HW_OP_MODE_NUM
491 } ENUM_HW_OP_MODE_T;
492
493 typedef enum _ENUM_TSF_T {
494     ENUM_LOCAL_TSF_0,
495     ENUM_LOCAL_TSF_1,
496     ENUM_LOCAL_TSF_NUM
497 } ENUM_LOCAL_TSF_T, *P_ENUM_LOCAL_TSF_T;
498
499 typedef enum _HAL_TS_HW_UPDATE_MODE {
500     HAL_TSF_HW_UPDATE_BY_TICK_AND_RECEIVED_FRAME,
501     HAL_TSF_HW_UPDATE_BY_TICK_ONLY,
502     HAL_TSF_HW_UPDATE_BY_RECEIVED_FRAME_ONLY,
503     HAL_TSF_HW_UPDATE_BY_TICK_AND_RECEIVED_FRAME_AD_HOC
504 } HAL_TSF_HW_UPDATE_MODE;
505
506
507 typedef enum _ENUM_AC_T {
508     AC0 = 0,
509     AC1,
510     AC2,
511     AC3,
512     AC_NUM
513 } ENUM_AC_T, *P_ENUM_AC_T;
514
515
516 /* The Type of Network been activated */
517 typedef enum _ENUM_NETWORK_TYPE_INDEX_T {
518     NETWORK_TYPE_AIS_INDEX = 0,
519     NETWORK_TYPE_P2P_INDEX,
520     NETWORK_TYPE_BOW_INDEX,
521     NETWORK_TYPE_INDEX_NUM
522 } ENUM_NETWORK_TYPE_INDEX_T;
523
524
525 /* The Type of STA Type. */
526 typedef enum _ENUM_STA_TYPE_INDEX_T {
527     STA_TYPE_LEGACY_INDEX = 0,
528     STA_TYPE_P2P_INDEX,
529     STA_TYPE_BOW_INDEX,
530     STA_TYPE_INDEX_NUM
531 }
532 ENUM_STA_TYPE_INDEX_T;
533
534 #define STA_ROLE_BASE_INDEX     4
535
536 typedef enum _ENUM_STA_ROLE_INDEX_T {
537     STA_ROLE_ADHOC_INDEX = STA_ROLE_BASE_INDEX, //4
538     STA_ROLE_CLIENT_INDEX,
539     STA_ROLE_AP_INDEX,
540     STA_ROLE_DLS_INDEX
541 } ENUM_STA_ROLE_INDEX_T;
542
543 /* The Power State of a specific Network */
544 typedef enum _ENUM_PWR_STATE_T {
545     PWR_STATE_IDLE = 0,
546     PWR_STATE_ACTIVE,
547     PWR_STATE_PS,
548     PWR_STATE_NUM
549 } ENUM_PWR_STATE_T;
550
551 typedef enum _ENUM_PHY_TYPE_INDEX_T {
552     //PHY_TYPE_DSSS_INDEX,      /* DSSS PHY (clause 15) -- Not used anymore */
553     PHY_TYPE_HR_DSSS_INDEX = 0, /* HR/DSSS PHY (clause 18) */
554     PHY_TYPE_ERP_INDEX,         /* ERP PHY (clause 19) */
555     PHY_TYPE_ERP_P2P_INDEX,     /* ERP PHY (clause 19) w/o HR/DSSS */
556     PHY_TYPE_OFDM_INDEX,        /* OFDM 5 GHz PHY (clause 17) */
557     PHY_TYPE_HT_INDEX,          /* HT PHY (clause 20) */
558     PHY_TYPE_INDEX_NUM // 5
559 } ENUM_PHY_TYPE_INDEX_T, *P_ENUM_PHY_TYPE_INDEX_T;
560
561 typedef enum _ENUM_ACPI_STATE_T {
562     ACPI_STATE_D0 = 0,
563     ACPI_STATE_D1,
564     ACPI_STATE_D2,
565     ACPI_STATE_D3
566 } ENUM_ACPI_STATE_T;
567
568 /* The operation mode of a specific Network */
569 typedef enum _ENUM_OP_MODE_T {
570     OP_MODE_INFRASTRUCTURE = 0,         /* Infrastructure/GC */
571     OP_MODE_IBSS,                       /* AdHoc */
572     OP_MODE_ACCESS_POINT,               /* For GO */
573     OP_MODE_P2P_DEVICE,                    /* P2P Device */
574     OP_MODE_BOW,
575     OP_MODE_NUM
576 } ENUM_OP_MODE_T, *P_ENUM_OP_MODE_T;
577
578 typedef enum _ENUM_CHNL_EXT_T {
579     CHNL_EXT_SCN = 0,
580     CHNL_EXT_SCA = 1,
581     CHNL_EXT_RES = 2,
582     CHNL_EXT_SCB = 3
583 } ENUM_CHNL_EXT_T, *P_ENUM_CHNL_EXT_T;
584
585 /* This starting freq of the band is unit of kHz */
586 typedef enum _ENUM_BAND_T {
587     BAND_NULL,
588     BAND_2G4,
589     BAND_5G,
590     BAND_NUM
591 } ENUM_BAND_T, *P_ENUM_BAND_T;
592
593 /* Provide supported channel list to other components in array format */
594 typedef struct _RF_CHANNEL_INFO_T {
595     ENUM_BAND_T     eBand;
596     UINT_8          ucChannelNum;
597 } RF_CHANNEL_INFO_T, *P_RF_CHANNEL_INFO_T;
598
599 typedef enum _ENUM_RATE_INDEX_T {
600     RATE_1M_INDEX = 0,      /* 1M */
601     RATE_2M_INDEX,          /* 2M */
602     RATE_5_5M_INDEX,        /* 5.5M */
603     RATE_11M_INDEX,         /* 11M */
604     RATE_22M_INDEX,         /* 22M */
605     RATE_33M_INDEX,         /* 33M */
606     RATE_6M_INDEX,          /* 6M */
607     RATE_9M_INDEX,          /* 9M */
608     RATE_12M_INDEX,         /* 12M */
609     RATE_18M_INDEX,         /* 18M */
610     RATE_24M_INDEX,         /* 24M */
611     RATE_36M_INDEX,         /* 36M */
612     RATE_48M_INDEX,         /* 48M */
613     RATE_54M_INDEX,         /* 54M */
614     RATE_HT_PHY_INDEX,      /* BSS Selector - HT PHY */
615     RATE_NUM // 15
616 } ENUM_RATE_INDEX_T, *P_ENUM_RATE_INDEX_T;
617
618 typedef enum _ENUM_HT_RATE_INDEX_T {
619     HT_RATE_MCS0_INDEX = 0,
620     HT_RATE_MCS1_INDEX,
621     HT_RATE_MCS2_INDEX,
622     HT_RATE_MCS3_INDEX,
623     HT_RATE_MCS4_INDEX,
624     HT_RATE_MCS5_INDEX,
625     HT_RATE_MCS6_INDEX,
626     HT_RATE_MCS7_INDEX,
627     HT_RATE_MCS32_INDEX,
628     HT_RATE_NUM // 9
629 } ENUM_HT_RATE_INDEX_T, *P_ENUM_HT_RATE_INDEX_T;
630
631 typedef enum _ENUM_PREMABLE_OPTION_T {
632     PREAMBLE_DEFAULT_LONG_NONE = 0, /* LONG for PHY_TYPE_HR_DSSS, NONE for PHY_TYPE_OFDM */
633     PREAMBLE_OPTION_SHORT, /* SHORT mandatory for PHY_TYPE_ERP, SHORT option for PHY_TYPE_HR_DSSS */
634     PREAMBLE_HT_MIXED_MODE,
635     PREAMBLE_HT_GREEN_FIELD,
636     PREAMBLE_OPTION_NUM
637 } ENUM_PREMABLE_OPTION_T, *P_ENUM_PREMABLE_OPTION_T;
638
639 typedef enum _ENUM_MODULATION_SYSTEM_T {
640     MODULATION_SYSTEM_CCK = 0,
641     MODULATION_SYSTEM_OFDM,
642     MODULATION_SYSTEM_HT20,
643     MODULATION_SYSTEM_HT40,
644     MODULATION_SYSTEM_NUM
645 } ENUM_MODULATION_SYSTEM_T, *P_ENUM_MODULATION_SYSTEM_T;
646
647 typedef enum _ENUM_MODULATION_TYPE_T {
648     MODULATION_TYPE_CCK_BPSK = 0,
649     MODULATION_TYPE_QPSK,
650     MODULATION_TYPE_16QAM,
651     MODULATION_TYPE_64QAM,
652     MODULATION_TYPE_NUM
653 } ENUM_MODULATION_TYPE_T, *P_ENUM_MODULATION_TYPE_T;
654
655 typedef enum _ENUM_PS_FORWARDING_TYPE_T {
656     PS_FORWARDING_TYPE_NON_PS = 0,
657     PS_FORWARDING_TYPE_DELIVERY_ENABLED,
658     PS_FORWARDING_TYPE_NON_DELIVERY_ENABLED,
659     PS_FORWARDING_MORE_DATA_ENABLED,
660     PS_FORWARDING_TYPE_NUM
661 } ENUM_PS_FORWARDING_TYPE_T, *P_ENUM_PS_FORWARDING_TYPE_T;
662
663 typedef struct _DEAUTH_INFO_T {
664     UINT_8 aucRxAddr[MAC_ADDR_LEN];
665     OS_SYSTIME rLastSendTime;
666 } DEAUTH_INFO_T, *P_DEAUTH_INFO_T;
667
668 /*----------------------------------------------------------------------------*/
669 /* Information Element (IE) handlers                                          */
670 /*----------------------------------------------------------------------------*/
671 typedef VOID (*PFN_APPEND_IE_FUNC)(P_ADAPTER_T, P_MSDU_INFO_T);
672 typedef VOID (*PFN_HANDLE_IE_FUNC)(P_ADAPTER_T, P_SW_RFB_T, P_IE_HDR_T);
673 typedef VOID (*PFN_VERIFY_IE_FUNC)(P_ADAPTER_T, P_SW_RFB_T, P_IE_HDR_T, PUINT_16);
674 typedef UINT_32 (*PFN_CALCULATE_VAR_IE_LEN_FUNC)(P_ADAPTER_T, ENUM_NETWORK_TYPE_INDEX_T, P_STA_RECORD_T);
675
676 typedef struct _APPEND_IE_ENTRY_T {
677     UINT_16             u2EstimatedIELen;
678     PFN_APPEND_IE_FUNC  pfnAppendIE;
679 } APPEND_IE_ENTRY_T, *P_APPEND_IE_ENTRY_T;
680
681 typedef struct _APPEND_VAR_IE_ENTRY_T {
682     UINT_16                         u2EstimatedFixedIELen; /* For Fixed Length */
683     PFN_CALCULATE_VAR_IE_LEN_FUNC   pfnCalculateVariableIELen;
684     PFN_APPEND_IE_FUNC              pfnAppendIE;
685 } APPEND_VAR_IE_ENTRY_T, *P_APPEND_VAR_IE_ENTRY_T;
686
687 typedef struct _HANDLE_IE_ENTRY_T {
688     UINT_8              ucElemID;
689     PFN_HANDLE_IE_FUNC  pfnHandleIE;
690 } HANDLE_IE_ENTRY_T, *P_HANDLE_IE_ENTRY_T;
691
692 typedef struct _VERIFY_IE_ENTRY_T {
693     UINT_8              ucElemID;
694     PFN_VERIFY_IE_FUNC  pfnVarifyIE;
695 } VERIFY_IE_ENTRY_T, *P_VERIFY_IE_ENTRY_T;
696
697 /*----------------------------------------------------------------------------*/
698 /* Parameters of User Configuration                                           */
699 /*----------------------------------------------------------------------------*/
700 typedef enum _ENUM_PARAM_CONNECTION_POLICY_T {
701     CONNECT_BY_SSID_BEST_RSSI = 0,
702     CONNECT_BY_SSID_GOOD_RSSI_MIN_CH_LOAD,
703     CONNECT_BY_SSID_ANY, /* NOTE(Kevin): Needed by WHQL */
704     CONNECT_BY_BSSID,
705     CONNECT_BY_CUSTOMIZED_RULE /* NOTE(Kevin): TBD */
706 } ENUM_PARAM_CONNECTION_POLICY_T, *P_ENUM_PARAM_CONNECTION_POLICY_T;
707
708 typedef enum _ENUM_PARAM_PREAMBLE_TYPE_T {
709     PREAMBLE_TYPE_LONG = 0,
710     PREAMBLE_TYPE_SHORT,
711     PREAMBLE_TYPE_AUTO                  /*!< Try preamble short first, if fail tray preamble long. */
712 } ENUM_PARAM_PREAMBLE_TYPE_T, *P_ENUM_PARAM_PREAMBLE_TYPE_T;
713
714 /* This is enum defined for user to select a phy config listed in combo box */
715 typedef enum _ENUM_PARAM_PHY_CONFIG_T {
716     PHY_CONFIG_802_11ABG = 0,           /*!< Can associated with 802.11abg AP but without n capability, Scan dual band. */
717     PHY_CONFIG_802_11BG,                /*!< Can associated with 802_11bg AP, Scan single band and not report 5G BSSs. */
718     PHY_CONFIG_802_11G,                 /*!< Can associated with 802_11g only AP, Scan single band and not report 5G BSSs. */
719     PHY_CONFIG_802_11A,                 /*!< Can associated with 802_11a only AP, Scan single band and not report 2.4G BSSs. */
720     PHY_CONFIG_802_11B,                 /*!< Can associated with 802_11b only AP, Scan single band and not report 5G BSSs. */
721     PHY_CONFIG_802_11ABGN,              /*!< Can associated with 802.11abgn AP, Scan dual band. */
722     PHY_CONFIG_802_11BGN,               /*!< Can associated with 802_11bgn AP, Scan single band and not report 5G BSSs. */
723     PHY_CONFIG_802_11AN,                /*!< Can associated with 802_11an AP, Scan single band and not report 2.4G BSSs. */
724     PHY_CONFIG_802_11GN,                /*!< Can associated with 802_11gn AP, Scan single band and not report 5G BSSs. */
725     PHY_CONFIG_NUM // 9
726 } ENUM_PARAM_PHY_CONFIG_T, *P_ENUM_PARAM_PHY_CONFIG_T;
727
728 /* This is enum defined for user to select an AP Mode */
729 typedef enum _ENUM_PARAM_AP_MODE_T {
730     AP_MODE_11B = 0,                /*!< Create 11b BSS if we support 802.11abg/802.11bg. */
731     AP_MODE_MIXED_11BG,             /*!< Create 11bg mixed BSS if we support 802.11abg/802.11bg/802.11g. */
732     AP_MODE_11G,                    /*!< Create 11g only BSS if we support 802.11abg/802.11bg/802.11g. */
733     AP_MODE_11G_P2P,                /*!< Create 11g only BSS for P2P if we support 802.11abg/802.11bg/802.11g. */
734     AP_MODE_11A,                    /*!< Create 11a only BSS if we support 802.11abg. */
735     AP_MODE_NUM // 4
736 } ENUM_PARAM_AP_MODE_T, *P_ENUM_PARAM_AP_MODE_T;
737
738
739 /* Masks for determining the Network Type or the Station Role, given the ENUM_STA_TYPE_T */
740 #define NETWORK_TYPE_AIS_MASK               BIT(NETWORK_TYPE_AIS_INDEX)
741 #define NETWORK_TYPE_P2P_MASK               BIT(NETWORK_TYPE_P2P_INDEX)
742 #define NETWORK_TYPE_BOW_MASK               BIT(NETWORK_TYPE_BOW_INDEX)
743 #define STA_TYPE_LEGACY_MASK                 BIT(STA_TYPE_LEGACY_INDEX)
744 #define STA_TYPE_P2P_MASK                       BIT(STA_TYPE_P2P_INDEX)
745 #define STA_TYPE_BOW_MASK                     BIT(STA_TYPE_BOW_INDEX)
746 #define STA_TYPE_ADHOC_MASK                 BIT(STA_ROLE_ADHOC_INDEX)
747 #define STA_TYPE_CLIENT_MASK                BIT(STA_ROLE_CLIENT_INDEX)
748 #define STA_TYPE_AP_MASK                    BIT(STA_ROLE_AP_INDEX)
749 #define STA_TYPE_DLS_MASK                   BIT(STA_ROLE_DLS_INDEX)
750
751 /* Macros for obtaining the Network Type or the Station Role, given the ENUM_STA_TYPE_T */
752 #define IS_STA_IN_AIS(_prStaRec)        ((_prStaRec)->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX)
753 #define IS_STA_IN_P2P(_prStaRec)        ((_prStaRec)->ucNetTypeIndex ==  NETWORK_TYPE_P2P_INDEX)
754 #define IS_STA_IN_BOW(_prStaRec)        ((_prStaRec)->ucNetTypeIndex ==  NETWORK_TYPE_BOW_INDEX)
755 #define IS_STA_LEGACY_TYPE(_prStaRec)        ((_prStaRec->eStaType) & STA_TYPE_LEGACY_MASK)
756 #define IS_STA_P2P_TYPE(_prStaRec)        ((_prStaRec->eStaType) & STA_TYPE_P2P_MASK)
757 #define IS_STA_BOW_TYPE(_prStaRec)        ((_prStaRec->eStaType) & STA_TYPE_BOW_MASK)
758 #define IS_ADHOC_STA(_prStaRec)         ((_prStaRec->eStaType) & STA_TYPE_ADHOC_MASK)
759 #define IS_CLIENT_STA(_prStaRec)        ((_prStaRec->eStaType) & STA_TYPE_CLIENT_MASK)
760 #define IS_AP_STA(_prStaRec)            ((_prStaRec->eStaType) & STA_TYPE_AP_MASK)
761 #define IS_DLS_STA(_prStaRec)           ((_prStaRec->eStaType) & STA_TYPE_DLS_MASK)
762
763 /* The ENUM_STA_TYPE_T accounts for ENUM_NETWORK_TYPE_T and ENUM_STA_ROLE_INDEX_T.
764  * *   It is a merged version of Network Type and STA Role.
765  * */
766 typedef enum _ENUM_STA_TYPE_T {
767     STA_TYPE_LEGACY_AP       = (STA_TYPE_LEGACY_MASK | STA_TYPE_AP_MASK),
768     STA_TYPE_LEGACY_CLIENT = (STA_TYPE_LEGACY_MASK | STA_TYPE_CLIENT_MASK),
769     STA_TYPE_ADHOC_PEER     = (STA_TYPE_LEGACY_MASK | STA_TYPE_ADHOC_MASK),
770 #if CFG_ENABLE_WIFI_DIRECT
771     STA_TYPE_P2P_GO         = (STA_TYPE_P2P_MASK | STA_TYPE_AP_MASK),
772     STA_TYPE_P2P_GC         = (STA_TYPE_P2P_MASK | STA_TYPE_CLIENT_MASK),
773 #endif
774 #if CFG_ENABLE_BT_OVER_WIFI
775     STA_TYPE_BOW_AP         = (STA_TYPE_BOW_MASK | STA_TYPE_AP_MASK),
776     STA_TYPE_BOW_CLIENT     = (STA_TYPE_BOW_MASK | STA_TYPE_CLIENT_MASK),
777 #endif
778     STA_TYPE_DLS_PEER       = (STA_TYPE_LEGACY_MASK | STA_TYPE_DLS_MASK)
779 } ENUM_STA_TYPE_T, *P_ENUM_STA_TYPE_T;
780
781 /* The type of BSS we discovered */
782 typedef enum _ENUM_BSS_TYPE_T {
783     BSS_TYPE_INFRASTRUCTURE = 1,
784     BSS_TYPE_IBSS,
785     BSS_TYPE_P2P_DEVICE,
786     BSS_TYPE_BOW_DEVICE,
787     BSS_TYPE_NUM
788 } ENUM_BSS_TYPE_T, *P_ENUM_BSS_TYPE_T;
789
790 /*----------------------------------------------------------------------------*/
791 /* RSN structures                                                             */
792 /*----------------------------------------------------------------------------*/
793 //#if defined(WINDOWS_DDK) || defined(WINDOWS_CE)
794 //#pragma pack(1)
795 //#endif
796
797 #define MAX_NUM_SUPPORTED_CIPHER_SUITES 8     /* max number of supported cipher suites */
798 #if CFG_SUPPORT_802_11W
799 #define MAX_NUM_SUPPORTED_AKM_SUITES    8     /* max number of supported AKM suites */
800 #else
801 #define MAX_NUM_SUPPORTED_AKM_SUITES    6     /* max number of supported AKM suites */
802 #endif
803
804 /* Structure of RSN Information */
805 typedef struct _RSN_INFO_T {
806     UINT_8          ucElemId;
807     UINT_16         u2Version;
808     UINT_32         u4GroupKeyCipherSuite;
809     UINT_32         u4PairwiseKeyCipherSuiteCount;
810     UINT_32         au4PairwiseKeyCipherSuite[MAX_NUM_SUPPORTED_CIPHER_SUITES];
811     UINT_32         u4AuthKeyMgtSuiteCount;
812     UINT_32         au4AuthKeyMgtSuite[MAX_NUM_SUPPORTED_AKM_SUITES];
813     UINT_16         u2RsnCap;
814     BOOLEAN         fgRsnCapPresent;
815 } /*__KAL_ATTRIB_PACKED__*/ RSN_INFO_T, *P_RSN_INFO_T;
816
817 #define MAX_NUM_SUPPORTED_WAPI_AKM_SUITES    1 /* max number of supported AKM suites */
818 #define MAX_NUM_SUPPORTED_WAPI_CIPHER_SUITES 1 /* max number of supported cipher suites */
819
820 /* Structure of WAPI Information */
821 typedef struct _WAPI_INFO_T {
822     UINT_8          ucElemId;
823     UCHAR           ucLength;
824     UINT_16         u2Version;
825     UINT_32         u4AuthKeyMgtSuiteCount;
826     UINT_32         au4AuthKeyMgtSuite[MAX_NUM_SUPPORTED_WAPI_AKM_SUITES];
827     UINT_32         u4PairwiseKeyCipherSuiteCount;
828     UINT_32         au4PairwiseKeyCipherSuite[MAX_NUM_SUPPORTED_WAPI_CIPHER_SUITES];
829     UINT_32         u4GroupKeyCipherSuite;
830     UINT_16         u2WapiCap;
831     UINT_16         u2Bkid;
832     UINT_8          aucBkid[1][16];
833 } /* __KAL_ATTRIB_PACKED__*/ WAPI_INFO_T, *P_WAPI_INFO_T;
834
835 //#if defined(WINDOWS_DDK) || defined(WINDOWS_CE)
836 //#pragma pack()
837 //#endif
838
839
840 #if CFG_ENABLE_WIFI_DIRECT
841
842 typedef struct _P2P_DEVICE_TYPE_T {
843     UINT_16 u2CategoryID;
844     UINT_16 u2SubCategoryID;
845 } P2P_DEVICE_TYPE_T, *P_P2P_DEVICE_TYPE_T;
846
847 typedef struct _P2P_DEVICE_DESC_T {
848     LINK_ENTRY_T        rLinkEntry;
849     BOOLEAN             fgDevInfoValid;
850     UINT_8              aucDeviceAddr[MAC_ADDR_LEN]; /* Device Address. */
851     UINT_8              aucInterfaceAddr[MAC_ADDR_LEN]; /* Interface Address. */
852     UINT_8              ucDeviceCapabilityBitmap;
853     UINT_8              ucGroupCapabilityBitmap;
854     UINT_16             u2ConfigMethod; /* Configure Method support. */
855     P2P_DEVICE_TYPE_T   rPriDevType;
856     UINT_8              ucSecDevTypeNum;
857     P2P_DEVICE_TYPE_T   arSecDevType[8];   // Reference to P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT
858     UINT_16             u2NameLength;
859     UINT_8              aucName[32];                // Reference to WPS_ATTRI_MAX_LEN_DEVICE_NAME
860     // TODO: Service Information or PasswordID valid?
861 } P2P_DEVICE_DESC_T, *P_P2P_DEVICE_DESC_T;
862
863 #endif
864
865
866 /*******************************************************************************
867 *                            P U B L I C   D A T A
868 ********************************************************************************
869 */
870
871 /*******************************************************************************
872 *                           P R I V A T E   D A T A
873 ********************************************************************************
874 */
875 static const UINT_8 aucRateIndex2RateCode[PREAMBLE_OPTION_NUM][RATE_NUM] = {
876     { /* Long Preamble */
877         RATE_CCK_1M_LONG,       /* RATE_1M_INDEX = 0 */
878         RATE_CCK_2M_LONG,       /* RATE_2M_INDEX */
879         RATE_CCK_5_5M_LONG,     /* RATE_5_5M_INDEX */
880         RATE_CCK_11M_LONG,      /* RATE_11M_INDEX */
881         RATE_CCK_1M_LONG,       /* RATE_22M_INDEX - Not supported */
882         RATE_CCK_1M_LONG,       /* RATE_33M_INDEX - Not supported */
883         RATE_OFDM_6M,           /* RATE_6M_INDEX */
884         RATE_OFDM_9M,           /* RATE_9M_INDEX */
885         RATE_OFDM_12M,          /* RATE_12M_INDEX */
886         RATE_OFDM_18M,          /* RATE_18M_INDEX */
887         RATE_OFDM_24M,          /* RATE_24M_INDEX */
888         RATE_OFDM_36M,          /* RATE_36M_INDEX */
889         RATE_OFDM_48M,          /* RATE_48M_INDEX */
890         RATE_OFDM_54M,           /* RATE_54M_INDEX */
891     },
892     { /* Short Preamble */
893         RATE_CCK_1M_LONG,       /* RATE_1M_INDEX = 0 */
894         RATE_CCK_2M_SHORT,      /* RATE_2M_INDEX */
895         RATE_CCK_5_5M_SHORT,    /* RATE_5_5M_INDEX */
896         RATE_CCK_11M_SHORT,     /* RATE_11M_INDEX */
897         RATE_CCK_1M_LONG,       /* RATE_22M_INDEX - Not supported */
898         RATE_CCK_1M_LONG,       /* RATE_33M_INDEX - Not supported */
899         RATE_OFDM_6M,           /* RATE_6M_INDEX */
900         RATE_OFDM_9M,           /* RATE_9M_INDEX */
901         RATE_OFDM_12M,          /* RATE_12M_INDEX */
902         RATE_OFDM_18M,          /* RATE_18M_INDEX */
903         RATE_OFDM_24M,          /* RATE_24M_INDEX */
904         RATE_OFDM_36M,          /* RATE_36M_INDEX */
905         RATE_OFDM_48M,          /* RATE_48M_INDEX */
906         RATE_OFDM_54M,           /* RATE_54M_INDEX */
907     },
908     { /* Mixed Mode(Option) */
909         RATE_MM_MCS_0,               /* RATE_MCS0_INDEX, */
910         RATE_MM_MCS_1,               /* RATE_MCS1_INDEX, */
911         RATE_MM_MCS_2,               /* RATE_MCS2_INDEX, */
912         RATE_MM_MCS_3,               /* RATE_MCS3_INDEX, */
913         RATE_MM_MCS_4,               /* RATE_MCS4_INDEX, */
914         RATE_MM_MCS_5,               /* RATE_MCS5_INDEX, */
915         RATE_MM_MCS_6,               /* RATE_MCS6_INDEX, */
916         RATE_MM_MCS_7,               /* RATE_MCS7_INDEX, */
917         RATE_MM_MCS_32               /* RATE_MCS32_INDEX, */
918     },
919     { /* Green Field(Option) */
920         RATE_GF_MCS_0,               /* RATE_MCS0_INDEX, */
921         RATE_GF_MCS_1,               /* RATE_MCS1_INDEX, */
922         RATE_GF_MCS_2,               /* RATE_MCS2_INDEX, */
923         RATE_GF_MCS_3,               /* RATE_MCS3_INDEX, */
924         RATE_GF_MCS_4,               /* RATE_MCS4_INDEX, */
925         RATE_GF_MCS_5,               /* RATE_MCS5_INDEX, */
926         RATE_GF_MCS_6,               /* RATE_MCS6_INDEX, */
927         RATE_GF_MCS_7,               /* RATE_MCS7_INDEX, */
928         RATE_GF_MCS_32               /* RATE_MCS32_INDEX, */
929     }
930 };
931
932 static const UINT_8 aucRateTableSize[PREAMBLE_OPTION_NUM] = {
933     RATE_HT_PHY_INDEX,
934     RATE_HT_PHY_INDEX,
935     HT_RATE_NUM,
936     HT_RATE_NUM
937 };
938
939
940 /*******************************************************************************
941 *                                 M A C R O S
942 ********************************************************************************
943 */
944 /* Macros to get and set the wireless LAN frame fields those are 16/32 bits in
945    length. */
946 #define WLAN_GET_FIELD_16(_memAddr_p, _value_p) \
947         { \
948             PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
949             *(PUINT_16)(_value_p) = ((UINT_16) __cp[0]) | ((UINT_16) __cp[1] << 8); \
950         }
951
952 #define WLAN_GET_FIELD_BE16(_memAddr_p, _value_p) \
953         { \
954             PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
955             *(PUINT_16)(_value_p) = ((UINT_16) __cp[0] << 8) | ((UINT_16) __cp[1]); \
956         }
957
958 #define WLAN_GET_FIELD_32(_memAddr_p, _value_p) \
959         { \
960             PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
961             *(PUINT_32)(_value_p) = ((UINT_32) __cp[0])       | ((UINT_32) __cp[1] << 8) | \
962                                     ((UINT_32) __cp[2] << 16) | ((UINT_32) __cp[3] << 24); \
963         }
964
965 #define WLAN_GET_FIELD_64(_memAddr_p, _value_p) \
966         { \
967             PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
968             *(PUINT_64)(_value_p) = \
969                 ((UINT_64) __cp[0])       | ((UINT_64) __cp[1] << 8)  | \
970                 ((UINT_64) __cp[2] << 16) | ((UINT_64) __cp[3] << 24) | \
971                 ((UINT_64) __cp[4] << 32) | ((UINT_64) __cp[5] << 40) | \
972                 ((UINT_64) __cp[6] << 48) | ((UINT_64) __cp[7] << 56); \
973         }
974
975 #define WLAN_SET_FIELD_16(_memAddr_p, _value) \
976         { \
977             PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
978             __cp[0] = (UINT_8) (_value); \
979             __cp[1] = (UINT_8) ((_value) >> 8); \
980         }
981
982 #define WLAN_SET_FIELD_BE16(_memAddr_p, _value) \
983        { \
984             PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
985             __cp[0] = (UINT_8) ((_value) >> 8); \
986             __cp[1] = (UINT_8) (_value); \
987        }
988
989 #define WLAN_SET_FIELD_32(_memAddr_p, _value) \
990         { \
991             PUINT_8 __cp = (PUINT_8) (_memAddr_p); \
992             __cp[0] = (UINT_8) (_value); \
993             __cp[1] = (UINT_8) ((_value) >> 8); \
994             __cp[2] = (UINT_8) ((_value) >> 16); \
995             __cp[3] = (UINT_8) ((_value) >> 24); \
996         }
997
998
999
1000 /*******************************************************************************
1001 *                   F U N C T I O N   D E C L A R A T I O N S
1002 ********************************************************************************
1003 */
1004
1005
1006 /*******************************************************************************
1007 *                              F U N C T I O N S
1008 ********************************************************************************
1009 */
1010
1011 #endif /* _WLAN_DEF_H */
1012