| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857 |
- /*
- ** Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/hem_mbox.c#7
- */
- /*! \file "hem_mbox.c"
- \brief
- */
- /*
- ** Log: hem_mbox.c
- **
- ** 08 22 2013 yuche.tsai
- ** [BORA00002761] [MT6630][Wi-Fi Direct][Driver] Group Interface formation
- ** [BORA00000779] [MT6620] Emulation For TX Code Check In
- ** Make P2P group interface formation success.
- **
- ** 08 09 2013 cp.wu
- ** [BORA00002253] [MT6630 Wi-Fi][Driver][Firmware] Add NLO and timeout mechanism to SCN module
- ** 1. integrate scheduled scan functionality
- ** 2. condition compilation for linux-3.4 & linux-3.8 compatibility
- ** 3. correct CMD queue access to reduce lock scope
- **
- ** 07 29 2013 cp.wu
- ** [BORA00002725] [MT6630][Wi-Fi] Add MGMT TX/RX support for Linux port
- ** Preparation for porting remain_on_channel support
- **
- ** 07 17 2013 yuche.tsai
- ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
- ** MT6630 P2P first connection check point 1.
- **
- ** 02 27 2013 yuche.tsai
- ** [BORA00002398] [MT6630][Volunteer Patch] P2P Driver Re-Design for Multiple BSS support
- ** Add new code, fix compile warning.
- **
- ** 01 22 2013 cp.wu
- ** [BORA00002253] [MT6630 Wi-Fi][Driver][Firmware] Add NLO and timeout mechanism to SCN module
- ** modification for ucBssIndex migration
- **
- ** 09 17 2012 cm.chang
- ** [BORA00002149] [MT6630 Wi-Fi] Initial software development
- ** Duplicate source from MT6620 v2.3 driver branch
- ** (Davinci label: MT6620_WIFI_Driver_V2_3_120913_1942_As_MT6630_Base)
- **
- ** 08 24 2012 cp.wu
- ** [WCXRP00001269] [MT6620 Wi-Fi][Driver] cfg80211 porting merge back to DaVinci
- ** .
- **
- ** 08 24 2012 cp.wu
- ** [WCXRP00001269] [MT6620 Wi-Fi][Driver] cfg80211 porting merge back to DaVinci
- ** cfg80211 support merge back from ALPS.JB to DaVinci - MT6620 Driver v2.3 branch.
- **
- ** 07 24 2012 yuche.tsai
- ** NULL
- ** Bug fix.
- **
- ** 07 24 2012 yuche.tsai
- ** NULL
- ** Bug fix for JB.
- **
- ** 07 19 2012 yuche.tsai
- ** NULL
- ** Code update for JB.
- *
- * 07 17 2012 yuche.tsai
- * NULL
- * Compile no error before trial run.
- *
- * 05 03 2012 cp.wu
- * [WCXRP00001231] [MT6620 Wi-Fi][MT5931][Driver] Correct SCAN_V2 related debugging facilities within hem_mbox.c
- * correct for debug message string table by adding missed scan_v2 related definitions.
- *
- * 03 02 2012 terry.wu
- * NULL
- * Sync CFG80211 modification from branch 2,2.
- *
- * 01 17 2012 yuche.tsai
- * NULL
- * Update mgmt frame filter setting.
- * Please also update FW 2.1
- *
- * 01 13 2012 yuche.tsai
- * NULL
- * WiFi Hot Spot Tethering for ICS ALPHA testing version.
- *
- * 11 24 2011 wh.su
- * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
- * Adjust code for DBG and CONFIG_XLOG.
- *
- * 11 15 2011 cm.chang
- * NULL
- * Add exception handle for NULL function pointer of mailbox message
- *
- * 11 11 2011 wh.su
- * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
- * modify the xlog related code.
- *
- * 11 02 2011 wh.su
- * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG
- * adding the code for XLOG.
- *
- * 07 18 2011 cp.wu
- * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID
- * in a single scanning request
- * 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
- *
- * 06 07 2011 yuche.tsai
- * [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
- * Add invitation support.
- *
- * 04 18 2011 terry.wu
- * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED
- * Remove flag CFG_WIFI_DIRECT_MOVED.
- *
- * 03 29 2011 cm.chang
- * [WCXRP00000606] [MT6620 Wi-Fi][Driver][FW] Fix klocwork warning
- * As CR title
- *
- * 02 24 2011 cp.wu
- * [WCXRP00000490] [MT6620 Wi-Fi][Driver][Win32] modify kalMsleep() implementation because
- * NdisMSleep() won't sleep long enough for specified interval such as 500ms
- * modify cnm_timer and hem_mbox APIs to be thread safe to ease invoking restrictions
- *
- * 02 15 2011 chinghwa.yu
- * [WCXRP00000065] Update BoW design and settings
- * Update bowString and channel grant.
- *
- * 01 26 2011 cm.chang
- * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument
- * Allocate system RAM if fixed message or mgmt buffer is not available
- *
- * 01 26 2011 yuche.tsai
- * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
- * .
- *
- * 01 25 2011 yuche.tsai
- * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record.
- * Fix Compile Error when DBG is disabled.
- *
- * 01 24 2011 cp.wu
- * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving
- * 1. add an extra counter for tracking pending forward frames.
- * 2. notify TX service thread as well when there is pending forward frame
- * 3. correct build errors leaded by introduction of Wi-Fi direct separation module
- *
- * 12 08 2010 chinghwa.yu
- * [WCXRP00000065] Update BoW design and settings
- * Support concurrent networks.
- *
- * 11 08 2010 cm.chang
- * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID
- * Remove CNM channel reover message ID
- *
- * 11 01 2010 cp.wu
- * [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
- * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead
- * 2) Remove CNM CH-RECOVER event handling
- * 3) cfg read/write API renamed with kal prefix for unified naming rules.
- *
- * 10 08 2010 wh.su
- * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine
- * update the frog's new p2p state machine.
- *
- * 09 28 2010 wh.su
- * NULL
- * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo.
- *
- * 09 16 2010 cm.chang
- * NULL
- * Remove unused message ID
- *
- * 08 30 2010 cp.wu
- * NULL
- * eliminate klockwork errors
- *
- * 08 26 2010 yuche.tsai
- * NULL
- * Add P2P Connection Abort Event Message handler.
- *
- * 08 25 2010 george.huang
- * NULL
- * update OID/ registry control path for PM related settings
- *
- * 08 24 2010 yarco.yang
- * NULL
- * Fixed Driver ASSERT at mboxInitMsgMap()
- *
- * 08 24 2010 chinghwa.yu
- * NULL
- * Update for MID_SCN_BOW_SCAN_DONE mboxDummy.
- * Update saa_fsm for BOW.
- *
- * 08 23 2010 chinghwa.yu
- * NULL
- * Add CFG_ENABLE_BT_OVER_WIFI.
- *
- * 08 23 2010 chinghwa.yu
- * NULL
- * Update for BOW.
- *
- * 08 16 2010 cp.wu
- * NULL
- * add interface for RLM to trigger OBSS-SCAN.
- *
- * 08 16 2010 yuche.tsai
- * NULL
- * Add debug message for newly add P2P message.
- *
- * 08 11 2010 yuche.tsai
- * NULL
- * Add some function entry for P2P FSM under provisioning phase..
- *
- * 08 11 2010 yuche.tsai
- * NULL
- * Add some events to P2P Module.
- *
- * 08 05 2010 yuche.tsai
- * NULL
- * Add message box event for P2P device switch on & device discovery.
- *
- * 08 04 2010 cp.wu
- * NULL
- * remove unused mailbox message definitions.
- *
- * 08 02 2010 yuche.tsai
- * NULL
- * P2P Group Negotiation Code Check in.
- *
- * 07 19 2010 cp.wu
- *
- * [WPD00003833] [MT6620 and MT5931] Driver migration.
- * message table should not be commented out by compilation option without modifying header file
- *
- * 07 19 2010 cp.wu
- *
- * [WPD00003833] [MT6620 and MT5931] Driver migration.
- * Add Ad-Hoc support to AIS-FSM
- *
- * 07 19 2010 yuche.tsai
- *
- * Add wifi direct scan done callback.
- *
- * 07 09 2010 cp.wu
- *
- * change handler of MID_MNY_CNM_CONNECTION_ABORT from NULL to mboxDummy.
- *
- * 07 08 2010 cp.wu
- *
- * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
- *
- * 07 08 2010 cm.chang
- * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
- * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT
- *
- * 07 01 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * AIS-FSM integration with CNM channel request messages
- *
- * 07 01 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * implementation of DRV-SCN and related mailbox message handling.
- *
- * 07 01 2010 cm.chang
- * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
- * Modify CNM message handler for new flow
- *
- * 06 15 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * enable currently migrated message call-backs.
- *
- * 06 14 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * restore utility function invoking via hem_mbox to direct calls
- *
- * 06 10 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * add buildable & linkable ais_fsm.c
- *
- * related reference are still waiting to be resolved
- *
- * 06 08 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * hem_mbox is migrated.
- *
- * 06 08 2010 cp.wu
- * [WPD00003833][MT6620 and MT5931] Driver migration
- * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration
- *
- * 05 12 2010 kevin.huang
- * [BORA00000794][WIFISYS][New Feature]Power Management Support
- * Fix file merge error
- *
- * 05 12 2010 kevin.huang
- * [BORA00000794][WIFISYS][New Feature]Power Management Support
- * Add Power Management - Legacy PS-POLL support.
- *
- * 04 29 2010 tehuang.liu
- * [BORA00000605][WIFISYS] Phase3 Integration
- * Removed MID_RXM_MQM_QOS_ACTION_FRAME
- *
- * 04 29 2010 tehuang.liu
- * [BORA00000605][WIFISYS] Phase3 Integration
- * Removed MID_RXM_MQM_BA_ACTION_FRAME
- *
- * 04 27 2010 tehuang.liu
- * [BORA00000605][WIFISYS] Phase3 Integration
- * MID_RXM_MQM_BA_ACTION_FRAME
- *
- * 03 30 2010 cm.chang
- * [BORA00000018]Integrate WIFI part into BORA for the 1st time
- * Support 2.4G OBSS scan
- *
- * 03 16 2010 kevin.huang
- * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
- * Add AdHoc Mode
- *
- * 03 10 2010 kevin.huang
- * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support
- *
- * * * * * * * * * * * * * * Add Channel Manager for arbitration of JOIN and SCAN Req
- *
- * 03 05 2010 cm.chang
- * [BORA00000018]Integrate WIFI part into BORA for the 1st time
- * Develop partial DPD code
- *
- * 02 11 2010 tehuang.liu
- * [BORA00000569][WIFISYS] Phase 2 Integration Test
- * Updated arMsgMapTable for MID_RXM_MQM_QOS_ACTION_FRAME
- *
- * 01 11 2010 kevin.huang
- * [BORA00000018]Integrate WIFI part into BORA for the 1st time
- * Add Deauth and Disassoc Handler
- *
- * Dec 9 2009 mtk01461
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Add hemRunEventScanDone() to arMsgMapTable[]
- *
- * Dec 4 2009 mtk01461
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Fix mboxDummy() didn't free prMsgHdr
- *
- * Dec 3 2009 mtk01461
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Add saaAisJoinComplete event handler
- *
- * Dec 2 2009 MTK02468
- * [BORA00000337] To check in codes for FPGA emulation
- * Fixed the handler function name in arMsgMapTable for MID_RXM_MQM_BA_ACTION_FRAME
- *
- * Dec 2 2009 MTK02468
- * [BORA00000337] To check in codes for FPGA emulation
- * Added MID_RXM_MQM_BA_ACTION_FRAME to MsgMapTable
- *
- * Nov 23 2009 mtk01461
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Revise MSG Handler (remove dummy and add for SAA)
- *
- * Nov 16 2009 mtk01461
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Add aisFsmRunEventAbort() event handler
- *
- * Nov 11 2009 mtk01461
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Fix typo
- *
- * Nov 10 2009 mtk01461
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Add more MSG_HNDL_ENTRY_T to avoid ASSERT() in mboxInitMsgMap()
- *
- * Nov 5 2009 mtk01461
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Add SCN message and function entry to arMsgMapTable[]
- *
- * Nov 2 2009 mtk01104
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- * Fix sorting algorithm in mboxInitMsgMap()
- *
- * Oct 28 2009 mtk01104
- * [BORA00000018] Integrate WIFI part into BORA for the 1st time
- *
- **
- */
- /*******************************************************************************
- * C O M P I L E R F L A G S
- ********************************************************************************
- */
- /*******************************************************************************
- * E X T E R N A L R E F E R E N C E S
- ********************************************************************************
- */
- #include "precomp.h"
- /*******************************************************************************
- * C O N S T A N T S
- ********************************************************************************
- */
- /*******************************************************************************
- * D A T A T Y P E S
- ********************************************************************************
- */
- /*******************************************************************************
- * P U B L I C D A T A
- ********************************************************************************
- */
- /*******************************************************************************
- * P R I V A T E D A T A
- ********************************************************************************
- */
- #if DBG
- /*lint -save -e64 Type mismatch */
- static PUINT_8 apucDebugMsg[] = {
- (PUINT_8) DISP_STRING("MID_MNY_CNM_CH_REQ"),
- (PUINT_8) DISP_STRING("MID_MNY_CNM_CH_ABORT"),
- (PUINT_8) DISP_STRING("MID_CNM_AIS_CH_GRANT"),
- (PUINT_8) DISP_STRING("MID_CNM_P2P_CH_GRANT"),
- (PUINT_8) DISP_STRING("MID_CNM_BOW_CH_GRANT"),
- (PUINT_8) DISP_STRING("MID_AIS_SCN_SCAN_REQ"),
- (PUINT_8) DISP_STRING("MID_AIS_SCN_SCAN_REQ_V2"),
- (PUINT_8) DISP_STRING("MID_AIS_SCN_SCAN_CANCEL"),
- (PUINT_8) DISP_STRING("MID_P2P_SCN_SCAN_REQ"),
- (PUINT_8) DISP_STRING("MID_P2P_SCN_SCAN_REQ_V2"),
- (PUINT_8) DISP_STRING("MID_P2P_SCN_SCAN_CANCEL"),
- (PUINT_8) DISP_STRING("MID_BOW_SCN_SCAN_REQ"),
- (PUINT_8) DISP_STRING("MID_BOW_SCN_SCAN_REQ_V2"),
- (PUINT_8) DISP_STRING("MID_BOW_SCN_SCAN_CANCEL"),
- (PUINT_8) DISP_STRING("MID_RLM_SCN_SCAN_REQ"),
- (PUINT_8) DISP_STRING("MID_RLM_SCN_SCAN_REQ_V2"),
- (PUINT_8) DISP_STRING("MID_RLM_SCN_SCAN_CANCEL"),
- (PUINT_8) DISP_STRING("MID_SCN_AIS_SCAN_DONE"),
- (PUINT_8) DISP_STRING("MID_SCN_P2P_SCAN_DONE"),
- (PUINT_8) DISP_STRING("MID_SCN_BOW_SCAN_DONE"),
- (PUINT_8) DISP_STRING("MID_SCN_RLM_SCAN_DONE"),
- (PUINT_8) DISP_STRING("MID_OID_AIS_FSM_JOIN_REQ"),
- (PUINT_8) DISP_STRING("MID_OID_AIS_FSM_ABORT"),
- (PUINT_8) DISP_STRING("MID_AIS_SAA_FSM_START"),
- (PUINT_8) DISP_STRING("MID_AIS_SAA_FSM_ABORT"),
- (PUINT_8) DISP_STRING("MID_SAA_AIS_JOIN_COMPLETE"),
- #if CFG_ENABLE_BT_OVER_WIFI
- (PUINT_8) DISP_STRING("MID_BOW_SAA_FSM_START"),
- (PUINT_8) DISP_STRING("MID_BOW_SAA_FSM_ABORT"),
- (PUINT_8) DISP_STRING("MID_SAA_BOW_JOIN_COMPLETE"),
- #endif
- #if CFG_ENABLE_WIFI_DIRECT
- (PUINT_8) DISP_STRING("MID_P2P_SAA_FSM_START"),
- (PUINT_8) DISP_STRING("MID_P2P_SAA_FSM_ABORT"),
- (PUINT_8) DISP_STRING("MID_SAA_P2P_JOIN_COMPLETE"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_FUN_SWITCH"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_DEVICE_DISCOVERY"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_CONNECTION_REQ"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_CONNECTION_ABORT"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_BEACON_UPDATE"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_STOP_AP"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_CHNL_REQ"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_CHNL_ABORT"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_MGMT_TX"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_GROUP_DISSOLVE"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_MGMT_FRAME_REGISTER"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_NET_DEV_REGISTER"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_START_AP"),
- (PUINT_8) DISP_STRING("MID_MNY_P2P_UPDATE_IE_BUF"),
- #endif
- #if CFG_SUPPORT_ADHOC
- /* (PUINT_8)DISP_STRING("MID_AIS_CNM_CREATE_IBSS_REQ"), */
- /* (PUINT_8)DISP_STRING("MID_CNM_AIS_CREATE_IBSS_GRANT"), */
- /* (PUINT_8)DISP_STRING("MID_AIS_CNM_MERGE_IBSS_REQ"), */
- /* (PUINT_8)DISP_STRING("MID_CNM_AIS_MERGE_IBSS_GRANT"), */
- (PUINT_8) DISP_STRING("MID_SCN_AIS_FOUND_IBSS"),
- #endif /* CFG_SUPPORT_ADHOC */
- (PUINT_8) DISP_STRING("MID_SAA_AIS_FSM_ABORT"),
- (PUINT_8) DISP_STRING("MID_MNY_AIS_REMAIN_ON_CHANNEL"),
- (PUINT_8) DISP_STRING("MID_MNY_AIS_CANCEL_REMAIN_ON_CHANNEL"),
- (PUINT_8) DISP_STRING("MID_MNY_AIS_MGMT_TX")
- };
- /*lint -restore */
- #endif /* DBG */
- /* This message entry will be re-ordered based on the message ID order
- * by invoking mboxInitMsgMap()
- */
- static MSG_HNDL_ENTRY_T arMsgMapTable[] = {
- {MID_MNY_CNM_CH_REQ, cnmChMngrRequestPrivilege},
- {MID_MNY_CNM_CH_ABORT, cnmChMngrAbortPrivilege},
- {MID_CNM_AIS_CH_GRANT, aisFsmRunEventChGrant},
- #if CFG_ENABLE_WIFI_DIRECT
- {MID_CNM_P2P_CH_GRANT, p2pFsmRunEventChGrant}, /*set in gl_p2p_init.c */
- #else
- {MID_CNM_P2P_CH_GRANT, mboxDummy},
- #endif
- #if CFG_ENABLE_BT_OVER_WIFI
- {MID_CNM_BOW_CH_GRANT, bowRunEventChGrant},
- #else
- {MID_CNM_BOW_CH_GRANT, mboxDummy},
- #endif
- /*--------------------------------------------------*/
- /* SCN Module Mailbox Messages */
- /*--------------------------------------------------*/
- {MID_AIS_SCN_SCAN_REQ, scnFsmMsgStart},
- {MID_AIS_SCN_SCAN_REQ_V2, scnFsmMsgStart},
- {MID_AIS_SCN_SCAN_CANCEL, scnFsmMsgAbort},
- {MID_P2P_SCN_SCAN_REQ, scnFsmMsgStart},
- {MID_P2P_SCN_SCAN_REQ_V2, scnFsmMsgStart},
- {MID_P2P_SCN_SCAN_CANCEL, scnFsmMsgAbort},
- {MID_BOW_SCN_SCAN_REQ, scnFsmMsgStart},
- {MID_BOW_SCN_SCAN_REQ_V2, scnFsmMsgStart},
- {MID_BOW_SCN_SCAN_CANCEL, scnFsmMsgAbort},
- {MID_RLM_SCN_SCAN_REQ, scnFsmMsgStart},
- {MID_RLM_SCN_SCAN_REQ_V2, scnFsmMsgStart},
- {MID_RLM_SCN_SCAN_CANCEL, scnFsmMsgAbort},
- {MID_SCN_AIS_SCAN_DONE, aisFsmRunEventScanDone},
- #if CFG_ENABLE_WIFI_DIRECT
- {MID_SCN_P2P_SCAN_DONE, p2pFsmRunEventScanDone}, /*set in gl_p2p_init.c */
- #else
- {MID_SCN_P2P_SCAN_DONE, mboxDummy},
- #endif
- #if CFG_ENABLE_BT_OVER_WIFI
- {MID_SCN_BOW_SCAN_DONE, bowResponderScanDone},
- #else
- {MID_SCN_BOW_SCAN_DONE, mboxDummy},
- #endif
- {MID_SCN_RLM_SCAN_DONE, rlmObssScanDone},
- /*--------------------------------------------------*/
- /* AIS Module Mailbox Messages */
- /*--------------------------------------------------*/
- {MID_OID_AIS_FSM_JOIN_REQ, aisFsmRunEventAbort},
- {MID_OID_AIS_FSM_ABORT, aisFsmRunEventAbort},
- {MID_AIS_SAA_FSM_START, saaFsmRunEventStart},
- {MID_AIS_SAA_FSM_ABORT, saaFsmRunEventAbort},
- {MID_SAA_AIS_JOIN_COMPLETE, aisFsmRunEventJoinComplete},
- #if CFG_ENABLE_BT_OVER_WIFI
- /*--------------------------------------------------*/
- /* BOW Module Mailbox Messages */
- /*--------------------------------------------------*/
- {MID_BOW_SAA_FSM_START, saaFsmRunEventStart},
- {MID_BOW_SAA_FSM_ABORT, saaFsmRunEventAbort},
- {MID_SAA_BOW_JOIN_COMPLETE, bowFsmRunEventJoinComplete},
- #endif
- #if CFG_ENABLE_WIFI_DIRECT /*set in gl_p2p_init.c */
- {MID_P2P_SAA_FSM_START, saaFsmRunEventStart},
- {MID_P2P_SAA_FSM_ABORT, saaFsmRunEventAbort},
- {MID_SAA_P2P_JOIN_COMPLETE, p2pRoleFsmRunEventJoinComplete}, /* V */
- {MID_MNY_P2P_FUN_SWITCH, p2pRoleFsmRunEventSwitchOPMode},
- {MID_MNY_P2P_DEVICE_DISCOVERY, p2pFsmRunEventScanRequest}, /* V */
- {MID_MNY_P2P_CONNECTION_REQ, p2pRoleFsmRunEventConnectionRequest},
- {MID_MNY_P2P_CONNECTION_ABORT, p2pRoleFsmRunEventConnectionAbort},
- {MID_MNY_P2P_BEACON_UPDATE, p2pFsmRunEventBeaconUpdate},
- {MID_MNY_P2P_STOP_AP, p2pRoleFsmRunEventStopAP},
- {MID_MNY_P2P_CHNL_REQ, p2pDevFsmRunEventChannelRequest}, /* V */
- {MID_MNY_P2P_CHNL_ABORT, p2pDevFsmRunEventChannelAbort}, /* V */
- {MID_MNY_P2P_MGMT_TX, p2pDevFsmRunEventMgmtTx}, /* V */
- {MID_MNY_P2P_GROUP_DISSOLVE, p2pRoleFsmRunEventDissolve},
- {MID_MNY_P2P_MGMT_FRAME_REGISTER, p2pDevFsmRunEventMgmtFrameRegister},
- {MID_MNY_P2P_NET_DEV_REGISTER, p2pFsmRunEventNetDeviceRegister},
- {MID_MNY_P2P_START_AP, p2pRoleFsmRunEventStartAP},
- {MID_MNY_P2P_MGMT_FRAME_UPDATE, p2pFsmRunEventUpdateMgmtFrame},
- {MID_MNY_P2P_EXTEND_LISTEN_INTERVAL, p2pFsmRunEventExtendListen},
- #if CFG_SUPPORT_WFD
- {MID_MNY_P2P_WFD_CFG_UPDATE, p2pFsmRunEventWfdSettingUpdate},
- #endif
- #endif
- #if CFG_SUPPORT_ADHOC
- {MID_SCN_AIS_FOUND_IBSS, aisFsmRunEventFoundIBSSPeer},
- #endif /* CFG_SUPPORT_ADHOC */
- {MID_SAA_AIS_FSM_ABORT, aisFsmRunEventAbort},
- {MID_MNY_AIS_REMAIN_ON_CHANNEL, aisFsmRunEventRemainOnChannel},
- {MID_MNY_AIS_CANCEL_REMAIN_ON_CHANNEL, aisFsmRunEventCancelRemainOnChannel},
- {MID_MNY_AIS_MGMT_TX, aisFsmRunEventMgmtFrameTx}
- };
- /*******************************************************************************
- * M A C R O S
- ********************************************************************************
- */
- #if DBG
- #define MBOX_HNDL_MSG(prAdapter, prMsg) do { \
- ASSERT(arMsgMapTable[prMsg->eMsgId].pfMsgHndl); \
- if (arMsgMapTable[prMsg->eMsgId].pfMsgHndl) { \
- DBGLOG(CNM, LOUD, "DO MSG [%d: %s]\n", prMsg->eMsgId, apucDebugMsg[prMsg->eMsgId]); \
- arMsgMapTable[prMsg->eMsgId].pfMsgHndl(prAdapter, prMsg); \
- } \
- else { \
- DBGLOG(CNM, ERROR, "NULL fptr for MSG [%d]\n", prMsg->eMsgId); \
- cnmMemFree(prAdapter, prMsg); \
- } \
- } while (0)
- #else
- #define MBOX_HNDL_MSG(prAdapter, prMsg) do { \
- ASSERT(arMsgMapTable[prMsg->eMsgId].pfMsgHndl); \
- if (arMsgMapTable[prMsg->eMsgId].pfMsgHndl) { \
- DBGLOG(CNM, LOUD, "DO MSG [%d]\n", prMsg->eMsgId); \
- arMsgMapTable[prMsg->eMsgId].pfMsgHndl(prAdapter, prMsg); \
- } \
- else { \
- DBGLOG(CNM, ERROR, "NULL fptr for MSG [%d]\n", prMsg->eMsgId); \
- cnmMemFree(prAdapter, prMsg); \
- } \
- } while (0)
- #endif
- /*******************************************************************************
- * F U N C T I O N D E C L A R A T I O N S
- ********************************************************************************
- */
- /*******************************************************************************
- * F U N C T I O N S
- ********************************************************************************
- */
- /*----------------------------------------------------------------------------*/
- /*!
- * \brief
- *
- * \param[in]
- *
- * \return none
- */
- /*----------------------------------------------------------------------------*/
- VOID mboxInitMsgMap(VOID)
- {
- UINT_32 i, idx;
- MSG_HNDL_ENTRY_T rTempEntry;
- ASSERT((sizeof(arMsgMapTable) / sizeof(MSG_HNDL_ENTRY_T)) == MID_TOTAL_NUM);
- for (i = 0; i < MID_TOTAL_NUM; i++) {
- if (arMsgMapTable[i].eMsgId == (ENUM_MSG_ID_T) i)
- continue;
- for (idx = i + 1; idx < MID_TOTAL_NUM; idx++) {
- if (arMsgMapTable[idx].eMsgId == (ENUM_MSG_ID_T) i)
- break;
- }
- ASSERT(idx < MID_TOTAL_NUM);
- if (idx >= MID_TOTAL_NUM)
- continue;
- /* Swap target entry and current entry */
- rTempEntry.eMsgId = arMsgMapTable[idx].eMsgId;
- rTempEntry.pfMsgHndl = arMsgMapTable[idx].pfMsgHndl;
- arMsgMapTable[idx].eMsgId = arMsgMapTable[i].eMsgId;
- arMsgMapTable[idx].pfMsgHndl = arMsgMapTable[i].pfMsgHndl;
- arMsgMapTable[i].eMsgId = rTempEntry.eMsgId;
- arMsgMapTable[i].pfMsgHndl = rTempEntry.pfMsgHndl;
- }
- /* Verify the correctness of final message map */
- for (i = 0; i < MID_TOTAL_NUM; i++) {
- ASSERT(arMsgMapTable[i].eMsgId == (ENUM_MSG_ID_T) i);
- while (arMsgMapTable[i].eMsgId != (ENUM_MSG_ID_T) i)
- ;
- }
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * \brief
- *
- * \param[in]
- *
- * \return none
- */
- /*----------------------------------------------------------------------------*/
- VOID mboxSetup(IN P_ADAPTER_T prAdapter, IN ENUM_MBOX_ID_T eMboxId)
- {
- P_MBOX_T prMbox;
- KAL_SPIN_LOCK_DECLARATION();
- ASSERT(eMboxId < MBOX_ID_TOTAL_NUM);
- ASSERT(prAdapter);
- prMbox = &(prAdapter->arMbox[eMboxId]);
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
- LINK_INITIALIZE(&prMbox->rLinkHead);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * \brief
- *
- * \param[in]
- *
- * \return none
- */
- /*----------------------------------------------------------------------------*/
- VOID
- mboxSendMsg(IN P_ADAPTER_T prAdapter,
- IN ENUM_MBOX_ID_T eMboxId, IN P_MSG_HDR_T prMsg, IN EUNM_MSG_SEND_METHOD_T eMethod)
- {
- P_MBOX_T prMbox;
- KAL_SPIN_LOCK_DECLARATION();
- ASSERT(eMboxId < MBOX_ID_TOTAL_NUM);
- ASSERT(prMsg);
- ASSERT(prAdapter);
- prMbox = &(prAdapter->arMbox[eMboxId]);
- switch (eMethod) {
- case MSG_SEND_METHOD_BUF:
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
- LINK_INSERT_TAIL(&prMbox->rLinkHead, &prMsg->rLinkEntry);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
- /* to wake up main service thread */
- GLUE_SET_EVENT(prAdapter->prGlueInfo);
- break;
- case MSG_SEND_METHOD_UNBUF:
- MBOX_HNDL_MSG(prAdapter, prMsg);
- break;
- default:
- ASSERT(0);
- break;
- }
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * \brief
- *
- * \param[in]
- *
- * \return none
- */
- /*----------------------------------------------------------------------------*/
- VOID mboxRcvAllMsg(IN P_ADAPTER_T prAdapter, ENUM_MBOX_ID_T eMboxId)
- {
- P_MBOX_T prMbox;
- P_MSG_HDR_T prMsg;
- KAL_SPIN_LOCK_DECLARATION();
- ASSERT(eMboxId < MBOX_ID_TOTAL_NUM);
- ASSERT(prAdapter);
- prMbox = &(prAdapter->arMbox[eMboxId]);
- while (!LINK_IS_EMPTY(&prMbox->rLinkHead)) {
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
- LINK_REMOVE_HEAD(&prMbox->rLinkHead, prMsg, P_MSG_HDR_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
- ASSERT(prMsg);
- MBOX_HNDL_MSG(prAdapter, prMsg);
- }
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * \brief
- *
- * \param[in]
- *
- * \return none
- */
- /*----------------------------------------------------------------------------*/
- VOID mboxInitialize(IN P_ADAPTER_T prAdapter)
- {
- UINT_32 i;
- ASSERT(prAdapter);
- /* Initialize Mailbox */
- mboxInitMsgMap();
- /* Setup/initialize each mailbox */
- for (i = 0; i < MBOX_ID_TOTAL_NUM; i++)
- mboxSetup(prAdapter, i);
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * \brief
- *
- * \param[in]
- *
- * \return none
- */
- /*----------------------------------------------------------------------------*/
- VOID mboxDestroy(IN P_ADAPTER_T prAdapter)
- {
- P_MBOX_T prMbox;
- P_MSG_HDR_T prMsg;
- UINT_8 i;
- KAL_SPIN_LOCK_DECLARATION();
- ASSERT(prAdapter);
- for (i = 0; i < MBOX_ID_TOTAL_NUM; i++) {
- prMbox = &(prAdapter->arMbox[i]);
- while (!LINK_IS_EMPTY(&prMbox->rLinkHead)) {
- KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
- LINK_REMOVE_HEAD(&prMbox->rLinkHead, prMsg, P_MSG_HDR_T);
- KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
- ASSERT(prMsg);
- cnmMemFree(prAdapter, prMsg);
- }
- }
- }
- /*----------------------------------------------------------------------------*/
- /*!
- * \brief This is dummy function to prevent empty arMsgMapTable[] for compiling.
- *
- * \param[in]
- *
- * \return none
- */
- /*----------------------------------------------------------------------------*/
- VOID mboxDummy(IN P_ADAPTER_T prAdapter, IN P_MSG_HDR_T prMsgHdr)
- {
- ASSERT(prAdapter);
- cnmMemFree(prAdapter, prMsgHdr);
- }
|