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