/drivers/net/wireless/tiwlan1251/common/src/core/sme/configMgr/configMgr.c
C | 2340 lines | 1331 code | 311 blank | 698 comment | 215 complexity | d61f251e051f3f2c0f65b32abedf042f MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
Large files files are truncated, but you can click here to view the full file
- /****************************************************************************
- **+-----------------------------------------------------------------------+**
- **| |**
- **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
- **| All rights reserved. |**
- **| |**
- **| Redistribution and use in source and binary forms, with or without |**
- **| modification, are permitted provided that the following conditions |**
- **| are met: |**
- **| |**
- **| * Redistributions of source code must retain the above copyright |**
- **| notice, this list of conditions and the following disclaimer. |**
- **| * Redistributions in binary form must reproduce the above copyright |**
- **| notice, this list of conditions and the following disclaimer in |**
- **| the documentation and/or other materials provided with the |**
- **| distribution. |**
- **| * Neither the name Texas Instruments nor the names of its |**
- **| contributors may be used to endorse or promote products derived |**
- **| from this software without specific prior written permission. |**
- **| |**
- **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
- **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
- **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
- **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
- **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
- **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
- **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
- **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
- **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
- **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
- **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
- **| |**
- **+-----------------------------------------------------------------------+**
- ****************************************************************************/
- /** \file configMgr.c
- * \brief Driver interface to OS abstraction layer
- *
- * \see srcApi.h
- */
- #include "osTIType.h"
- #include "osApi.h"
- #include "paramOut.h"
- #include "paramIn.h"
- #include "srcApi.h"
- #include "report.h"
- #include "whalCtrl_api.h"
- #include "connApi.h"
- #include "siteMgrApi.h"
- #include "smeSmApi.h"
- #include "utils.h"
- #include "fsm.h"
- #include "configMgr.h"
- #include "DataCtrl_Api.h"
- #include "rsnApi.h"
- #include "scrApi.h"
- #include "MacServices_api.h"
- #include "ScanCncnApi.h"
- #include "scanMngrApi.h"
- #include "regulatoryDomainApi.h"
- #include "measurementMgrApi.h"
- #ifdef EXC_MODULE_INCLUDED
- #include "excMngr.h"
- #endif
- #include "SoftGeminiApi.h"
- #include "roamingMngrApi.h"
- #include "qosMngr_API.h"
- #include "whalCtrl.h"
- #include "TrafficMonitor.h"
- #include "PowerMgr_API.h"
- #include "EvHandler.h"
- #include "apConn.h"
- #include "currBss.h"
- #include "SwitchChannelApi.h"
- #include "ScanCncnAppApi.h"
- #include "healthMonitor.h"
- #include "wspVer.h"
- #include "Ethernet.h"
- #include "Core_AdaptTx.h"
- #include "TNETW_Driver_api.h"
- #include "rx.h"
- #include "Ctrl.h"
- #include "recoveryMgr_API.h"
- /****************************************************/
- /* Local Functions */
- /****************************************************/
- static configMgr_t *createDriver(TI_HANDLE hOs,void *pWLAN_Images, initTable_t *pInitTable);
- static void configMgr_config (TI_HANDLE hConfigManager);
- static int createCore(configMgr_t *pConfigManager, TI_HANDLE hOs, initTable_t *pInitTable);
- static void configMgr_RetrieveFWInfo(configMgr_t *pConfigManager, initTable_t *pInitTable, whalCtrl_chip_t *pChip_Version);
- static TI_STATUS configCore(configMgr_t *pConfigManager, whalCtrl_chip_t *pChipVer);
- static void release_module(configMgr_t *pConfigManager);
- static void configParamsAccessTable(configMgr_t *pConfigManager);
- UINT32 configMgr_RegisterEvent(TI_HANDLE hConfigMgr, PUCHAR pData, ULONG Length)
- {
- configMgr_t *pConfigManager= (configMgr_t *)hConfigMgr;
-
- return EvHandlerRegisterEvent(pConfigManager->hEvHandler,pData,Length);
- }
- UINT32 configMgr_UnRegisterEvent(TI_HANDLE hConfigMgr, TI_HANDLE uEventID)
- {
- configMgr_t *pConfigManager= (configMgr_t *)hConfigMgr;
- return EvHandlerUnRegisterEvent(pConfigManager->hEvHandler,uEventID);
- }
- UINT32 configMgr_GetEventData(TI_HANDLE hConfigMgr, PUCHAR pData, ULONG* pLength)
- {
- configMgr_t *pConfigManager= (configMgr_t *)hConfigMgr;
- return EvHandlerGetEventData(pConfigManager->hEvHandler,pData,pLength);
- }
- /****************************************************/
- /* Interface Functions Implementation */
- /****************************************************/
- /************************************************************************
- * configMgr_create *
- ************************************************************************
- DESCRIPTION: Driver creation & configuration function, called by the OS abstraction layer, performs the following:
- - Create the driver
- - Configure the driver
- INPUT: hOs - Handle to OS
- pInitTable - Pointer to the init table as received from the OS abstraction layer
- OUTPUT: pMac- MAC address of the device as read from the chip
- RETURN: Handle to the driver
- ************************************************************************/
- TI_HANDLE configMgr_create (TI_HANDLE hOs,
- void *pWLAN_Images,
- initTable_t *pInitTable,
- macAddress_t *pMac)
- {
- configMgr_t *pConfigManager;
- /****************
- Create the Driver
- *****************/
- pConfigManager = createDriver(hOs, pWLAN_Images, pInitTable);
- if (pConfigManager == NULL)
- {
- WLAN_OS_REPORT(("\n.....Configuration manager creation failure \n"));
- return NULL;
- }
- WLAN_REPORT_INIT(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("CREATED DRIVER\n"));
- return (TI_HANDLE)pConfigManager;
- }
- /************************************************************************
- * configMgr_init *
- ************************************************************************
- DESCRIPTION: FW Code Download in partition
- INPUT: hOs - Handle to OS
- TI_HANDLE hConfigManager
- pInitTable - Pointer to the init table as received from the OS abstraction layer
- OUTPUT: pMac- MAC address of the device as read from the chip
- RETURN: Handle to the driver
- ************************************************************************/
- TI_HANDLE configMgr_init (TI_HANDLE hOs,
- TI_HANDLE hConfigManager,
- void *pWLAN_Images,
- initTable_t *pInitTable,
- macAddress_t *pMacAddr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigManager;
- pConfigManager->pInitTable = pInitTable;
- pConfigManager->pMacAddr = pMacAddr;
- /*
- * Init the module and Download the FW code in partition
- * At this stage it is very important that the pConfigManager has been created and linked to the HAL Ctrl
- * so that if the first DMA ends before the user returns to wait for the end of DMA
- * then the pConfigManager will have a valid value
- */
- if (TnetwDrv_Init (pConfigManager->hTnetwDrv,
- pConfigManager->hReport,
- pConfigManager->hMemMgr,
- hConfigManager,
- pWLAN_Images,
- &pInitTable->TnetwDrv_InitParams,
- configMgr_config) == TNETWIF_ERROR)
- {
- WLAN_OS_REPORT(("\n.....TNETW_Driver_Initialize: TNETW_Driver_Init failure \n"));
- return NULL;
- }
- return pConfigManager->hTnetwDrv;
- }
- /************************************************************************
- DESCRIPTION: Driver creation & configuration function, called by the OS abstraction layer, performs the following:
- - Create the driver
- - Configure the driver
- INPUT: hOs - Handle to OS
- pInitTable - Pointer to the init table as received from the OS abstraction layer
- OUTPUT: pMac- MAC address of the device as read from the chip
- RETURN: Handle to the driver
- ************************************************************************/
- static void configMgr_config (TI_HANDLE hConfigManager)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigManager;
- whalCtrl_chip_t chipVer;
- UINT8 *pMac;
- /****************
- Config the Driver
- *****************/
- WLAN_OS_REPORT(("Initializing Config Manager...\n"));
- if (configCore (pConfigManager, &chipVer) == NOK)
- {
- WLAN_OS_REPORT(("\n.....Configuration manager configuration failure\n"));
- release_module (pConfigManager);
- return;
- }
- pMac = (UINT8 *)chipVer.macAddress.addr;
- os_memoryCopy (pConfigManager->hOs,
- pConfigManager->pMacAddr,
- (void *)pConfigManager->pInitTable->ctrlDataInitParams.ctrlDataDeviceMacAddress.addr,
- MAC_ADDR_LEN);
- pConfigManager->state = CFG_MGR_STATE_IDLE;
- /* Print the driver and firmware version and the mac address */
- WLAN_OS_REPORT(("\n"));
- WLAN_OS_REPORT(("--------------------------------------------------------------------\n"));
- WLAN_OS_REPORT(("Driver Version : %s\n", SW_VERSION_STR));
- WLAN_OS_REPORT(("Firmware Version: %s\n", chipVer.fwVer));
- WLAN_OS_REPORT(("Station ID : %02X-%02X-%02X-%02X-%02X-%02X\n",
- pMac[0], pMac[1], pMac[2], pMac[3], pMac[4], pMac[5]));
- WLAN_OS_REPORT(("--------------------------------------------------------------------\n"));
- WLAN_OS_REPORT(("\n"));
- }
- /************************************************************************
- * configMgr_start *
- ************************************************************************
- DESCRIPTION: Driver start function, called by the OS abstraction layer in
- order to start the driver after creation.
- It enables the ISR and sends a start event to the driver's main state machine
- If the the driver was in IDLE state, it sends a 'WakeUp' command to the chip.
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_start(TI_HANDLE hConfigMgr)
- {
- TI_STATUS status = PARAM_VALUE_NOT_VALID;
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- switch (pConfigManager->state)
- {
- case CFG_MGR_STATE_IDLE :
- pConfigManager->state = CFG_MGR_STATE_RUNNING;
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_IDLE, EVENT_START> --> STATE_RUNNING\n\n"));
- status = smeSm_start(pConfigManager->hSmeSm);
- #ifdef SDIO_INTERRUPT_HANDLING_ON
- whalCtr_SlaveAckMaskNotification(pConfigManager->hHalCtrl);
- #endif
- break;
- case CFG_MGR_STATE_RUNNING :
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("Got start command while not in RUNNING, ignoring the command"));
- break;
- case CFG_MGR_STATE_STOPPED:
- pConfigManager->state = CFG_MGR_STATE_RUNNING;
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_STOPPED, EVENT_START> --> STATE_RUNNING\n\n"));
- status = smeSm_start(pConfigManager->hSmeSm);
- break;
- }
- return status;
- }
- /************************************************************************
- * configMgr_stop *
- ************************************************************************
- DESCRIPTION: Driver stop function, called by the OS abstraction layer in
- order to stop the driver.
- It sends a stop event to the driver main state mmachine
- If the the driver was in RUNNING state, it sends a 'Sleep' command to the chip.
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_stop(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- TI_STATUS status = PARAM_VALUE_NOT_VALID;
-
- switch (pConfigManager->state)
- {
- case CFG_MGR_STATE_IDLE :
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_IDLE, EVENT_STOP> --> STATE_IDLE\n\n"));
- status = STATION_IS_NOT_RUNNING;
- break;
- case CFG_MGR_STATE_RUNNING :
- pConfigManager->state = CFG_MGR_STATE_STOPPED;
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_STOP> --> STATE_STOPPED\n\n"));
- smeSm_stop(pConfigManager->hSmeSm);
- break;
-
- case CFG_MGR_STATE_STOPPED:
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_STOPPED, EVENT_STOP> --> STATE_STOPPED\n\n"));
- status = STATION_IS_NOT_RUNNING;
- break;
- }
- return status;
- }
- /****************************************************************************************
- * configMgr_setParam *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to set a parameter the driver.
- If the parameter can not be set from outside the driver it returns a fialure status
- The parameters is set to the module that uses as its father in the system
- (refer to the file paramOut.h for more explanations)
- If the father returns a RE_SCAN_NEEDED status, it restarts the main
- state machine of the driver.
- INPUT: hConfigMgr - Handle to the driver
- pParam - Pointer to the parameter
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_setParam(TI_HANDLE hConfigMgr, paramInfo_t *pParam)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- TI_STATUS status;
- UINT32 moduleNumber;
- if (pConfigManager->state != CFG_MGR_STATE_RUNNING)
- {
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG, ("State machine error, EVENT_SET_PARAM while in IDLE state \n\n"));
- return STATION_IS_NOT_RUNNING;
- }
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_SET_PARAM> --> STATE_RUNNING\n\n"));
- if (!EXTERNAL_SET_ENABLE(pParam->paramType))
- return EXTERNAL_SET_PARAM_DENIED;
- moduleNumber = GET_PARAM_MODULE_NUMBER(pParam->paramType);
- if (moduleNumber > MAX_PARAM_MODULE_NUMBER)
- return PARAM_MODULE_NUMBER_INVALID;
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("ParamType=0x%x ModuleNumber=0x%x\n\n",pParam->paramType));
- status = pConfigManager->paramAccessTable[moduleNumber - 1].set(pConfigManager->paramAccessTable[moduleNumber - 1].handle, pParam);
-
- if(status == RE_SCAN_NEEDED)
- return smeSm_reselect(pConfigManager->hSmeSm);
- else
- return status;
- }
- /****************************************************************************************
- * configMgr_getParam *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to get a parameter the driver.
- If the parameter can not be get from outside the driver it returns a fialure status
- The parameters is get from the module that uses as its father in the system
- (refer to the file paramOut.h for more explanations)
- INPUT: hConfigMgr - Handle to the driver
- pParam - Pointer to the parameter
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_getParam (TI_HANDLE hConfigMgr, paramInfo_t *pParam)
-
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- UINT32 moduleNumber;
- /* This is a unique parameter, it checks the driver running status, therefore we handle it here. */
- if (pParam->paramType == DRIVER_STATUS_PARAM)
- {
- if (pConfigManager->state == CFG_MGR_STATE_RUNNING)
- pParam->content.driverStatus = DRIVER_STATUS_RUNNING;
- else
- pParam->content.driverStatus = DRIVER_STATUS_IDLE;
- return OK;
- }
- if (pConfigManager->state != CFG_MGR_STATE_RUNNING)
- {
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG, ("State machine error, EVENT_GET_PARAM while in IDLE state \n\n"));
- return STATION_IS_NOT_RUNNING;
- }
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_GET_PARAM> --> STATE_RUNNING\n\n"));
- if (!EXTERNAL_GET_ENABLE(pParam->paramType))
- return EXTERNAL_GET_PARAM_DENIED;
- moduleNumber = GET_PARAM_MODULE_NUMBER(pParam->paramType);
- if (moduleNumber > MAX_PARAM_MODULE_NUMBER)
- return PARAM_MODULE_NUMBER_INVALID;
- return pConfigManager->paramAccessTable[moduleNumber - 1].get(pConfigManager->paramAccessTable[moduleNumber - 1].handle, pParam);
- }
- /****************************************************************************************
- * configMgr_checkTxQueueSize *
- ****************************************************************************************
- DESCRIPTION: Check Tx queue size
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on queue full
- ************************************************************************/
- TI_STATUS configMgr_checkTxQueueSize(TI_HANDLE hConfigMgr,UINT8 qIndex)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- return txData_checkQueueSize(pConfigManager->hTxData, qIndex);
- }
- /****************************************************************************************
- * configMgr_printTxQueues *
- ****************************************************************************************
- DESCRIPTION: Tx queues print
- INPUT: hConfigMgr - Handle to the driver
- ************************************************************************/
- #ifdef TI_DBG
- void configMgr_printTxQueuesAndMemPolls(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- txData_printTxQosCounters(pConfigManager->hTxData);
- txData_fullPrintDataMsduList(pConfigManager->hTxData);
- memMngrPrint(pConfigManager->hMemMgr);
- }
- #endif
- /****************************************************************************************
- * configMgr_sendMsdu *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstract in layer in order to send a MSDU to the wlan network.
- INPUT: hConfigMgr - Handle to the driver
- pMsdu - Pointer to the MSDU
- packet_DTag - NDIS packet user priority tag
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_sendMsdu (TI_HANDLE hConfigMgr,
- mem_MSDU_T *pMsdu,
- UINT8 packet_DTag)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- TI_STATUS status = OK;
- #ifdef TI_DBG
- /* Add time stamp */
- wlan_memMngrAddTimeStamp (pConfigManager->hMemMgr, pMsdu);
- if (pConfigManager->state != CFG_MGR_STATE_RUNNING)
- {
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG, ("State machine error, EVENT_SEND_MSDU while in IDLE state \n\n"));
- return STATION_IS_NOT_RUNNING;
- }
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_SEND_MSDU> --> STATE_RUNNING\n\n"));
- #endif
- WLAN_REPORT_DEBUG_TX(pConfigManager->hReport,("configMgr_sendMsdu Sending packet Lenght\n",pMsdu->dataLen));
- status = txData_sendPktToWlan(pConfigManager->hTxData, pMsdu, packet_DTag);
- return status;
- }
- /****************************************************************************************
- * configMgr_PollApPackets *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to send VAD frame.
- Calls the txData module corresponding function.
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_PollApPackets(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- if (pConfigManager->state != CFG_MGR_STATE_RUNNING)
- {
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG, ("State machine error, EVENT_SEND_MSDU while in IDLE state \n\n"));
- return STATION_IS_NOT_RUNNING;
- }
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_SEND_VAD_FRAME> --> STATE_RUNNING\n\n"));
- return txData_sendVadFrame(pConfigManager->hTxData, POLL_AP_PACKETS_FORCE_PS_POLL);
- }
- /****************************************************************************************
- * configMgr_HandleBusTxn_Complete *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order notify the driver that the DMA has finished
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_HandleBusTxn_Complete(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- whalCtrl_HandleBusTxn_Complete(pConfigManager->hHalCtrl);
- return OK;
- }
- /****************************************************************************************
- * configMgr_handleInterrupts *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order notify the driver that a ISR arrived
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_handleInterrupts(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- return (TI_STATUS)whalCtrl_HandleInterrupts(pConfigManager->hHalCtrl);
- }
- /****************************************************************************************
- * configMgr_enableInterrupts *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to enable interrupts
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_enableInterrupts(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- whalCtrl_EnableInterrupts(pConfigManager->hHalCtrl);
- return OK;
- }
- /****************************************************************************************
- * configMgr_disableInterrupts *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to disable interrupts
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_disableInterrupts(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- whalCtrl_DisableInterrupts(pConfigManager->hHalCtrl);
- return OK;
- }
- /****************************************************************************************
- * configMgr_disableRadio *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to disable Radio
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_disableRadio(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_DISABLE_RADIO> --> STATE_RUNNING\n\n"));
- /* Disable radio command is no longer active, and should be directed to the SME module. */
- /* whalCtrl_DisableRadio(pConfigManager->hHalCtrl); */
- return OK;
- }
- /****************************************************************************************
- * configMgr_checkInterrupts *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to let the driver check if
- the receive interrupt is a driver's ISR.
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- UINT32 configMgr_checkInterrupts(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- return whalCtrl_CheckInterrupts(pConfigManager->hHalCtrl);
- }
- /****************************************************************************************
- * configMgr_ReadMacRegister *
- ****************************************************************************************
- DESCRIPTION: API function for registers read/write
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN:
- ************************************************************************/
- UINT32 configMgr_ReadMacRegister(TI_HANDLE hConfigMgr, UINT32 addr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- return whalCtrlReadMacReg(pConfigManager->hHalCtrl, addr);
- }
- void configMgr_WriteMacRegister(TI_HANDLE hConfigMgr, UINT32 addr, UINT32 val)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- whalCtrlWriteMacReg(pConfigManager->hHalCtrl, addr, val);
- }
- UINT32 configMgr_ReadPhyRegister(TI_HANDLE hConfigMgr, UINT32 addr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- return whalCtrlReadPhyReg(pConfigManager->hHalCtrl, addr);
- }
- void configMgr_WritePhyRegister(TI_HANDLE hConfigMgr, UINT32 addr, UINT32 val)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- whalCtrlWritePhyReg(pConfigManager->hHalCtrl, addr, val);
- }
- /****************************************************************************************
- * configMgr_isCardExist *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to check if the card is inserted.
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- BOOL configMgr_isCardExist(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- if (whalCtrl_isCardIn(pConfigManager->hHalCtrl) == TRUE)
- return TRUE;
- else
- {
- wlan_memMngrFreeAllOsAlocatesBuffer(pConfigManager->hMemMgr);
- return FALSE;
- }
- }
- /****************************************************************************************
- * configMgr_areInputsFromOsDisabled *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstractin layer in order to
- check if Inputs From OS are Disabled.
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: TRUE - recovery is in process,
- FALSE - recovery is not in process
- ************************************************************************/
- BOOL configMgr_areInputsFromOsDisabled(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- return (recoveryMgr_areInputsFromOsDisabled(pConfigManager->hRecoveryMgr));
- }
- /****************************************************************************************
- * configMgr_allocBDs *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction in order to allocate BDs from the memory manager pool.
- Calls the memory manager corresponding function.
- INPUT: hConfigMgr - Handle to the driver
- bdNumber - Number of BDs to allocate
- OUTPUT: bdPtr - Pointer to return the link list of allocated BDs.
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_allocBDs(TI_HANDLE hConfigMgr,
- UINT32 bdNumber,
- mem_BD_T** bdPtr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- TI_STATUS Status;
- #ifdef TI_DBG
- if (pConfigManager->state != CFG_MGR_STATE_RUNNING)
- {
- WLAN_REPORT_ERROR(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG, ("State machine error, EVENT_ALLOC_BDS while in IDLE state \n\n"));
- return STATION_IS_NOT_RUNNING;
- }
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_ALLOC_BDS> --> STATE_RUNNING\n\n"));
- #endif
- Status = wlan_memMngrAllocBDs(pConfigManager->hMemMgr, bdNumber, bdPtr);
- return Status;
- }
- /****************************************************************************************
- * configMgr_allocMSDU *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to allocate a MSDU and its associated
- BDs and data buffers.
- Calls the memory manager corresponding function.
- INPUT: hConfigMgr - Handle to the driver
- len - the length of the required data buffer
- module - The module that requests the allocation.
- OUTPUT: MSDUPtr - Pointer to return he allocated MSDU.
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_allocMSDU(TI_HANDLE hConfigMgr,
- mem_MSDU_T** MSDUPtr,
- UINT32 len,
- allocatingModule_e module)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- #ifdef TI_DBG
- if (pConfigManager->state != CFG_MGR_STATE_RUNNING)
- {
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG, ("State machine error, EVENT_ALLOC_MSDU while in IDLE state \n\n"));
- return STATION_IS_NOT_RUNNING;
- }
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_ALLOC_MSDU> --> STATE_RUNNING\n\n"));
- #endif
- return wlan_memMngrAllocMSDU(pConfigManager->hMemMgr, MSDUPtr, len, OS_ABS_TX_MODULE);
- }
- /****************************************************************************************
- * configMgr_allocMSDUBufferOnly *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to allocate a MSDU only.
- Calls the memory manager corresponding function.
- INPUT: hConfigMgr - Handle to the driver
- module - The module that requests the allocation.
- OUTPUT: MSDUPtr - Pointer to return he allocated MSDU.
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_allocMSDUBufferOnly(TI_HANDLE hConfigMgr,
- mem_MSDU_T** MSDUPtr,
- allocatingModule_e module)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- #ifdef TI_DBG
- if (pConfigManager->state != CFG_MGR_STATE_RUNNING)
- {
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG, ("State machine error, EVENT_ALLOC_MSDU_BUFFER_ONLY while in IDLE state \n\n"));
- return STATION_IS_NOT_RUNNING;
- }
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_ALLOC_MSDU_BUFFER_ONLY> --> STATE_RUNNING\n\n"));
- #endif
- return wlan_memMngrAllocMSDUBufferOnly(pConfigManager->hMemMgr, MSDUPtr, OS_ABS_TX_MODULE);
- }
- /****************************************************************************************
- * configMgr_memMngrFreeMSDU *
- ****************************************************************************************
- DESCRIPTION: Called by the OS abstraction layer in order to free a MSDU.
- Calls the memory manager corresponding function.
- INPUT: hConfigMgr - Handle to the driver
- handle - handle of the MSDU.
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_memMngrFreeMSDU(TI_HANDLE hConfigMgr, UINT32 handle)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- #ifdef TI_DBG
- WLAN_REPORT_SM(pConfigManager->hReport, CONFIG_MGR_MODULE_LOG,
- ("<STATE_RUNNING, EVENT_FREE_MSDU> --> STATE_RUNNING\n\n"));
- #endif
- wlan_memMngrFreeMSDU(pConfigManager->hMemMgr, handle);
- return OK;
- }
- /****************************************************************************************
- * configMgr_unLoad *
- ****************************************************************************************
- DESCRIPTION: Driver unload function
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_unLoad(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- if (!pConfigManager)
- return NOK;
- whalCtrl_Stop(pConfigManager->hHalCtrl);
- WLAN_OS_REPORT(("\nCONFIG_MGR, UNLOAD: ***** DESTROYING THE DRIVER *****\n\n\n"));
- release_module(pConfigManager);
- return OK;
- }
- /****************************************************************************************
- * configMgr_InitiateUnload *
- ****************************************************************************************
- DESCRIPTION: Driver unload function
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_InitiateUnload(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- if (!pConfigManager)
- return NOK;
- smeSm_stopAndShutdown(pConfigManager->hSmeSm);
- WLAN_OS_REPORT(("\nCONFIG_MGR, UNLOAD: ***** DESTROYING THE DRIVER *****\n\n\n"));
- return OK;
- }
- /****************************************************************************************
- * configMgr_UnloadModules *
- ****************************************************************************************
- DESCRIPTION: Driver unload function
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- TI_STATUS configMgr_UnloadModules(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- if (!pConfigManager)
- return NOK;
- release_module(pConfigManager);
- return OK;
- }
- /****************************************************************************************
- * configMgr_DriverShutdownStatus *
- ****************************************************************************************
- DESCRIPTION: return status of driver shutdown process
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: OK on success, NOK on failure
- ************************************************************************/
- UINT8 configMgr_DriverShutdownStatus(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- return smeSm_getDriverShutdownStatus(pConfigManager->hSmeSm);
- }
- /****************************************************************************************
- * configMgr_SlaveAckMaskNotification *
- ****************************************************************************************
- DESCRIPTION:
- INPUT: hConfigMgr - Handle to the driver
- OUTPUT:
- RETURN: void
- ************************************************************************/
- void configMgr_SlaveAckMaskNotification(TI_HANDLE hConfigMgr)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
- whalCtr_SlaveAckMaskNotification(pConfigManager->hHalCtrl);
- }
- /****************************************************************************************
- * configMgr_getPacketHeaderLength *
- ****************************************************************************************
- DESCRIPTION: Called by os to know reserved space for WLAN header.
- INPUT: hConfigMgr - Handle to the driver
- data - pointer to packet
- txFlags - whether this frame is data or management
- OUTPUT:
- RETURN: void
- ************************************************************************/
- UINT32 configMgr_getPacketHeaderLength(TI_HANDLE hConfigMgr,
- void *pData,
- UINT32 txFlags)
- {
- configMgr_t *pConfigManager = (configMgr_t *)hConfigMgr;
-
- /* returns TxDescriptor size + reserved place for the bus txn operation + actual header length */
- return TX_TOTAL_OFFSET_BEFORE_DATA +
- txData_GetWlanHeaderLength (pConfigManager->hTxData, pData, txFlags);
- }
- /****************************************************/
- /* Local Functions Implementations */
- /****************************************************/
- /****************************************************************************************
- * createDriver *
- ****************************************************************************************
- DESCRIPTION: Driver creation function. Performs the following:
- - Calls the create function of each module.
- - Each module returns a handle if successful and NULL otherwise.
- - If the creation of all the modules succeeded, the driver main handle is configured with the
- modules handles. Then the driver main handle is returned to the caller.
- - If one of the modules fails in creation, the function calls the release function of the driver
- and all the modules handles are free, including the driver main handle.
- - Some of the modules are called with an init table as a parameter.
- - The callbacks table is filled with the callbacks returned from the core, in the configuration phase,
- the HAL is configured with those callbacks.
- INPUT: hOs - Handle to the OS
- pInitTable - Pointer to the init table as read from registry
- pCoreCallbacks - Table of core callbacks functions to filled by the CORE
- OUTPUT: Main Handle to the driver.
- RETURN: Handle to the driver on success, NOK on failure
- ************************************************************************/
- static configMgr_t *createDriver(TI_HANDLE hOs, void *pWLAN_Images, initTable_t *pInitTable)
- {
- configMgr_t *pConfigManager;
-
- /************************
- Create the Config Manager
- *************************/
- pConfigManager = os_memoryAlloc(hOs, sizeof(configMgr_t));
- if (pConfigManager == NULL)
- {
- return NULL;
- }
- os_memoryZero (hOs, pConfigManager, sizeof(configMgr_t));
- pConfigManager->hOs = hOs;
- /**************************
- Create all the CORE modules
- ***************************/
- if (createCore (pConfigManager ,hOs, pInitTable) != OK)
- {
- WLAN_OS_REPORT(("\n createCore() Failed!!! \n"));
- release_module(pConfigManager);
- return NULL;
- }
-
- WLAN_INIT_REPORT(("\n createDriver(): pConfigManager->hOs %x pConfigManager->hMemMgr %x!!! :\n\n",pConfigManager->hOs,pConfigManager->hMemMgr));
- /**************************
- Configure the Report module
- ***************************/
- if (report_config(pConfigManager->hReport, hOs, &pInitTable->TnetwDrv_InitParams.reportParams) != OK)
- {
- WLAN_OS_REPORT(("\n Report configuration failure \n"));
- release_module(pConfigManager);
- return NULL;
- }
- /**********************
- Create the TNETW Driver
- ***********************/
- pConfigManager->hTnetwDrv = TnetwDrv_Create(hOs);
- if (pConfigManager->hTnetwDrv == NULL)
- {
- WLAN_OS_REPORT(("\n createDriver() !!! TnetwDrv_Create failed !!! \n"));
- release_module(pConfigManager);
- return NULL;
- }
- WLAN_INIT_REPORT(("\n createDriver(): pConfigManager %x pConfigManager->hTnetwDrv %x!!! :\n\n",pConfigManager,pConfigManager->hTnetwDrv));
- /***************************************************************
- TEMPORARY!! - get TNETW-Driver internal modules handles untill
- the new TNETW-Driver architecture is completed!!
- ****************************************************************/
- TnetwDrv_TEMP_GetHandles (pConfigManager->hTnetwDrv,
- &pConfigManager->hHalCtrl,
- &pConfigManager->hMacServices);
-
- WLAN_INIT_REPORT(("\nCONFIG_MGR, INIT: ***** CREATION SUCCESS *****\n\n\n"));
-
- return pConfigManager;
- }
- /****************************************************************************************
- * createCore *
- ****************************************************************************************
- DESCRIPTION: Called by the CreateDriver to
- - Create the CORE modules
- - Create the CORE Adapter module
- - Config the CORE Adapter module by giving it CORE callbacks
- INPUT: TI_HANDLE hOs - Handle to OS
- initTable_t *pInitTable - pointer to the Init table filled by the registry
- coreCallbacks_t *pCoreCallbacks - pointer to the CORE callbacks to be used by each module to fll it (Scan,CtrlData ..)
- OUTPUT: TI_STATUS - OK on success else NOK
- RETURN: void
- ************************************************************************/
- static int createCore(configMgr_t *pConfigManager, TI_HANDLE hOs, initTable_t *pInitTable)
- {
- /* Report module */
- pConfigManager->hReport = report_create(hOs);
- if (pConfigManager->hReport == NULL)
- {
- return NOK;
- }
- /* SCR module */
- pConfigManager->hSCR = scr_create(hOs);
- if (pConfigManager->hSCR == NULL)
- {
- return NOK;
- }
- /* Event Handler module */
- pConfigManager->hEvHandler = EvHandlerInit(hOs);
- if (pConfigManager->hEvHandler == NULL)
- {
- return NOK;
- }
- /* Connection module */
- pConfigManager->hConn = conn_create(hOs);
- if (pConfigManager->hConn == NULL)
- {
- return NOK;
- }
- /* Scan Concentrator module */
- pConfigManager->hScanCncn = scanConcentrator_create(hOs);
- if (pConfigManager->hScanCncn == NULL)
- {
- return NOK;
- }
- /* SME state machine module */
- pConfigManager->hSmeSm = smeSm_create(hOs);
- if (pConfigManager->hSmeSm == NULL)
- {
- return NOK;
- }
- /* Site manager module */
- pConfigManager->hSiteMgr = siteMgr_create(hOs);
- if (pConfigManager->hSiteMgr == NULL)
- {
- return NOK;
- }
- /* MLME SM module */
- pConfigManager->hMlmeSm = mlme_create(hOs);
- if (pConfigManager->hMlmeSm == NULL)
- {
- return NOK;
- }
- /* AUTH module */
- pConfigManager->hAuth = auth_create(hOs);
- if (pConfigManager->hAuth == NULL)
- {
- return NOK;
- }
- /* ASSOC module */
- pConfigManager->hAssoc = assoc_create(hOs);
- if (pConfigManager->hAssoc == NULL)
- {
- return NOK;
- }
- /* Rx data module */
- pConfigManager->hRxData = rxData_create(hOs);
- if (pConfigManager->hRxData == NULL)
- {
- return NOK;
- }
- /* Tx data module */
- pConfigManager->hTxData = txData_create (&pInitTable->txDataInitParams, hOs);
- if (pConfigManager->hTxData == NULL)
- {
- return NOK;
- }
- /* Ctrl data module */
- pConfigManager->hCtrlData = ctrlData_create(hOs);
- if (pConfigManager->hCtrlData == NULL)
- {
- return NOK;
- }
- /* Traffic Monitor */
- pConfigManager->hTrafficMon = TrafficMonitor_create(hOs);
- if (pConfigManager->hTrafficMon == NULL)
- {
- return NOK;
- }
- /* Memory Manager */
- pConfigManager->hMemMgr = wlan_memMngrInit(hOs);
- if (pConfigManager->hMemMgr == NULL)
- {
- return NOK;
- }
- /* RSN create code */
- pConfigManager->hRsn = rsn_create(hOs);
- if (pConfigManager->hRsn == NULL)
- {
- return NOK;
- }
- /* Regulatory Domain module */
- pConfigManager->hRegulatoryDomain = regulatoryDomain_create(hOs);
- if (pConfigManager->hRegulatoryDomain == NULL)
- {
- return NOK;
- }
- /* MeasurementMgr module */
- pConfigManager->hMeasurementMgr = measurementMgr_create(hOs);
- if (pConfigManager->hMeasurementMgr == NULL)
- {
- return NOK;
- }
- /* Soft Gemini module */
- pConfigManager->hSoftGemini = SoftGemini_create(hOs);
- if (pConfigManager->hSoftGemini == NULL)
- {
- return NOK;
- }
- #ifdef EXC_MODULE_INCLUDED
- pConfigManager->hExcMngr = excMngr_create(hOs);
- if (pConfigManager->hExcMngr == NULL)
- {
- return NOK;
- }
- #else
- pConfigManager->hExcMngr = NULL;
- #endif
- pConfigManager->hRoamingMngr = roamingMngr_create(hOs);
- if (pConfi…
Large files files are truncated, but you can click here to view the full file