2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/hem_mbox.c#7 $
15 ** 08 22 2013 yuche.tsai
16 ** [BORA00002761] [MT6630][Wi-Fi Direct][Driver] Group Interface formation
17 ** [BORA00000779] [MT6620] Emulation For TX Code Check In
18 ** Make P2P group interface formation success.
21 ** [BORA00002253] [MT6630 Wi-Fi][Driver][Firmware] Add NLO and timeout mechanism to SCN module
22 ** 1. integrate scheduled scan functionality
23 ** 2. condition compilation for linux-3.4 & linux-3.8 compatibility
24 ** 3. correct CMD queue access to reduce lock scope
27 ** [BORA00002725] [MT6630][Wi-Fi] Add MGMT TX/RX support for Linux port
28 ** Preparation for porting remain_on_channel support
30 ** 07 17 2013 yuche.tsai
31 ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
32 ** MT6630 P2P first connection check point 1.
34 ** 02 27 2013 yuche.tsai
35 ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
36 ** Add new code, fix compile warning.
39 ** [BORA00002253] [MT6630 Wi-Fi][Driver][Firmware] Add NLO and timeout mechanism to SCN module
40 ** modification for ucBssIndex migration
42 ** 09 17 2012 cm.chang
43 ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
44 ** Duplicate source from MT6620 v2.3 driver branch
45 ** (Davinci label: MT6620_WIFI_Driver_V2_3_120913_1942_As_MT6630_Base)
48 ** [WCXRP00001269] [MT6620 Wi-Fi][Driver] cfg80211 porting merge back to DaVinci
52 ** [WCXRP00001269] [MT6620 Wi-Fi][Driver] cfg80211 porting merge back to DaVinci
53 ** cfg80211 support merge back from ALPS.JB to DaVinci - MT6620 Driver v2.3 branch.
55 ** 07 24 2012 yuche.tsai
59 ** 07 24 2012 yuche.tsai
63 ** 07 19 2012 yuche.tsai
65 ** Code update for JB.
67 * 07 17 2012 yuche.tsai
69 * Compile no error before trial run.
72 * [WCXRP00001231] [MT6620 Wi-Fi][MT5931][Driver] Correct SCAN_V2 related debugging facilities within hem_mbox.c
73 * correct for debug message string table by adding missed scan_v2 related definitions.
77 * Sync CFG80211 modification from branch 2,2.
79 * 01 17 2012 yuche.tsai
81 * Update mgmt frame filter setting.
82 * Please also update FW 2.1
84 * 01 13 2012 yuche.tsai
86 * WiFi Hot Spot Tethering for ICS ALPHA testing version.
89 * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
90 * Adjust code for DBG and CONFIG_XLOG.
94 * Add exception handle for NULL function pointer of mailbox message
97 * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
98 * modify the xlog related code.
101 * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
102 * adding the code for XLOG.
105 * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID in a single scanning request
106 * add framework in driver domain for supporting new SCAN_REQ_V2 for more than 1 SSID support as well as uProbeDelay in NDIS 6.x driver model
108 * 06 07 2011 yuche.tsai
109 * [WCXRP00000696] [Volunteer Patch][MT6620][Driver] Infinite loop issue when RX invitation response.[WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue
110 * Add invitation support.
112 * 04 18 2011 terry.wu
113 * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED
114 * Remove flag CFG_WIFI_DIRECT_MOVED.
116 * 03 29 2011 cm.chang
117 * [WCXRP00000606] [MT6620 Wi-Fi][Driver][FW] Fix klocwork warning
121 * [WCXRP00000490] [MT6620 Wi-Fi][Driver][Win32] modify kalMsleep() implementation because NdisMSleep() won't sleep long enough for specified interval such as 500ms
122 * modify cnm_timer and hem_mbox APIs to be thread safe to ease invoking restrictions
124 * 02 15 2011 chinghwa.yu
125 * [WCXRP00000065] Update BoW design and settings
126 * Update bowString and channel grant.
128 * 01 26 2011 cm.chang
129 * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
130 * Allocate system RAM if fixed message or mgmt buffer is not available
132 * 01 26 2011 yuche.tsai
133 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
136 * 01 25 2011 yuche.tsai
137 * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
138 * Fix Compile Error when DBG is disabled.
141 * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving
142 * 1. add an extra counter for tracking pending forward frames.
143 * 2. notify TX service thread as well when there is pending forward frame
144 * 3. correct build errors leaded by introduction of Wi-Fi direct separation module
146 * 12 08 2010 chinghwa.yu
147 * [WCXRP00000065] Update BoW design and settings
148 * Support concurrent networks.
150 * 11 08 2010 cm.chang
151 * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID
152 * Remove CNM channel reover message ID
155 * [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
156 * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
157 * 2) Remove CNM CH-RECOVER event handling
158 * 3) cfg read/write API renamed with kal prefix for unified naming rules.
161 * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
162 * update the frog's new p2p state machine.
166 * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo.
168 * 09 16 2010 cm.chang
170 * Remove unused message ID
174 * eliminate klockwork errors
176 * 08 26 2010 yuche.tsai
178 * Add P2P Connection Abort Event Message handler.
180 * 08 25 2010 george.huang
182 * update OID/ registry control path for PM related settings
184 * 08 24 2010 yarco.yang
186 * Fixed Driver ASSERT at mboxInitMsgMap()
188 * 08 24 2010 chinghwa.yu
190 * Update for MID_SCN_BOW_SCAN_DONE mboxDummy.
191 * Update saa_fsm for BOW.
193 * 08 23 2010 chinghwa.yu
195 * Add CFG_ENABLE_BT_OVER_WIFI.
197 * 08 23 2010 chinghwa.yu
203 * add interface for RLM to trigger OBSS-SCAN.
205 * 08 16 2010 yuche.tsai
207 * Add debug message for newly add P2P message.
209 * 08 11 2010 yuche.tsai
211 * Add some function entry for P2P FSM under provisioning phase..
213 * 08 11 2010 yuche.tsai
215 * Add some events to P2P Module.
217 * 08 05 2010 yuche.tsai
219 * Add message box event for P2P device switch on & device discovery.
223 * remove unused mailbox message definitions.
225 * 08 02 2010 yuche.tsai
227 * P2P Group Negotiation Code Check in.
231 * [WPD00003833] [MT6620 and MT5931] Driver migration.
232 * message table should not be commented out by compilation option without modifying header file
236 * [WPD00003833] [MT6620 and MT5931] Driver migration.
237 * Add Ad-Hoc support to AIS-FSM
239 * 07 19 2010 yuche.tsai
241 * Add wifi direct scan done callback.
245 * change handler of MID_MNY_CNM_CONNECTION_ABORT from NULL to mboxDummy.
249 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
251 * 07 08 2010 cm.chang
252 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
253 * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT
256 * [WPD00003833][MT6620 and MT5931] Driver migration
257 * AIS-FSM integration with CNM channel request messages
260 * [WPD00003833][MT6620 and MT5931] Driver migration
261 * implementation of DRV-SCN and related mailbox message handling.
263 * 07 01 2010 cm.chang
264 * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
265 * Modify CNM message handler for new flow
268 * [WPD00003833][MT6620 and MT5931] Driver migration
269 * enable currently migrated message call-backs.
272 * [WPD00003833][MT6620 and MT5931] Driver migration
273 * restore utility function invoking via hem_mbox to direct calls
276 * [WPD00003833][MT6620 and MT5931] Driver migration
277 * add buildable & linkable ais_fsm.c
279 * related reference are still waiting to be resolved
282 * [WPD00003833][MT6620 and MT5931] Driver migration
283 * hem_mbox is migrated.
286 * [WPD00003833][MT6620 and MT5931] Driver migration
287 * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration
289 * 05 12 2010 kevin.huang
290 * [BORA00000794][WIFISYS][New Feature]Power Management Support
291 * Fix file merge error
293 * 05 12 2010 kevin.huang
294 * [BORA00000794][WIFISYS][New Feature]Power Management Support
295 * Add Power Management - Legacy PS-POLL support.
297 * 04 29 2010 tehuang.liu
298 * [BORA00000605][WIFISYS] Phase3 Integration
299 * Removed MID_RXM_MQM_QOS_ACTION_FRAME
301 * 04 29 2010 tehuang.liu
302 * [BORA00000605][WIFISYS] Phase3 Integration
303 * Removed MID_RXM_MQM_BA_ACTION_FRAME
305 * 04 27 2010 tehuang.liu
306 * [BORA00000605][WIFISYS] Phase3 Integration
307 * MID_RXM_MQM_BA_ACTION_FRAME
309 * 03 30 2010 cm.chang
310 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
311 * Support 2.4G OBSS scan
313 * 03 16 2010 kevin.huang
314 * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
317 * 03 10 2010 kevin.huang
318 * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support
320 * * * * * * * * * * * * * * Add Channel Manager for arbitration of JOIN and SCAN Req
322 * 03 05 2010 cm.chang
323 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
324 * Develop partial DPD code
326 * 02 11 2010 tehuang.liu
327 * [BORA00000569][WIFISYS] Phase 2 Integration Test
328 * Updated arMsgMapTable for MID_RXM_MQM_QOS_ACTION_FRAME
330 * 01 11 2010 kevin.huang
331 * [BORA00000018]Integrate WIFI part into BORA for the 1st time
332 * Add Deauth and Disassoc Handler
334 * Dec 9 2009 mtk01461
335 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
336 * Add hemRunEventScanDone() to arMsgMapTable[]
338 * Dec 4 2009 mtk01461
339 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
340 * Fix mboxDummy() didn't free prMsgHdr
342 * Dec 3 2009 mtk01461
343 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
344 * Add saaAisJoinComplete event handler
346 * Dec 2 2009 MTK02468
347 * [BORA00000337] To check in codes for FPGA emulation
348 * Fixed the handler function name in arMsgMapTable for MID_RXM_MQM_BA_ACTION_FRAME
350 * Dec 2 2009 MTK02468
351 * [BORA00000337] To check in codes for FPGA emulation
352 * Added MID_RXM_MQM_BA_ACTION_FRAME to MsgMapTable
354 * Nov 23 2009 mtk01461
355 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
356 * Revise MSG Handler (remove dummy and add for SAA)
358 * Nov 16 2009 mtk01461
359 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
360 * Add aisFsmRunEventAbort() event handler
362 * Nov 11 2009 mtk01461
363 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
366 * Nov 10 2009 mtk01461
367 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
368 * Add more MSG_HNDL_ENTRY_T to avoid ASSERT() in mboxInitMsgMap()
370 * Nov 5 2009 mtk01461
371 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
372 * Add SCN message and function entry to arMsgMapTable[]
374 * Nov 2 2009 mtk01104
375 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
376 * Fix sorting algorithm in mboxInitMsgMap()
378 * Oct 28 2009 mtk01104
379 * [BORA00000018] Integrate WIFI part into BORA for the 1st time
384 /*******************************************************************************
385 * C O M P I L E R F L A G S
386 ********************************************************************************
389 /*******************************************************************************
390 * E X T E R N A L R E F E R E N C E S
391 ********************************************************************************
395 /*******************************************************************************
397 ********************************************************************************
400 /*******************************************************************************
402 ********************************************************************************
405 /*******************************************************************************
406 * P U B L I C D A T A
407 ********************************************************************************
410 /*******************************************************************************
411 * P R I V A T E D A T A
412 ********************************************************************************
415 /*lint -save -e64 Type mismatch */
416 static PUINT_8 apucDebugMsg
[] = {
417 (PUINT_8
) DISP_STRING("MID_MNY_CNM_CH_REQ"),
418 (PUINT_8
) DISP_STRING("MID_MNY_CNM_CH_ABORT"),
419 (PUINT_8
) DISP_STRING("MID_CNM_AIS_CH_GRANT"),
420 (PUINT_8
) DISP_STRING("MID_CNM_P2P_CH_GRANT"),
421 (PUINT_8
) DISP_STRING("MID_CNM_BOW_CH_GRANT"),
423 (PUINT_8
) DISP_STRING("MID_AIS_SCN_SCAN_REQ"),
424 (PUINT_8
) DISP_STRING("MID_AIS_SCN_SCAN_REQ_V2"),
425 (PUINT_8
) DISP_STRING("MID_AIS_SCN_SCAN_CANCEL"),
426 (PUINT_8
) DISP_STRING("MID_P2P_SCN_SCAN_REQ"),
427 (PUINT_8
) DISP_STRING("MID_P2P_SCN_SCAN_REQ_V2"),
428 (PUINT_8
) DISP_STRING("MID_P2P_SCN_SCAN_CANCEL"),
429 (PUINT_8
) DISP_STRING("MID_BOW_SCN_SCAN_REQ"),
430 (PUINT_8
) DISP_STRING("MID_BOW_SCN_SCAN_REQ_V2"),
431 (PUINT_8
) DISP_STRING("MID_BOW_SCN_SCAN_CANCEL"),
432 (PUINT_8
) DISP_STRING("MID_RLM_SCN_SCAN_REQ"),
433 (PUINT_8
) DISP_STRING("MID_RLM_SCN_SCAN_REQ_V2"),
434 (PUINT_8
) DISP_STRING("MID_RLM_SCN_SCAN_CANCEL"),
435 (PUINT_8
) DISP_STRING("MID_SCN_AIS_SCAN_DONE"),
436 (PUINT_8
) DISP_STRING("MID_SCN_P2P_SCAN_DONE"),
437 (PUINT_8
) DISP_STRING("MID_SCN_BOW_SCAN_DONE"),
438 (PUINT_8
) DISP_STRING("MID_SCN_RLM_SCAN_DONE"),
440 (PUINT_8
) DISP_STRING("MID_OID_AIS_FSM_JOIN_REQ"),
441 (PUINT_8
) DISP_STRING("MID_OID_AIS_FSM_ABORT"),
442 (PUINT_8
) DISP_STRING("MID_AIS_SAA_FSM_START"),
443 (PUINT_8
) DISP_STRING("MID_AIS_SAA_FSM_ABORT"),
444 (PUINT_8
) DISP_STRING("MID_SAA_AIS_JOIN_COMPLETE"),
446 #if CFG_ENABLE_BT_OVER_WIFI
447 (PUINT_8
) DISP_STRING("MID_BOW_SAA_FSM_START"),
448 (PUINT_8
) DISP_STRING("MID_BOW_SAA_FSM_ABORT"),
449 (PUINT_8
) DISP_STRING("MID_SAA_BOW_JOIN_COMPLETE"),
452 #if CFG_ENABLE_WIFI_DIRECT
453 (PUINT_8
) DISP_STRING("MID_P2P_SAA_FSM_START"),
454 (PUINT_8
) DISP_STRING("MID_P2P_SAA_FSM_ABORT"),
455 (PUINT_8
) DISP_STRING("MID_SAA_P2P_JOIN_COMPLETE"),
457 (PUINT_8
) DISP_STRING("MID_MNY_P2P_FUN_SWITCH"),
458 (PUINT_8
) DISP_STRING("MID_MNY_P2P_DEVICE_DISCOVERY"),
459 (PUINT_8
) DISP_STRING("MID_MNY_P2P_CONNECTION_REQ"),
460 (PUINT_8
) DISP_STRING("MID_MNY_P2P_CONNECTION_ABORT"),
461 (PUINT_8
) DISP_STRING("MID_MNY_P2P_BEACON_UPDATE"),
462 (PUINT_8
) DISP_STRING("MID_MNY_P2P_STOP_AP"),
463 (PUINT_8
) DISP_STRING("MID_MNY_P2P_CHNL_REQ"),
464 (PUINT_8
) DISP_STRING("MID_MNY_P2P_CHNL_ABORT"),
465 (PUINT_8
) DISP_STRING("MID_MNY_P2P_MGMT_TX"),
466 (PUINT_8
) DISP_STRING("MID_MNY_P2P_GROUP_DISSOLVE"),
467 (PUINT_8
) DISP_STRING("MID_MNY_P2P_MGMT_FRAME_REGISTER"),
468 (PUINT_8
) DISP_STRING("MID_MNY_P2P_NET_DEV_REGISTER"),
469 (PUINT_8
) DISP_STRING("MID_MNY_P2P_START_AP"),
470 (PUINT_8
) DISP_STRING("MID_MNY_P2P_UPDATE_IE_BUF"),
473 #if CFG_SUPPORT_ADHOC
474 /* (PUINT_8)DISP_STRING("MID_AIS_CNM_CREATE_IBSS_REQ"), */
475 /* (PUINT_8)DISP_STRING("MID_CNM_AIS_CREATE_IBSS_GRANT"), */
476 /* (PUINT_8)DISP_STRING("MID_AIS_CNM_MERGE_IBSS_REQ"), */
477 /* (PUINT_8)DISP_STRING("MID_CNM_AIS_MERGE_IBSS_GRANT"), */
478 (PUINT_8
) DISP_STRING("MID_SCN_AIS_FOUND_IBSS"),
479 #endif /* CFG_SUPPORT_ADHOC */
481 (PUINT_8
) DISP_STRING("MID_SAA_AIS_FSM_ABORT"),
482 (PUINT_8
) DISP_STRING("MID_MNY_AIS_REMAIN_ON_CHANNEL"),
483 (PUINT_8
) DISP_STRING("MID_MNY_AIS_CANCEL_REMAIN_ON_CHANNEL"),
484 (PUINT_8
) DISP_STRING("MID_MNY_AIS_MGMT_TX")
491 /* This message entry will be re-ordered based on the message ID order
492 * by invoking mboxInitMsgMap()
494 static MSG_HNDL_ENTRY_T arMsgMapTable
[] = {
495 {MID_MNY_CNM_CH_REQ
, cnmChMngrRequestPrivilege
},
496 {MID_MNY_CNM_CH_ABORT
, cnmChMngrAbortPrivilege
},
497 {MID_CNM_AIS_CH_GRANT
, aisFsmRunEventChGrant
},
498 #if CFG_ENABLE_WIFI_DIRECT
499 {MID_CNM_P2P_CH_GRANT
, p2pFsmRunEventChGrant
}, /*set in gl_p2p_init.c */
501 {MID_CNM_P2P_CH_GRANT
, mboxDummy
},
504 #if CFG_ENABLE_BT_OVER_WIFI
505 {MID_CNM_BOW_CH_GRANT
, bowRunEventChGrant
},
507 {MID_CNM_BOW_CH_GRANT
, mboxDummy
},
510 /*--------------------------------------------------*/
511 /* SCN Module Mailbox Messages */
512 /*--------------------------------------------------*/
513 {MID_AIS_SCN_SCAN_REQ
, scnFsmMsgStart
},
514 {MID_AIS_SCN_SCAN_REQ_V2
, scnFsmMsgStart
},
515 {MID_AIS_SCN_SCAN_CANCEL
, scnFsmMsgAbort
},
516 {MID_P2P_SCN_SCAN_REQ
, scnFsmMsgStart
},
517 {MID_P2P_SCN_SCAN_REQ_V2
, scnFsmMsgStart
},
518 {MID_P2P_SCN_SCAN_CANCEL
, scnFsmMsgAbort
},
519 {MID_BOW_SCN_SCAN_REQ
, scnFsmMsgStart
},
520 {MID_BOW_SCN_SCAN_REQ_V2
, scnFsmMsgStart
},
521 {MID_BOW_SCN_SCAN_CANCEL
, scnFsmMsgAbort
},
522 {MID_RLM_SCN_SCAN_REQ
, scnFsmMsgStart
},
523 {MID_RLM_SCN_SCAN_REQ_V2
, scnFsmMsgStart
},
524 {MID_RLM_SCN_SCAN_CANCEL
, scnFsmMsgAbort
},
525 {MID_SCN_AIS_SCAN_DONE
, aisFsmRunEventScanDone
},
526 #if CFG_ENABLE_WIFI_DIRECT
527 {MID_SCN_P2P_SCAN_DONE
, p2pFsmRunEventScanDone
}, /*set in gl_p2p_init.c */
529 {MID_SCN_P2P_SCAN_DONE
, mboxDummy
},
532 #if CFG_ENABLE_BT_OVER_WIFI
533 {MID_SCN_BOW_SCAN_DONE
, bowResponderScanDone
},
535 {MID_SCN_BOW_SCAN_DONE
, mboxDummy
},
537 {MID_SCN_RLM_SCAN_DONE
, rlmObssScanDone
},
539 /*--------------------------------------------------*/
540 /* AIS Module Mailbox Messages */
541 /*--------------------------------------------------*/
542 {MID_OID_AIS_FSM_JOIN_REQ
, aisFsmRunEventAbort
},
543 {MID_OID_AIS_FSM_ABORT
, aisFsmRunEventAbort
},
544 {MID_AIS_SAA_FSM_START
, saaFsmRunEventStart
},
545 {MID_AIS_SAA_FSM_ABORT
, saaFsmRunEventAbort
},
546 {MID_SAA_AIS_JOIN_COMPLETE
, aisFsmRunEventJoinComplete
},
548 #if CFG_ENABLE_BT_OVER_WIFI
549 /*--------------------------------------------------*/
550 /* BOW Module Mailbox Messages */
551 /*--------------------------------------------------*/
552 {MID_BOW_SAA_FSM_START
, saaFsmRunEventStart
},
553 {MID_BOW_SAA_FSM_ABORT
, saaFsmRunEventAbort
},
554 {MID_SAA_BOW_JOIN_COMPLETE
, bowFsmRunEventJoinComplete
},
557 #if CFG_ENABLE_WIFI_DIRECT /*set in gl_p2p_init.c */
558 {MID_P2P_SAA_FSM_START
, saaFsmRunEventStart
},
559 {MID_P2P_SAA_FSM_ABORT
, saaFsmRunEventAbort
},
560 {MID_SAA_P2P_JOIN_COMPLETE
, p2pRoleFsmRunEventJoinComplete
}, /* V */
562 {MID_MNY_P2P_FUN_SWITCH
, p2pRoleFsmRunEventSwitchOPMode
},
563 {MID_MNY_P2P_DEVICE_DISCOVERY
, p2pFsmRunEventScanRequest
}, /* V */
564 {MID_MNY_P2P_CONNECTION_REQ
, p2pRoleFsmRunEventConnectionRequest
},
565 {MID_MNY_P2P_CONNECTION_ABORT
, p2pRoleFsmRunEventConnectionAbort
},
566 {MID_MNY_P2P_BEACON_UPDATE
, p2pFsmRunEventBeaconUpdate
},
567 {MID_MNY_P2P_STOP_AP
, p2pRoleFsmRunEventStopAP
},
568 {MID_MNY_P2P_CHNL_REQ
, p2pDevFsmRunEventChannelRequest
}, /* V */
569 {MID_MNY_P2P_CHNL_ABORT
, p2pDevFsmRunEventChannelAbort
}, /* V */
570 {MID_MNY_P2P_MGMT_TX
, p2pDevFsmRunEventMgmtTx
}, /* V */
571 {MID_MNY_P2P_GROUP_DISSOLVE
, p2pRoleFsmRunEventDissolve
},
572 {MID_MNY_P2P_MGMT_FRAME_REGISTER
, p2pDevFsmRunEventMgmtFrameRegister
},
573 {MID_MNY_P2P_NET_DEV_REGISTER
, p2pFsmRunEventNetDeviceRegister
},
574 {MID_MNY_P2P_START_AP
, p2pRoleFsmRunEventStartAP
},
575 {MID_MNY_P2P_MGMT_FRAME_UPDATE
, p2pFsmRunEventUpdateMgmtFrame
},
577 {MID_MNY_P2P_WFD_CFG_UPDATE
, p2pFsmRunEventWfdSettingUpdate
},
582 #if CFG_SUPPORT_ADHOC
583 {MID_SCN_AIS_FOUND_IBSS
, aisFsmRunEventFoundIBSSPeer
},
584 #endif /* CFG_SUPPORT_ADHOC */
586 {MID_SAA_AIS_FSM_ABORT
, aisFsmRunEventAbort
},
587 {MID_MNY_AIS_REMAIN_ON_CHANNEL
, aisFsmRunEventRemainOnChannel
},
588 {MID_MNY_AIS_CANCEL_REMAIN_ON_CHANNEL
, aisFsmRunEventCancelRemainOnChannel
},
589 {MID_MNY_AIS_MGMT_TX
, aisFsmRunEventMgmtFrameTx
}
594 /*******************************************************************************
596 ********************************************************************************
600 #define MBOX_HNDL_MSG(prAdapter, prMsg) do { \
601 ASSERT(arMsgMapTable[prMsg->eMsgId].pfMsgHndl); \
602 if (arMsgMapTable[prMsg->eMsgId].pfMsgHndl) { \
603 DBGLOG(CNM, LOUD, ("DO MSG [%d: %s]\n", prMsg->eMsgId, apucDebugMsg[prMsg->eMsgId])); \
604 arMsgMapTable[prMsg->eMsgId].pfMsgHndl(prAdapter, prMsg); \
607 DBGLOG(CNM, ERROR, ("NULL fptr for MSG [%d]\n", prMsg->eMsgId)); \
608 cnmMemFree(prAdapter, prMsg); \
612 #define MBOX_HNDL_MSG(prAdapter, prMsg) do { \
613 ASSERT(arMsgMapTable[prMsg->eMsgId].pfMsgHndl); \
614 if (arMsgMapTable[prMsg->eMsgId].pfMsgHndl) { \
615 DBGLOG(CNM, LOUD, ("DO MSG [%d]\n", prMsg->eMsgId)); \
616 arMsgMapTable[prMsg->eMsgId].pfMsgHndl(prAdapter, prMsg); \
619 DBGLOG(CNM, ERROR, ("NULL fptr for MSG [%d]\n", prMsg->eMsgId)); \
620 cnmMemFree(prAdapter, prMsg); \
624 /*******************************************************************************
625 * F U N C T I O N D E C L A R A T I O N S
626 ********************************************************************************
629 /*******************************************************************************
631 ********************************************************************************
635 /*----------------------------------------------------------------------------*/
643 /*----------------------------------------------------------------------------*/
644 VOID
mboxInitMsgMap(VOID
)
647 MSG_HNDL_ENTRY_T rTempEntry
;
649 ASSERT((sizeof(arMsgMapTable
) / sizeof(MSG_HNDL_ENTRY_T
)) == MID_TOTAL_NUM
);
651 for (i
= 0; i
< MID_TOTAL_NUM
; i
++) {
652 if (arMsgMapTable
[i
].eMsgId
== (ENUM_MSG_ID_T
) i
) {
655 for (idx
= i
+ 1; idx
< MID_TOTAL_NUM
; idx
++) {
656 if (arMsgMapTable
[idx
].eMsgId
== (ENUM_MSG_ID_T
) i
) {
660 ASSERT(idx
< MID_TOTAL_NUM
);
661 if (idx
>= MID_TOTAL_NUM
) {
665 /* Swap target entry and current entry */
666 rTempEntry
.eMsgId
= arMsgMapTable
[idx
].eMsgId
;
667 rTempEntry
.pfMsgHndl
= arMsgMapTable
[idx
].pfMsgHndl
;
669 arMsgMapTable
[idx
].eMsgId
= arMsgMapTable
[i
].eMsgId
;
670 arMsgMapTable
[idx
].pfMsgHndl
= arMsgMapTable
[i
].pfMsgHndl
;
672 arMsgMapTable
[i
].eMsgId
= rTempEntry
.eMsgId
;
673 arMsgMapTable
[i
].pfMsgHndl
= rTempEntry
.pfMsgHndl
;
676 /* Verify the correctness of final message map */
677 for (i
= 0; i
< MID_TOTAL_NUM
; i
++) {
678 ASSERT(arMsgMapTable
[i
].eMsgId
== (ENUM_MSG_ID_T
) i
);
679 while (arMsgMapTable
[i
].eMsgId
!= (ENUM_MSG_ID_T
) i
) {
686 /*----------------------------------------------------------------------------*/
694 /*----------------------------------------------------------------------------*/
695 VOID
mboxSetup(IN P_ADAPTER_T prAdapter
, IN ENUM_MBOX_ID_T eMboxId
)
698 KAL_SPIN_LOCK_DECLARATION();
700 ASSERT(eMboxId
< MBOX_ID_TOTAL_NUM
);
703 prMbox
= &(prAdapter
->arMbox
[eMboxId
]);
705 KAL_ACQUIRE_SPIN_LOCK(prAdapter
, SPIN_LOCK_MAILBOX
);
706 LINK_INITIALIZE(&prMbox
->rLinkHead
);
707 KAL_RELEASE_SPIN_LOCK(prAdapter
, SPIN_LOCK_MAILBOX
);
710 /*----------------------------------------------------------------------------*/
718 /*----------------------------------------------------------------------------*/
720 mboxSendMsg(IN P_ADAPTER_T prAdapter
,
721 IN ENUM_MBOX_ID_T eMboxId
, IN P_MSG_HDR_T prMsg
, IN EUNM_MSG_SEND_METHOD_T eMethod
)
724 KAL_SPIN_LOCK_DECLARATION();
726 ASSERT(eMboxId
< MBOX_ID_TOTAL_NUM
);
730 prMbox
= &(prAdapter
->arMbox
[eMboxId
]);
733 case MSG_SEND_METHOD_BUF
:
734 KAL_ACQUIRE_SPIN_LOCK(prAdapter
, SPIN_LOCK_MAILBOX
);
735 LINK_INSERT_TAIL(&prMbox
->rLinkHead
, &prMsg
->rLinkEntry
);
736 KAL_RELEASE_SPIN_LOCK(prAdapter
, SPIN_LOCK_MAILBOX
);
738 /* to wake up main service thread */
739 GLUE_SET_EVENT(prAdapter
->prGlueInfo
);
743 case MSG_SEND_METHOD_UNBUF
:
744 MBOX_HNDL_MSG(prAdapter
, prMsg
);
753 /*----------------------------------------------------------------------------*/
761 /*----------------------------------------------------------------------------*/
762 VOID
mboxRcvAllMsg(IN P_ADAPTER_T prAdapter
, ENUM_MBOX_ID_T eMboxId
)
766 KAL_SPIN_LOCK_DECLARATION();
768 ASSERT(eMboxId
< MBOX_ID_TOTAL_NUM
);
771 prMbox
= &(prAdapter
->arMbox
[eMboxId
]);
773 while (!LINK_IS_EMPTY(&prMbox
->rLinkHead
)) {
774 KAL_ACQUIRE_SPIN_LOCK(prAdapter
, SPIN_LOCK_MAILBOX
);
775 LINK_REMOVE_HEAD(&prMbox
->rLinkHead
, prMsg
, P_MSG_HDR_T
);
776 KAL_RELEASE_SPIN_LOCK(prAdapter
, SPIN_LOCK_MAILBOX
);
779 MBOX_HNDL_MSG(prAdapter
, prMsg
);
784 /*----------------------------------------------------------------------------*/
792 /*----------------------------------------------------------------------------*/
793 VOID
mboxInitialize(IN P_ADAPTER_T prAdapter
)
799 /* Initialize Mailbox */
802 /* Setup/initialize each mailbox */
803 for (i
= 0; i
< MBOX_ID_TOTAL_NUM
; i
++) {
804 mboxSetup(prAdapter
, i
);
809 /*----------------------------------------------------------------------------*/
817 /*----------------------------------------------------------------------------*/
818 VOID
mboxDestroy(IN P_ADAPTER_T prAdapter
)
823 KAL_SPIN_LOCK_DECLARATION();
827 for (i
= 0; i
< MBOX_ID_TOTAL_NUM
; i
++) {
828 prMbox
= &(prAdapter
->arMbox
[i
]);
830 while (!LINK_IS_EMPTY(&prMbox
->rLinkHead
)) {
831 KAL_ACQUIRE_SPIN_LOCK(prAdapter
, SPIN_LOCK_MAILBOX
);
832 LINK_REMOVE_HEAD(&prMbox
->rLinkHead
, prMsg
, P_MSG_HDR_T
);
833 KAL_RELEASE_SPIN_LOCK(prAdapter
, SPIN_LOCK_MAILBOX
);
836 cnmMemFree(prAdapter
, prMsg
);
841 /*----------------------------------------------------------------------------*/
843 * \brief This is dummy function to prevent empty arMsgMapTable[] for compiling.
849 /*----------------------------------------------------------------------------*/
850 VOID
mboxDummy(IN P_ADAPTER_T prAdapter
, IN P_MSG_HDR_T prMsgHdr
)
854 cnmMemFree(prAdapter
, prMsgHdr
);