diff --git a/pasdk/test_arm/framework/audioStreamDecodeProc.c b/pasdk/test_arm/framework/audioStreamDecodeProc.c
index 197af1dba413bc58b2d49605e887bda5d6afc699..effd395e41d8ea41477dd533e450733145de04b1 100644 (file)
#include "audioStreamProc_common.h"
#include "audioStreamDecodeProc.h"
+#include "statusOp_common.h"
+
+
// FL: debug
//#include "fwkSim.h"
#include "dbgCapAf.h"
PAF_AudioSize gDecAudioFrameChannelSizes[PAF_MAXNUMCHAN_AF];
PAF_AudioData *gDecOrigAudioFrameChannelPointers[PAF_MAXNUMCHAN_AF];
-// Underflow threshold before returning error to Top-Level FSM
+// Underflow threshold before circular buffer reset and return error to Top-Level FSM
#define DEC_OP_CB_WRTAF_OVR_THR ( 20 ) // FL: arbitrary setting
UInt32 gDecOpCbWrtAfOvr =0; // decoder output circular buffer overflow count
UInt32 gSlaveDecDecodeCnt =0;
UInt32 gSlaveDecDeactivateCnt =0;
+// debug
+UInt32 gCbWrtAfErrCnt =0; // decoder output circular buffer write error count
+
+// FL: (***) debug
+#include "evmc66x_gpio_dbg.h"
+
/*
* ======== taskAsdpFxn ========
Int status;
Int zI;
Int bufEnd, wrapSize, currentBufSize, chunkSize;
+ Int8 temp8;
Log_info0("Enter taskAsdpFxn()");
pP->fxns->memStatusPrint(HEAP_INTERNAL, HEAP_INTERNAL1, HEAP_EXTERNAL, HEAP_INTERNAL1_SHM);
}
+#ifdef NON_CACHE_STATUS
+ //
+ // init Status structure Gate
+ //
+ if (statusOp_Init(GATEMP_INDEX_DEC) == STATUSOP_INIT_FAIL)
+ {
+ TRACE_TERSE1("TaskAsdp: Gate Index %d:initialization status GateMP Fail.", GATEMP_INDEX_DEC);
+ }
+ if (statusOp_Init(GATEMP_INDEX_DDP) == STATUSOP_INIT_FAIL)
+ {
+ TRACE_TERSE1("TaskAsdp: Gate Index %d:initialization status GateMP Fail.", GATEMP_INDEX_DDP);
+ }
+ if (statusOp_Init(GATEMP_INDEX_PCM) == STATUSOP_INIT_FAIL)
+ {
+ TRACE_TERSE1("TaskAsdp: Gate Index %d:initialization status GateMP Fail.", GATEMP_INDEX_PCM);
+ }
+ if (statusOp_Init(GATEMP_INDEX_THD) == STATUSOP_INIT_FAIL)
+ {
+ TRACE_TERSE1("TaskAsdp: Gate Index %d:initialization status GateMP Fail.", GATEMP_INDEX_THD);
+ }
+#endif
+
// (***) FL: revisit
// write back Status structure addresses for Beta Units initialized on Slave
Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
// (***) FL: revisit
// write back Status structures for Beta Units initialized on Slave
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
+ /* size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
+ Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
+ Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), size, Cache_Type_ALLD, 0);
+ Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), size, Cache_Type_ALLD, 0);
size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+ Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), size, Cache_Type_ALLD, 0);
+ Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
Cache_wait();
// (***) FL: revisit
// write back Dec configuration
- Cache_wb(&pAstCfg->xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
- Cache_wait();
+ Cache_wbInv(&pAstCfg->xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+ Cache_wait();*/
// Send initialization complete message to master
queId = MessageQ_getReplyQueue(pAspMsg);
// invalidate Status structures for shared Beta Units
//size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
//Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
+ /*size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
- Cache_wait();
+ Cache_wait();*/
argIdx = 0; // get decIdx
z = *(Int32 *)&pAspMsg->buf[argIdx];
{
SW_BREAKPOINT;
}
+ gCbWrtAfErrCnt=0; // debug
+ gDecOpCbWrtAfOvr=0; // decoder output circular buffer overflow count
// FL: debug, log circular buffer control variables
cbLog(pCbCtl, z, 1, "cbWriteStart");
// Reset audio frame
// write back Status structures for shared Beta Units
//size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
//Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
+ /* size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
+ Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
- Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
- Cache_wait();
+ Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+ Cache_wait();*/
// send dec reset complete message to master
queId = MessageQ_getReplyQueue(pAspMsg);
TRACE_TERSE2("slaveCmd=%d,decIdx=%d", slaveCmd, z);
// Get input associated w/ decoder
zI = pP->inputsFromDecodes[z];
-
+
// (***) FL: revisit
// invalidate Inp configuration
Cache_inv(&pAstCfg->xInp[zI], sizeof(PAF_AST_InpBuf), Cache_Type_ALLD, 0);
size = pIpBufConfig->frameLength * pIpBufConfig->sizeofElement;
if (sourceSelect == PAF_SOURCE_PCM)
{
- size *= pIpBufConfig->stride;
+ size *= pIpBufConfig->stride;
}
bufEnd = (Int) pIpBufConfig->base.pVoid + pIpBufConfig->sizeofBuffer;
Cache_wb(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
- // Re-initialize audio frame if decoder is disabled or
- // doesn't have a valid input
+#ifdef NON_CACHE_STATUS
+ statusOp_read(&(temp8),
+ &(pAstCfg->xDec[z].decodeStatus.mode),
+ sizeof(Int8),
+ GATEMP_INDEX_DEC);
+ // Re-initialize audio frame if decoder is disabled or
+ // doesn't have a valid input
+ if (!temp8 || !pAstCfg->xInp[zI].hRxSio)
+ {
+ pP->fxns->initFrame1(pP, pQ, pC, z, 0);
+ }
+#else
+ // Re-initialize audio frame if decoder is disabled or
+ // doesn't have a valid input
if (!pAstCfg->xDec[z].decodeStatus.mode || !pAstCfg->xInp[zI].hRxSio)
{
pP->fxns->initFrame1(pP, pQ, pC, z, 0);
}
+#endif
// send dec info complete message to master
queId = MessageQ_getReplyQueue(pAspMsg);
errno = dec->fxns->decode(dec, NULL, &pAstCfg->xDec[z].decodeInStruct, &pAstCfg->xDec[z].decodeOutStruct);
if (errno < 0)
{
- SW_BREAKPOINT;
+ //SW_BREAKPOINT;
}
TRACE_TERSE0("Dec:decode done");
cbErrno = cbWriteAf(pCbCtl, z, pAfWrt);
if (cbErrno < 0)
{
+ gCbWrtAfErrCnt++;
//SW_BREAKPOINT; // FL: debug
if (cbErrno == ASP_DECOP_CB_WRITE_OVERFLOW)
{
- // Reset circular buffer
- cbReset(pCbCtl, z);
- // Update overflow count, return if above threshold
+ // Update underflow count.
+ // If above underflow threshold, reset circular buffer underflow count.
gDecOpCbWrtAfOvr++;
if (gDecOpCbWrtAfOvr < DEC_OP_CB_WRTAF_OVR_THR)
{
}
else
{
+ // Reset circular buffer
+ cbReset(pCbCtl, z);
+ //
gDecOpCbWrtAfOvr = 0;
}
}
}
TRACE_TERSE0("Dec:cbWriteAf() complete");
+#if 1 // (***) FL: shows timing of CB write
+ // (***) debug // B9
+ {
+ static Uint8 toggleState = 0;
+ if (toggleState == 0)
+ GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_107);
+ else
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_107);
+ toggleState = ~(toggleState);
+ }
+#endif
+
+
// FL: debug, log circular buffer control variables
cbLog(pCbCtl, z, 1, "cbWriteAf");
}
Cache_wb(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
+#ifdef NON_CACHE_STATUS
+ statusOp_read(&(temp8),
+ &(pAstCfg->xDec[z].decodeStatus.mode),
+ sizeof(Int8),
+ GATEMP_INDEX_DEC);
// Re-initialize audio frame if decoder is disabled or
// doesn't have a valid input
+ if (!temp8 || !pAstCfg->xInp[zI].hRxSio)
+ {
+ pP->fxns->initFrame1(pP, pQ, pC, z, 0);
+ }
+#else
+ // Re-initialize audio frame if decoder is disabled or
+ // doesn't have a valid input
if (!pAstCfg->xDec[z].decodeStatus.mode || !pAstCfg->xInp[zI].hRxSio)
{
pP->fxns->initFrame1(pP, pQ, pC, z, 0);
}
-
+#endif
// send dec info complete message to master
queId = MessageQ_getReplyQueue(pAspMsg);
pAspMsg->procId = hAspMsgSlave->slaveProcId;
TRACE_TERSE0("PAF_ASDT_initPhaseCommon: calling PAF_ALG_setup.");
PAF_ALG_setup(&pafAlgConfig,
- HEAP_ID_INTERNAL, HEAP_INTERNAL,
- HEAP_ID_INTERNAL1, HEAP_INTERNAL1,
- HEAP_ID_EXTERNAL, HEAP_EXTERNAL,
- HEAP_ID_INTERNAL1_SHM, HEAP_INTERNAL1_SHM,
- HEAP_ID_EXTERNAL_SHM, HEAP_EXTERNAL_SHM,
+ HEAP_ID_INTERNAL, HEAP_INTERNAL,
+ HEAP_ID_INTERNAL1, HEAP_INTERNAL1,
+ HEAP_ID_EXTERNAL, HEAP_EXTERNAL,
+ HEAP_ID_INTERNAL1_SHM, HEAP_INTERNAL1_SHM,
+ HEAP_ID_EXTERNAL_SHM, HEAP_EXTERNAL_SHM,
+ HEAP_ID_EXTERNAL_NONCACHED_SHM, HEAP_EXTERNAL_NONCACHED_SHM,
HEAP_CLEAR);
if (pP->fxns->headerPrint)
//maxFrameLength += PA_MODULO - maxFrameLength % PA_MODULO; // compute maximum framelength (needed for ARC support)
//aLen = numchan[z] * maxFrameLength;
aLen = numchan[z] * maxFrameLength + (maxFrameLength - FRAMELENGTH); /* Qin - need additional memory for starting offset
- See line 1307 */
+ See line 1301 */
//
// Initialize audio frame elements directly