eHalStatus ccmCfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr, tANI_U32 length, tCcmCfgSetCallback callback, eAniBoolean toBeSaved) { if( callback || toBeSaved ) { //we need to sychronous this one return cfgSet(hHal, cfgId, CCM_STRING_TYPE, length, pStr, 0, callback, toBeSaved); } else { //Simply push to CFG and not waiting for the response tCfgReq req; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); req.callback = NULL; req.next = NULL; req.cfgId = ( tANI_U16 )cfgId; req.length = length; req.type = CCM_STRING_TYPE; req.ccmPtr = pStr; req.ccmValue = 0; req.toBeSaved = toBeSaved; req.state = eCCM_REQ_SENT; return ( sendCfg( pMac, pMac->hHdd, &req, eANI_BOOLEAN_FALSE ) ); } }
eHalStatus ccmCfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue, tCcmCfgSetCallback callback, eAniBoolean toBeSaved) { if( callback || toBeSaved) { return cfgSet(hHal, cfgId, CCM_INTEGER_TYPE, sizeof(tANI_U32), NULL, ccmValue, callback, toBeSaved); } else { tCfgReq req; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); req.callback = NULL; req.next = NULL; req.cfgId = ( tANI_U16 )cfgId; req.length = sizeof( tANI_U32 ); req.type = CCM_INTEGER_TYPE; req.ccmPtr = NULL; req.ccmValue = ccmValue; req.toBeSaved = toBeSaved; req.state = eCCM_REQ_SENT; return ( sendCfg( pMac, pMac->hHdd, &req, eANI_BOOLEAN_FALSE ) ); } }
static void sendQueuedReqToMacSw(tpAniSirGlobal pMac, tHddHandle hHdd) { tCfgReq *req ; /* Send the head req */ req = pMac->ccm.reqQ.head ; if (req) { if (req->state == eCCM_REQ_QUEUED) { /* Send WNI_CFG_SET_REQ */ req->state = eCCM_REQ_SENT; if (sendCfg(pMac, hHdd, req, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS) { smsLog( pMac, LOGW, FL("sendCfg() failed")); palSpinLockTake(hHdd, pMac->ccm.lock); del_req(req, &pMac->ccm.reqQ) ; palSpinLockGive(hHdd, pMac->ccm.lock); if (req->callback) { req->callback((tHalHandle)pMac, WNI_CFG_OTHER_ERROR) ; } #ifdef CCM_DEBUG smsLog(pMac, LOGW, FL("ccmComplete(%p)"), req->done); #endif ccmComplete(hHdd, req->done); freeCfgReq(hHdd, req); } } else { smsLog( pMac, LOGW, FL("reqState is not eCCM_REQ_QUEUED, is %d"), req->state ); } } return ; }
static eHalStatus cfgSetSub(tpAniSirGlobal pMac, tHddHandle hHdd, tANI_U32 cfgId, tANI_U32 type, tANI_S32 length, void *ccmPtr, tANI_U32 ccmValue, tCcmCfgSetCallback callback, eAniBoolean toBeSaved, void *sem, tCfgReq **r) { eHalStatus status = eHAL_STATUS_SUCCESS; tCfgReq *req ; do { *r = NULL ; if (pMac->ccm.state == eCCM_STOPPED) { status = eHAL_STATUS_FAILURE ; break ; } req = allocateCfgReq(hHdd, type, length); if (req == NULL) { status = eHAL_STATUS_FAILED_ALLOC ; break ; } req->next = NULL ; req->cfgId = (tANI_U16)cfgId ; req->type = (tANI_U8)type ; req->state = eCCM_REQ_QUEUED ; req->toBeSaved = !!toBeSaved ; req->length = length ; req->done = sem ; req->callback = callback ; if (type == CCM_INTEGER_TYPE) { req->ccmValue = ccmValue ; } else { vos_mem_copy((void *)req->ccmPtr, (void *)ccmPtr, length); } palSpinLockTake(hHdd, pMac->ccm.lock); add_req_tail(req, &pMac->ccm.reqQ); /* If this is the first req on the queue, send it to MAC SW */ if ((pMac->ccm.replay.started == 0) && (pMac->ccm.reqQ.head == req)) { /* Send WNI_CFG_SET_REQ */ req->state = eCCM_REQ_SENT; palSpinLockGive(hHdd, pMac->ccm.lock); status = sendCfg(pMac, hHdd, req, eANI_BOOLEAN_TRUE) ; if (status != eHAL_STATUS_SUCCESS) { smsLog( pMac, LOGW, FL("sendCfg() failed")); palSpinLockTake(hHdd, pMac->ccm.lock); del_req(req, &pMac->ccm.reqQ); palSpinLockGive(hHdd, pMac->ccm.lock); freeCfgReq(hHdd, req); break ; } else { palSpinLockTake(hHdd, pMac->ccm.lock); if(req != pMac->ccm.reqQ.head) { //We send the request and it must be done already req = NULL; } palSpinLockGive(hHdd, pMac->ccm.lock); } } else { palSpinLockGive(hHdd, pMac->ccm.lock); } *r = req ; } while(0) ; return status; }