Path: blob/master/ALFA-W1F1/RTL8814AU/core/rtw_bt_mp.c
1307 views
/******************************************************************************1*2* Copyright(c) 2007 - 2017 Realtek Corporation.3*4* This program is free software; you can redistribute it and/or modify it5* under the terms of version 2 of the GNU General Public License as6* published by the Free Software Foundation.7*8* This program is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for11* more details.12*13*****************************************************************************/141516#include <drv_types.h>17#include <rtw_bt_mp.h>1819#if defined(CONFIG_RTL8723B)20#include <rtl8723b_hal.h>21#endif2223#if defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8821A)24void MPh2c_timeout_handle(void *FunctionContext)25{26PADAPTER pAdapter;27PMPT_CONTEXT pMptCtx;282930RTW_INFO("[MPT], MPh2c_timeout_handle\n");3132pAdapter = (PADAPTER)FunctionContext;33pMptCtx = &pAdapter->mppriv.mpt_ctx;3435pMptCtx->bMPh2c_timeout = _TRUE;3637if ((_FALSE == pMptCtx->MptH2cRspEvent)38|| ((_TRUE == pMptCtx->MptH2cRspEvent)39&& (_FALSE == pMptCtx->MptBtC2hEvent)))40_rtw_up_sema(&pMptCtx->MPh2c_Sema);41}4243u32 WaitC2Hevent(PADAPTER pAdapter, u8 *C2H_event, u32 delay_time)44{45PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);46pMptCtx->bMPh2c_timeout = _FALSE;4748if (pAdapter->registrypriv.mp_mode == 0) {49RTW_INFO("[MPT], Error!! WaitC2Hevent mp_mode == 0!!\n");50return _FALSE;51}5253_set_timer(&pMptCtx->MPh2c_timeout_timer, delay_time);5455_rtw_down_sema(&pMptCtx->MPh2c_Sema);5657if (pMptCtx->bMPh2c_timeout == _TRUE) {58*C2H_event = _FALSE;5960return _FALSE;61}6263/* for safty, cancel timer here again */64_cancel_timer_ex(&pMptCtx->MPh2c_timeout_timer);6566return _TRUE;67}6869BT_CTRL_STATUS70mptbt_CheckC2hFrame(71PADAPTER Adapter,72PBT_H2C pH2c,73PBT_EXT_C2H pExtC2h74)75{76BT_CTRL_STATUS c2hStatus = BT_STATUS_C2H_SUCCESS;7778/* RTW_INFO("[MPT], MPT rsp C2H hex: %x %x %x %x %x %x\n"), pExtC2h , pExtC2h+1 ,pExtC2h+2 ,pExtC2h+3 ,pExtC2h+4 ,pExtC2h+5); */7980RTW_INFO("[MPT], statusCode = 0x%x\n", pExtC2h->statusCode);81RTW_INFO("[MPT], retLen = %d\n", pExtC2h->retLen);82RTW_INFO("[MPT], opCodeVer : req/rsp=%d/%d\n", pH2c->opCodeVer, pExtC2h->opCodeVer);83RTW_INFO("[MPT], reqNum : req/rsp=%d/%d\n", pH2c->reqNum, pExtC2h->reqNum);84if (pExtC2h->reqNum != pH2c->reqNum) {85c2hStatus = BT_STATUS_C2H_REQNUM_MISMATCH;86RTW_INFO("[MPT], Error!! C2H reqNum Mismatch!!\n");87} else if (pExtC2h->opCodeVer != pH2c->opCodeVer) {88c2hStatus = BT_STATUS_OPCODE_L_VERSION_MISMATCH;89RTW_INFO("[MPT], Error!! OPCode version L mismatch!!\n");90}9192return c2hStatus;93}9495BT_CTRL_STATUS96mptbt_SendH2c(97PADAPTER Adapter,98PBT_H2C pH2c,99u16 h2cCmdLen100)101{102/* KIRQL OldIrql = KeGetCurrentIrql(); */103BT_CTRL_STATUS h2cStatus = BT_STATUS_H2C_SUCCESS;104PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);105u8 i;106107RTW_INFO("[MPT], mptbt_SendH2c()=========>\n");108109/* PlatformResetEvent(&pMptCtx->MptH2cRspEvent); */110/* PlatformResetEvent(&pMptCtx->MptBtC2hEvent); */111112/* if(OldIrql == PASSIVE_LEVEL)113* { */114/* RTPRINT_DATA(FMPBT, FMPBT_H2C_CONTENT, ("[MPT], MPT H2C hex:\n"), pH2c, h2cCmdLen); */115116for (i = 0; i < BT_H2C_MAX_RETRY; i++) {117RTW_INFO("[MPT], Send H2C command to wifi!!!\n");118119pMptCtx->MptH2cRspEvent = _FALSE;120pMptCtx->MptBtC2hEvent = _FALSE;121122#if defined(CONFIG_RTL8723B)123rtl8723b_set_FwBtMpOper_cmd(Adapter, pH2c->opCode, pH2c->opCodeVer, pH2c->reqNum, pH2c->buf);124#endif125pMptCtx->h2cReqNum++;126pMptCtx->h2cReqNum %= 16;127128if (WaitC2Hevent(Adapter, &pMptCtx->MptH2cRspEvent, 100)) {129RTW_INFO("[MPT], Received WiFi MptH2cRspEvent!!!\n");130if (WaitC2Hevent(Adapter, &pMptCtx->MptBtC2hEvent, 400)) {131RTW_INFO("[MPT], Received MptBtC2hEvent!!!\n");132break;133} else {134RTW_INFO("[MPT], Error!!BT MptBtC2hEvent timeout!!\n");135h2cStatus = BT_STATUS_H2C_BT_NO_RSP;136}137} else {138RTW_INFO("[MPT], Error!!WiFi MptH2cRspEvent timeout!!\n");139h2cStatus = BT_STATUS_H2C_TIMTOUT;140}141}142/* }143* else144* {145* RT_ASSERT(FALSE, ("[MPT], mptbt_SendH2c() can only run under PASSIVE_LEVEL!!\n"));146* h2cStatus = BT_STATUS_WRONG_LEVEL;147* } */148149RTW_INFO("[MPT], mptbt_SendH2c()<=========\n");150return h2cStatus;151}152153154155BT_CTRL_STATUS156mptbt_CheckBtRspStatus(157PADAPTER Adapter,158PBT_EXT_C2H pExtC2h159)160{161BT_CTRL_STATUS retStatus = BT_OP_STATUS_SUCCESS;162163switch (pExtC2h->statusCode) {164case BT_OP_STATUS_SUCCESS:165retStatus = BT_STATUS_BT_OP_SUCCESS;166RTW_INFO("[MPT], BT status : BT_STATUS_SUCCESS\n");167break;168case BT_OP_STATUS_VERSION_MISMATCH:169retStatus = BT_STATUS_OPCODE_L_VERSION_MISMATCH;170RTW_INFO("[MPT], BT status : BT_STATUS_OPCODE_L_VERSION_MISMATCH\n");171break;172case BT_OP_STATUS_UNKNOWN_OPCODE:173retStatus = BT_STATUS_UNKNOWN_OPCODE_L;174RTW_INFO("[MPT], BT status : BT_STATUS_UNKNOWN_OPCODE_L\n");175break;176case BT_OP_STATUS_ERROR_PARAMETER:177retStatus = BT_STATUS_PARAMETER_FORMAT_ERROR_L;178RTW_INFO("[MPT], BT status : BT_STATUS_PARAMETER_FORMAT_ERROR_L\n");179break;180default:181retStatus = BT_STATUS_UNKNOWN_STATUS_L;182RTW_INFO("[MPT], BT status : BT_STATUS_UNKNOWN_STATUS_L\n");183break;184}185186return retStatus;187}188189190191BT_CTRL_STATUS192mptbt_BtFwOpCodeProcess(193PADAPTER Adapter,194u8 btFwOpCode,195u8 opCodeVer,196u8 *pH2cPar,197u8 h2cParaLen198)199{200u8 H2C_Parameter[6] = {0};201PBT_H2C pH2c = (PBT_H2C)&H2C_Parameter[0];202PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);203PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];204u16 paraLen = 0, i;205BT_CTRL_STATUS h2cStatus = BT_STATUS_H2C_SUCCESS, c2hStatus = BT_STATUS_C2H_SUCCESS;206BT_CTRL_STATUS retStatus = BT_STATUS_H2C_BT_NO_RSP;207208if (Adapter->registrypriv.mp_mode == 0) {209RTW_INFO("[MPT], Error!! mptbt_BtFwOpCodeProces mp_mode == 0!!\n");210return _FALSE;211}212213pH2c->opCode = btFwOpCode;214pH2c->opCodeVer = opCodeVer;215pH2c->reqNum = pMptCtx->h2cReqNum;216/* PlatformMoveMemory(&pH2c->buf[0], pH2cPar, h2cParaLen); */217/* _rtw_memcpy(&pH2c->buf[0], pH2cPar, h2cParaLen); */218_rtw_memcpy(pH2c->buf, pH2cPar, h2cParaLen);219220RTW_INFO("[MPT], pH2c->opCode=%d\n", pH2c->opCode);221RTW_INFO("[MPT], pH2c->opCodeVer=%d\n", pH2c->opCodeVer);222RTW_INFO("[MPT], pH2c->reqNum=%d\n", pH2c->reqNum);223RTW_INFO("[MPT], h2c parameter length=%d\n", h2cParaLen);224for (i = 0; i < h2cParaLen; i++)225RTW_INFO("[MPT], parameter[%d]=0x%02x\n", i, pH2c->buf[i]);226227h2cStatus = mptbt_SendH2c(Adapter, pH2c, h2cParaLen + 2);228if (BT_STATUS_H2C_SUCCESS == h2cStatus) {229/* if reach here, it means H2C get the correct c2h response, */230c2hStatus = mptbt_CheckC2hFrame(Adapter, pH2c, pExtC2h);231if (BT_STATUS_C2H_SUCCESS == c2hStatus)232retStatus = mptbt_CheckBtRspStatus(Adapter, pExtC2h);233else {234RTW_INFO("[MPT], Error!! C2H failed for pH2c->opCode=%d\n", pH2c->opCode);235/* check c2h status error, return error status code to upper layer. */236retStatus = c2hStatus;237}238} else {239RTW_INFO("[MPT], Error!! H2C failed for pH2c->opCode=%d\n", pH2c->opCode);240/* check h2c status error, return error status code to upper layer. */241retStatus = h2cStatus;242}243244return retStatus;245}246247248249250u16251mptbt_BtReady(252PADAPTER Adapter,253PBT_REQ_CMD pBtReq,254PBT_RSP_CMD pBtRsp255)256{257u8 h2cParaBuf[6] = {0};258u8 h2cParaLen = 0;259u16 paraLen = 0;260u8 retStatus = BT_STATUS_BT_OP_SUCCESS;261u8 btOpcode;262u8 btOpcodeVer = 0;263PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);264PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];265u8 i;266u8 btFwVer = 0, bdAddr[6] = {0};267u16 btRealFwVer = 0;268u16 *pu2Tmp = NULL;269270/* */271/* check upper layer parameters */272/* */273274/* 1. check upper layer opcode version */275if (pBtReq->opCodeVer != 1) {276RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");277pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;278return paraLen;279}280281pBtRsp->pParamStart[0] = MP_BT_NOT_READY;282paraLen = 10;283/* */284/* execute lower layer opcodes */285/* */286287/* Get BT FW version */288/* fill h2c parameters */289btOpcode = BT_LO_OP_GET_BT_VERSION;290/* execute h2c and check respond c2h from bt fw is correct or not */291retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);292/* ckeck bt return status. */293if (BT_STATUS_BT_OP_SUCCESS != retStatus) {294pBtRsp->status = ((btOpcode << 8) | retStatus);295RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);296return paraLen;297} else {298pu2Tmp = (u16 *)&pExtC2h->buf[0];299btRealFwVer = *pu2Tmp;300btFwVer = pExtC2h->buf[1];301RTW_INFO("[MPT], btRealFwVer=0x%x, btFwVer=0x%x\n", btRealFwVer, btFwVer);302}303304/* Get BD Address */305/* fill h2c parameters */306btOpcode = BT_LO_OP_GET_BD_ADDR_L;307/* execute h2c and check respond c2h from bt fw is correct or not */308retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);309/* ckeck bt return status. */310if (BT_STATUS_BT_OP_SUCCESS != retStatus) {311pBtRsp->status = ((btOpcode << 8) | retStatus);312RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);313return paraLen;314} else {315bdAddr[5] = pExtC2h->buf[0];316bdAddr[4] = pExtC2h->buf[1];317bdAddr[3] = pExtC2h->buf[2];318}319320/* fill h2c parameters */321btOpcode = BT_LO_OP_GET_BD_ADDR_H;322/* execute h2c and check respond c2h from bt fw is correct or not */323retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);324/* ckeck bt return status. */325if (BT_STATUS_BT_OP_SUCCESS != retStatus) {326pBtRsp->status = ((btOpcode << 8) | retStatus);327RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);328return paraLen;329} else {330bdAddr[2] = pExtC2h->buf[0];331bdAddr[1] = pExtC2h->buf[1];332bdAddr[0] = pExtC2h->buf[2];333}334RTW_INFO("[MPT], Local BDAddr:");335for (i = 0; i < 6; i++)336RTW_INFO(" 0x%x ", bdAddr[i]);337pBtRsp->status = BT_STATUS_SUCCESS;338pBtRsp->pParamStart[0] = MP_BT_READY;339pu2Tmp = (u16 *)&pBtRsp->pParamStart[1];340*pu2Tmp = btRealFwVer;341pBtRsp->pParamStart[3] = btFwVer;342for (i = 0; i < 6; i++)343pBtRsp->pParamStart[4 + i] = bdAddr[5 - i];344345return paraLen;346}347348void mptbt_close_WiFiRF(PADAPTER Adapter)349{350phy_set_bb_reg(Adapter, 0x824, 0xF, 0x0);351phy_set_bb_reg(Adapter, 0x824, 0x700000, 0x0);352phy_set_rf_reg(Adapter, RF_PATH_A, 0x0, 0xF0000, 0x0);353}354355void mptbt_open_WiFiRF(PADAPTER Adapter)356{357phy_set_bb_reg(Adapter, 0x824, 0x700000, 0x3);358phy_set_bb_reg(Adapter, 0x824, 0xF, 0x2);359phy_set_rf_reg(Adapter, RF_PATH_A, 0x0, 0xF0000, 0x3);360}361362u32 mptbt_switch_RF(PADAPTER Adapter, u8 Enter)363{364u16 tmp_2byte = 0;365366/* Enter test mode */367if (Enter) {368/* 1>. close WiFi RF */369mptbt_close_WiFiRF(Adapter);370371/* 2>. change ant switch to BT */372tmp_2byte = rtw_read16(Adapter, 0x860);373tmp_2byte = tmp_2byte | BIT(9);374tmp_2byte = tmp_2byte & (~BIT(8));375rtw_write16(Adapter, 0x860, tmp_2byte);376rtw_write16(Adapter, 0x870, 0x300);377} else {378/* 1>. Open WiFi RF */379mptbt_open_WiFiRF(Adapter);380381/* 2>. change ant switch back */382tmp_2byte = rtw_read16(Adapter, 0x860);383tmp_2byte = tmp_2byte | BIT(8);384tmp_2byte = tmp_2byte & (~BIT(9));385rtw_write16(Adapter, 0x860, tmp_2byte);386rtw_write16(Adapter, 0x870, 0x300);387}388389return 0;390}391392u16393mptbt_BtSetMode(394PADAPTER Adapter,395PBT_REQ_CMD pBtReq,396PBT_RSP_CMD pBtRsp397)398{399u8 h2cParaBuf[6] = {0};400u8 h2cParaLen = 0;401u16 paraLen = 0;402u8 retStatus = BT_STATUS_BT_OP_SUCCESS;403u8 btOpcode;404u8 btOpcodeVer = 0;405u8 btModeToSet = 0;406407/* */408/* check upper layer parameters */409/* */410/* 1. check upper layer opcode version */411if (pBtReq->opCodeVer != 1) {412RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");413pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;414return paraLen;415}416/* 2. check upper layer parameter length */417if (1 == pBtReq->paraLength) {418btModeToSet = pBtReq->pParamStart[0];419RTW_INFO("[MPT], BtTestMode=%d\n", btModeToSet);420} else {421RTW_INFO("[MPT], Error!! wrong parameter length=%d (should be 1)\n", pBtReq->paraLength);422pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;423return paraLen;424}425426/* */427/* execute lower layer opcodes */428/* */429430/* 1. fill h2c parameters */431/* check bt mode */432btOpcode = BT_LO_OP_SET_BT_MODE;433if (btModeToSet >= MP_BT_MODE_MAX) {434pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;435return paraLen;436} else {437mptbt_switch_RF(Adapter, 1);438439h2cParaBuf[0] = btModeToSet;440h2cParaLen = 1;441/* 2. execute h2c and check respond c2h from bt fw is correct or not */442retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);443}444445/* 3. construct respond status code and data. */446if (BT_STATUS_BT_OP_SUCCESS == retStatus)447pBtRsp->status = BT_STATUS_SUCCESS;448else {449pBtRsp->status = ((btOpcode << 8) | retStatus);450RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);451}452453return paraLen;454}455456457void458MPTBT_FwC2hBtMpCtrl(459PADAPTER Adapter,460u8 *tmpBuf,461u8 length462)463{464u32 i;465PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);466PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)tmpBuf;467468if (GET_HAL_DATA(Adapter)->bBTFWReady == _FALSE || Adapter->registrypriv.mp_mode == 0) {469/* RTW_INFO("Ignore C2H BT MP Info since not in MP mode\n"); */470return;471}472if (length > 32 || length < 3) {473RTW_INFO("\n [MPT], pExtC2h->buf hex: length=%d > 32 || < 3\n", length);474return;475}476477/* cancel_timeout for h2c handle */478_cancel_timer_ex(&pMptCtx->MPh2c_timeout_timer);479480for (i = 0; i < length; i++)481RTW_INFO("[MPT], %s, buf[%d]=0x%02x ", __FUNCTION__, i, tmpBuf[i]);482RTW_INFO("[MPT], pExtC2h->extendId=0x%x\n", pExtC2h->extendId);483484switch (pExtC2h->extendId) {485case EXT_C2H_WIFI_FW_ACTIVE_RSP:486RTW_INFO("[MPT], EXT_C2H_WIFI_FW_ACTIVE_RSP\n");487#if 0488RTW_INFO("[MPT], pExtC2h->buf hex:\n");489for (i = 0; i < (length - 3); i++)490RTW_INFO(" 0x%x ", pExtC2h->buf[i]);491#endif492if ((_FALSE == pMptCtx->bMPh2c_timeout)493&& (_FALSE == pMptCtx->MptH2cRspEvent)) {494pMptCtx->MptH2cRspEvent = _TRUE;495_rtw_up_sema(&pMptCtx->MPh2c_Sema);496}497break;498499case EXT_C2H_TRIG_BY_BT_FW:500RTW_INFO("[MPT], EXT_C2H_TRIG_BY_BT_FW\n");501_rtw_memcpy(&pMptCtx->c2hBuf[0], tmpBuf, length);502RTW_INFO("[MPT], pExtC2h->statusCode=0x%x\n", pExtC2h->statusCode);503RTW_INFO("[MPT], pExtC2h->retLen=0x%x\n", pExtC2h->retLen);504RTW_INFO("[MPT], pExtC2h->opCodeVer=0x%x\n", pExtC2h->opCodeVer);505RTW_INFO("[MPT], pExtC2h->reqNum=0x%x\n", pExtC2h->reqNum);506for (i = 0; i < (length - 3); i++)507RTW_INFO("[MPT], pExtC2h->buf[%d]=0x%02x\n", i, pExtC2h->buf[i]);508509if ((_FALSE == pMptCtx->bMPh2c_timeout)510&& (_TRUE == pMptCtx->MptH2cRspEvent)511&& (_FALSE == pMptCtx->MptBtC2hEvent)) {512pMptCtx->MptBtC2hEvent = _TRUE;513_rtw_up_sema(&pMptCtx->MPh2c_Sema);514}515break;516517default:518RTW_INFO("[MPT], EXT_C2H Target not found,pExtC2h->extendId =%d ,pExtC2h->reqNum=%d\n", pExtC2h->extendId, pExtC2h->reqNum);519break;520}521522523524}525526527u16528mptbt_BtGetGeneral(529PADAPTER Adapter,530PBT_REQ_CMD pBtReq,531PBT_RSP_CMD pBtRsp532)533{534PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);535PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];536u8 h2cParaBuf[6] = {0};537u8 h2cParaLen = 0;538u16 paraLen = 0;539u8 retStatus = BT_STATUS_BT_OP_SUCCESS;540u8 btOpcode, bdAddr[6] = {0};541u8 btOpcodeVer = 0;542u8 getType = 0, i;543u16 getParaLen = 0, validParaLen = 0;544u8 regType = 0, reportType = 0;545u32 regAddr = 0, regValue = 0;546u32 *pu4Tmp;547u16 *pu2Tmp;548u8 *pu1Tmp;549550/* */551/* check upper layer parameters */552/* */553554/* check upper layer opcode version */555if (pBtReq->opCodeVer != 1) {556RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");557pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;558return paraLen;559}560/* check upper layer parameter length */561if (pBtReq->paraLength < 1) {562RTW_INFO("[MPT], Error!! wrong parameter length=%d (should larger than 1)\n", pBtReq->paraLength);563pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;564return paraLen;565}566getParaLen = pBtReq->paraLength - 1;567getType = pBtReq->pParamStart[0];568569RTW_INFO("[MPT], getType=%d, getParaLen=%d\n", getType, getParaLen);570571/* check parameter first */572switch (getType) {573case BT_GGET_REG:574RTW_INFO("[MPT], [BT_GGET_REG]\n");575validParaLen = 5;576if (getParaLen == validParaLen) {577btOpcode = BT_LO_OP_READ_REG;578regType = pBtReq->pParamStart[1];579pu4Tmp = (u32 *)&pBtReq->pParamStart[2];580regAddr = *pu4Tmp;581RTW_INFO("[MPT], BT_GGET_REG regType=0x%02x, regAddr=0x%08x!!\n",582regType, regAddr);583if (regType >= BT_REG_MAX) {584pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;585return paraLen;586} else {587if (((BT_REG_RF == regType) && (regAddr > 0x7f)) ||588((BT_REG_MODEM == regType) && (regAddr > 0x1ff)) ||589((BT_REG_BLUEWIZE == regType) && (regAddr > 0xfff)) ||590((BT_REG_VENDOR == regType) && (regAddr > 0xfff)) ||591((BT_REG_LE == regType) && (regAddr > 0xfff))) {592pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;593return paraLen;594}595}596}597break;598case BT_GGET_STATUS:599RTW_INFO("[MPT], [BT_GGET_STATUS]\n");600validParaLen = 0;601break;602case BT_GGET_REPORT:603RTW_INFO("[MPT], [BT_GGET_REPORT]\n");604validParaLen = 1;605if (getParaLen == validParaLen) {606reportType = pBtReq->pParamStart[1];607RTW_INFO("[MPT], BT_GGET_REPORT reportType=0x%x!!\n", reportType);608if (reportType >= BT_REPORT_MAX) {609pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;610return paraLen;611}612}613break;614default: {615RTW_INFO("[MPT], Error!! getType=%d, out of range\n", getType);616pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;617return paraLen;618}619break;620}621if (getParaLen != validParaLen) {622RTW_INFO("[MPT], Error!! wrong parameter length=%d for BT_GET_GEN_CMD cmd id=0x%x, paraLen should=0x%x\n",623getParaLen, getType, validParaLen);624pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;625return paraLen;626}627628/* */629/* execute lower layer opcodes */630/* */631if (BT_GGET_REG == getType) {632/* fill h2c parameters */633/* here we should write reg value first then write the address, adviced by Austin */634btOpcode = BT_LO_OP_READ_REG;635h2cParaBuf[0] = regType;636h2cParaBuf[1] = pBtReq->pParamStart[2];637h2cParaBuf[2] = pBtReq->pParamStart[3];638h2cParaLen = 3;639/* execute h2c and check respond c2h from bt fw is correct or not */640retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);641/* construct respond status code and data. */642if (BT_STATUS_BT_OP_SUCCESS != retStatus) {643pBtRsp->status = ((btOpcode << 8) | retStatus);644RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);645return paraLen;646}647648pu2Tmp = (u16 *)&pExtC2h->buf[0];649regValue = *pu2Tmp;650RTW_INFO("[MPT], read reg regType=0x%02x, regAddr=0x%08x, regValue=0x%04x\n",651regType, regAddr, regValue);652653pu4Tmp = (u32 *)&pBtRsp->pParamStart[0];654*pu4Tmp = regValue;655paraLen = 4;656} else if (BT_GGET_STATUS == getType) {657btOpcode = BT_LO_OP_GET_BT_STATUS;658h2cParaLen = 0;659/* execute h2c and check respond c2h from bt fw is correct or not */660retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);661/* construct respond status code and data. */662if (BT_STATUS_BT_OP_SUCCESS != retStatus) {663pBtRsp->status = ((btOpcode << 8) | retStatus);664RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);665return paraLen;666}667668pBtRsp->pParamStart[0] = pExtC2h->buf[0];669pBtRsp->pParamStart[1] = pExtC2h->buf[1];670RTW_INFO("[MPT], read bt status, testMode=0x%x, testStatus=0x%x\n",671pBtRsp->pParamStart[0], pBtRsp->pParamStart[1]);672paraLen = 2;673} else if (BT_GGET_REPORT == getType) {674switch (reportType) {675case BT_REPORT_RX_PACKET_CNT: {676RTW_INFO("[MPT], [Rx Packet Counts]\n");677btOpcode = BT_LO_OP_GET_RX_PKT_CNT_L;678h2cParaLen = 0;679/* execute h2c and check respond c2h from bt fw is correct or not */680retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);681/* construct respond status code and data. */682if (BT_STATUS_BT_OP_SUCCESS != retStatus) {683pBtRsp->status = ((btOpcode << 8) | retStatus);684RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);685return paraLen;686}687pBtRsp->pParamStart[0] = pExtC2h->buf[0];688pBtRsp->pParamStart[1] = pExtC2h->buf[1];689690btOpcode = BT_LO_OP_GET_RX_PKT_CNT_H;691h2cParaLen = 0;692/* execute h2c and check respond c2h from bt fw is correct or not */693retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);694/* construct respond status code and data. */695if (BT_STATUS_BT_OP_SUCCESS != retStatus) {696pBtRsp->status = ((btOpcode << 8) | retStatus);697RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);698return paraLen;699}700pBtRsp->pParamStart[2] = pExtC2h->buf[0];701pBtRsp->pParamStart[3] = pExtC2h->buf[1];702paraLen = 4;703}704break;705case BT_REPORT_RX_ERROR_BITS: {706RTW_INFO("[MPT], [Rx Error Bits]\n");707btOpcode = BT_LO_OP_GET_RX_ERROR_BITS_L;708h2cParaLen = 0;709/* execute h2c and check respond c2h from bt fw is correct or not */710retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);711/* construct respond status code and data. */712if (BT_STATUS_BT_OP_SUCCESS != retStatus) {713pBtRsp->status = ((btOpcode << 8) | retStatus);714RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);715return paraLen;716}717pBtRsp->pParamStart[0] = pExtC2h->buf[0];718pBtRsp->pParamStart[1] = pExtC2h->buf[1];719720btOpcode = BT_LO_OP_GET_RX_ERROR_BITS_H;721h2cParaLen = 0;722/* execute h2c and check respond c2h from bt fw is correct or not */723retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);724/* construct respond status code and data. */725if (BT_STATUS_BT_OP_SUCCESS != retStatus) {726pBtRsp->status = ((btOpcode << 8) | retStatus);727RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);728return paraLen;729}730pBtRsp->pParamStart[2] = pExtC2h->buf[0];731pBtRsp->pParamStart[3] = pExtC2h->buf[1];732paraLen = 4;733}734break;735case BT_REPORT_RSSI: {736RTW_INFO("[MPT], [RSSI]\n");737btOpcode = BT_LO_OP_GET_RSSI;738h2cParaLen = 0;739/* execute h2c and check respond c2h from bt fw is correct or not */740retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);741/* construct respond status code and data. */742if (BT_STATUS_BT_OP_SUCCESS != retStatus) {743pBtRsp->status = ((btOpcode << 8) | retStatus);744RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);745return paraLen;746}747pBtRsp->pParamStart[0] = pExtC2h->buf[0];748pBtRsp->pParamStart[1] = pExtC2h->buf[1];749paraLen = 2;750}751break;752case BT_REPORT_CFO_HDR_QUALITY: {753RTW_INFO("[MPT], [CFO & Header Quality]\n");754btOpcode = BT_LO_OP_GET_CFO_HDR_QUALITY_L;755h2cParaLen = 0;756/* execute h2c and check respond c2h from bt fw is correct or not */757retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);758/* construct respond status code and data. */759if (BT_STATUS_BT_OP_SUCCESS != retStatus) {760pBtRsp->status = ((btOpcode << 8) | retStatus);761RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);762return paraLen;763}764pBtRsp->pParamStart[0] = pExtC2h->buf[0];765pBtRsp->pParamStart[1] = pExtC2h->buf[1];766767btOpcode = BT_LO_OP_GET_CFO_HDR_QUALITY_H;768h2cParaLen = 0;769/* execute h2c and check respond c2h from bt fw is correct or not */770retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);771/* construct respond status code and data. */772if (BT_STATUS_BT_OP_SUCCESS != retStatus) {773pBtRsp->status = ((btOpcode << 8) | retStatus);774RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);775return paraLen;776}777pBtRsp->pParamStart[2] = pExtC2h->buf[0];778pBtRsp->pParamStart[3] = pExtC2h->buf[1];779paraLen = 4;780}781break;782case BT_REPORT_CONNECT_TARGET_BD_ADDR: {783RTW_INFO("[MPT], [Connected Target BD ADDR]\n");784btOpcode = BT_LO_OP_GET_TARGET_BD_ADDR_L;785h2cParaLen = 0;786/* execute h2c and check respond c2h from bt fw is correct or not */787retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);788/* construct respond status code and data. */789if (BT_STATUS_BT_OP_SUCCESS != retStatus) {790pBtRsp->status = ((btOpcode << 8) | retStatus);791RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);792return paraLen;793}794bdAddr[5] = pExtC2h->buf[0];795bdAddr[4] = pExtC2h->buf[1];796bdAddr[3] = pExtC2h->buf[2];797798btOpcode = BT_LO_OP_GET_TARGET_BD_ADDR_H;799h2cParaLen = 0;800/* execute h2c and check respond c2h from bt fw is correct or not */801retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);802/* construct respond status code and data. */803if (BT_STATUS_BT_OP_SUCCESS != retStatus) {804pBtRsp->status = ((btOpcode << 8) | retStatus);805RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);806return paraLen;807}808bdAddr[2] = pExtC2h->buf[0];809bdAddr[1] = pExtC2h->buf[1];810bdAddr[0] = pExtC2h->buf[2];811812RTW_INFO("[MPT], Connected Target BDAddr:%s", bdAddr);813for (i = 0; i < 6; i++)814pBtRsp->pParamStart[i] = bdAddr[5 - i];815paraLen = 6;816}817break;818default:819pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;820return paraLen;821break;822}823}824825pBtRsp->status = BT_STATUS_SUCCESS;826return paraLen;827}828829830831u16832mptbt_BtSetGeneral(833PADAPTER Adapter,834PBT_REQ_CMD pBtReq,835PBT_RSP_CMD pBtRsp836)837{838u8 h2cParaBuf[6] = {0};839u8 h2cParaLen = 0;840u16 paraLen = 0;841u8 retStatus = BT_STATUS_BT_OP_SUCCESS;842u8 btOpcode;843u8 btOpcodeVer = 0;844u8 setType = 0;845u16 setParaLen = 0, validParaLen = 0;846u8 regType = 0, bdAddr[6] = {0}, calVal = 0;847u32 regAddr = 0, regValue = 0;848u32 *pu4Tmp;849u16 *pu2Tmp;850u8 *pu1Tmp;851852/* */853/* check upper layer parameters */854/* */855856/* check upper layer opcode version */857if (pBtReq->opCodeVer != 1) {858RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");859pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;860return paraLen;861}862/* check upper layer parameter length */863if (pBtReq->paraLength < 1) {864RTW_INFO("[MPT], Error!! wrong parameter length=%d (should larger than 1)\n", pBtReq->paraLength);865pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;866return paraLen;867}868setParaLen = pBtReq->paraLength - 1;869setType = pBtReq->pParamStart[0];870871RTW_INFO("[MPT], setType=%d, setParaLen=%d\n", setType, setParaLen);872873/* check parameter first */874switch (setType) {875case BT_GSET_REG:876RTW_INFO("[MPT], [BT_GSET_REG]\n");877validParaLen = 9;878if (setParaLen == validParaLen) {879btOpcode = BT_LO_OP_WRITE_REG_VALUE;880regType = pBtReq->pParamStart[1];881pu4Tmp = (u32 *)&pBtReq->pParamStart[2];882regAddr = *pu4Tmp;883pu4Tmp = (u32 *)&pBtReq->pParamStart[6];884regValue = *pu4Tmp;885RTW_INFO("[MPT], BT_GSET_REG regType=0x%x, regAddr=0x%x, regValue=0x%x!!\n",886regType, regAddr, regValue);887if (regType >= BT_REG_MAX) {888pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;889return paraLen;890} else {891if (((BT_REG_RF == regType) && (regAddr > 0x7f)) ||892((BT_REG_MODEM == regType) && (regAddr > 0x1ff)) ||893((BT_REG_BLUEWIZE == regType) && (regAddr > 0xfff)) ||894((BT_REG_VENDOR == regType) && (regAddr > 0xfff)) ||895((BT_REG_LE == regType) && (regAddr > 0xfff))) {896pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;897return paraLen;898}899}900}901break;902case BT_GSET_RESET:903RTW_INFO("[MPT], [BT_GSET_RESET]\n");904validParaLen = 0;905break;906case BT_GSET_TARGET_BD_ADDR:907RTW_INFO("[MPT], [BT_GSET_TARGET_BD_ADDR]\n");908validParaLen = 6;909if (setParaLen == validParaLen) {910btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_H;911if ((pBtReq->pParamStart[1] == 0) &&912(pBtReq->pParamStart[2] == 0) &&913(pBtReq->pParamStart[3] == 0) &&914(pBtReq->pParamStart[4] == 0) &&915(pBtReq->pParamStart[5] == 0) &&916(pBtReq->pParamStart[6] == 0)) {917RTW_INFO("[MPT], Error!! targetBDAddr=all zero\n");918pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;919return paraLen;920}921if ((pBtReq->pParamStart[1] == 0xff) &&922(pBtReq->pParamStart[2] == 0xff) &&923(pBtReq->pParamStart[3] == 0xff) &&924(pBtReq->pParamStart[4] == 0xff) &&925(pBtReq->pParamStart[5] == 0xff) &&926(pBtReq->pParamStart[6] == 0xff)) {927RTW_INFO("[MPT], Error!! targetBDAddr=all 0xf\n");928pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;929return paraLen;930}931bdAddr[0] = pBtReq->pParamStart[6];932bdAddr[1] = pBtReq->pParamStart[5];933bdAddr[2] = pBtReq->pParamStart[4];934bdAddr[3] = pBtReq->pParamStart[3];935bdAddr[4] = pBtReq->pParamStart[2];936bdAddr[5] = pBtReq->pParamStart[1];937RTW_INFO("[MPT], target BDAddr:%x,%x,%x,%x,%x,%x\n",938bdAddr[0], bdAddr[1], bdAddr[2], bdAddr[3], bdAddr[4], bdAddr[5]);939}940break;941case BT_GSET_TX_PWR_FINETUNE:942RTW_INFO("[MPT], [BT_GSET_TX_PWR_FINETUNE]\n");943validParaLen = 1;944if (setParaLen == validParaLen) {945btOpcode = BT_LO_OP_SET_TX_POWER_CALIBRATION;946calVal = pBtReq->pParamStart[1];947if ((calVal < 1) || (calVal > 9)) {948pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;949return paraLen;950}951RTW_INFO("[MPT], calVal=%d\n", calVal);952}953break;954case BT_SET_TRACKING_INTERVAL:955RTW_INFO("[MPT], [BT_SET_TRACKING_INTERVAL] setParaLen =%d\n", setParaLen);956957validParaLen = 1;958if (setParaLen == validParaLen)959calVal = pBtReq->pParamStart[1];960break;961case BT_SET_THERMAL_METER:962RTW_INFO("[MPT], [BT_SET_THERMAL_METER] setParaLen =%d\n", setParaLen);963validParaLen = 1;964if (setParaLen == validParaLen)965calVal = pBtReq->pParamStart[1];966break;967case BT_ENABLE_CFO_TRACKING:968RTW_INFO("[MPT], [BT_ENABLE_CFO_TRACKING] setParaLen =%d\n", setParaLen);969validParaLen = 1;970if (setParaLen == validParaLen)971calVal = pBtReq->pParamStart[1];972break;973case BT_GSET_UPDATE_BT_PATCH:974975break;976default: {977RTW_INFO("[MPT], Error!! setType=%d, out of range\n", setType);978pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;979return paraLen;980}981break;982}983if (setParaLen != validParaLen) {984RTW_INFO("[MPT], Error!! wrong parameter length=%d for BT_SET_GEN_CMD cmd id=0x%x, paraLen should=0x%x\n",985setParaLen, setType, validParaLen);986pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;987return paraLen;988}989990/* */991/* execute lower layer opcodes */992/* */993if (BT_GSET_REG == setType) {994/* fill h2c parameters */995/* here we should write reg value first then write the address, adviced by Austin */996btOpcode = BT_LO_OP_WRITE_REG_VALUE;997h2cParaBuf[0] = pBtReq->pParamStart[6];998h2cParaBuf[1] = pBtReq->pParamStart[7];999h2cParaBuf[2] = pBtReq->pParamStart[8];1000h2cParaLen = 3;1001/* execute h2c and check respond c2h from bt fw is correct or not */1002retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1003/* construct respond status code and data. */1004if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1005pBtRsp->status = ((btOpcode << 8) | retStatus);1006RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1007return paraLen;1008}10091010/* write reg address */1011btOpcode = BT_LO_OP_WRITE_REG_ADDR;1012h2cParaBuf[0] = regType;1013h2cParaBuf[1] = pBtReq->pParamStart[2];1014h2cParaBuf[2] = pBtReq->pParamStart[3];1015h2cParaLen = 3;1016/* execute h2c and check respond c2h from bt fw is correct or not */1017retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1018/* construct respond status code and data. */1019if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1020pBtRsp->status = ((btOpcode << 8) | retStatus);1021RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1022return paraLen;1023}1024} else if (BT_GSET_RESET == setType) {1025btOpcode = BT_LO_OP_RESET;1026h2cParaLen = 0;1027/* execute h2c and check respond c2h from bt fw is correct or not */1028retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1029/* construct respond status code and data. */1030if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1031pBtRsp->status = ((btOpcode << 8) | retStatus);1032RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1033return paraLen;1034}1035} else if (BT_GSET_TARGET_BD_ADDR == setType) {1036/* fill h2c parameters */1037btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_L;1038h2cParaBuf[0] = pBtReq->pParamStart[1];1039h2cParaBuf[1] = pBtReq->pParamStart[2];1040h2cParaBuf[2] = pBtReq->pParamStart[3];1041h2cParaLen = 3;1042retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1043/* ckeck bt return status. */1044if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1045pBtRsp->status = ((btOpcode << 8) | retStatus);1046RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1047return paraLen;1048}10491050btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_H;1051h2cParaBuf[0] = pBtReq->pParamStart[4];1052h2cParaBuf[1] = pBtReq->pParamStart[5];1053h2cParaBuf[2] = pBtReq->pParamStart[6];1054h2cParaLen = 3;1055retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1056/* ckeck bt return status. */1057if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1058pBtRsp->status = ((btOpcode << 8) | retStatus);1059RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1060return paraLen;1061}1062} else if (BT_GSET_TX_PWR_FINETUNE == setType) {1063/* fill h2c parameters */1064btOpcode = BT_LO_OP_SET_TX_POWER_CALIBRATION;1065h2cParaBuf[0] = calVal;1066h2cParaLen = 1;1067retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1068/* ckeck bt return status. */1069if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1070pBtRsp->status = ((btOpcode << 8) | retStatus);1071RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1072return paraLen;1073}1074} else if (BT_SET_TRACKING_INTERVAL == setType) {1075/* BT_LO_OP_SET_TRACKING_INTERVAL = 0x22, */1076/* BT_LO_OP_SET_THERMAL_METER = 0x23, */1077/* BT_LO_OP_ENABLE_CFO_TRACKING = 0x24, */1078btOpcode = BT_LO_OP_SET_TRACKING_INTERVAL;1079h2cParaBuf[0] = calVal;1080h2cParaLen = 1;1081retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1082/* ckeck bt return status. */1083if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1084pBtRsp->status = ((btOpcode << 8) | retStatus);1085RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1086return paraLen;1087}1088} else if (BT_SET_THERMAL_METER == setType) {1089btOpcode = BT_LO_OP_SET_THERMAL_METER;1090h2cParaBuf[0] = calVal;1091h2cParaLen = 1;1092retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1093/* ckeck bt return status. */1094if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1095pBtRsp->status = ((btOpcode << 8) | retStatus);1096RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1097return paraLen;1098}1099} else if (BT_ENABLE_CFO_TRACKING == setType) {1100btOpcode = BT_LO_OP_ENABLE_CFO_TRACKING;1101h2cParaBuf[0] = calVal;1102h2cParaLen = 1;1103retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1104/* ckeck bt return status. */1105if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1106pBtRsp->status = ((btOpcode << 8) | retStatus);1107RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1108return paraLen;1109}1110}11111112pBtRsp->status = BT_STATUS_SUCCESS;1113return paraLen;1114}1115111611171118u161119mptbt_BtSetTxRxPars(1120PADAPTER Adapter,1121PBT_REQ_CMD pBtReq,1122PBT_RSP_CMD pBtRsp1123)1124{1125u8 h2cParaBuf[6] = {0};1126u8 h2cParaLen = 0;1127u16 paraLen = 0;1128u8 retStatus = BT_STATUS_BT_OP_SUCCESS;1129u8 btOpcode;1130u8 btOpcodeVer = 0;1131PBT_TXRX_PARAMETERS pTxRxPars = (PBT_TXRX_PARAMETERS)&pBtReq->pParamStart[0];1132u16 lenTxRx = sizeof(BT_TXRX_PARAMETERS);1133u8 i;1134u8 bdAddr[6] = {0};11351136/* */1137/* check upper layer parameters */1138/* */11391140/* 1. check upper layer opcode version */1141if (pBtReq->opCodeVer != 1) {1142RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");1143pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;1144return paraLen;1145}1146/* 2. check upper layer parameter length */1147if (pBtReq->paraLength == sizeof(BT_TXRX_PARAMETERS)) {1148RTW_INFO("[MPT], pTxRxPars->txrxChannel=0x%x\n", pTxRxPars->txrxChannel);1149RTW_INFO("[MPT], pTxRxPars->txrxTxPktCnt=0x%8x\n", pTxRxPars->txrxTxPktCnt);1150RTW_INFO("[MPT], pTxRxPars->txrxTxPktInterval=0x%x\n", pTxRxPars->txrxTxPktInterval);1151RTW_INFO("[MPT], pTxRxPars->txrxPayloadType=0x%x\n", pTxRxPars->txrxPayloadType);1152RTW_INFO("[MPT], pTxRxPars->txrxPktType=0x%x\n", pTxRxPars->txrxPktType);1153RTW_INFO("[MPT], pTxRxPars->txrxPayloadLen=0x%x\n", pTxRxPars->txrxPayloadLen);1154RTW_INFO("[MPT], pTxRxPars->txrxPktHeader=0x%x\n", pTxRxPars->txrxPktHeader);1155RTW_INFO("[MPT], pTxRxPars->txrxWhitenCoeff=0x%x\n", pTxRxPars->txrxWhitenCoeff);1156bdAddr[0] = pTxRxPars->txrxBdaddr[5];1157bdAddr[1] = pTxRxPars->txrxBdaddr[4];1158bdAddr[2] = pTxRxPars->txrxBdaddr[3];1159bdAddr[3] = pTxRxPars->txrxBdaddr[2];1160bdAddr[4] = pTxRxPars->txrxBdaddr[1];1161bdAddr[5] = pTxRxPars->txrxBdaddr[0];1162RTW_INFO("[MPT], pTxRxPars->txrxBdaddr: %s", &bdAddr[0]);1163RTW_INFO("[MPT], pTxRxPars->txrxTxGainIndex=0x%x\n", pTxRxPars->txrxTxGainIndex);1164} else {1165RTW_INFO("[MPT], Error!! pBtReq->paraLength=%d, correct Len=%d\n", pBtReq->paraLength, lenTxRx);1166pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;1167return paraLen;1168}11691170/* */1171/* execute lower layer opcodes */1172/* */11731174/* fill h2c parameters */1175btOpcode = BT_LO_OP_SET_PKT_HEADER;1176if (pTxRxPars->txrxPktHeader > 0x3ffff) {1177RTW_INFO("[MPT], Error!! pTxRxPars->txrxPktHeader=0x%x is out of range, (should be between 0x0~0x3ffff)\n", pTxRxPars->txrxPktHeader);1178pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1179return paraLen;1180} else {1181h2cParaBuf[0] = (u8)(pTxRxPars->txrxPktHeader & 0xff);1182h2cParaBuf[1] = (u8)((pTxRxPars->txrxPktHeader & 0xff00) >> 8);1183h2cParaBuf[2] = (u8)((pTxRxPars->txrxPktHeader & 0xff0000) >> 16);1184h2cParaLen = 3;1185retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1186}11871188/* ckeck bt return status. */1189if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1190pBtRsp->status = ((btOpcode << 8) | retStatus);1191RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1192return paraLen;1193}11941195/* fill h2c parameters */1196btOpcode = BT_LO_OP_SET_PKT_TYPE_LEN;1197{1198u16 payloadLenLimit = 0;1199switch (pTxRxPars->txrxPktType) {1200case MP_BT_PKT_DH1:1201payloadLenLimit = 27 * 8;1202break;1203case MP_BT_PKT_DH3:1204payloadLenLimit = 183 * 8;1205break;1206case MP_BT_PKT_DH5:1207payloadLenLimit = 339 * 8;1208break;1209case MP_BT_PKT_2DH1:1210payloadLenLimit = 54 * 8;1211break;1212case MP_BT_PKT_2DH3:1213payloadLenLimit = 367 * 8;1214break;1215case MP_BT_PKT_2DH5:1216payloadLenLimit = 679 * 8;1217break;1218case MP_BT_PKT_3DH1:1219payloadLenLimit = 83 * 8;1220break;1221case MP_BT_PKT_3DH3:1222payloadLenLimit = 552 * 8;1223break;1224case MP_BT_PKT_3DH5:1225payloadLenLimit = 1021 * 8;1226break;1227case MP_BT_PKT_LE:1228payloadLenLimit = 39 * 8;1229break;1230default: {1231RTW_INFO("[MPT], Error!! Unknown pTxRxPars->txrxPktType=0x%x\n", pTxRxPars->txrxPktType);1232pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1233return paraLen;1234}1235break;1236}12371238if (pTxRxPars->txrxPayloadLen > payloadLenLimit) {1239RTW_INFO("[MPT], Error!! pTxRxPars->txrxPayloadLen=0x%x, (should smaller than %d)\n",1240pTxRxPars->txrxPayloadLen, payloadLenLimit);1241pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1242return paraLen;1243}12441245h2cParaBuf[0] = pTxRxPars->txrxPktType;1246h2cParaBuf[1] = (u8)((pTxRxPars->txrxPayloadLen & 0xff));1247h2cParaBuf[2] = (u8)((pTxRxPars->txrxPayloadLen & 0xff00) >> 8);1248h2cParaLen = 3;1249retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1250}12511252/* ckeck bt return status. */1253if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1254pBtRsp->status = ((btOpcode << 8) | retStatus);1255RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1256return paraLen;1257}12581259/* fill h2c parameters */1260btOpcode = BT_LO_OP_SET_PKT_CNT_L_PL_TYPE;1261if (pTxRxPars->txrxPayloadType > MP_BT_PAYLOAD_MAX) {1262RTW_INFO("[MPT], Error!! pTxRxPars->txrxPayloadType=0x%x, (should be between 0~4)\n", pTxRxPars->txrxPayloadType);1263pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1264return paraLen;1265} else {1266h2cParaBuf[0] = (u8)((pTxRxPars->txrxTxPktCnt & 0xff));1267h2cParaBuf[1] = (u8)((pTxRxPars->txrxTxPktCnt & 0xff00) >> 8);1268h2cParaBuf[2] = pTxRxPars->txrxPayloadType;1269h2cParaLen = 3;1270retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1271}12721273/* ckeck bt return status. */1274if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1275pBtRsp->status = ((btOpcode << 8) | retStatus);1276RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1277return paraLen;1278}12791280/* fill h2c parameters */1281btOpcode = BT_LO_OP_SET_PKT_CNT_H_PKT_INTV;1282if (pTxRxPars->txrxTxPktInterval > 15) {1283RTW_INFO("[MPT], Error!! pTxRxPars->txrxTxPktInterval=0x%x, (should be between 0~15)\n", pTxRxPars->txrxTxPktInterval);1284pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1285return paraLen;1286} else {1287h2cParaBuf[0] = (u8)((pTxRxPars->txrxTxPktCnt & 0xff0000) >> 16);1288h2cParaBuf[1] = (u8)((pTxRxPars->txrxTxPktCnt & 0xff000000) >> 24);1289h2cParaBuf[2] = pTxRxPars->txrxTxPktInterval;1290h2cParaLen = 3;1291retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1292}12931294/* ckeck bt return status. */1295if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1296pBtRsp->status = ((btOpcode << 8) | retStatus);1297RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1298return paraLen;1299}13001301/* fill h2c parameters */1302btOpcode = BT_LO_OP_SET_WHITENCOEFF;1303{1304h2cParaBuf[0] = pTxRxPars->txrxWhitenCoeff;1305h2cParaLen = 1;1306retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1307}13081309/* ckeck bt return status. */1310if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1311pBtRsp->status = ((btOpcode << 8) | retStatus);1312RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1313return paraLen;1314}131513161317/* fill h2c parameters */1318btOpcode = BT_LO_OP_SET_CHNL_TX_GAIN;1319if ((pTxRxPars->txrxChannel > 78) ||1320(pTxRxPars->txrxTxGainIndex > 7)) {1321RTW_INFO("[MPT], Error!! pTxRxPars->txrxChannel=0x%x, (should be between 0~78)\n", pTxRxPars->txrxChannel);1322RTW_INFO("[MPT], Error!! pTxRxPars->txrxTxGainIndex=0x%x, (should be between 0~7)\n", pTxRxPars->txrxTxGainIndex);1323pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1324return paraLen;1325} else {1326h2cParaBuf[0] = pTxRxPars->txrxChannel;1327h2cParaBuf[1] = pTxRxPars->txrxTxGainIndex;1328h2cParaLen = 2;1329retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1330}13311332/* ckeck bt return status. */1333if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1334pBtRsp->status = ((btOpcode << 8) | retStatus);1335RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1336return paraLen;1337}13381339/* fill h2c parameters */1340btOpcode = BT_LO_OP_SET_BD_ADDR_L;1341if ((pTxRxPars->txrxBdaddr[0] == 0) &&1342(pTxRxPars->txrxBdaddr[1] == 0) &&1343(pTxRxPars->txrxBdaddr[2] == 0) &&1344(pTxRxPars->txrxBdaddr[3] == 0) &&1345(pTxRxPars->txrxBdaddr[4] == 0) &&1346(pTxRxPars->txrxBdaddr[5] == 0)) {1347RTW_INFO("[MPT], Error!! pTxRxPars->txrxBdaddr=all zero\n");1348pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1349return paraLen;1350}1351if ((pTxRxPars->txrxBdaddr[0] == 0xff) &&1352(pTxRxPars->txrxBdaddr[1] == 0xff) &&1353(pTxRxPars->txrxBdaddr[2] == 0xff) &&1354(pTxRxPars->txrxBdaddr[3] == 0xff) &&1355(pTxRxPars->txrxBdaddr[4] == 0xff) &&1356(pTxRxPars->txrxBdaddr[5] == 0xff)) {1357RTW_INFO("[MPT], Error!! pTxRxPars->txrxBdaddr=all 0xf\n");1358pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1359return paraLen;1360}13611362{1363h2cParaBuf[0] = pTxRxPars->txrxBdaddr[0];1364h2cParaBuf[1] = pTxRxPars->txrxBdaddr[1];1365h2cParaBuf[2] = pTxRxPars->txrxBdaddr[2];1366h2cParaLen = 3;1367retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1368}1369/* ckeck bt return status. */1370if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1371pBtRsp->status = ((btOpcode << 8) | retStatus);1372RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1373return paraLen;1374}13751376btOpcode = BT_LO_OP_SET_BD_ADDR_H;1377{1378h2cParaBuf[0] = pTxRxPars->txrxBdaddr[3];1379h2cParaBuf[1] = pTxRxPars->txrxBdaddr[4];1380h2cParaBuf[2] = pTxRxPars->txrxBdaddr[5];1381h2cParaLen = 3;1382retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1383}1384/* ckeck bt return status. */1385if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1386pBtRsp->status = ((btOpcode << 8) | retStatus);1387RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1388return paraLen;1389}13901391pBtRsp->status = BT_STATUS_SUCCESS;1392return paraLen;1393}1394139513961397u161398mptbt_BtTestCtrl(1399PADAPTER Adapter,1400PBT_REQ_CMD pBtReq,1401PBT_RSP_CMD pBtRsp1402)1403{1404u8 h2cParaBuf[6] = {0};1405u8 h2cParaLen = 0;1406u16 paraLen = 0;1407u8 retStatus = BT_STATUS_BT_OP_SUCCESS;1408u8 btOpcode;1409u8 btOpcodeVer = 0;1410u8 testCtrl = 0;14111412/* */1413/* check upper layer parameters */1414/* */14151416/* 1. check upper layer opcode version */1417if (pBtReq->opCodeVer != 1) {1418RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");1419pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;1420return paraLen;1421}1422/* 2. check upper layer parameter length */1423if (1 == pBtReq->paraLength) {1424testCtrl = pBtReq->pParamStart[0];1425RTW_INFO("[MPT], testCtrl=%d\n", testCtrl);1426} else {1427RTW_INFO("[MPT], Error!! wrong parameter length=%d (should be 1)\n", pBtReq->paraLength);1428pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;1429return paraLen;1430}14311432/* */1433/* execute lower layer opcodes */1434/* */14351436/* 1. fill h2c parameters */1437/* check bt mode */1438btOpcode = BT_LO_OP_TEST_CTRL;1439if (testCtrl >= MP_BT_TEST_MAX) {1440RTW_INFO("[MPT], Error!! testCtrl=0x%x, (should be between smaller or equal to 0x%x)\n",1441testCtrl, MP_BT_TEST_MAX - 1);1442pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;1443return paraLen;1444} else {1445h2cParaBuf[0] = testCtrl;1446h2cParaLen = 1;1447retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);1448}14491450/* 3. construct respond status code and data. */1451if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1452pBtRsp->status = ((btOpcode << 8) | retStatus);1453RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1454return paraLen;1455}14561457pBtRsp->status = BT_STATUS_SUCCESS;1458return paraLen;1459}146014611462u161463mptbt_TestBT(1464PADAPTER Adapter,1465PBT_REQ_CMD pBtReq,1466PBT_RSP_CMD pBtRsp1467)1468{14691470u8 h2cParaBuf[6] = {0};1471u8 h2cParaLen = 0;1472u16 paraLen = 0;1473u8 retStatus = BT_STATUS_BT_OP_SUCCESS;1474u8 btOpcode;1475u8 btOpcodeVer = 0;1476u8 testCtrl = 0;14771478/* 1. fill h2c parameters */1479btOpcode = 0x11;1480h2cParaBuf[0] = 0x11;1481h2cParaBuf[1] = 0x0;1482h2cParaBuf[2] = 0x0;1483h2cParaBuf[3] = 0x0;1484h2cParaBuf[4] = 0x0;1485h2cParaLen = 1;1486/* retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen); */1487retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, h2cParaBuf, h2cParaLen);148814891490/* 3. construct respond status code and data. */1491if (BT_STATUS_BT_OP_SUCCESS != retStatus) {1492pBtRsp->status = ((btOpcode << 8) | retStatus);1493RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);1494return paraLen;1495}14961497pBtRsp->status = BT_STATUS_SUCCESS;1498return paraLen;1499}15001501void1502mptbt_BtControlProcess(1503PADAPTER Adapter,1504void *pInBuf1505)1506{1507u8 H2C_Parameter[6] = {0};1508PBT_H2C pH2c = (PBT_H2C)&H2C_Parameter[0];1509PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);1510PBT_REQ_CMD pBtReq = (PBT_REQ_CMD)pInBuf;1511PBT_RSP_CMD pBtRsp;1512u8 i;151315141515RTW_INFO("[MPT], mptbt_BtControlProcess()=========>\n");15161517RTW_INFO("[MPT], input opCodeVer=%d\n", pBtReq->opCodeVer);1518RTW_INFO("[MPT], input OpCode=%d\n", pBtReq->OpCode);1519RTW_INFO("[MPT], paraLength=%d\n", pBtReq->paraLength);1520if (pBtReq->paraLength) {1521/* RTW_INFO("[MPT], parameters(hex):0x%x %d\n",&pBtReq->pParamStart[0], pBtReq->paraLength); */1522}15231524_rtw_memset((void *)pMptCtx->mptOutBuf, 0, 100);1525pMptCtx->mptOutLen = 4; /* length of (BT_RSP_CMD.status+BT_RSP_CMD.paraLength) */15261527pBtRsp = (PBT_RSP_CMD)pMptCtx->mptOutBuf;1528pBtRsp->status = BT_STATUS_SUCCESS;1529pBtRsp->paraLength = 0x0;15301531/* The following we should maintain the User OP codes sent by upper layer */1532switch (pBtReq->OpCode) {1533case BT_UP_OP_BT_READY:1534RTW_INFO("[MPT], OPcode : [BT_READY]\n");1535pBtRsp->paraLength = mptbt_BtReady(Adapter, pBtReq, pBtRsp);1536break;1537case BT_UP_OP_BT_SET_MODE:1538RTW_INFO("[MPT], OPcode : [BT_SET_MODE]\n");1539pBtRsp->paraLength = mptbt_BtSetMode(Adapter, pBtReq, pBtRsp);1540break;1541case BT_UP_OP_BT_SET_TX_RX_PARAMETER:1542RTW_INFO("[MPT], OPcode : [BT_SET_TXRX_PARAMETER]\n");1543pBtRsp->paraLength = mptbt_BtSetTxRxPars(Adapter, pBtReq, pBtRsp);1544break;1545case BT_UP_OP_BT_SET_GENERAL:1546RTW_INFO("[MPT], OPcode : [BT_SET_GENERAL]\n");1547pBtRsp->paraLength = mptbt_BtSetGeneral(Adapter, pBtReq, pBtRsp);1548break;1549case BT_UP_OP_BT_GET_GENERAL:1550RTW_INFO("[MPT], OPcode : [BT_GET_GENERAL]\n");1551pBtRsp->paraLength = mptbt_BtGetGeneral(Adapter, pBtReq, pBtRsp);1552break;1553case BT_UP_OP_BT_TEST_CTRL:1554RTW_INFO("[MPT], OPcode : [BT_TEST_CTRL]\n");1555pBtRsp->paraLength = mptbt_BtTestCtrl(Adapter, pBtReq, pBtRsp);1556break;1557case BT_UP_OP_TEST_BT:1558RTW_INFO("[MPT], OPcode : [TEST_BT]\n");1559pBtRsp->paraLength = mptbt_TestBT(Adapter, pBtReq, pBtRsp);1560break;1561default:1562RTW_INFO("[MPT], Error!! OPcode : UNDEFINED!!!!\n");1563pBtRsp->status = BT_STATUS_UNKNOWN_OPCODE_U;1564pBtRsp->paraLength = 0x0;1565break;1566}15671568pMptCtx->mptOutLen += pBtRsp->paraLength;15691570RTW_INFO("[MPT], pMptCtx->mptOutLen=%d, pBtRsp->paraLength=%d\n", pMptCtx->mptOutLen, pBtRsp->paraLength);1571RTW_INFO("[MPT], mptbt_BtControlProcess()<=========\n");1572}15731574#endif157515761577