add MTK-combo-module,continue with commit 17f39ed917874e77e80411f33faba1b7ee8138c8
[firefly-linux-kernel-4.4.55.git] / drivers / mtk_wcn_combo / drv_wlan / wlan / include / nic_cmd_event.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_2/include/nic_cmd_event.h#1 $
3 */
4
5 /*! \file   "nic_cmd_event.h"
6     \brief This file contains the declairation file of the WLAN OID processing routines
7            of Windows driver for MediaTek Inc. 802.11 Wireless LAN Adapters.
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: nic_cmd_event.h $
54  *
55  * 01 09 2012 wh.su
56  * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function
57  * Check in the Add Tx power Cmd to driver.
58  *
59  * 11 19 2011 yuche.tsai
60  * NULL
61  * Add P2P RSSI Link Quality Query Support. (Default Off)
62  *
63  * 11 10 2011 eddie.chen
64  * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog)
65  * Add TX_DONE status detail information.
66  *
67  * 11 08 2011 tsaiyuan.hsu
68  * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
69  * check if CFG_SUPPORT_SWCR is defined to avoid compiler error.
70  *
71  * 11 04 2011 tsaiyuan.hsu
72  * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered
73  * add debug counters and periodically dump counters for Xlog debugging.
74  *
75  * 10 26 2011 cp.wu
76  * [WCXRP00001065] [MT6620 Wi-Fi][MT5931][FW][DRV] Adding parameter for controlling minimum channel dwell time for scanning
77  * add interface for control minimum channel dwell time for scanning.
78  *
79  * 10 19 2011 yuche.tsai
80  * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch.
81  * Branch 2.1
82  * Davinci Maintrunk Label: MT6620_WIFI_DRIVER_FW_TRUNK_MT6620E5_111019_0926.
83  *
84  * 08 11 2011 cp.wu
85  * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time
86  * sparse channel detection:
87  * driver: collect sparse channel information with scan-done event
88  *
89  * 08 09 2011 cp.wu
90  * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC[WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC
91  * add CCK-DSSS TX-PWR control field in NVRAM and CMD definition for MT5931-MP
92  *
93  * 08 03 2011 terry.wu
94  * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode
95  * Reply Probe Rsp in FW for Hotspot Mode.
96  * 
97  * 
98  *
99  * 08 03 2011 terry.wu
100  * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode
101  * Reply Probe Rsp in FW for Hotspot Mode.
102  * 
103  *
104  * 08 03 2011 terry.wu
105  * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode
106  * Reply Probe Rsp in FW for Hotspot Mode.
107  *
108  * 08 03 2011 terry.wu
109  * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode
110  * Reply Probe Rsp in FW for Hotspot Mode.
111  *
112  * 06 23 2011 cp.wu
113  * [WCXRP00000812] [MT6620 Wi-Fi][Driver] not show NVRAM when there is no valid MAC address in NVRAM content
114  * check with firmware for valid MAC address.
115  *
116  * 06 23 2011 cp.wu
117  * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
118  * follow-ups for frequency-shifted WAPI AP support
119  *
120  * 06 09 2011 tsaiyuan.hsu
121  * [WCXRP00000760] [MT5931 Wi-Fi][FW] Refine rxmHandleMacRxDone to reduce code size
122  * move send_auth at rxmHandleMacRxDone in firmware to driver to reduce code size.
123  *
124  * 05 27 2011 cp.wu
125  * [WCXRP00000749] [MT6620 Wi-Fi][Driver] Add band edge tx power control to Wi-Fi NVRAM
126  * invoke CMD_ID_SET_EDGE_TXPWR_LIMIT when there is valid data exist in NVRAM content.
127  *
128  * 04 18 2011 terry.wu
129  * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED
130  * Remove flag CFG_WIFI_DIRECT_MOVED.
131  *
132  * 03 31 2011 chinglan.wang
133  * [WCXRP00000613] [MT6620 Wi-Fi] [FW] [Driver] BssInfo can get the security mode which is WPA/WPA2/WAPI or not.
134  * .
135  *
136  * 03 18 2011 cp.wu
137  * [WCXRP00000577] [MT6620 Wi-Fi][Driver][FW] Create V2.0 branch for firmware and driver
138  * create V2.0 driver release based on label "MT6620_WIFI_DRIVER_V2_0_110318_1600" from main trunk
139  *
140  * 03 18 2011 cm.chang
141  * [WCXRP00000576] [MT6620 Wi-Fi][Driver][FW] Remove P2P compile option in scan req/cancel command
142  * As CR title
143  *
144  * 03 17 2011 yarco.yang
145  * [WCXRP00000569] [MT6620 Wi-Fi][F/W][Driver] Set multicast address support current network usage
146  * .
147  *
148  * 03 07 2011 wh.su
149  * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
150  * rename the define to anti_pviracy.
151  *
152  * 03 05 2011 wh.su
153  * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
154  * add the code to get the check rsponse and indicate to app.
155  *
156  * 03 02 2011 wh.su
157  * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code
158  * Add Security check related code.
159  *
160  * 03 02 2011 george.huang
161  * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command
162  * Support UAPSD/OppPS/NoA parameter setting
163  *
164  * 02 16 2011 cm.chang
165  * [WCXRP00000447] [MT6620 Wi-Fi][FW] Support new NVRAM update mechanism
166  * .
167  *
168  * 02 10 2011 cp.wu
169  * [WCXRP00000434] [MT6620 Wi-Fi][Driver] Obsolete unused event packet handlers
170  * EVENT_ID_CONNECTION_STATUS has been obsoleted and no need to handle.
171  *
172  * 02 08 2011 eddie.chen
173  * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode
174  * Add event STA agint timeout
175  *
176  * 01 27 2011 tsaiyuan.hsu
177  * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support
178  * add roaming fsm
179  * 1. not support 11r, only use strength of signal to determine roaming.
180  * 2. not enable CFG_SUPPORT_ROAMING until completion of full test.
181  * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw
182  * 4. assume that change of link quality in smooth way.
183  *
184  * 01 25 2011 yuche.tsai
185  * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue
186  * Update cmd format of BSS INFO, always sync OwnMac to FW no matter P2P is enabled or not..
187  *
188  * 01 20 2011 eddie.chen
189  * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control
190  * Add Oid for sw control debug command
191  *
192  * 01 15 2011 puff.wen
193  * NULL
194  * Add Stress test
195  *
196  * 01 12 2011 cm.chang
197  * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting
198  * Sync HT operation element information from host to FW
199  *
200  * 01 12 2011 cm.chang
201  * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting
202  * User-defined bandwidth is for 2.4G and 5G individually
203  *
204  * 12 29 2010 eddie.chen
205  * [WCXRP00000322] Add WMM IE in beacon,
206
207 Add per station flow control when STA is in PS
208
209
210  * 1) PS flow control event
211  *
212  * 2) WMM IE in beacon, assoc resp, probe resp
213  *
214  * 12 28 2010 cp.wu
215  * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release
216  * report EEPROM used flag via NIC_CAPABILITY
217  *
218  * 12 28 2010 cp.wu
219  * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release
220  * integrate with 'EEPROM used' flag for reporting correct capability to Engineer Mode/META and other tools
221  *
222  * 12 23 2010 george.huang
223  * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function
224  * 1. update WMM IE parsing, with ASSOC REQ handling
225  * 2. extend U-APSD parameter passing from driver to FW
226  *
227  * 12 07 2010 cm.chang
228  * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
229  * 1. BSSINFO include RLM parameter
230  * 2. free all sta records when network is disconnected
231  *
232  * 12 07 2010 cm.chang
233  * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant
234  * 1. Country code is from NVRAM or supplicant
235  * 2. Change band definition in CMD/EVENT.
236  *
237  * 11 29 2010 cm.chang
238  * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm
239  * Sync RCPI of STA_REC to FW as reference of initial TX rate
240  *
241  * 11 08 2010 cm.chang
242  * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID
243  * Remove CNM channel reover message ID
244  *
245  * 11 01 2010 cp.wu
246  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module
247  * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
248  * 2) Remove CNM CH-RECOVER event handling
249  * 3) cfg read/write API renamed with kal prefix for unified naming rules.
250  *
251  * 10 26 2010 cp.wu
252  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command
253  * 1) update NVRAM content template to ver 1.02
254  * 2) add compile option for querying NIC capability (default: off)
255  * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting
256  * 4) correct auto-rate compiler error under linux (treat warning as error)
257  * 5) simplify usage of NVRAM and REG_INFO_T
258  * 6) add version checking between driver and firmware
259  *
260  * 10 25 2010 cp.wu
261  * [WCXRP00000133] [MT6620 Wi-Fi] [FW][Driver] Change TX power offset band definition
262  * follow-up for CMD_5G_PWR_OFFSET_T definition change
263  *
264  * 10 20 2010 cp.wu
265  * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore
266  * use OID_CUSTOM_TEST_MODE as indication for driver reset
267  * by dropping pending TX packets
268  *
269  * 10 20 2010 wh.su
270  * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group
271  * Add the code to support disconnect p2p group
272  *
273  * 09 15 2010 cm.chang
274  * NULL
275  * Add new CMD for TX power, 5G power offset and power parameters
276  *
277  * 09 07 2010 yuche.tsai
278  * NULL
279  * Add a pointer in P2P SCAN RESULT structure. This pointer
280  * is pointed to a IE buffer for this P2p device.
281  *
282  * 09 07 2010 wh.su
283  * NULL
284  * adding the code for beacon/probe req/ probe rsp wsc ie at p2p.
285  *
286  * 09 03 2010 kevin.huang
287  * NULL
288  * Refine #include sequence and solve recursive/nested #include issue
289  *
290  * 08 23 2010 chinghwa.yu
291  * NULL
292  * Update for BOW.
293  *
294  * 08 20 2010 cm.chang
295  * NULL
296  * Migrate RLM code to host from FW
297  *
298  * 08 16 2010 george.huang
299  * NULL
300  * add new CMD ID definition
301  *
302  * 08 16 2010 yuche.tsai
303  * NULL
304  * Add a field in BSS INFO cmd to change interface address for P2P. (switching between Device Addr & Interface Addr)
305  *
306  * 08 12 2010 yuche.tsai
307  * NULL
308  * Add interface address indication when indicate connection status.
309  * It is requested by supplicant to do 4 way handshake.
310  *
311  * 08 07 2010 wh.su
312  * NULL
313  * adding the privacy related code for P2P network
314  *
315  * 08 05 2010 yuche.tsai
316  * NULL
317  * Change data structure for P2P Device scan result, all channel time for scan command.
318  *
319  * 08 04 2010 george.huang
320  * NULL
321  * handle change PS mode OID/ CMD
322  *
323  * 08 04 2010 yarco.yang
324  * NULL
325  * Add TX_AMPDU and ADDBA_REJECT command
326  *
327  * 08 03 2010 george.huang
328  * NULL
329  * handle event for updating NOA parameters indicated from FW
330  *
331  * 08 02 2010 george.huang
332  * NULL
333  * add WMM-PS test related OID/ CMD handlers
334  *
335  * 07 28 2010 cp.wu
336  * NULL
337  * sync. CMD_BSS_INFO structure change to CMD-EVENT v0.15.
338  *
339  * 07 26 2010 yuche.tsai
340  *
341  * Add P2P Device Found Event.
342  * Channel extention option in scan abort command.
343  *
344  * 07 23 2010 cp.wu
345  *
346  * add AIS-FSM handling for beacon timeout event.
347  *
348  * 07 21 2010 yuche.tsai
349  *
350  * Add for P2P Scan Result Parsing & Saving.
351  *
352  * 07 20 2010 george.huang
353  *
354  * DWORD align for the CMD data structure
355  *
356  * 07 20 2010 cp.wu
357  *
358  * pass band information for scan in an efficient way by mapping ENUM_BAND_T into UINT_8..
359  *
360  * 07 19 2010 wh.su
361  *
362  * update for security supporting.
363  *
364  * 07 19 2010 cm.chang
365  *
366  * Set RLM parameters and enable CNM channel manager
367  *
368  * 07 16 2010 yarco.yang
369  *
370  * 1. Support BSS Absence/Presence Event
371  * 2. Support STA change PS mode Event
372  * 3. Support BMC forwarding for AP mode.
373  *
374  * 07 14 2010 cp.wu
375  *
376  * [WPD00003833] [MT6620 and MT5931] Driver migration.
377  * pass band with channel number information as scan parameter
378  *
379  * 07 14 2010 yarco.yang
380  *
381  * 1. Remove CFG_MQM_MIGRATION
382  * 2. Add CMD_UPDATE_WMM_PARMS command
383  *
384  * 07 09 2010 cp.wu
385  *
386  * reorder members of CMD_SET_BSS_INFO.
387  *
388  * 07 08 2010 cp.wu
389  *
390  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
391  *
392  * 07 07 2010 cp.wu
393  * [WPD00003833][MT6620 and MT5931] Driver migration
394  * update prStaRecOfAP with BSS-INFO.
395  *
396  * 07 07 2010 cm.chang
397  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
398  * Support state of STA record change from 1 to 1
399  *
400  * 07 01 2010 cm.chang
401  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
402  * Support sync command of STA_REC
403  *
404  * 07 01 2010 cp.wu
405  * [WPD00003833][MT6620 and MT5931] Driver migration
406  * implementation of DRV-SCN and related mailbox message handling.
407  *
408  * 06 30 2010 cp.wu
409  * [WPD00003833][MT6620 and MT5931] Driver migration
410  * sync. with CMD/EVENT document ver0.07.
411  *
412  * 06 29 2010 cp.wu
413  * [WPD00003833][MT6620 and MT5931] Driver migration
414  * correct variable naming for 8-bit variable used in CMD_BEACON_TEMPLATE_UPDATE.
415  *
416  * 06 29 2010 cp.wu
417  * [WPD00003833][MT6620 and MT5931] Driver migration
418  * 1) sync to. CMD/EVENT document v0.03
419  * 2) simplify DTIM period parsing in scan.c only, bss.c no longer parses it again.
420  * 3) send command packet to indicate FW-PM after
421  *     a) 1st beacon is received after AIS has connected to an AP
422  *     b) IBSS-ALONE has been created
423  *     c) IBSS-MERGE has occured
424  *
425  * 06 28 2010 george.huang
426  * [WPD00001556]Basic power managemenet function
427  * Create beacon update path, with expose bssUpdateBeaconContent()
428  *
429  * 06 22 2010 cp.wu
430  * [WPD00003833][MT6620 and MT5931] Driver migration
431  * 1) add command warpper for STA-REC/BSS-INFO sync.
432  * 2) enhance command packet sending procedure for non-oid part
433  * 3) add command packet definitions for STA-REC/BSS-INFO sync.
434  *
435  * 06 21 2010 cp.wu
436  * [WPD00003833][MT6620 and MT5931] Driver migration
437  * add BSS/STA_REC commands for integration.
438  *
439  * 06 21 2010 yarco.yang
440  * [WPD00003837][MT6620]Data Path Refine
441  * Add TX Done Event handle entry
442  *
443  * 06 10 2010 cp.wu
444  * [WPD00003833][MT6620 and MT5931] Driver migration
445  * 1) eliminate CFG_CMD_EVENT_VERSION_0_9
446  * 2) when disconnected, indicate nic directly (no event is needed)
447  *
448  * 06 06 2010 kevin.huang
449  * [WPD00003832][MT6620 5931] Create driver base
450  * [MT6620 5931] Create driver base
451  *
452  * 05 20 2010 cp.wu
453  * [WPD00001943]Create WiFi test driver framework on WinXP
454  * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS
455  * 2) buffer statistics data for 2 seconds
456  * 3) use default value for adhoc parameters instead of 0
457  *
458  * 05 19 2010 cp.wu
459  * [WPD00001943]Create WiFi test driver framework on WinXP
460  * 1) do not take timeout mechanism for power mode oids
461  * 2) retrieve network type from connection status
462  * 3) after disassciation, set radio state to off
463  * 4) TCP option over IPv6 is supported
464  *
465  * 05 17 2010 cp.wu
466  * [WPD00001943]Create WiFi test driver framework on WinXP
467  * correct OID_802_11_DISASSOCIATE handling.
468  *
469  * 05 17 2010 cp.wu
470  * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support
471  * 1) add timeout handler mechanism for pending command packets
472  * 2) add p2p add/removal key
473  *
474  * 04 13 2010 cp.wu
475  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support
476  * add framework for BT-over-Wi-Fi support.
477  *  *  *  *  *  *  *  *  *  * 1) prPendingCmdInfo is replaced by queue for multiple handler capability
478  *  *  *  *  *  *  *  *  *  * 2) command sequence number is now increased atomically
479  *  *  *  *  *  *  *  *  *  * 3) private data could be hold and taken use for other purpose
480  *
481  * 04 06 2010 cp.wu
482  * [WPD00001943]Create WiFi test driver framework on WinXP
483  * sync statistics data structure definition with firmware implementation
484  *
485  * 03 30 2010 cp.wu
486  * [WPD00001943]Create WiFi test driver framework on WinXP
487  * statistics information OIDs are now handled by querying from firmware domain
488  *
489  * 03 26 2010 cp.wu
490  * [WPD00001943]Create WiFi test driver framework on WinXP
491  * indicate media stream mode after set is done
492  *
493  * 03 26 2010 cp.wu
494  * [WPD00001943]Create WiFi test driver framework on WinXP
495  * add a temporary flag for integration with CMD/EVENT v0.9.
496  *
497  * 03 25 2010 cp.wu
498  * [WPD00001943]Create WiFi test driver framework on WinXP
499  * 1) correct OID_802_11_CONFIGURATION with frequency setting behavior.
500  *  * the frequency is used for adhoc connection only
501  *  * 2) update with SD1 v0.9 CMD/EVENT documentation
502  *
503  * 03 24 2010 jeffrey.chang
504  * [WPD00003826]Initial import for Linux port
505  * initial import for Linux port
506  *
507  * 03 22 2010 cp.wu
508  * [WPD00003824][MT6620 Wi-Fi][New Feature] Add support of large scan list
509  * Implement feature needed by CR: WPD00003824: refining association command by pasting scanning result
510  *
511  * 03 19 2010 cp.wu
512  * [WPD00001943]Create WiFi test driver framework on WinXP
513  * 1) add ACPI D0/D3 state switching support
514  *  *  *  *  *  * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response
515  *
516  * 03 15 2010 kevin.huang
517  * [WPD00003820][MT6620 Wi-Fi] Modify the code for meet the WHQL test
518  * Add event for activate STA_RECORD_T
519  *
520  * 03 03 2010 cp.wu
521  * [WPD00001943]Create WiFi test driver framework on WinXP
522  * implement custom OID: EEPROM read/write access
523  *
524  * 03 03 2010 cp.wu
525  * [WPD00001943]Create WiFi test driver framework on WinXP
526  * implement OID_802_3_MULTICAST_LIST oid handling
527  *
528  * 02 26 2010 cp.wu
529  * [WPD00001943]Create WiFi test driver framework on WinXP
530  * move EVENT_ID_ASSOC_INFO from nic_rx.c to gl_kal_ndis_51.c
531  * 'cause it involves OS dependent data structure handling
532  *
533  * 02 25 2010 cp.wu
534  * [WPD00001943]Create WiFi test driver framework on WinXP
535  * send CMD_ID_INFRASTRUCTURE when handling OID_802_11_INFRASTRUCTURE_MODE set.
536  *
537  * 02 09 2010 cp.wu
538  * [WPD00001943]Create WiFi test driver framework on WinXP
539  * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address
540  *  *  *  *  * 2. follow MSDN defined behavior when associates to another AP
541  *  *  *  *  * 3. for firmware download, packet size could be up to 2048 bytes
542  *
543  * 01 27 2010 wh.su
544  * [WPD00003816][MT6620 Wi-Fi] Adding the security support
545  * .
546  *
547  * 01 27 2010 cp.wu
548  * [WPD00001943]Create WiFi test driver framework on WinXP
549  * 1. eliminate improper variable in rHifInfo
550  *  *  *  *  *  * 2. block TX/ordinary OID when RF test mode is engaged
551  *  *  *  *  *  * 3. wait until firmware finish operation when entering into and leaving from RF test mode
552  *  *  *  *  *  * 4. correct some HAL implementation
553  *
554  * 01 22 2010 cp.wu
555  * [WPD00001943]Create WiFi test driver framework on WinXP
556  * implement following 802.11 OIDs:
557  *  *  * OID_802_11_RSSI,
558  *  *  * OID_802_11_RSSI_TRIGGER,
559  *  *  * OID_802_11_STATISTICS,
560  *  *  * OID_802_11_DISASSOCIATE,
561  *  *  * OID_802_11_POWER_MODE
562  *
563  * 01 21 2010 cp.wu
564  * [WPD00001943]Create WiFi test driver framework on WinXP
565  * implement OID_802_11_MEDIA_STREAM_MODE
566  *
567  * 01 21 2010 cp.wu
568  * [WPD00001943]Create WiFi test driver framework on WinXP
569  * implement OID_802_11_SUPPORTED_RATES / OID_802_11_DESIRED_RATES
570  *
571  * 12 30 2009 cp.wu
572  * [WPD00001943]Create WiFi test driver framework on WinXP
573  * 1) According to CMD/EVENT documentation v0.8,
574  *  *  *  *  *  * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used,
575  *  *  *  *  *  * and result is retrieved by get ATInfo instead
576  *  *  *  *  *  * 2) add 4 counter for recording aggregation statistics
577 **  \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-12-11 18:35:07 GMT mtk02752
578 **  add CMD added in CMD/EVEN document v0.8
579 **  \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-12-10 16:39:37 GMT mtk02752
580 **  eliminate unused definitions
581 **  \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-12-10 09:55:11 GMT mtk02752
582 **  command ID/event ID revised
583 **  \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-12-09 13:57:37 GMT MTK02468
584 **  Added event ids (EVENT_ID_RX_ADDBA and EVENT_ID_RX_DELBA)
585 **  \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-12-08 17:35:39 GMT mtk02752
586 **  + add event ID for EVENT_ID_TEST_STATUS (rf test)
587 **  \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-12-07 23:01:09 GMT mtk02752
588 **  add data structure for RF_TEST
589 **  \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-12-03 16:22:56 GMT mtk01461
590 **  Modify the element - i4RSSI in EVENT of SCAN RESULT
591 **  \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-11-30 10:54:44 GMT mtk02752
592 **  1st DW of WIFI_CMD_T is shared with HIF_TX_HEADER_T, while 1st DW of WIFI_EVENT_T is shared with HIF_RX_HEADER_T
593 **  \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-11-26 10:16:58 GMT mtk02752
594 **  resync EVENT_CONNECTION_STATUS
595 **  \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-11-25 21:34:01 GMT mtk02752
596 **  sync. EVENT_SCAN_RESULT_T with firmware
597 **  \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-11-25 21:03:48 GMT mtk02752
598 **  refine MGMT_FRAME
599 **  \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-11-25 18:17:47 GMT mtk02752
600 **  refine GL_WLAN_INFO_T for buffering scan result and presume max. ie length = 600 bytes
601 **  \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-11-24 22:41:20 GMT mtk02752
602 **  add EVENT_SCAN_RESULT_T definition
603 **  \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-11-23 20:29:16 GMT mtk02752
604 **   fix typo
605 **  \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-11-23 14:46:01 GMT mtk02752
606 **  add new command/event structure upon CM@SD1's documentation
607 **  \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-11-13 15:13:40 GMT mtk02752
608 **  add command definition for CMD_BUILD_CONNECTION and EVENT_CONNECTION_STATUS
609 **  \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-05-20 12:22:22 GMT mtk01461
610 **  Add SeqNum field to Event Header
611 **  \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-04-29 15:42:11 GMT mtk01461
612 **  Update structure of HIF_EVENT_HEADER_T and EVENT_HDR_SIZE
613 **  \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-04-21 12:10:36 GMT mtk01461
614 **  Add Common Set CMD Callback for MCR Write and other Set OID
615 **  \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-04-21 01:40:17 GMT mtk01461
616 **  Command Done Handler
617 */
618 #ifndef _NIC_CMD_EVENT_H
619 #define _NIC_CMD_EVENT_H
620
621 /*******************************************************************************
622 *                         C O M P I L E R   F L A G S
623 ********************************************************************************
624 */
625
626 /*******************************************************************************
627 *                    E X T E R N A L   R E F E R E N C E S
628 ********************************************************************************
629 */
630
631 /*******************************************************************************
632 *                              C O N S T A N T S
633 ********************************************************************************
634 */
635 #define CMD_STATUS_SUCCESS      0
636 #define CMD_STATUS_REJECTED     1
637 #define CMD_STATUS_UNKNOWN      2
638
639 #define EVENT_HDR_SIZE          OFFSET_OF(WIFI_EVENT_T, aucBuffer[0])
640
641 #define MAX_IE_LENGTH       (600)
642 #define MAX_WSC_IE_LENGTH   (400)
643
644 /* Action field in structure CMD_CH_PRIVILEGE_T */
645 #define CMD_CH_ACTION_REQ           0
646 #define CMD_CH_ACTION_ABORT         1
647
648 /* Status field in structure EVENT_CH_PRIVILEGE_T */
649 #define EVENT_CH_STATUS_GRANT       0
650
651
652 typedef enum _ENUM_CMD_ID_T {
653     CMD_ID_TEST_MODE = 1,               /* 0x01 (Set) */
654     CMD_ID_RESET_REQUEST,               /* 0x02 (Set) */
655     CMD_ID_BUILD_CONNECTION,            /* 0x03 (Set) */
656     CMD_ID_SCAN_REQ_V2,                 /* 0x04 (Set) */
657     CMD_ID_NIC_POWER_CTRL,              /* 0x05 (Set) */
658     CMD_ID_POWER_SAVE_MODE,             /* 0x06 (Set) */
659     CMD_ID_LINK_ATTRIB,                 /* 0x07 (Set) */
660     CMD_ID_ADD_REMOVE_KEY,              /* 0x08 (Set) */
661     CMD_ID_DEFAULT_KEY_ID,              /* 0x09 (Set) */
662     CMD_ID_INFRASTRUCTURE,              /* 0x0a (Set) */
663     CMD_ID_SET_RX_FILTER,               /* 0x0b (Set) */
664     CMD_ID_DOWNLOAD_BUF,                /* 0x0c (Set) */
665     CMD_ID_WIFI_START,                  /* 0x0d (Set) */
666     CMD_ID_CMD_BT_OVER_WIFI,            /* 0x0e (Set) */
667     CMD_ID_SET_MEDIA_CHANGE_DELAY_TIME, /* 0x0f (Set) */
668     CMD_ID_SEND_ADDBA_RSP,              /* 0x10 (Set) */
669     CMD_ID_WAPI_MODE,                   /* 0x11 (Set)  (obsolete) */
670     CMD_ID_WAPI_ASSOC_INFO,             /* 0x12 (Set)  (obsolete) */
671     CMD_ID_SET_DOMAIN_INFO,             /* 0x13 (Set) */
672     CMD_ID_SET_IP_ADDRESS,              /* 0x14 (Set) */
673     CMD_ID_BSS_ACTIVATE_CTRL,           /* 0x15 (Set) */
674     CMD_ID_SET_BSS_INFO,                /* 0x16 (Set) */
675     CMD_ID_UPDATE_STA_RECORD,           /* 0x17 (Set) */
676     CMD_ID_REMOVE_STA_RECORD,           /* 0x18 (Set) */
677     CMD_ID_INDICATE_PM_BSS_CREATED,     /* 0x19 (Set) */
678     CMD_ID_INDICATE_PM_BSS_CONNECTED,   /* 0x1a (Set) */
679     CMD_ID_INDICATE_PM_BSS_ABORT,       /* 0x1b (Set) */
680     CMD_ID_UPDATE_BEACON_CONTENT,       /* 0x1c (Set) */
681     CMD_ID_SET_BSS_RLM_PARAM,           /* 0x1d (Set) */
682     CMD_ID_SCAN_REQ,                    /* 0x1e (Set) */
683     CMD_ID_SCAN_CANCEL,                 /* 0x1f (Set) */
684     CMD_ID_CH_PRIVILEGE,                /* 0x20 (Set) */
685     CMD_ID_UPDATE_WMM_PARMS,            /* 0x21 (Set) */
686     CMD_ID_SET_WMM_PS_TEST_PARMS,       /* 0x22 (Set) */
687     CMD_ID_TX_AMPDU,                    /* 0x23 (Set) */
688     CMD_ID_ADDBA_REJECT,                /* 0x24 (Set) */
689     CMD_ID_SET_PS_PROFILE_ADV,          /* 0x25 (Set) */
690     CMD_ID_SET_RAW_PATTERN,             /* 0x26 (Set) */
691     CMD_ID_CONFIG_PATTERN_FUNC,         /* 0x27 (Set) */
692     CMD_ID_SET_TX_PWR,                  /* 0x28 (Set) */
693     CMD_ID_SET_5G_PWR_OFFSET,           /* 0x29 (Set) */
694     CMD_ID_SET_PWR_PARAM,               /* 0x2A (Set) */
695     CMD_ID_P2P_ABORT,                   /* 0x2B (Set) */
696 #if CFG_STRESS_TEST_SUPPORT
697         CMD_ID_RANDOM_RX_RESET_EN = 0x2C,       /* 0x2C (Set ) */
698         CMD_ID_RANDOM_RX_RESET_DE = 0x2D,       /* 0x2D (Set ) */
699         CMD_ID_SAPP_EN            = 0x2E,       /* 0x2E (Set ) */
700         CMD_ID_SAPP_DE            = 0x2F,       /* 0x2F (Set ) */
701 #endif
702     CMD_ID_ROAMING_TRANSIT  = 0x30,     /* 0x30 (Set) */
703     CMD_ID_SET_PHY_PARAM,               /* 0x31 (Set) */
704     CMD_ID_SET_NOA_PARAM,               /* 0x32 (Set) */
705     CMD_ID_SET_OPPPS_PARAM,             /* 0x33 (Set) */
706     CMD_ID_SET_UAPSD_PARAM,             /* 0x34 (Set) */
707     CMD_ID_SET_SIGMA_STA_SLEEP,         /* 0x35 (Set) */
708     CMD_ID_SET_EDGE_TXPWR_LIMIT,        /* 0x36 (Set) */
709     CMD_ID_SET_DEVICE_MODE,             /* 0x37 (Set) */
710     CMD_ID_SET_TXPWR_CTRL,              /* 0x38 (Set) */
711
712     CMD_ID_GET_NIC_CAPABILITY = 0x80,   /* 0x80 (Query) */
713     CMD_ID_GET_LINK_QUALITY,            /* 0x81 (Query) */
714     CMD_ID_GET_STATISTICS,              /* 0x82 (Query) */
715     CMD_ID_GET_CONNECTION_STATUS,       /* 0x83 (Query) */
716     CMD_ID_GET_ASSOC_INFO,              /* 0x84 (Query) (obsolete) */
717
718     CMD_ID_BASIC_CONFIG = 0xc1,         /* 0xc1 (Set / Query) */
719     CMD_ID_ACCESS_REG,                  /* 0xc2 (Set / Query) */
720     CMD_ID_MAC_MCAST_ADDR,              /* 0xc3 (Set / Query) */
721     CMD_ID_802_11_PMKID,                /* 0xc4 (Set / Query) */
722     CMD_ID_ACCESS_EEPROM,               /* 0xc5 (Set / Query) */
723     CMD_ID_SW_DBG_CTRL,                 /* 0xc6 (Set / Query) */
724 #if 1/* CFG_SUPPORT_ANTI_PIRACY */
725     CMD_ID_SEC_CHECK,                    /* 0xc7 (Set / Query) */
726 #endif
727
728 #if CFG_SUPPORT_RDD_TEST_MODE
729     CMD_ID_SET_RDD_CH = 0xE1,
730 #endif
731
732     CMD_ID_SET_BWCS = 0xF1,
733 #if CFG_SUPPORT_OSC_SETTING && defined(MT5931)
734     CMD_ID_SET_OSC = 0xf2,
735 #endif
736 } ENUM_CMD_ID_T, *P_ENUM_CMD_ID_T;
737
738 typedef enum _ENUM_EVENT_ID_T {
739     EVENT_ID_CMD_RESULT = 1,            /* 0x01 (Query) */
740     EVENT_ID_NIC_CAPABILITY,            /* 0x02 (Query) */
741     EVENT_ID_CONNECTION_STATUS,         /* 0x03 (Query / Unsolicited) (obsolete) */
742     EVENT_ID_SCAN_RESULT,               /* 0x04 (Query / Unsolicited) (obselete) */
743     EVENT_ID_LINK_QUALITY,              /* 0x05 (Query / Unsolicited) */
744     EVENT_ID_STATISTICS,                /* 0x06 (Query) */
745     EVENT_ID_MIC_ERR_INFO,              /* 0x07 (Unsolicited) */
746     EVENT_ID_ASSOC_INFO,                /* 0x08 (Query - CMD_ID_GET_ASSOC_INFO) */
747     EVENT_ID_BASIC_CONFIG,              /* 0x09 (Query - CMD_ID_BASIC_CONFIG) */
748     EVENT_ID_ACCESS_REG,                /* 0x0a (Query - CMD_ID_ACCESS_REG) */
749     EVENT_ID_MAC_MCAST_ADDR,            /* 0x0b (Query - CMD_ID_MAC_MCAST_ADDR) */
750     EVENT_ID_802_11_PMKID,              /* 0x0c (Query - CMD_ID_802_11_PMKID) */
751     EVENT_ID_ACCESS_EEPROM,             /* 0x0d (Query - CMD_ID_ACCESS_EEPROM) */
752     EVENT_ID_SLEEPY_NOTIFY,             /* 0x0e (Query) */
753     EVENT_ID_BT_OVER_WIFI,              /* 0x0f (Unsolicited) */
754     EVENT_ID_TEST_STATUS,               /* 0x10 (Query - CMD_ID_TEST_MODE) */
755     EVENT_ID_RX_ADDBA,                  /* 0x11 (Unsolicited) (obsolete) */
756     EVENT_ID_RX_DELBA,                  /* 0x12 (Unsolicited) (obsolete) */
757     EVENT_ID_ACTIVATE_STA_REC_T,        /* 0x13 (Unsolicited) */
758     EVENT_ID_DEACTIVATE_STA_REC_T,      /* 0x14 (Unsolicited) */
759     EVENT_ID_SCAN_DONE,                 /* 0x15 (Unsoiicited) */
760     EVENT_ID_RX_FLUSH,                  /* 0x16 (Unsolicited) */
761     EVENT_ID_TX_DONE,                   /* 0x17 (Unsolicited) */
762     EVENT_ID_CH_PRIVILEGE,              /* 0x18 (Unsolicited) */
763     EVENT_ID_BSS_ABSENCE_PRESENCE = 0x19,  /* 0x19 (Unsolicited) */
764     EVENT_ID_STA_CHANGE_PS_MODE,        /* 0x1A (Unsolicited) */
765     EVENT_ID_BSS_BEACON_TIMEOUT,        /* 0x1B (Unsolicited) */
766     EVENT_ID_UPDATE_NOA_PARAMS,         /* 0x1C (Unsolicited) */
767     EVENT_ID_AP_OBSS_STATUS,            /* 0x1D (Unsolicited) */
768     EVENT_ID_STA_UPDATE_FREE_QUOTA,     /* 0x1E (Unsolicited) */
769     EVENT_ID_SW_DBG_CTRL,               /* 0x1F (Query - CMD_ID_SW_DBG_CTRL) */
770     EVENT_ID_ROAMING_STATUS,            /* 0x20 (Unsolicited) */
771     EVENT_ID_STA_AGING_TIMEOUT,         /* 0x21 (Unsolicited) */
772 #if 1 /* CFG_SUPPORT_ANTI_PIRACY */
773     EVENT_ID_SEC_CHECK_RSP,              /* 0x22 (Unsolicited) */
774 #endif
775     EVENT_ID_SEND_DEAUTH,               /* 0x23 (Unsolicited) */
776
777 #if CFG_SUPPORT_RDD_TEST_MODE
778     EVENT_ID_UPDATE_RDD_STATUS,          /* 0x24 (Unsolicited) */
779 #endif
780
781 #if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS
782     EVENT_ID_UPDATE_BWCS_STATUS = 0x25,         /* 0x25 (Unsolicited) */
783     EVENT_ID_UPDATE_BCM_DEBUG                    /* 0x26 (Unsolicited) */
784 #endif
785 } ENUM_EVENT_ID_T, *P_ENUM_EVENT_ID_T;
786
787
788 /*******************************************************************************
789 *                             D A T A   T Y P E S
790 ********************************************************************************
791 */
792 #ifndef LINUX
793 typedef UINT_8 CMD_STATUS;
794 #endif
795 /* for Event Packet (via HIF-RX) */
796     /* following CM's documentation v0.7 */
797 typedef struct _WIFI_CMD_T {
798     UINT_16     u2TxByteCount_UserPriority;
799     UINT_8      ucEtherTypeOffset;
800     UINT_8      ucResource_PktType_CSflags;
801     UINT_8      ucCID;
802     UINT_8      ucSetQuery;
803     UINT_8      ucSeqNum;
804     UINT_8      aucReserved2;
805
806     UINT_8      aucBuffer[0];
807 } WIFI_CMD_T, *P_WIFI_CMD_T;
808
809 /* for Command Packet (via HIF-TX) */
810     /* following CM's documentation v0.7 */
811 typedef struct _WIFI_EVENT_T {
812     UINT_16     u2PacketLen;
813     UINT_16     u2PacketType;
814     UINT_8      ucEID;
815     UINT_8      ucSeqNum;
816     UINT_8      aucReserved2[2];
817
818     UINT_8      aucBuffer[0];
819 } WIFI_EVENT_T, *P_WIFI_EVENT_T;
820
821 // CMD_ID_TEST_MODE
822 typedef struct _CMD_TEST_CTRL_T {
823     UINT_8  ucAction;
824     UINT_8      aucReserved[3];
825     union {
826         UINT_32                 u4OpMode;
827         UINT_32                 u4ChannelFreq;
828         PARAM_MTK_WIFI_TEST_STRUC_T rRfATInfo;
829     } u;
830 } CMD_TEST_CTRL_T, *P_CMD_TEST_CTRL_T;
831
832 // EVENT_TEST_STATUS
833 typedef struct _PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T {
834     UINT_32             u4PktSentStatus;
835     UINT_32             u4PktSentCount;
836     UINT_16             u2AvgAlc;
837     UINT_8              ucCckGainControl;
838     UINT_8              ucOfdmGainControl;
839 } PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T, *P_PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T;
840
841 typedef struct  _PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T {
842     UINT_32             u4IntRxOk;            /*!< number of packets that Rx ok from interrupt */
843     UINT_32             u4IntCrcErr;          /*!< number of packets that CRC error from interrupt */
844     UINT_32             u4IntShort;           /*!< number of packets that is short preamble from interrupt */
845     UINT_32             u4IntLong;            /*!< number of packets that is long preamble from interrupt */
846     UINT_32             u4PauRxPktCount;      /*!< number of packets that Rx ok from PAU */
847     UINT_32             u4PauCrcErrCount;     /*!< number of packets that CRC error from PAU */
848     UINT_32             u4PauRxFifoFullCount; /*!< number of packets that is short preamble from PAU */
849     UINT_32             u4PauCCACount;        /*!< CCA rising edge count */
850 } PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T, *P_PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T;
851
852 typedef union _EVENT_TEST_STATUS {
853     PARAM_MTK_WIFI_TEST_STRUC_T             rATInfo;
854 //    PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T   rTxStatus;
855 //    PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T   rRxStatus;
856 } EVENT_TEST_STATUS, *P_EVENT_TEST_STATUS;
857
858 // CMD_BUILD_CONNECTION
859 typedef struct _CMD_BUILD_CONNECTION {
860     UINT_8      ucInfraMode;
861     UINT_8      ucAuthMode;
862     UINT_8      ucEncryptStatus;
863     UINT_8      ucSsidLen;
864     UINT_8      aucSsid[PARAM_MAX_LEN_SSID];
865     UINT_8      aucBssid[PARAM_MAC_ADDR_LEN];
866
867     /* Ad-hoc mode */
868     UINT_16     u2BeaconPeriod;
869     UINT_16     u2ATIMWindow;
870     UINT_8      ucJoinOnly;
871     UINT_8      ucReserved;
872     UINT_32     u4FreqInKHz;
873
874     /* for faster connection */
875     UINT_8      aucScanResult[0];
876 } CMD_BUILD_CONNECTION, *P_CMD_BUILD_CONNECTION;
877
878 //CMD_ADD_REMOVE_KEY
879 typedef struct _CMD_802_11_KEY {
880     UINT_8      ucAddRemove;
881     UINT_8      ucTxKey;
882     UINT_8      ucKeyType;
883     UINT_8      ucIsAuthenticator;
884     UINT_8      aucPeerAddr[6];
885     UINT_8      ucNetType;
886     UINT_8      ucAlgorithmId;
887     UINT_8      ucKeyId;
888     UINT_8      ucKeyLen;
889     UINT_8      aucReverved[2];
890     UINT_8      aucKeyMaterial[32];
891     UINT_8      aucKeyRsc[16];
892 } CMD_802_11_KEY, *P_CMD_802_11_KEY;
893
894 /* WPA2 PMKID cache structure */
895 typedef struct _PMKID_ENTRY_T {
896     PARAM_BSSID_INFO_T  rBssidInfo;
897     BOOLEAN             fgPmkidExist;
898 } PMKID_ENTRY_T, *P_PMKID_ENTRY_T;
899
900 typedef struct _CMD_802_11_PMKID
901 {
902     ULONG               u4BSSIDInfoCount;
903     P_PMKID_ENTRY_T     arPMKIDInfo[1];
904 } CMD_802_11_PMKID, *P_CMD_802_11_PMKID;
905
906 // CMD_BASIC_CONFIG
907 typedef struct _CMD_CSUM_OFFLOAD {
908     UINT_16     u2RxChecksum; // bit0: IP, bit1: UDP, bit2: TCP
909     UINT_16     u2TxChecksum; // bit0: IP, bit1: UDP, bit2: TCP
910 } CMD_CSUM_OFFLOAD, *P_CMD_CSUM_OFFLOAD;
911
912 typedef struct _CMD_BASIC_CONFIG {
913     PARAM_MAC_ADDRESS   rMyMacAddr;
914     UINT_8              ucNative80211;
915     UINT_8              aucReserved[1];
916
917     CMD_CSUM_OFFLOAD    rCsumOffload;
918 } CMD_BASIC_CONFIG, *P_CMD_BASIC_CONFIG, EVENT_BASIC_CONFIG, *P_EVENT_BASIC_CONFIG;
919
920 // CMD_MAC_MCAST_ADDR
921 typedef struct _CMD_MAC_MCAST_ADDR {
922     UINT_32             u4NumOfGroupAddr;
923     UINT_8              ucNetTypeIndex;
924     UINT_8              aucReserved[3];
925     PARAM_MAC_ADDRESS   arAddress[MAX_NUM_GROUP_ADDR];
926 } CMD_MAC_MCAST_ADDR, *P_CMD_MAC_MCAST_ADDR, EVENT_MAC_MCAST_ADDR, *P_EVENT_MAC_MCAST_ADDR;
927
928 // CMD_ACCESS_EEPROM
929 typedef struct _CMD_ACCESS_EEPROM {
930     UINT_16             u2Offset;
931     UINT_16             u2Data;
932 } CMD_ACCESS_EEPROM, *P_CMD_ACCESS_EEPROM, EVENT_ACCESS_EEPROM, *P_EVENT_ACCESS_EEPROM;
933
934 typedef struct _CMD_CUSTOM_NOA_PARAM_STRUC_T {
935     UINT_32  u4NoaDurationMs;
936     UINT_32  u4NoaIntervalMs;
937     UINT_32  u4NoaCount;
938 } CMD_CUSTOM_NOA_PARAM_STRUC_T, *P_CMD_CUSTOM_NOA_PARAM_STRUC_T;
939
940 typedef struct _CMD_CUSTOM_OPPPS_PARAM_STRUC_T {
941     UINT_32  u4CTwindowMs;
942 } CMD_CUSTOM_OPPPS_PARAM_STRUC_T, *P_CMD_CUSTOM_OPPPS_PARAM_STRUC_T;
943
944 typedef struct _CMD_CUSTOM_UAPSD_PARAM_STRUC_T {
945     UINT_8  fgEnAPSD;
946     UINT_8  fgEnAPSD_AcBe;
947     UINT_8  fgEnAPSD_AcBk;
948     UINT_8  fgEnAPSD_AcVo;
949     UINT_8  fgEnAPSD_AcVi;
950     UINT_8  ucMaxSpLen;
951     UINT_8  aucResv[2];
952 } CMD_CUSTOM_UAPSD_PARAM_STRUC_T, *P_CMD_CUSTOM_UAPSD_PARAM_STRUC_T;
953
954 // EVENT_CONNECTION_STATUS
955 typedef struct _EVENT_CONNECTION_STATUS {
956     UINT_8  ucMediaStatus;
957     UINT_8  ucReasonOfDisconnect;
958
959     UINT_8  ucInfraMode;
960     UINT_8  ucSsidLen;
961     UINT_8  aucSsid[PARAM_MAX_LEN_SSID];
962     UINT_8  aucBssid[PARAM_MAC_ADDR_LEN];
963     UINT_8  ucAuthenMode;
964     UINT_8  ucEncryptStatus;
965     UINT_16 u2BeaconPeriod;
966     UINT_16 u2AID;
967     UINT_16 u2ATIMWindow;
968     UINT_8  ucNetworkType;
969     UINT_8  aucReserved[1];
970     UINT_32 u4FreqInKHz;
971
972 #if CFG_ENABLE_WIFI_DIRECT
973     UINT_8 aucInterfaceAddr[PARAM_MAC_ADDR_LEN];
974 #endif
975
976 } EVENT_CONNECTION_STATUS, *P_EVENT_CONNECTION_STATUS;
977
978 // EVENT_NIC_CAPABILITY
979 typedef struct _EVENT_NIC_CAPABILITY {
980     UINT_16     u2ProductID;
981     UINT_16     u2FwVersion;
982     UINT_16     u2DriverVersion;
983     UINT_8      ucHw5GBandDisabled;
984     UINT_8      ucEepromUsed;
985     UINT_8      ucEfuseValid;
986     UINT_8      ucMacAddrValid;
987     UINT_8      aucReserved[2];
988 } EVENT_NIC_CAPABILITY, *P_EVENT_NIC_CAPABILITY;
989
990 // modified version of WLAN_BEACON_FRAME_BODY_T for simplier buffering
991 typedef struct _WLAN_BEACON_FRAME_BODY_T_LOCAL {
992     /* Beacon frame body */
993     UINT_32     au4Timestamp[2];            /* Timestamp */
994     UINT_16     u2BeaconInterval;           /* Beacon Interval */
995     UINT_16     u2CapInfo;                  /* Capability */
996     UINT_8      aucInfoElem[MAX_IE_LENGTH]; /* Various IEs, start from SSID */
997     UINT_16     u2IELength;                 /* This field is *NOT* carried by F/W but caculated by nic_rx */
998 } WLAN_BEACON_FRAME_BODY_T_LOCAL, *P_WLAN_BEACON_FRAME_BODY_T_LOCAL;
999
1000 // EVENT_SCAN_RESULT
1001 typedef struct _EVENT_SCAN_RESULT_T {
1002     INT_32                          i4RSSI;
1003     UINT_32                         u4LinkQuality;
1004     UINT_32                         u4DSConfig; /* Center frequency */
1005     UINT_32                         u4DomainInfo; /* Require CM opinion */
1006     UINT_32                         u4Reserved;
1007     UINT_8                          ucNetworkType;
1008     UINT_8                          ucOpMode;
1009     UINT_8                          aucBssid[MAC_ADDR_LEN];
1010     UINT_8                          aucRatesEx[PARAM_MAX_LEN_RATES_EX];
1011     WLAN_BEACON_FRAME_BODY_T_LOCAL  rBeaconFrameBody;
1012 } EVENT_SCAN_RESULT_T, *P_EVENT_SCAN_RESULT_T;
1013
1014 /* event of tkip mic error */
1015 typedef struct _EVENT_MIC_ERR_INFO
1016 {
1017     UINT_32     u4Flags;
1018 } EVENT_MIC_ERR_INFO, *P_EVENT_MIC_ERR_INFO;
1019
1020 typedef struct _EVENT_PMKID_CANDIDATE_LIST_T
1021 {
1022     UINT_32     u4Version;            /*!< Version */
1023     UINT_32     u4NumCandidates;      /*!< How many candidates follow */
1024     PARAM_PMKID_CANDIDATE_T   arCandidateList[1];
1025 } EVENT_PMKID_CANDIDATE_LIST_T, *P_EVENT_PMKID_CANDIDATE_LIST_T;
1026
1027
1028 typedef struct _EVENT_CMD_RESULT {
1029         UINT_8          ucCmdID;
1030         UINT_8          ucStatus;
1031         UINT_8          aucReserved[2];
1032 } EVENT_CMD_RESULT, *P_EVENT_CMD_RESULT;
1033
1034 #if CFG_SUPPORT_OSC_SETTING && defined(MT5931)
1035 typedef struct _CMD_MCU_LP_PARAM_T {
1036     UINT_16     u2OscStableTime;
1037     UINT_8      ucReserved[6];
1038 } CMD_MCU_LP_PARAM_T, *P_CMD_MCU_LP_PARAM_T;
1039 #endif
1040
1041
1042 // CMD_ID_ACCESS_REG & EVENT_ID_ACCESS_REG
1043 typedef struct _CMD_ACCESS_REG {
1044     UINT_32     u4Address;
1045     UINT_32     u4Data;
1046 } CMD_ACCESS_REG, *P_CMD_ACCESS_REG;
1047
1048 typedef struct _CMD_SW_DBG_CTRL_T {
1049     UINT_32     u4Id;
1050     UINT_32     u4Data;
1051     /* Debug Support */
1052     UINT_32         u4DebugCnt[64];
1053 } CMD_SW_DBG_CTRL_T, *P_CMD_SW_DBG_CTRL_T;
1054
1055
1056 // CMD_ID_LINK_ATTRIB
1057 typedef struct _CMD_LINK_ATTRIB {
1058     INT_8       cRssiTrigger;
1059     UINT_8      ucDesiredRateLen;
1060     UINT_16     u2DesiredRate[32];
1061     UINT_8      ucMediaStreamMode;
1062     UINT_8      aucReserved[1];
1063 } CMD_LINK_ATTRIB, *P_CMD_LINK_ATTRIB;
1064
1065 // CMD_ID_NIC_POWER_CTRL
1066 typedef struct _CMD_NIC_POWER_CTRL {
1067     UINT_8  ucPowerMode;
1068     UINT_8  aucReserved[3];
1069 } CMD_NIC_POWER_CTRL, *P_CMD_NIC_POWER_CTRL;
1070
1071 // CMD_ID_POWER_SAVE_MODE
1072 typedef struct _CMD_PS_PROFILE_T {
1073     UINT_8  ucNetTypeIndex;
1074     UINT_8  ucPsProfile;
1075     UINT_8  aucReserved[2];
1076 } CMD_PS_PROFILE_T, *P_CMD_PS_PROFILE_T;
1077
1078
1079 // EVENT_LINK_QUALITY
1080 typedef struct _EVENT_LINK_QUALITY {
1081     INT_8       cRssi;
1082     INT_8       cLinkQuality;
1083     UINT_16     u2LinkSpeed;
1084     UINT_8      ucMediumBusyPercentage;
1085 } EVENT_LINK_QUALITY, *P_EVENT_LINK_QUALITY;
1086
1087 #if CFG_SUPPORT_P2P_RSSI_QUERY
1088 // EVENT_LINK_QUALITY
1089 typedef struct _EVENT_LINK_QUALITY_EX {
1090     INT_8       cRssi;
1091     INT_8       cLinkQuality;
1092     UINT_16     u2LinkSpeed;
1093     UINT_8      ucMediumBusyPercentage;
1094     UINT_8     ucIsLQ0Rdy;
1095     INT_8       cRssiP2P;   /* For P2P Network. */
1096     INT_8       cLinkQualityP2P;
1097     UINT_16     u2LinkSpeedP2P;
1098     UINT_8      ucMediumBusyPercentageP2P;
1099     UINT_8     ucIsLQ1Rdy;
1100 } EVENT_LINK_QUALITY_EX, *P_EVENT_LINK_QUALITY_EX;
1101 #endif
1102
1103 // EVENT_ID_STATISTICS
1104 typedef struct _EVENT_STATISTICS {
1105     LARGE_INTEGER   rTransmittedFragmentCount;
1106     LARGE_INTEGER   rMulticastTransmittedFrameCount;
1107     LARGE_INTEGER   rFailedCount;
1108     LARGE_INTEGER   rRetryCount;
1109     LARGE_INTEGER   rMultipleRetryCount;
1110     LARGE_INTEGER   rRTSSuccessCount;
1111     LARGE_INTEGER   rRTSFailureCount;
1112     LARGE_INTEGER   rACKFailureCount;
1113     LARGE_INTEGER   rFrameDuplicateCount;
1114     LARGE_INTEGER   rReceivedFragmentCount;
1115     LARGE_INTEGER   rMulticastReceivedFrameCount;
1116     LARGE_INTEGER   rFCSErrorCount;
1117 } EVENT_STATISTICS, *P_EVENT_STATISTICS;
1118
1119 // EVENT_ID_FW_SLEEPY_NOTIFY
1120 typedef struct _EVENT_SLEEPY_NOTIFY {
1121     UINT_8  ucSleepyState;
1122     UINT_8  aucReserved[3];
1123 } EVENT_SLEEPY_NOTIFY, *P_EVENT_SLEEPY_NOTIFY;
1124
1125 typedef struct _EVENT_ACTIVATE_STA_REC_T {
1126     UINT_8      aucMacAddr[6];
1127     UINT_8      ucStaRecIdx;
1128     UINT_8      ucNetworkTypeIndex;
1129     BOOLEAN     fgIsQoS;
1130     BOOLEAN     fgIsAP;
1131     UINT_8      aucReserved[2];
1132 } EVENT_ACTIVATE_STA_REC_T, *P_EVENT_ACTIVATE_STA_REC_T;
1133
1134 typedef struct _EVENT_DEACTIVATE_STA_REC_T {
1135     UINT_8      ucStaRecIdx;
1136     UINT_8      aucReserved[3];
1137 } EVENT_DEACTIVATE_STA_REC_T, *P_EVENT_DEACTIVATE_STA_REC_T;
1138
1139 // CMD_BT_OVER_WIFI
1140 typedef struct _CMD_BT_OVER_WIFI {
1141     UINT_8              ucAction;       /* 0: query, 1: setup, 2: destroy */
1142     UINT_8              ucChannelNum;
1143     PARAM_MAC_ADDRESS   rPeerAddr;
1144     UINT_16             u2BeaconInterval;
1145     UINT_8              ucTimeoutDiscovery;
1146     UINT_8              ucTimeoutInactivity;
1147     UINT_8              ucRole;
1148     UINT_8              PAL_Capabilities;
1149     UINT_8              cMaxTxPower;
1150     UINT_8              ucChannelBand;
1151     UINT_8              ucReserved[1];
1152 } CMD_BT_OVER_WIFI, *P_CMD_BT_OVER_WIFI;
1153
1154 // EVENT_BT_OVER_WIFI
1155 typedef struct _EVENT_BT_OVER_WIFI {
1156     UINT_8      ucLinkStatus;
1157     UINT_8      ucSelectedChannel;
1158     INT_8       cRSSI;
1159     UINT_8      ucReserved[1];
1160 } EVENT_BT_OVER_WIFI, *P_EVENT_BT_OVER_WIFI;
1161
1162 // Same with DOMAIN_SUBBAND_INFO
1163 typedef struct _CMD_SUBBAND_INFO {
1164     UINT_8              ucRegClass;
1165     UINT_8              ucBand;
1166     UINT_8              ucChannelSpan;
1167     UINT_8              ucFirstChannelNum;
1168     UINT_8              ucNumChannels;
1169     UINT_8              aucReserved[3];
1170 } CMD_SUBBAND_INFO, *P_CMD_SUBBAND_INFO;
1171
1172 // CMD_SET_DOMAIN_INFO
1173 typedef struct _CMD_SET_DOMAIN_INFO_T {
1174     UINT_16             u2CountryCode;
1175     UINT_16             u2Reserved;
1176     CMD_SUBBAND_INFO    rSubBand[6];
1177
1178     UINT_8              uc2G4Bandwidth; /* CONFIG_BW_20_40M or CONFIG_BW_20M */
1179     UINT_8              uc5GBandwidth;  /* CONFIG_BW_20_40M or CONFIG_BW_20M */
1180     UINT_8              aucReserved[2];
1181 } CMD_SET_DOMAIN_INFO_T, *P_CMD_SET_DOMAIN_INFO_T;
1182
1183 // CMD_SET_IP_ADDRESS
1184 typedef struct _IPV4_NETWORK_ADDRESS {
1185     UINT_8 aucIpAddr[4];
1186 } IPV4_NETWORK_ADDRESS, *P_IPV4_NETWORK_ADDRESS;
1187
1188 typedef struct _CMD_SET_NETWORK_ADDRESS_LIST {
1189     UINT_8  ucNetTypeIndex;
1190     UINT_8  ucAddressCount;
1191     UINT_8  ucReserved[2];
1192     IPV4_NETWORK_ADDRESS arNetAddress[1];
1193 } CMD_SET_NETWORK_ADDRESS_LIST, *P_CMD_SET_NETWORK_ADDRESS_LIST;
1194
1195 typedef struct _PATTERN_DESCRIPTION {
1196     UINT_8      fgCheckBcA1;
1197     UINT_8      fgCheckMcA1;
1198     UINT_8      ePatternHeader;
1199     UINT_8      fgAndOp;
1200     UINT_8      fgNotOp;
1201     UINT_8      ucPatternMask;
1202     UINT_16    ucPatternOffset;
1203     UINT_8      aucPattern[8];
1204 } PATTERN_DESCRIPTION, *P_PATTERN_DESCRIPTION;
1205
1206 typedef struct _CMD_RAW_PATTERN_CONFIGURATION_T {
1207     PATTERN_DESCRIPTION arPatternDesc[4];
1208 } CMD_RAW_PATTERN_CONFIGURATION_T, *P_CMD_RAW_PATTERN_CONFIGURATION_T;
1209
1210 typedef struct _CMD_PATTERN_FUNC_CONFIG {
1211     BOOLEAN      fgBcA1En;
1212     BOOLEAN      fgMcA1En;
1213     BOOLEAN      fgBcA1MatchDrop;
1214     BOOLEAN      fgMcA1MatchDrop;
1215 } CMD_PATTERN_FUNC_CONFIG, *P_CMD_PATTERN_FUNC_CONFIG;
1216
1217
1218 typedef struct _EVENT_TX_DONE_T {
1219     UINT_8      ucPacketSeq;
1220         UINT_8          ucStatus;
1221     UINT_16     u2SequenceNumber;
1222     UINT_32     au4Reserved1;
1223     UINT_32     au4Reserved2;
1224     UINT_32     au4Reserved3;
1225 } EVENT_TX_DONE_T, *P_EVENT_TX_DONE_T;
1226
1227 typedef struct _CMD_BSS_ACTIVATE_CTRL {
1228     UINT_8  ucNetTypeIndex;
1229     UINT_8  ucActive;
1230     UINT_8  aucReserved[2];
1231 } CMD_BSS_ACTIVATE_CTRL, *P_CMD_BSS_ACTIVATE_CTRL;
1232
1233 typedef struct _CMD_SET_BSS_RLM_PARAM_T {
1234     UINT_8      ucNetTypeIndex;
1235     UINT_8      ucRfBand;
1236     UINT_8      ucPrimaryChannel;
1237     UINT_8      ucRfSco;
1238     UINT_8      ucErpProtectMode;
1239     UINT_8      ucHtProtectMode;
1240     UINT_8      ucGfOperationMode;
1241     UINT_8      ucTxRifsMode;
1242     UINT_16     u2HtOpInfo3;
1243     UINT_16     u2HtOpInfo2;
1244     UINT_8      ucHtOpInfo1;
1245     UINT_8      ucUseShortPreamble;
1246     UINT_8      ucUseShortSlotTime;
1247     UINT_8      ucCheckId;          /* Fixed value: 0x72 */
1248 } CMD_SET_BSS_RLM_PARAM_T, *P_CMD_SET_BSS_RLM_PARAM_T;
1249
1250 typedef struct _CMD_SET_BSS_INFO {
1251     UINT_8  ucNetTypeIndex;
1252     UINT_8  ucConnectionState;
1253     UINT_8  ucCurrentOPMode;
1254     UINT_8  ucSSIDLen;
1255     UINT_8  aucSSID[32];
1256     UINT_8  aucBSSID[6];
1257     UINT_8  ucIsQBSS;
1258     UINT_8  ucReserved1;
1259     UINT_16 u2OperationalRateSet;
1260     UINT_16 u2BSSBasicRateSet;
1261     UINT_8  ucStaRecIdxOfAP;
1262     UINT_8  ucReserved2;
1263     UINT_8  ucReserved3;
1264     UINT_8  ucNonHTBasicPhyType; /* For Slot Time and CWmin */
1265     UINT_8  ucAuthMode;
1266     UINT_8  ucEncStatus;
1267     UINT_8  ucPhyTypeSet;
1268     UINT_8  aucOwnMac[6];
1269         UINT_8  fgWapiMode;
1270         UINT_8  fgIsApMode;
1271     UINT_8  aucRsv[1];
1272     CMD_SET_BSS_RLM_PARAM_T rBssRlmParam;
1273 } CMD_SET_BSS_INFO, *P_CMD_SET_BSS_INFO;
1274
1275 typedef struct _CMD_UPDATE_STA_RECORD_T {
1276     UINT_8  ucIndex;
1277     UINT_8  ucStaType;
1278     UINT_8  aucMacAddr[MAC_ADDR_LEN];
1279     UINT_16 u2AssocId;
1280     UINT_16 u2ListenInterval;
1281     UINT_8  ucNetTypeIndex;
1282     UINT_8  ucDesiredPhyTypeSet;
1283     UINT_16 u2DesiredNonHTRateSet;
1284     UINT_16 u2BSSBasicRateSet;
1285     UINT_8  ucIsQoS;
1286     UINT_8  ucIsUapsdSupported;
1287     UINT_8  ucStaState;
1288     UINT_8  ucMcsSet;
1289     UINT_8  ucSupMcs32;
1290     UINT_8  ucAmpduParam;
1291     UINT_16 u2HtCapInfo;
1292     UINT_16 u2HtExtendedCap;
1293     UINT_32 u4TxBeamformingCap;
1294     UINT_8  ucAselCap;
1295     UINT_8  ucRCPI;
1296     UINT_8  ucNeedResp;
1297     UINT_8  ucUapsdAc;  /* b0~3: Trigger enabled, b4~7: Delivery enabled */
1298     UINT_8  ucUapsdSp;  /* 0: all, 1: max 2, 2: max 4, 3: max 6 */
1299     UINT_8  aucReserved[3];
1300     /* TBD */
1301 } CMD_UPDATE_STA_RECORD_T, *P_CMD_UPDATE_STA_RECORD_T;
1302
1303 typedef struct _CMD_REMOVE_STA_RECORD_T {
1304     UINT_8  ucIndex;
1305     UINT_8  ucReserved;
1306     UINT_8  aucMacAddr[MAC_ADDR_LEN];
1307 } CMD_REMOVE_STA_RECORD_T, *P_CMD_REMOVE_STA_RECORD_T;
1308
1309 typedef struct _CMD_INDICATE_PM_BSS_CREATED_T {
1310     UINT_8  ucNetTypeIndex;
1311     UINT_8  ucDtimPeriod;
1312     UINT_16 u2BeaconInterval;
1313     UINT_16 u2AtimWindow;
1314     UINT_8  aucReserved[2];
1315 } CMD_INDICATE_PM_BSS_CREATED, *P_CMD_INDICATE_PM_BSS_CREATED;
1316
1317 typedef struct _CMD_INDICATE_PM_BSS_CONNECTED_T {
1318     UINT_8  ucNetTypeIndex;
1319     UINT_8  ucDtimPeriod;
1320     UINT_16 u2AssocId;
1321     UINT_16 u2BeaconInterval;
1322     UINT_16 u2AtimWindow;
1323     UINT_8  fgIsUapsdConnection;
1324     UINT_8  ucBmpDeliveryAC;
1325     UINT_8  ucBmpTriggerAC;
1326     UINT_8  aucReserved[1];
1327 } CMD_INDICATE_PM_BSS_CONNECTED, *P_CMD_INDICATE_PM_BSS_CONNECTED;
1328
1329 typedef struct _CMD_INDICATE_PM_BSS_ABORT {
1330     UINT_8  ucNetTypeIndex;
1331     UINT_8  aucReserved[3];
1332 } CMD_INDICATE_PM_BSS_ABORT, *P_CMD_INDICATE_PM_BSS_ABORT;
1333
1334 typedef struct _CMD_BEACON_TEMPLATE_UPDATE {
1335     UINT_8    ucUpdateMethod; // 0: update randomly, 1: update all, 2: delete all (1 and 2 will update directly without search)
1336     UINT_8    ucNetTypeIndex;
1337     UINT_8    aucReserved[2];
1338     UINT_16   u2Capability;
1339     UINT_16   u2IELen;
1340     UINT_8    aucIE[MAX_IE_LENGTH];
1341 } CMD_BEACON_TEMPLATE_UPDATE, *P_CMD_BEACON_TEMPLATE_UPDATE;
1342
1343 typedef struct _CMD_SET_WMM_PS_TEST_STRUC_T {
1344     UINT_8  ucNetTypeIndex;
1345     UINT_8  bmfgApsdEnAc;           /* b0~3: trigger-en AC0~3. b4~7: delivery-en AC0~3 */
1346     UINT_8  ucIsEnterPsAtOnce;      /* enter PS immediately without 5 second guard after connected */
1347     UINT_8  ucIsDisableUcTrigger;   /* not to trigger UC on beacon TIM is matched (under U-APSD) */
1348 } CMD_SET_WMM_PS_TEST_STRUC_T, *P_CMD_SET_WMM_PS_TEST_STRUC_T;
1349
1350
1351 /* Definition for CHANNEL_INFO.ucBand:
1352  * 0:       Reserved
1353  * 1:       BAND_2G4
1354  * 2:       BAND_5G
1355  * Others:  Reserved
1356  */
1357 typedef struct _CHANNEL_INFO_T {
1358     UINT_8  ucBand;
1359     UINT_8  ucChannelNum;
1360 } CHANNEL_INFO_T, *P_CHANNEL_INFO_T;
1361
1362 typedef struct _CMD_SCAN_REQ_T {
1363     UINT_8          ucSeqNum;
1364     UINT_8          ucNetworkType;
1365     UINT_8          ucScanType;
1366     UINT_8          ucSSIDType;     /* BIT(0) wildcard / BIT(1) P2P-wildcard / BIT(2) specific */
1367     UINT_8          ucSSIDLength;
1368     UINT_8          aucReserved[1];
1369     UINT_16         u2ChannelMinDwellTime;
1370     UINT_8          aucSSID[32];
1371     UINT_16         u2ChannelDwellTime; /* For P2P */
1372     UINT_8          ucChannelType;
1373     UINT_8          ucChannelListNum;
1374     CHANNEL_INFO_T  arChannelList[32];
1375     UINT_16         u2IELen;
1376     UINT_8          aucIE[MAX_IE_LENGTH];
1377 } CMD_SCAN_REQ, *P_CMD_SCAN_REQ;
1378
1379 typedef struct _CMD_SCAN_REQ_V2_T {
1380     UINT_8          ucSeqNum;
1381     UINT_8          ucNetworkType;
1382     UINT_8          ucScanType;
1383     UINT_8          ucSSIDType;
1384     PARAM_SSID_T    arSSID[4];
1385     UINT_16         u2ProbeDelayTime;
1386     UINT_16         u2ChannelDwellTime; /* For P2P */
1387     UINT_8          ucChannelType;
1388     UINT_8          ucChannelListNum;
1389     CHANNEL_INFO_T  arChannelList[32];
1390     UINT_16         u2IELen;
1391     UINT_8          aucIE[MAX_IE_LENGTH];
1392 } CMD_SCAN_REQ_V2, *P_CMD_SCAN_REQ_V2;
1393
1394 typedef struct _CMD_SCAN_CANCEL_T {
1395     UINT_8          ucSeqNum;
1396     UINT_8          ucIsExtChannel;     /* For P2P channel extention. */
1397     UINT_8          aucReserved[2];
1398 } CMD_SCAN_CANCEL, *P_CMD_SCAN_CANCEL;
1399
1400 typedef struct _EVENT_SCAN_DONE_T {
1401     UINT_8          ucSeqNum;
1402     UINT_8          ucSparseChannelValid;
1403     CHANNEL_INFO_T  rSparseChannel;
1404 } EVENT_SCAN_DONE, *P_EVENT_SCAN_DONE;
1405
1406 typedef struct _CMD_CH_PRIVILEGE_T {
1407     UINT_8      ucNetTypeIndex;
1408     UINT_8      ucTokenID;
1409     UINT_8      ucAction;
1410     UINT_8      ucPrimaryChannel;
1411     UINT_8      ucRfSco;
1412     UINT_8      ucRfBand;
1413     UINT_8      ucReqType;
1414     UINT_8      ucReserved;
1415     UINT_32     u4MaxInterval;  /* In unit of ms */
1416     UINT_8      aucBSSID[6];
1417     UINT_8      aucReserved[2];
1418 } CMD_CH_PRIVILEGE_T, *P_CMD_CH_PRIVILEGE_T;
1419
1420 typedef struct _CMD_TX_PWR_T {
1421     INT_8       cTxPwr2G4Cck;           /* signed, in unit of 0.5dBm */
1422 #if defined(MT6620)
1423     INT_8       acReserved[3];
1424 #elif defined(MT5931) || defined(MT6628)
1425     INT_8       cTxPwr2G4Dsss;      /* signed, in unit of 0.5dBm */
1426     INT_8       acReserved[2];
1427 #else
1428     #error "No valid definition!"
1429 #endif
1430
1431     INT_8       cTxPwr2G4OFDM_BPSK;
1432     INT_8       cTxPwr2G4OFDM_QPSK;
1433     INT_8       cTxPwr2G4OFDM_16QAM;
1434     INT_8       cTxPwr2G4OFDM_Reserved;
1435     INT_8       cTxPwr2G4OFDM_48Mbps;
1436     INT_8       cTxPwr2G4OFDM_54Mbps;
1437
1438     INT_8       cTxPwr2G4HT20_BPSK;
1439     INT_8       cTxPwr2G4HT20_QPSK;
1440     INT_8       cTxPwr2G4HT20_16QAM;
1441     INT_8       cTxPwr2G4HT20_MCS5;
1442     INT_8       cTxPwr2G4HT20_MCS6;
1443     INT_8       cTxPwr2G4HT20_MCS7;
1444
1445     INT_8       cTxPwr2G4HT40_BPSK;
1446     INT_8       cTxPwr2G4HT40_QPSK;
1447     INT_8       cTxPwr2G4HT40_16QAM;
1448     INT_8       cTxPwr2G4HT40_MCS5;
1449     INT_8       cTxPwr2G4HT40_MCS6;
1450     INT_8       cTxPwr2G4HT40_MCS7;
1451
1452     INT_8       cTxPwr5GOFDM_BPSK;
1453     INT_8       cTxPwr5GOFDM_QPSK;
1454     INT_8       cTxPwr5GOFDM_16QAM;
1455     INT_8       cTxPwr5GOFDM_Reserved;
1456     INT_8       cTxPwr5GOFDM_48Mbps;
1457     INT_8       cTxPwr5GOFDM_54Mbps;
1458
1459     INT_8       cTxPwr5GHT20_BPSK;
1460     INT_8       cTxPwr5GHT20_QPSK;
1461     INT_8       cTxPwr5GHT20_16QAM;
1462     INT_8       cTxPwr5GHT20_MCS5;
1463     INT_8       cTxPwr5GHT20_MCS6;
1464     INT_8       cTxPwr5GHT20_MCS7;
1465
1466     INT_8       cTxPwr5GHT40_BPSK;
1467     INT_8       cTxPwr5GHT40_QPSK;
1468     INT_8       cTxPwr5GHT40_16QAM;
1469     INT_8       cTxPwr5GHT40_MCS5;
1470     INT_8       cTxPwr5GHT40_MCS6;
1471     INT_8       cTxPwr5GHT40_MCS7;
1472 } CMD_TX_PWR_T, *P_CMD_TX_PWR_T;
1473
1474 typedef struct _CMD_5G_PWR_OFFSET_T {
1475     INT_8       cOffsetBand0;       /* 4.915-4.980G */
1476     INT_8       cOffsetBand1;       /* 5.000-5.080G */
1477     INT_8       cOffsetBand2;       /* 5.160-5.180G */
1478     INT_8       cOffsetBand3;       /* 5.200-5.280G */
1479     INT_8       cOffsetBand4;       /* 5.300-5.340G */
1480     INT_8       cOffsetBand5;       /* 5.500-5.580G */
1481     INT_8       cOffsetBand6;       /* 5.600-5.680G */
1482     INT_8       cOffsetBand7;       /* 5.700-5.825G */
1483 } CMD_5G_PWR_OFFSET_T, *P_CMD_5G_PWR_OFFSET_T;
1484
1485 typedef struct _CMD_PWR_PARAM_T {
1486     UINT_32     au4Data[28];
1487     UINT_32     u4RefValue1;
1488     UINT_32     u4RefValue2;
1489 } CMD_PWR_PARAM_T, *P_CMD_PWR_PARAM_T;
1490
1491 typedef struct _CMD_PHY_PARAM_T {
1492     UINT_8      aucData[144];           /* eFuse content */
1493 } CMD_PHY_PARAM_T, *P_CMD_PHY_PARAM_T;
1494
1495
1496
1497 typedef struct _EVENT_CH_PRIVILEGE_T {
1498     UINT_8          ucNetTypeIndex;
1499     UINT_8          ucTokenID;
1500     UINT_8          ucStatus;
1501     UINT_8          ucPrimaryChannel;
1502     UINT_8          ucRfSco;
1503     UINT_8          ucRfBand;
1504     UINT_8          ucReqType;
1505     UINT_8          ucReserved;
1506     UINT_32         u4GrantInterval;    /* In unit of ms */
1507 } EVENT_CH_PRIVILEGE_T, *P_EVENT_CH_PRIVILEGE_T;
1508
1509 typedef struct _EVENT_BSS_BEACON_TIMEOUT_T {
1510     UINT_8  ucNetTypeIndex;
1511     UINT_8  aucReserved[3];
1512 } EVENT_BSS_BEACON_TIMEOUT_T, *P_EVENT_BSS_BEACON_TIMEOUT_T;
1513
1514 typedef struct _EVENT_STA_AGING_TIMEOUT_T {
1515     UINT_8  ucStaRecIdx;
1516     UINT_8  aucReserved[3];
1517 } EVENT_STA_AGING_TIMEOUT_T, *P_EVENT_STA_AGING_TIMEOUT_T;
1518
1519 typedef struct _EVENT_NOA_TIMING_T {
1520     UINT_8      fgIsInUse;              /* Indicate if this entry is in use or not */
1521     UINT_8      ucCount;                /* Count */
1522     UINT_8      aucReserved[2];
1523
1524     UINT_32     u4Duration;             /* Duration */
1525     UINT_32     u4Interval;             /* Interval */
1526     UINT_32     u4StartTime;            /* Start Time */
1527 } EVENT_NOA_TIMING_T, *P_EVENT_NOA_TIMING_T;
1528
1529 typedef struct _EVENT_UPDATE_NOA_PARAMS_T {
1530     UINT_8      ucNetTypeIndex;
1531     UINT_8      aucReserved[2];
1532     UINT_8      fgEnableOppPS;
1533     UINT_16     u2CTWindow;
1534
1535     UINT_8              ucNoAIndex;
1536     UINT_8              ucNoATimingCount; /* Number of NoA Timing */
1537     EVENT_NOA_TIMING_T  arEventNoaTiming[8/*P2P_MAXIMUM_NOA_COUNT*/];
1538 } EVENT_UPDATE_NOA_PARAMS_T, *P_EVENT_UPDATE_NOA_PARAMS_T;
1539
1540 typedef struct _EVENT_AP_OBSS_STATUS_T {
1541     UINT_8      ucNetTypeIndex;
1542     UINT_8      ucObssErpProtectMode;
1543     UINT_8      ucObssHtProtectMode;
1544     UINT_8      ucObssGfOperationMode;
1545     UINT_8      ucObssRifsOperationMode;
1546     UINT_8      ucObssBeaconForcedTo20M;
1547     UINT_8      aucReserved[2];
1548 } EVENT_AP_OBSS_STATUS_T, *P_EVENT_AP_OBSS_STATUS_T;
1549
1550 typedef struct _CMD_EDGE_TXPWR_LIMIT_T {
1551     INT_8       cBandEdgeMaxPwrCCK;
1552     INT_8       cBandEdgeMaxPwrOFDM20;
1553     INT_8       cBandEdgeMaxPwrOFDM40;
1554     INT_8       cReserved;
1555 } CMD_EDGE_TXPWR_LIMIT_T, *P_CMD_EDGE_TXPWR_LIMIT_T;
1556
1557 typedef struct _CMD_SET_DEVICE_MODE_T {
1558     UINT_16     u2ChipID;
1559     UINT_16     u2Mode;
1560 } CMD_SET_DEVICE_MODE_T, *P_CMD_SET_DEVICE_MODE_T;
1561
1562
1563 #if CFG_SUPPORT_RDD_TEST_MODE
1564 typedef struct _CMD_RDD_CH_T {
1565     UINT_8       ucRddTestMode;
1566     UINT_8      ucRddShutCh;
1567     UINT_8      ucRddStartCh;
1568     UINT_8      ucRddStopCh;
1569     UINT_8      ucRddDfs;
1570     UINT_8      ucReserved;
1571     UINT_8      ucReserved1;
1572     UINT_8      ucReserved2;
1573 } CMD_RDD_CH_T, *P_CMD_RDD_CH_T;
1574
1575 typedef struct _EVENT_RDD_STATUS_T {
1576     UINT_8  ucRddStatus;
1577     UINT_8  aucReserved[3];
1578 } EVENT_RDD_STATUS_T, *P_EVENT_RDD_STATUS_T;
1579 #endif
1580
1581 typedef struct _CMD_SET_TXPWR_CTRL_T{
1582     INT_8    c2GLegacyStaPwrOffset;  /* Unit: 0.5dBm, default: 0*/
1583     INT_8    c2GHotspotPwrOffset;
1584     INT_8    c2GP2pPwrOffset;
1585     INT_8    c2GBowPwrOffset;
1586     INT_8    c5GLegacyStaPwrOffset;   /* Unit: 0.5dBm, default: 0*/
1587     INT_8    c5GHotspotPwrOffset;
1588     INT_8    c5GP2pPwrOffset;
1589     INT_8    c5GBowPwrOffset;
1590     UINT_8  ucConcurrencePolicy;   /* TX power policy when concurrence
1591                                                             in the same channel
1592                                                             0: Highest power has priority
1593                                                             1: Lowest power has priority */
1594     INT_8    acReserved1[3];            /* Must be zero */
1595
1596     /* Power limit by channel for all data rates */
1597     INT_8    acTxPwrLimit2G[14];     /* Channel 1~14, Unit: 0.5dBm*/
1598     INT_8    acTxPwrLimit5G[4];       /* UNII 1~4 */
1599     INT_8    acReserved2[2];            /* Must be zero */
1600 } CMD_SET_TXPWR_CTRL_T, *P_CMD_SET_TXPWR_CTRL_T;
1601
1602 /*******************************************************************************
1603 *                            P U B L I C   D A T A
1604 ********************************************************************************
1605 */
1606
1607 /*******************************************************************************
1608 *                           P R I V A T E   D A T A
1609 ********************************************************************************
1610 */
1611
1612 /*******************************************************************************
1613 *                                 M A C R O S
1614 ********************************************************************************
1615 */
1616
1617 /*******************************************************************************
1618 *                   F U N C T I O N   D E C L A R A T I O N S
1619 ********************************************************************************
1620 */
1621 VOID
1622 nicCmdEventQueryMcrRead (
1623     IN P_ADAPTER_T  prAdapter,
1624     IN P_CMD_INFO_T prCmdInfo,
1625     IN PUINT_8      pucEventBuf
1626     );
1627
1628 VOID
1629 nicCmdEventQuerySwCtrlRead (
1630     IN P_ADAPTER_T  prAdapter,
1631     IN P_CMD_INFO_T prCmdInfo,
1632     IN PUINT_8      pucEventBuf
1633     );
1634
1635
1636
1637 VOID
1638 nicCmdEventQueryRfTestATInfo(
1639     IN P_ADAPTER_T  prAdapter,
1640     IN P_CMD_INFO_T prCmdInfo,
1641     IN PUINT_8      pucEventBuf
1642     );
1643
1644 VOID
1645 nicCmdEventSetCommon (
1646     IN P_ADAPTER_T  prAdapter,
1647     IN P_CMD_INFO_T prCmdInfo,
1648     IN PUINT_8      pucEventBuf
1649     );
1650
1651 VOID
1652 nicCmdEventSetDisassociate (
1653     IN P_ADAPTER_T  prAdapter,
1654     IN P_CMD_INFO_T prCmdInfo,
1655     IN PUINT_8      pucEventBuf
1656     );
1657
1658 VOID
1659 nicCmdEventSetIpAddress (
1660     IN P_ADAPTER_T  prAdapter,
1661     IN P_CMD_INFO_T prCmdInfo,
1662     IN PUINT_8      pucEventBuf
1663     );
1664
1665 VOID
1666 nicCmdEventQueryLinkQuality(
1667     IN P_ADAPTER_T  prAdapter,
1668     IN P_CMD_INFO_T prCmdInfo,
1669     IN PUINT_8      pucEventBuf
1670     );
1671
1672 VOID
1673 nicCmdEventQueryLinkSpeed(
1674     IN P_ADAPTER_T  prAdapter,
1675     IN P_CMD_INFO_T prCmdInfo,
1676     IN PUINT_8      pucEventBuf
1677     );
1678
1679 VOID
1680 nicCmdEventQueryStatistics(
1681     IN P_ADAPTER_T  prAdapter,
1682     IN P_CMD_INFO_T prCmdInfo,
1683     IN PUINT_8      pucEventBuf
1684     );
1685
1686 VOID
1687 nicCmdEventEnterRfTest(
1688     IN P_ADAPTER_T  prAdapter,
1689     IN P_CMD_INFO_T prCmdInfo,
1690     IN PUINT_8      pucEventBuf
1691     );
1692
1693 VOID
1694 nicCmdEventLeaveRfTest(
1695     IN P_ADAPTER_T  prAdapter,
1696     IN P_CMD_INFO_T prCmdInfo,
1697     IN PUINT_8      pucEventBuf
1698     );
1699
1700 VOID
1701 nicCmdEventQueryAddress(
1702     IN P_ADAPTER_T  prAdapter,
1703     IN P_CMD_INFO_T prCmdInfo,
1704     IN PUINT_8      pucEventBuf
1705     );
1706
1707 VOID
1708 nicCmdEventQueryMcastAddr(
1709     IN P_ADAPTER_T  prAdapter,
1710     IN P_CMD_INFO_T prCmdInfo,
1711     IN PUINT_8      pucEventBuf
1712     );
1713
1714 VOID
1715 nicCmdEventQueryEepromRead(
1716     IN P_ADAPTER_T  prAdapter,
1717     IN P_CMD_INFO_T prCmdInfo,
1718     IN PUINT_8      pucEventBuf
1719     );
1720
1721 VOID
1722 nicCmdEventSetMediaStreamMode(
1723     IN P_ADAPTER_T  prAdapter,
1724     IN P_CMD_INFO_T prCmdInfo,
1725     IN PUINT_8      pucEventBuf
1726     );
1727
1728 /* Statistics responder */
1729 VOID
1730 nicCmdEventQueryXmitOk(
1731     IN P_ADAPTER_T  prAdapter,
1732     IN P_CMD_INFO_T prCmdInfo,
1733     IN PUINT_8      pucEventBuf
1734     );
1735
1736 VOID
1737 nicCmdEventQueryRecvOk(
1738     IN P_ADAPTER_T  prAdapter,
1739     IN P_CMD_INFO_T prCmdInfo,
1740     IN PUINT_8      pucEventBuf
1741     );
1742
1743 VOID
1744 nicCmdEventQueryXmitError(
1745     IN P_ADAPTER_T  prAdapter,
1746     IN P_CMD_INFO_T prCmdInfo,
1747     IN PUINT_8      pucEventBuf
1748     );
1749
1750 VOID
1751 nicCmdEventQueryRecvError(
1752     IN P_ADAPTER_T  prAdapter,
1753     IN P_CMD_INFO_T prCmdInfo,
1754     IN PUINT_8      pucEventBuf
1755     );
1756
1757 VOID
1758 nicCmdEventQueryRecvNoBuffer(
1759     IN P_ADAPTER_T  prAdapter,
1760     IN P_CMD_INFO_T prCmdInfo,
1761     IN PUINT_8      pucEventBuf
1762     );
1763
1764 VOID
1765 nicCmdEventQueryRecvCrcError(
1766     IN P_ADAPTER_T  prAdapter,
1767     IN P_CMD_INFO_T prCmdInfo,
1768     IN PUINT_8      pucEventBuf
1769     );
1770
1771 VOID
1772 nicCmdEventQueryRecvErrorAlignment(
1773     IN P_ADAPTER_T  prAdapter,
1774     IN P_CMD_INFO_T prCmdInfo,
1775     IN PUINT_8      pucEventBuf
1776     );
1777
1778 VOID
1779 nicCmdEventQueryXmitOneCollision(
1780     IN P_ADAPTER_T  prAdapter,
1781     IN P_CMD_INFO_T prCmdInfo,
1782     IN PUINT_8      pucEventBuf
1783     );
1784
1785 VOID
1786 nicCmdEventQueryXmitMoreCollisions(
1787     IN P_ADAPTER_T  prAdapter,
1788     IN P_CMD_INFO_T prCmdInfo,
1789     IN PUINT_8      pucEventBuf
1790     );
1791
1792 VOID
1793 nicCmdEventQueryXmitMaxCollisions(
1794     IN P_ADAPTER_T  prAdapter,
1795     IN P_CMD_INFO_T prCmdInfo,
1796     IN PUINT_8      pucEventBuf
1797     );
1798
1799 /* for timeout check */
1800 VOID
1801 nicOidCmdTimeoutCommon (
1802     IN P_ADAPTER_T  prAdapter,
1803     IN P_CMD_INFO_T prCmdInfo
1804     );
1805
1806 VOID
1807 nicCmdTimeoutCommon (
1808     IN P_ADAPTER_T  prAdapter,
1809     IN P_CMD_INFO_T prCmdInfo
1810     );
1811
1812 VOID
1813 nicOidCmdEnterRFTestTimeout (
1814     IN P_ADAPTER_T  prAdapter,
1815     IN P_CMD_INFO_T prCmdInfo
1816     );
1817
1818 /*******************************************************************************
1819 *                              F U N C T I O N S
1820 ********************************************************************************
1821 */
1822
1823 #endif /* _NIC_CMD_EVENT_H */
1824