From 420778fcee054257d540cf24fbf1b1e3f9fc0d9f Mon Sep 17 00:00:00 2001 From: graydon <weidong.gao@cretone.cn> Date: 星期三, 28 二月 2024 10:36:07 +0800 Subject: [PATCH] 合并近期修改。 --- src/messageproc.cpp | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/messageproc.cpp b/src/messageproc.cpp index e371790..21fbd87 100644 --- a/src/messageproc.cpp +++ b/src/messageproc.cpp @@ -27,8 +27,12 @@ s32 Message::Send(MSG* pmsg ) { + extern u32 g_spiQ_drop_cnt; u32 ret= txQueue->Push(*pmsg); - + if(ret == 0) { + g_spiQ_drop_cnt++; + set_error(DSP_SPIQ_OVERRANGE); + } return ret; } @@ -36,6 +40,7 @@ { static u8* bin = NULL; extern ubool TopoLoading ; + extern eErrStatus err_status; if(pmsg->pktNo == 0 && bin != NULL ) { sram_free(SRAM_DDR, bin); @@ -52,10 +57,14 @@ u32 size = (pmsg->totalPkts -1)*MSG_DATA_LEN+pmsg->dataLen; uLongf realsize = size*10; Bytef* uncompress_ptr = (Bytef*)sram_malloc(SRAM_DDR, mem_any ,realsize); + ErrStatus err = ErrStatus::ERR_PARAM; if(uncompress_ptr){ if(tob && uncompress(uncompress_ptr, &realsize, (Bytef*)bin, size) == Z_OK) { - tob->toCtrl(uncompress_ptr, realsize); + err = tob->toCtrl(uncompress_ptr, realsize); + } + if(err != ErrStatus::SUCCESS){ + set_error(DSP_PRESET_INVALID); } sram_free(SRAM_DDR, uncompress_ptr); } @@ -89,6 +98,7 @@ memcpy(bin+pmsg->pktNo*MSG_DATA_LEN, pmsg->data , pmsg->dataLen); if(pmsg->pktNo == pmsg->totalPkts -1) { ToB* tob = ToB::GetInstance(); + ErrStatus err = ErrStatus::SUCCESS; size = (pmsg->totalPkts -1)*MSG_DATA_LEN+pmsg->dataLen; SetTxRxNullBufferPtr(); @@ -96,11 +106,14 @@ if(tob) { tob->toClear(); - tob->CreateModule(bin, size); + err = tob->CreateModule(bin, size); } + if(err != ErrStatus::SUCCESS) { + set_error(DSP_TOPO_INVALID); + } + sram_free(SRAM_DDR, bin); bin = NULL; - if(TopoRequest) { Send(MsgType::MSG_TOPO_RES, 0 ,0) ; TopoRequest = ufalse; @@ -168,11 +181,17 @@ { struct DSPStatus* status = (struct DSPStatus*)pmsg->data; extern ufloat cpu_utility(); + extern u32 g_spiQ_drop_cnt; + ToB* tob = ToB::GetInstance(); status->mCpu = cpu_utility()*100; //all modules execute time.; status->mInternalUnUsedMem = space_unused(); status->mExternalUnUsedMem = sram_free_space(SRAM_DDR,mem_any); - status->mDDRPassed = 1; + status->mSPIQDropCnt = g_spiQ_drop_cnt; + status->mErrStatus = err_status; + status->mLevelPacketsNum = tob?tob->GetLevelPacketNum():0; + status->mModuleCnt = tob?tob->GetModuleNum():0; + pmsg->Enc(MsgType::MSG_DSP_STATUS_RES, 0, sizeof(struct DSPStatus)); @@ -221,7 +240,7 @@ { u32 status = 0; - if(SPITxDone) { + if(SPIRxDone) { RxMessageHandler((MSG*)SPI_Rx_BUFFER); if(txQueue->Count() > 0) { txQueue->Pop(*(MSG*)SPI_Tx_BUFFER); -- Gitblit v1.9.3