INT32 stp_notify_btm_dump(MTKSTP_BTM_T *stp_btm) { /* pr_warn("%s:enter++\n",__func__); */ if (NULL == stp_btm) { osal_dbg_print("%s: NULL POINTER\n", __func__); return -1; } else { gDumplogflag = 1; osal_trigger_event(&stp_btm->STPd_event); return 0; } }
INT32 wmt_ctrl_ul_cmd ( P_DEV_WMT pWmtDev, const UCHAR *pCmdStr ) { INT32 waitRet = -1; P_OSAL_SIGNAL pCmdSignal; P_OSAL_EVENT pCmdReq; if (osal_test_and_set_bit(WMT_STAT_CMD, &pWmtDev->state)) { WMT_WARN_FUNC("cmd buf is occupied by (%s) \n", pWmtDev->cCmd); return -1; } /* indicate baud rate change to user space app */ #if 0 INIT_COMPLETION(pWmtDev->cmd_comp); pWmtDev->cmd_result = -1; strncpy(pWmtDev->cCmd, pCmdStr, NAME_MAX); pWmtDev->cCmd[NAME_MAX] = '\0'; wake_up_interruptible(&pWmtDev->cmd_wq); #endif pCmdSignal = &pWmtDev->cmdResp; osal_signal_init(pCmdSignal); pCmdSignal->timeoutValue = 2000; osal_strncpy(pWmtDev->cCmd, pCmdStr, NAME_MAX); pWmtDev->cCmd[NAME_MAX] = '\0'; pCmdReq = &pWmtDev->cmdReq; osal_trigger_event(&pWmtDev->cmdReq); WMT_DBG_FUNC("str(%s) request ok\n", pCmdStr); // waitRet = wait_for_completion_interruptible_timeout(&pWmtDev->cmd_comp, msecs_to_jiffies(2000)); waitRet = osal_wait_for_signal_timeout(pCmdSignal); WMT_LOUD_FUNC("wait signal iRet:%d\n", waitRet); if (0 == waitRet) { WMT_ERR_FUNC("wait signal timeout \n"); return -2; } WMT_INFO_FUNC("str(%s) result(%d)\n", pCmdStr, pWmtDev->cmdResult); return pWmtDev->cmdResult; }
INT32 _stp_btm_put_act_op ( MTKSTP_BTM_T *stp_btm, P_OSAL_OP pOp ) { INT32 bRet = 0; INT32 bCleanup = 0; long wait_ret = -1; P_OSAL_SIGNAL pSignal = NULL; do { if (!stp_btm || !pOp) { break; } pSignal = &pOp->signal; if (pSignal->timeoutValue) { pOp->result = -9; osal_signal_init(&pOp->signal); } /* put to active Q */ bRet = _stp_btm_put_op(stp_btm, &stp_btm->rActiveOpQ, pOp); if(0 == bRet) { STP_BTM_WARN_FUNC("put active queue fail\n"); bCleanup = 1;//MTK_WCN_BOOL_TRUE; break; } /* wake up wmtd */ osal_trigger_event(&stp_btm->STPd_event); if (pSignal->timeoutValue == 0) { bRet = 1;//MTK_WCN_BOOL_TRUE; /* clean it in wmtd */ break; } /* wait result, clean it here */ bCleanup = 1;//MTK_WCN_BOOL_TRUE; /* check result */ wait_ret = osal_wait_for_signal_timeout(&pOp->signal); STP_BTM_DBG_FUNC("wait completion:%ld\n", wait_ret); if (!wait_ret) { STP_BTM_ERR_FUNC("wait completion timeout \n"); // TODO: how to handle it? retry? } else { if (pOp->result) { STP_BTM_WARN_FUNC("op(%d) result:%d\n", pOp->op.opId, pOp->result); } bRet = (pOp->result) ? 0 : 1; } } while(0); if (bCleanup) { /* put Op back to freeQ */ _stp_btm_put_op(stp_btm, &stp_btm->rFreeOpQ, pOp); } return bRet; }