static INT32 _stp_btm_proc (void *pvData) { MTKSTP_BTM_T *stp_btm = (MTKSTP_BTM_T *)pvData; P_OSAL_OP pOp; INT32 id; INT32 result; if (!stp_btm) { STP_BTM_WARN_FUNC("!stp_btm \n"); return -1; } for (;;) { pOp = NULL; osal_wait_for_event(&stp_btm->STPd_event, _stp_btm_wait_for_msg, (void *)stp_btm ); if (osal_thread_should_stop(&stp_btm->BTMd)) { STP_BTM_INFO_FUNC("should stop now... \n"); // TODO: clean up active opQ break; } /* get Op from activeQ */ pOp = _stp_btm_get_op(stp_btm, &stp_btm->rActiveOpQ); if (!pOp) { STP_BTM_WARN_FUNC("get_lxop activeQ fail\n"); continue; } id = osal_op_get_id(pOp); STP_BTM_DBG_FUNC("======> lxop_get_opid = %d, %s, remaining count = *%d*\n", id, (id >= 4)?("???"):(g_btm_op_name[id]), RB_COUNT(&stp_btm->rActiveOpQ)); if (id >= STP_OPID_BTM_NUM) { STP_BTM_WARN_FUNC("abnormal opid id: 0x%x \n", id); result = -1; goto handler_done; } result = _stp_btm_handler(stp_btm, &pOp->op); handler_done: if (result) { STP_BTM_WARN_FUNC("opid id(0x%x)(%s) error(%d)\n", id, (id >= 4)?("???"):(g_btm_op_name[id]), result); } if (osal_op_is_wait_for_signal(pOp)) { osal_op_raise_signal(pOp, result); } else { /* put Op back to freeQ */ _stp_btm_put_op(stp_btm, &stp_btm->rFreeOpQ, pOp); } if (STP_OPID_BTM_EXIT == id) { break; } } STP_BTM_INFO_FUNC("exits \n"); return 0; };
static INT32 _stp_btm_proc(PVOID pvData) { MTKSTP_BTM_T *stp_btm = (MTKSTP_BTM_T *) pvData; P_OSAL_OP pOp; INT32 id; INT32 result; if (!stp_btm) { STP_BTM_WARN_FUNC("!stp_btm\n"); return -1; } for (;;) { pOp = NULL; osal_wait_for_event(&stp_btm->STPd_event, _stp_btm_wait_for_msg, (PVOID)stp_btm); if (osal_thread_should_stop(&stp_btm->BTMd)) { STP_BTM_INFO_FUNC("should stop now...\n"); /* TODO: clean up active opQ */ break; } #if 1 if (gDumplogflag) { /* pr_warn("enter place1\n"); */ if (mtk_wcn_stp_is_uart_mand_mode() || mtk_wcn_stp_is_uart_fullset_mode()) dump_uart_history(); gDumplogflag = 0; continue; } #endif /* get Op from activeQ */ pOp = _stp_btm_get_op(stp_btm, &stp_btm->rActiveOpQ); if (!pOp) { STP_BTM_WARN_FUNC("get_lxop activeQ fail\n"); continue; } id = osal_op_get_id(pOp); STP_BTM_DBG_FUNC("======> lxop_get_opid = %d, %s, remaining count = *%d*\n", id, (id >= 4) ? ("???") : (g_btm_op_name[id]), RB_COUNT(&stp_btm->rActiveOpQ)); if (id >= STP_OPID_BTM_NUM) { STP_BTM_WARN_FUNC("abnormal opid id: 0x%x\n", id); result = -1; goto handler_done; } osal_lock_unsleepable_lock(&(stp_btm->wq_spinlock)); stp_btm_set_current_op(stp_btm, pOp); osal_unlock_unsleepable_lock(&(stp_btm->wq_spinlock)); result = _stp_btm_handler(stp_btm, &pOp->op); osal_lock_unsleepable_lock(&(stp_btm->wq_spinlock)); stp_btm_set_current_op(stp_btm, NULL); osal_unlock_unsleepable_lock(&(stp_btm->wq_spinlock)); handler_done: if (result) { STP_BTM_WARN_FUNC("opid id(0x%x)(%s) error(%d)\n", id, (id >= 4) ? ("???") : (g_btm_op_name[id]), result); } if (osal_op_is_wait_for_signal(pOp)) { osal_op_raise_signal(pOp, result); } else { /* put Op back to freeQ */ _stp_btm_put_op(stp_btm, &stp_btm->rFreeOpQ, pOp); } if (STP_OPID_BTM_EXIT == id) { break; } else if (STP_OPID_BTM_RST == id) { /* prevent multi reset case */ stp_btm_reset_btm_wq(stp_btm); } } STP_BTM_INFO_FUNC("exits\n"); return 0; };