/* * \brief Configure the CmdMbox object * * \param hCmdMbox - Handle to CmdMbox * \param hReport - Handle to report module * \param hTwIf - Handle to TwIf * \param hTimer - Handle to os timer * \param hCmdQueue - Handle to CmdQueue * \param fErrorCb - Handle to error handling function * \return TI_OK on success or TI_NOK on failure * * \par Description * * \sa */ TI_STATUS cmdMbox_Init (TI_HANDLE hCmdMbox, TI_HANDLE hReport, TI_HANDLE hTwIf, TI_HANDLE hTimer, TI_HANDLE hCmdQueue, TCmdMboxErrorCb fErrorCb) { TCmdMbox *pCmdMbox = (TCmdMbox *)hCmdMbox; pCmdMbox->hCmdQueue = hCmdQueue; pCmdMbox->hTwIf = hTwIf; pCmdMbox->hReport = hReport; pCmdMbox->uFwAddr = 0; pCmdMbox->uReadLen = 0; pCmdMbox->uWriteLen = 0; pCmdMbox->bCmdInProgress = TI_FALSE; pCmdMbox->fErrorCb = fErrorCb; /* allocate OS timer memory */ pCmdMbox->hCmdMboxTimer = tmr_CreateTimer (hTimer); if (pCmdMbox->hCmdMboxTimer == NULL) { return TI_NOK; } return TI_OK; }
TI_STATUS conn_SetDefaults (TI_HANDLE hConn, connInitParams_t *pConnInitParams) { conn_t *pConn = (conn_t *)hConn; pConn->timeout = pConnInitParams->connSelfTimeout; pConn->connType = CONN_TYPE_FIRST_CONN; pConn->ibssDisconnectCount = 0; /* allocate OS timer memory */ pConn->hConnTimer = tmr_CreateTimer (pConn->hTimer); if (pConn->hConnTimer == NULL) { TRACE0(pConn->hReport, REPORT_SEVERITY_ERROR, "conn_SetDefaults(): Failed to create hConnTimer!\n"); release_module (pConn); return TI_NOK; } TWD_RegisterEvent (pConn->hTWD, TWD_OWN_EVENT_JOIN_CMPLT, (void *)connInfra_JoinCmpltNotification, pConn); TWD_EnableEvent (pConn->hTWD, TWD_OWN_EVENT_JOIN_CMPLT); /* Register for 'TWD_OWN_EVENT_DISCONNECT_COMPLETE' event */ TWD_RegisterEvent (pConn->hTWD, TWD_OWN_EVENT_DISCONNECT_COMPLETE, (void *)conn_DisconnectComplete, pConn); TWD_EnableEvent (pConn->hTWD, TWD_OWN_EVENT_DISCONNECT_COMPLETE); return TI_OK; }
/** * \fn RxQueue_Init() * \brief Init required handles * * Init required handles and module variables. * * \note * \param hRxQueue - The module object * \param hReport - Report module Handles * \return TI_OK on success or TI_NOK on failure * \sa */ TI_STATUS RxQueue_Init (TI_HANDLE hRxQueue, TI_HANDLE hReport, TI_HANDLE hTimerModule) { TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; pRxQueue->hReport = hReport; pRxQueue->hTimer = tmr_CreateTimer (hTimerModule); return TI_OK; }
void TrafficMonitor_Init (TStadHandlesList *pStadHandles, TI_UINT32 BWwindowMs) { TrafficMonitor_t *TrafficMonitor = (TrafficMonitor_t *)(pStadHandles->hTrafficMon); TI_UINT32 uCurrTS = os_timeStampMs (TrafficMonitor->hOs); /* Create the base threshold timer that will serve all the down thresholds*/ TrafficMonitor->hTrafficMonTimer = tmr_CreateTimer (pStadHandles->hTimer); TrafficMonitor->Active = TI_FALSE; TrafficMonitor->hRxData = pStadHandles->hRxData; TrafficMonitor->hTxCtrl = pStadHandles->hTxCtrl; TrafficMonitor->hTimer = pStadHandles->hTimer; /*Init All the bandwidth elements in the system */ os_memoryZero(TrafficMonitor->hOs,&TrafficMonitor->DirectTxFrameBW,sizeof(BandWidth_t)); os_memoryZero(TrafficMonitor->hOs,&TrafficMonitor->DirectRxFrameBW,sizeof(BandWidth_t)); TrafficMonitor->DirectRxFrameBW.auFirstEventsTS[0] = uCurrTS; TrafficMonitor->DirectTxFrameBW.auFirstEventsTS[0] = uCurrTS; /*Registering to the RX module for notification.*/ TrafficMonitor->RxRegReqHandle = rxData_RegNotif (pStadHandles->hRxData, DIRECTED_FRAMES_RECV, TrafficMonitor_Event, TrafficMonitor, RX_TRAFF_MODULE); /*Registering to the TX module for notification .*/ TrafficMonitor->TxRegReqHandle = txCtrlParams_RegNotif (pStadHandles->hTxCtrl, DIRECTED_FRAMES_XFER, TrafficMonitor_Event, TrafficMonitor, TX_TRAFF_MODULE); TrafficMonitor->DownTimerEnabled = TI_FALSE; TrafficMonitor->trafficDownTestIntervalPercent = MIN_INTERVAL_PERCENT; #ifdef TRAFF_TEST TestTrafficMonitor = TrafficMonitor; TestEventTimer = tmr_CreateTimer (pStadHandles->hTimer); tmr_StartTimer (TestEventTimer, TestEventFunc, (TI_HANDLE)TrafficMonitor, 5000, TI_TRUE); #endif }
void pwrState_Init (TStadHandlesList *pStadHandles) { TPwrState *pPwrState = (TPwrState*) pStadHandles->hPwrState; pPwrState->hReport = pStadHandles->hReport; pPwrState->hDrvMain = pStadHandles->hDrvMain; pPwrState->hScanCncn = pStadHandles->hScanCncn; pPwrState->hSme = pStadHandles->hSme; pPwrState->hMeasurementMgr = pStadHandles->hMeasurementMgr; pPwrState->hPowerMgr = pStadHandles->hPowerMgr; pPwrState->hTimer = pStadHandles->hTimer; pPwrState->hTWD = pStadHandles->hTWD; pPwrState->tCurrentTransition.hCompleteTimer = tmr_CreateTimer(pPwrState->hTimer); pPwrState->hDozeTimer = tmr_CreateTimer(pPwrState->hTimer); pPwrState->fCurrentState = state_Initial; pPwrState->fCurrentState(pPwrState, PWRSTATE_EVNT_CREATE); }
TI_STATUS measurementMgr_SetDefaults (TI_HANDLE hMeasurementMgr, measurementInitParams_t * pMeasurementInitParams) { measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) hMeasurementMgr; #ifdef XCC_MODULE_INCLUDED TI_UINT32 currAC; #endif pMeasurementMgr->trafficIntensityThreshold = pMeasurementInitParams->trafficIntensityThreshold; pMeasurementMgr->maxDurationOnNonServingChannel = pMeasurementInitParams->maxDurationOnNonServingChannel; /* allocating the measurement Activation Delay timer */ pMeasurementMgr->hActivationDelayTimer = tmr_CreateTimer (pMeasurementMgr->hTimer); if (pMeasurementMgr->hActivationDelayTimer == NULL) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_ERROR, "measurementMgr_SetDefaults(): Failed to create hActivationDelayTimer!\n"); return TI_NOK; } #ifdef XCC_MODULE_INCLUDED /* allocating the per AC TS Metrics report timers */ for (currAC = 0; currAC < MAX_NUM_OF_AC; currAC++) { pMeasurementMgr->isTsMetricsEnabled[currAC] = TI_FALSE; pMeasurementMgr->hTsMetricsReportTimer[currAC] = tmr_CreateTimer (pMeasurementMgr->hTimer); if (pMeasurementMgr->hTsMetricsReportTimer[currAC] == NULL) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_ERROR, "measurementMgr_SetDefaults(): Failed to create hTsMetricsReportTimer!\n"); return TI_NOK; } } /* Check in the Registry if the station supports XCC RM */ if (pMeasurementInitParams->XCCEnabled == XCC_MODE_ENABLED) { pMeasurementMgr->Capabilities |= MEASUREMENT_CAPABILITIES_XCC_RM; } #endif return TI_OK; }
/** * \fn RxQueue_Init() * \brief Init required handles * * Init required handles and module variables. * * \note * \param hRxQueue - The module object * \param hReport - Report module Handles * \return TI_OK on success or TI_NOK on failure * \sa */ TI_STATUS RxQueue_Init (TI_HANDLE hRxQueue, TI_HANDLE hReport, TI_HANDLE hTimerModule) { TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; TI_UINT8 uTid; pRxQueue->hReport = hReport; pRxQueue->hMissingPktTimer = tmr_CreateTimer (hTimerModule); pRxQueue->uMissingPktTimerClient = TID_CLIENT_NONE; for (uTid = 0; uTid < MAX_NUM_OF_802_1d_TAGS; uTid++) { pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uTid].uMissingPktTimeStamp = 0xffffffff; } return TI_OK; }
TI_STATUS assoc_SetDefaults (TI_HANDLE hAssoc, assocInitParams_t *pAssocInitParams) { assoc_t *pHandle = (assoc_t*)hAssoc; pHandle->timeout = pAssocInitParams->assocResponseTimeout; pHandle->maxCount = pAssocInitParams->assocMaxRetryCount; /* allocate OS timer memory */ pHandle->hAssocSmTimer = tmr_CreateTimer (pHandle->hTimer); if (pHandle->hAssocSmTimer == NULL) { TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "assoc_SetDefaults(): Failed to create hAssocSmTimer!\n"); return TI_NOK; } return TI_OK; }
/** * \fn healthMonitor_SetDefaults * \brief Set module defaults and create timers * * Set module defaults from Ini-file and create timers. * * \note * \param hHealthMonitor - The module's handle * \param healthMonitorInitParams - The module's parameters default values (from Ini-file). * \return void * \sa */ TI_STATUS healthMonitor_SetDefaults (TI_HANDLE hHealthMonitor, healthMonitorInitParams_t *healthMonitorInitParams) { THealthMonitor *pHealthMonitor = hHealthMonitor; int i; /* Registry configuration */ pHealthMonitor->bFullRecoveryEnable = healthMonitorInitParams->FullRecoveryEnable; for (i = 0; i < MAX_FAILURE_EVENTS; i++) { pHealthMonitor->recoveryTriggerEnabled[i] = healthMonitorInitParams->recoveryTriggerEnabled[i]; } /* Create recovery request timer */ pHealthMonitor->hFailTimer = tmr_CreateTimer (pHealthMonitor->hTimer); if (pHealthMonitor->hFailTimer == NULL) { TRACE0(pHealthMonitor->hReport, REPORT_SEVERITY_ERROR, "healthMonitor_SetDefaults(): Failed to create hFailTimer!\n"); return TI_NOK; } return TI_OK; }
TI_STATUS auth_SetDefaults (TI_HANDLE hAuth, authInitParams_t *pAuthInitParams) { auth_t *pHandle = (TI_HANDLE) hAuth; pHandle->timeout = pAuthInitParams->authResponseTimeout; pHandle->maxCount = pAuthInitParams->authMaxRetryCount; pHandle->retryCount = 0; pHandle->authRejectCount = 0; pHandle->authTimeoutCount = 0; pHandle->authType = AUTH_LEGACY_NONE; /* allocate OS timer memory */ pHandle->hAuthSmTimer = tmr_CreateTimer (pHandle->hTimer); if (pHandle->hAuthSmTimer == NULL) { return TI_NOK; } return TI_OK; }
TI_STATUS auth_SetDefaults (TI_HANDLE hAuth, authInitParams_t *pAuthInitParams) { auth_t *pHandle = (TI_HANDLE) hAuth; pHandle->timeout = pAuthInitParams->authResponseTimeout; pHandle->maxCount = pAuthInitParams->authMaxRetryCount; pHandle->retryCount = 0; pHandle->authRejectCount = 0; pHandle->authTimeoutCount = 0; pHandle->authType = AUTH_LEGACY_NONE; /* allocate OS timer memory */ pHandle->hAuthSmTimer = tmr_CreateTimer (pHandle->hTimer); if (pHandle->hAuthSmTimer == NULL) { TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "auth_SetDefaults(): Failed to create hAuthSmTimer!\n"); return TI_NOK; } return TI_OK; }
void mlme_SetDefaults (TI_HANDLE hMlme, TMlmeInitParams *pMlmeInitParams) { mlme_t *pMlme = (mlme_t *)(hMlme); /* set default values */ pMlme->bParseBeaconWSC = pMlmeInitParams->parseWSCInBeacons; pMlme->authInfo.timeout = pMlmeInitParams->authResponseTimeout; pMlme->authInfo.maxCount = pMlmeInitParams->authMaxRetryCount; pMlme->assocInfo.timeout = pMlmeInitParams->assocResponseTimeout; pMlme->assocInfo.maxCount = pMlmeInitParams->assocMaxRetryCount; pMlme->hMlmeTimer = tmr_CreateTimer (pMlme->hTimer); if (NULL == pMlme->hMlmeTimer) { WLAN_OS_REPORT (("mlme_Create: unable to create MLME timer. MLME creation failed\n")); return; } /* Initialize the MLME state-machine */ genSM_SetDefaults (pMlme->hMlmeSm, MLME_SM_NUMBER_OF_STATES, MLME_SM_NUMBER_OF_EVENTS, (TGenSM_matrix)mlmeMatrix, MLME_SM_STATE_IDLE, "MLME SM", uMlmeStateDescription, uMlmeEventDescription, __FILE_ID__); }
TI_STATUS measurementMgr_SetDefaults (TI_HANDLE hMeasurementMgr, measurementInitParams_t * pMeasurementInitParams) { measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) hMeasurementMgr; pMeasurementMgr->trafficIntensityThreshold = pMeasurementInitParams->trafficIntensityThreshold; pMeasurementMgr->maxDurationOnNonServingChannel = pMeasurementInitParams->maxDurationOnNonServingChannel; /* allocating the measurement Activation Delay timer */ pMeasurementMgr->hActivationDelayTimer = tmr_CreateTimer (pMeasurementMgr->hTimer); if (pMeasurementMgr->hActivationDelayTimer == NULL) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_ERROR, "measurementMgr_SetDefaults(): Failed to create hActivationDelayTimer!\n"); return TI_NOK; } if (pMeasurementInitParams->rrmEnabled == TI_TRUE) { pMeasurementMgr->Capabilities |= MEASUREMENT_CAPABILITIES_RRM; } return TI_OK; }
/** * \\n * \date 08-November-2005\n * \brief Initializes the measurement SRV object * * Function Scope \e Public.\n * \param hMeasurementSRV - handle to the measurement SRV object.\n * \param hReport - handle to the report object.\n * \param hCmdBld - handle to the Command Builder object.\n * \param hPowerSaveSRV - handle to the power save SRV object.\n */ TI_STATUS MacServices_measurementSRV_init (TI_HANDLE hMeasurementSRV, TI_HANDLE hReport, TI_HANDLE hCmdBld, TI_HANDLE hEventMbox, TI_HANDLE hPowerSaveSRV, TI_HANDLE hTimer) { measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV; TI_INT32 i; /* store handles */ pMeasurementSRV->hReport = hReport; pMeasurementSRV->hCmdBld = hCmdBld; pMeasurementSRV->hEventMbox = hEventMbox; pMeasurementSRV->hPowerSaveSRV = hPowerSaveSRV; pMeasurementSRV->hTimer = hTimer; /* Initialize the state machine */ measurementSRVSM_init (hMeasurementSRV); /* allocate the module timers */ pMeasurementSRV->hStartStopTimer = tmr_CreateTimer (pMeasurementSRV->hTimer); if (pMeasurementSRV->hStartStopTimer == NULL) { return TI_NOK; } pMeasurementSRV->bStartStopTimerRunning = TI_FALSE; for (i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++) { pMeasurementSRV->hRequestTimer[i] = tmr_CreateTimer (pMeasurementSRV->hTimer); if (pMeasurementSRV->hRequestTimer[i] == NULL) { return TI_NOK; } pMeasurementSRV->bRequestTimerRunning[i] = TI_FALSE; } /* register HAL callbacks */ /* Register and Enable the Measure Start event in HAL */ eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_START, (void *)MacServices_measurementSRV_measureStartCB, hMeasurementSRV); eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_START, NULL, NULL); /* Register and Enable the Measurement Complete event in HAL. This event will be received when the Measurement duration expired, or after Stop Measure command. */ eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_COMPLETE, (void *)MacServices_measurementSRV_measureCompleteCB, hMeasurementSRV); eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_COMPLETE, NULL, NULL); /* Register and Enable the AP Discovery Complete event in HAL */ eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_AP_DISCOVERY_COMPLETE, (void *)MacServices_measurementSRV_apDiscoveryCompleteCB, hMeasurementSRV); eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_AP_DISCOVERY_COMPLETE, NULL, NULL); return TI_OK; }
/** * * admCtrl_config * * \b Description: * * Configure the admission control module. * * \b ARGS: * * I - role - admission cotrol role (AP or Station) \n * I - authSuite - authentication suite to work with \n * * \b RETURNS: * * TI_OK on success, TI_NOK on failure. * * \sa */ TI_STATUS admCtrl_config (TI_HANDLE hAdmCtrl, TI_HANDLE hMlme, TI_HANDLE hRx, TI_HANDLE hReport, TI_HANDLE hOs, struct _rsn_t *pRsn, TI_HANDLE hXCCMngr, TI_HANDLE hPowerMgr, TI_HANDLE hEvHandler, TI_HANDLE hTimer, TI_HANDLE hCurrBss, TRsnInitParams *pInitParam) { admCtrl_t *pAdmCtrl; TI_STATUS status; if (hAdmCtrl == NULL) { return TI_NOK; } pAdmCtrl = (admCtrl_t*)hAdmCtrl; pAdmCtrl->pRsn = pRsn; pAdmCtrl->hMlme = hMlme; pAdmCtrl->hRx = hRx; pAdmCtrl->hReport = hReport; pAdmCtrl->hOs = hOs; pAdmCtrl->hXCCMngr = hXCCMngr; pAdmCtrl->hPowerMgr = hPowerMgr; pAdmCtrl->hEvHandler = hEvHandler; pAdmCtrl->hTimer = hTimer; pAdmCtrl->hCurrBss = hCurrBss; /* Initialize admission control parameters */ pAdmCtrl->role = RSN_PAE_SUPP; pAdmCtrl->networkMode = RSN_INFRASTRUCTURE; pAdmCtrl->authSuite = pInitParam->authSuite; pAdmCtrl->externalAuthMode = pInitParam->externalAuthMode; pAdmCtrl->mixedMode = pInitParam->mixedMode; if (pInitParam->privacyOn) { pAdmCtrl->broadcastSuite = TWD_CIPHER_WEP; pAdmCtrl->unicastSuite = TWD_CIPHER_WEP; } else { pAdmCtrl->broadcastSuite = TWD_CIPHER_NONE; pAdmCtrl->unicastSuite = TWD_CIPHER_NONE; } pAdmCtrl->preAuthSupport = pInitParam->preAuthSupport; pAdmCtrl->preAuthTimeout = pInitParam->preAuthTimeout; pAdmCtrl->WPAMixedModeEnable = pInitParam->WPAMixedModeEnable; /*pAdmCtrl->PMKIDCandListDelay = pInitParam->PMKIDCandListDelay;*/ pAdmCtrl->MaxNumOfPMKIDs = PMKID_MAX_NUMBER; /* Initialize admission control member functions */ pAdmCtrl->setAuthSuite = admCtrl_setAuthSuite; pAdmCtrl->setNetworkMode = admCtrl_setNetworkMode; pAdmCtrl->getAuthSuite = admCtrl_getAuthSuite; pAdmCtrl->setExtAuthMode = admCtrl_setExtAuthMode; pAdmCtrl->getExtAuthMode = admCtrl_getExtAuthMode; pAdmCtrl->setUcastSuite = admCtrl_setUcastSuite; pAdmCtrl->setBcastSuite = admCtrl_setBcastSuite; pAdmCtrl->getCipherSuite = admCtrl_getCipherSuite; pAdmCtrl->setKeyMngSuite = admCtrl_setKeyMngSuite; pAdmCtrl->getMixedMode = admCtrl_getMixedMode; pAdmCtrl->setMixedMode = admCtrl_setMixedMode; pAdmCtrl->getAuthEncrCap = admCtrl_getAuthEncrCapability; pAdmCtrl->getPmkidList = admCtrl_nullGetPMKIDlist; pAdmCtrl->setPmkidList = admCtrl_nullSetPMKIDlist; pAdmCtrl->resetPmkidList = admCtrl_resetPMKIDlist; pAdmCtrl->getPromoteFlags = admCtrl_getPromoteFlags; pAdmCtrl->setPromoteFlags = admCtrl_setPromoteFlags; pAdmCtrl->getWPAMixedModeSupport = admCtrl_getWPAMixedModeSupport; #ifdef XCC_MODULE_INCLUDED pAdmCtrl->setNetworkEap = admCtrl_setNetworkEap; pAdmCtrl->getNetworkEap = admCtrl_getNetworkEap; pAdmCtrl->networkEapMode = OS_XCC_NETWORK_EAP_OFF; #endif pAdmCtrl->getPreAuthStatus = admCtrl_nullGetPreAuthStatus; pAdmCtrl->startPreAuth = admCtrl_nullStartPreAuth; pAdmCtrl->get802_1x_AkmExists = admCtrl_nullGet802_1x_AkmExists; /* Zero number of sent wpa2 preauthentication candidates */ pAdmCtrl->numberOfPreAuthCandidates = 0; /* Create hPreAuthTimerWpa2 timer */ pAdmCtrl->hPreAuthTimerWpa2 = tmr_CreateTimer (pAdmCtrl->hTimer); if (pAdmCtrl->hPreAuthTimerWpa2 == NULL) { TRACE0(pAdmCtrl->hReport, REPORT_SEVERITY_ERROR , "admCtrl_config(): Failed to create hPreAuthTimerWpa2!\n"); } status = admCtrl_subConfig(pAdmCtrl); return status; }
/** * * mainKeys_config * * \b Description: * * Init main security state machine state machine * * \b ARGS: * * none * * \b RETURNS: * * TI_OK on success, TI_NOK otherwise. * * \sa */ TI_STATUS mainKeys_config (mainKeys_t *pMainKeys, TRsnPaeConfig *pPaeConfig, void *pParent, TI_HANDLE hReport, TI_HANDLE hOs, TI_HANDLE hCtrlData, TI_HANDLE hEvHandler, TI_HANDLE hConn, TI_HANDLE hRsn, TI_HANDLE hTimer) { TI_STATUS status; /** Main key State Machine matrix */ fsm_actionCell_t mainKeysSM_matrix[MAIN_KEYS_NUM_STATES][MAIN_KEYS_NUM_EVENTS] = { /* next state and actions for IDLE state */ { {MAIN_KEYS_STATE_START, (fsm_Action_t)mainKeys_startIdle}, {MAIN_KEYS_STATE_IDLE, (fsm_Action_t)mainKeySmNop}, {MAIN_KEYS_STATE_IDLE, (fsm_Action_t)mainKeySmUnexpected}, {MAIN_KEYS_STATE_IDLE, (fsm_Action_t)mainKeySmUnexpected}, {MAIN_KEYS_STATE_IDLE, (fsm_Action_t)mainKeySmUnexpected} }, /* next state and actions for START state */ { {MAIN_KEYS_STATE_START, (fsm_Action_t)mainKeySmUnexpected}, {MAIN_KEYS_STATE_IDLE, (fsm_Action_t)mainKeys_stopStart}, {MAIN_KEYS_STATE_UNICAST_COMPLETE, (fsm_Action_t)mainKeySmNop}, {MAIN_KEYS_STATE_BROADCAST_COMPLETE, (fsm_Action_t)mainKeySmNop}, {MAIN_KEYS_STATE_START, (fsm_Action_t)mainKeys_smTimeOut} }, /* next state and actions for UNICAST COMPLETE state */ { {MAIN_KEYS_STATE_UNICAST_COMPLETE, (fsm_Action_t)mainKeySmUnexpected}, {MAIN_KEYS_STATE_IDLE, (fsm_Action_t)mainKeys_stopUcastComplete}, {MAIN_KEYS_STATE_UNICAST_COMPLETE, (fsm_Action_t)mainKeySmNop}, {MAIN_KEYS_STATE_COMPLETE, (fsm_Action_t)mainKeys_bcastCompleteUcastComplete}, {MAIN_KEYS_STATE_UNICAST_COMPLETE, (fsm_Action_t)mainKeys_smTimeOut} }, /* next state and actions for BROADCAST COMPLETE state */ { {MAIN_KEYS_STATE_BROADCAST_COMPLETE, (fsm_Action_t)mainKeySmUnexpected}, {MAIN_KEYS_STATE_IDLE, (fsm_Action_t)mainKeys_stopBcastComplete}, {MAIN_KEYS_STATE_COMPLETE, (fsm_Action_t)mainKeys_ucastCompleteBcastComplete}, {MAIN_KEYS_STATE_BROADCAST_COMPLETE, (fsm_Action_t)mainKeySmNop}, {MAIN_KEYS_STATE_BROADCAST_COMPLETE, (fsm_Action_t)mainKeys_smTimeOut} }, /* next state and actions for COMPLETE state */ { {MAIN_KEYS_STATE_COMPLETE, (fsm_Action_t)mainKeySmUnexpected}, {MAIN_KEYS_STATE_IDLE, (fsm_Action_t)mainKeys_stopComplete}, {MAIN_KEYS_STATE_COMPLETE, (fsm_Action_t)mainKeySmNop}, {MAIN_KEYS_STATE_COMPLETE, (fsm_Action_t)mainKeySmNop}, {MAIN_KEYS_STATE_COMPLETE, (fsm_Action_t)mainKeySmUnexpected} } }; pMainKeys->hCtrlData = hCtrlData; pMainKeys->hOs = hOs; pMainKeys->hReport = hReport; pMainKeys->hEvHandler = hEvHandler; pMainKeys->hConn = hConn; pMainKeys->hRsn = hRsn; pMainKeys->hTimer = hTimer; pMainKeys->pParent = pParent; pMainKeys->keysTimeout = MAIN_KEYS_TIMEOUT; pMainKeys->start = mainKeys_start; pMainKeys->stop = mainKeys_stop; pMainKeys->reportUcastStatus = mainKeys_reportUcastStatus; pMainKeys->reportBcastStatus = mainKeys_reportBcastStatus; pMainKeys->setKey = mainKeys_setKey; pMainKeys->removeKey = mainKeys_removeKey; pMainKeys->setDefaultKeyId = mainKeys_setDefaultKeyId; pMainKeys->getSessionKey = mainKeys_getSessionKey; pMainKeys->currentState = MAIN_KEYS_STATE_IDLE; /* allocate OS timer memory */ if (pMainKeys->hSessionTimer == NULL) { pMainKeys->hSessionTimer = tmr_CreateTimer (pMainKeys->hTimer); if (pMainKeys->hSessionTimer == NULL) { return TI_NOK; } } status = fsm_Config(pMainKeys->pMainKeysSm, &mainKeysSM_matrix[0][0], MAIN_KEYS_NUM_STATES, MAIN_KEYS_NUM_EVENTS, NULL, pMainKeys->hOs); if (status != TI_OK) { return status; } status = keyParser_config(pMainKeys->pKeyParser, pPaeConfig, pMainKeys->pUcastSm, pMainKeys->pBcastSm, pMainKeys, hReport, hOs, hCtrlData); if (status != TI_OK) { return status; } status = broadcastKey_config(pMainKeys->pBcastSm, pPaeConfig, pMainKeys, hReport, hOs); if (status != TI_OK) { return status; } status = unicastKey_config(pMainKeys->pUcastSm, pPaeConfig, pMainKeys, hReport, hOs); if (status != TI_OK) { return status; } return TI_OK; }
/** * \fn txDataQ_Init * \brief Save required modules handles * * Save other modules handles. * * \note * \param pStadHandles - The driver modules handles * \return void * \sa */ void txDataQ_Init (TStadHandlesList *pStadHandles) { TTxDataQ *pTxDataQ = (TTxDataQ *)(pStadHandles->hTxDataQ); TI_UINT32 uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode); TI_UINT8 uQueId; TDataLinkQ *pLinkQ; TI_UINT32 uHlid; /* save modules handles */ pTxDataQ->hContext = pStadHandles->hContext; pTxDataQ->hTxCtrl = pStadHandles->hTxCtrl; pTxDataQ->hOs = pStadHandles->hOs; pTxDataQ->hReport = pStadHandles->hReport; pTxDataQ->hTxMgmtQ = pStadHandles->hTxMgmtQ; pTxDataQ->hTWD = pStadHandles->hTWD; /* Configures the Port Default status to Close */ pTxDataQ->bDataPortEnable = TI_FALSE; /* Configures the NextQueId to zero => scheduler will strart from Queue 1*/ pTxDataQ->uNextQueId = 0; pTxDataQ->uNextHlid = 0; /* init the number of the Data queue to be used */ pTxDataQ->uNumQueues = MAX_NUM_OF_AC; /* init the max size of the Data queues */ pTxDataQ->aQueueMaxSize[QOS_AC_BE] = DATA_QUEUE_DEPTH_BE; pTxDataQ->aQueueMaxSize[QOS_AC_BK] = DATA_QUEUE_DEPTH_BK; pTxDataQ->aQueueMaxSize[QOS_AC_VI] = DATA_QUEUE_DEPTH_VI; pTxDataQ->aQueueMaxSize[QOS_AC_VO] = DATA_QUEUE_DEPTH_VO; for (uQueId = 0; uQueId < pTxDataQ->uNumQueues; uQueId++) { pTxDataQ->aTxSendPaceThresh[uQueId] = 1; } /* * init all queues in all links */ for (uHlid = 0; uHlid < WLANLINKS_MAX_LINKS; uHlid++) { pLinkQ = &pTxDataQ->aDataLinkQ[uHlid]; /* Link queues */ pLinkQ->bBusy = TI_FALSE; /* default is not busy */ pLinkQ->bEnabled = TI_FALSE; /* default is not enabled */ /* Create the tx data queues */ for (uQueId = 0; uQueId < pTxDataQ->uNumQueues; uQueId++) { pLinkQ->aQueues[uQueId] = que_Create (pTxDataQ->hOs, pTxDataQ->hReport, pTxDataQ->aQueueMaxSize[uQueId], uNodeHeaderOffset); /* If any Queues' allocation failed, print error, free TxDataQueue module and exit */ if (pLinkQ->aQueues[uQueId] == NULL) { WLAN_OS_REPORT(("Failed to create queue\n")); os_memoryFree (pTxDataQ->hOs, pTxDataQ, sizeof(TTxDataQ)); return; } /* Configure the Queues default values */ pLinkQ->aNetStackQueueStopped[uQueId] = TI_FALSE; } } /* Init busy flag per AC (not also per link) */ for (uQueId = 0; uQueId < pTxDataQ->uNumQueues; uQueId++) { pTxDataQ->aQueueBusy[uQueId] = TI_FALSE; } pTxDataQ->hTxSendPaceTimer = tmr_CreateTimer (pStadHandles->hTimer); if (pTxDataQ->hTxSendPaceTimer == NULL) { return; } /* Register to the context engine and get the client ID */ pTxDataQ->uContextId = context_RegisterClient (pTxDataQ->hContext, txDataQ_RunScheduler, (TI_HANDLE)pTxDataQ, TI_TRUE, "TX_DATA", sizeof("TX_DATA")); }
/** * \fn txDataQ_Init * \brief Save required modules handles * * Save other modules handles. * * \note * \param pStadHandles - The driver modules handles * \return void * \sa */ void txDataQ_Init (TStadHandlesList *pStadHandles) { TTxDataQ *pTxDataQ = (TTxDataQ *)(pStadHandles->hTxDataQ); TI_UINT32 uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode); TI_UINT8 uQueId; /* save modules handles */ pTxDataQ->hContext = pStadHandles->hContext; pTxDataQ->hTxCtrl = pStadHandles->hTxCtrl; pTxDataQ->hOs = pStadHandles->hOs; pTxDataQ->hReport = pStadHandles->hReport; pTxDataQ->hTxMgmtQ = pStadHandles->hTxMgmtQ; pTxDataQ->hTWD = pStadHandles->hTWD; /* Configures the Port Default status to Close */ pTxDataQ->bDataPortEnable = TI_FALSE; /* Configures the LastQueId to zero => scheduler will strart from Queue 1*/ pTxDataQ->uLastQueId = 0; /* init the number of the Data queue to be used */ pTxDataQ->uNumQueues = MAX_NUM_OF_AC; /* init the max size of the Data queues */ pTxDataQ->aQueueMaxSize[QOS_AC_BE] = DATA_QUEUE_DEPTH_BE; pTxDataQ->aQueueMaxSize[QOS_AC_BK] = DATA_QUEUE_DEPTH_BK; pTxDataQ->aQueueMaxSize[QOS_AC_VI] = DATA_QUEUE_DEPTH_VI; pTxDataQ->aQueueMaxSize[QOS_AC_VO] = DATA_QUEUE_DEPTH_VO; /* Create the tx data queues */ for (uQueId = 0; uQueId < pTxDataQ->uNumQueues; uQueId++) { pTxDataQ->aQueues[uQueId] = que_Create (pTxDataQ->hOs, pTxDataQ->hReport, pTxDataQ->aQueueMaxSize[uQueId], uNodeHeaderOffset); /* If any Queues' allocation failed, print error, free TxDataQueue module and exit */ if (pTxDataQ->aQueues[uQueId] == NULL) { TRACE0(pTxDataQ->hReport, REPORT_SEVERITY_CONSOLE , "Failed to create queue\n"); WLAN_OS_REPORT(("Failed to create queue\n")); os_memoryFree (pTxDataQ->hOs, pTxDataQ, sizeof(TTxDataQ)); return; } /* Configure the Queues default values */ pTxDataQ->aQueueBusy[uQueId] = TI_FALSE; pTxDataQ->aNetStackQueueStopped[uQueId] = TI_FALSE; pTxDataQ->aTxSendPaceThresh[uQueId] = 1; } pTxDataQ->hTxSendPaceTimer = tmr_CreateTimer (pStadHandles->hTimer); if (pTxDataQ->hTxSendPaceTimer == NULL) { TRACE0(pTxDataQ->hReport, REPORT_SEVERITY_ERROR, "txDataQ_Init(): Failed to create hTxSendPaceTimer!\n"); return; } /* Register to the context engine and get the client ID */ pTxDataQ->uContextId = context_RegisterClient (pTxDataQ->hContext, txDataQ_RunScheduler, (TI_HANDLE)pTxDataQ, TI_TRUE, "TX_DATA", sizeof("TX_DATA")); }
/** * \fn twIf_Init * \brief Init module * * - Init required handles and module variables * - Create the TxnDone-queue * - Register to TxnQ * - Register to context module * * \note * \param hTwIf - The module's object * \param hXxx - Handles to other modules * \param fRecoveryCb - Callback function for recovery completed after TxnDone * \param hRecoveryCb - Handle for fRecoveryCb * \return void * \sa */ void twIf_Init(TI_HANDLE hTwIf, TI_HANDLE hReport, TI_HANDLE hContext, TI_HANDLE hTimer, TI_HANDLE hTxnQ, TRecoveryCb fRecoveryCb, TI_HANDLE hRecoveryCb) { TTwIfObj *pTwIf = (TTwIfObj *) hTwIf; TI_UINT32 uNodeHeaderOffset; TTxnStruct *pTxnHdr; /* The ELP transactions header (as used in the TxnQ API) */ pTwIf->hReport = hReport; pTwIf->hContext = hContext; pTwIf->hTimer = hTimer; pTwIf->hTxnQ = hTxnQ; pTwIf->fRecoveryCb = fRecoveryCb; pTwIf->hRecoveryCb = hRecoveryCb; /* Prepare ELP sleep transaction */ pTwIf->tElpTxnSleep.uElpData = ELP_CTRL_REG_SLEEP; pTxnHdr = &(pTwIf->tElpTxnSleep.tHdr); TXN_PARAM_SET(pTxnHdr, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR) TXN_PARAM_SET_MORE(pTxnHdr, 0); /* Sleep is the last transaction! */ /* NOTE: Function id for single step will be replaced to 0 by the bus driver */ TXN_PARAM_SET_SINGLE_STEP(pTxnHdr, 1); /* ELP write is always single step (TxnQ is topped)! */ BUILD_TTxnStruct(pTxnHdr, ELP_CTRL_REG_ADDR, &(pTwIf->tElpTxnSleep.uElpData), sizeof(TI_UINT8), NULL, NULL) /* Prepare ELP awake transaction */ pTwIf->tElpTxnAwake.uElpData = ELP_CTRL_REG_AWAKE; pTxnHdr = &(pTwIf->tElpTxnAwake.tHdr); TXN_PARAM_SET(pTxnHdr, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR) TXN_PARAM_SET_MORE(pTxnHdr, 1); /* NOTE: Function id for single step will be replaced to 0 by the bus driver */ TXN_PARAM_SET_SINGLE_STEP(pTxnHdr, 1); /* ELP write is always single step (TxnQ is topped)! */ BUILD_TTxnStruct(pTxnHdr, ELP_CTRL_REG_ADDR, &(pTwIf->tElpTxnAwake.uElpData), sizeof(TI_UINT8), NULL, NULL) /* Create the TxnDone queue. */ uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode); pTwIf->hTxnDoneQueue = que_Create(pTwIf->hOs, pTwIf->hReport, TXN_DONE_QUE_SIZE, uNodeHeaderOffset); if (pTwIf->hTxnDoneQueue == NULL) { TRACE0(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_Init: TxnDone queue creation failed!\n"); } /* Register to the context engine and get the client ID */ pTwIf->uContextId = context_RegisterClient(pTwIf->hContext, twIf_HandleTxnDone, hTwIf, TI_TRUE, "TWIF", sizeof("TWIF")); /* Allocate timer */ pTwIf->hPendRestartTimer = tmr_CreateTimer(hTimer); if (pTwIf->hPendRestartTimer == NULL) { TRACE0(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_Init: Failed to create PendRestartTimer!\n"); return; } pTwIf->bPendRestartTimerRunning = TI_FALSE; /* Register to TxnQ */ txnQ_Open(pTwIf->hTxnQ, TXN_FUNC_ID_WLAN, TXN_NUM_PRIORITYS, (TTxnQueueDoneCb) twIf_TxnDoneCb, hTwIf); /* Restart TwIf and TxnQ modules */ twIf_Restart(hTwIf); }