diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.c b/pasdk/test_dsp/framework/audioStreamInpProc.c
index 9dbed6ce80cffae98f67005b1fcbfdb71b7ecbc0..bf595044718a60f6a722487abb1ccd78f2b7b70b 100644 (file)
};
// Global debug counters */
-UInt32 gTaskAsipCnt=0; // debug
-UInt32 gAsipInitCnt =0;
-UInt32 gAsipInfo1Cnt =0;
-UInt32 gAsipInfo2Cnt =0;
-UInt32 gAsipDecodeCnt =0;
-UInt32 gAsipDecodeErrCnt =0;
-UInt32 gAsipFinalCnt =0;
-UInt32 gAsipQuitCnt =0;
-UInt32 gIbReset_cnt =0;
-UInt32 gcapIb_cnt =0;
+UInt32 gTaskAsipCnt =0;
+UInt32 gAsipInitCnt =0;
+UInt32 gAsipInfo1Cnt =0;
+UInt32 gAsipInfo2Cnt =0;
+UInt32 gAsipDecodeCnt =0;
+UInt32 gAsipDecodeErrCnt =0;
+UInt32 gAsipFinalCnt =0;
+UInt32 gAsipQuitCnt =0;
+UInt32 gAsipInfo1_PrimaryErrCnt =0;
+UInt32 gAsipInfo1_ErrCnt =0;
UInt32 gAsipInfo2_PrimaryErrCnt =0;
-UInt32 gAsipInfo2_ErrCnt =0;
+UInt32 gAsipInfo2_ErrCnt =0;
+UInt32 gCapIbReset_cnt =0;
+UInt32 gCapIb_cnt =0;
+// debug
+UInt32 gCbWrtAfErrCnt =0; // decoder output circular buffer write error count (returned from ARM to DSP)
+
-#include "dbgDib.h"
+#include "dbgDib.h" // debug
extern struct {
Int size;
IALG_Status *pStatus[512];
} IACP_STD_BETA_TABLE;
+// FL: debug
+#include "evmc66x_gpio_dbg.h"
/*
* ======== taskAsipFxn ========
#ifdef NON_CACHE_STATUS
Int8 tempVar8;
#endif
+ Task_Handle taskHandle;
Log_info0("Enter taskAsipFxn()");
pAstCfg->as = as;
TRACE_TERSE1("TaskAsip: Started with AS%d.", as);
+ taskHandle = Task_self();
+
//
// Initialize message log trace and line number reporting
//
// FL: debug, reset IB capture buffer
capIbReset();
- gIbReset_cnt++;
+ gCapIbReset_cnt++;
Log_info0("capIbReset()");
// FL: send source select message to slave
TRACE_VERBOSE1(procName[sourceProgram], as+zMS);
+ // Reduce priority level since autodetection complete
+ Task_setPri(taskHandle, Task_getPri(taskHandle)-1);
+
TRACE_VERBOSE0("TaskAsip: calling decodeProcessing.");
errno = pP->fxns->decodeProcessing(pP, pQ, pC, sourceSelect);
if (errno)
TRACE_VERBOSE0("TaskAsip: decodeProcessing complete with no error.");
}
+ // Increase priority level since decoding complete
+ Task_setPri(taskHandle, Task_getPri(taskHandle)+1);
+
// FL: send dec exit message to slave
pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg); /* set the return address in the message header */
nbytes = SIO_reclaim(pAstCfg->xInp[zMI].hRxSio, (Ptr)&pAstCfg->xInp[zMI].pInpBuf, NULL);
if (nbytes == -DIBERR_SYNC)
{
+#if 0 // (***) FL: shows timing of autosync restart
+ // (***) debug // B5
+ {
+ static Uint8 toggleState = 0;
+ if (toggleState == 0)
+ GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_99);
+ else
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_99);
+ toggleState = ~(toggleState);
+ }
+#endif
+
TRACE_TERSE2("PAF_ASIT_autoProcessing: AS%d: SIO_reclaim returned 0x%x, ignoring", as+zMS, nbytes);
- return 0;
+ return nbytes;
}
if (nbytes != sizeof(PAF_InpBufConfig))
{
return errno;
} //PAF_ASIT_autoProcessing
+UInt32 gProbe1Err=0;
+UInt32 gProbe2Err=0;
+UInt32 gMajorAuMissed=0;
+
// -----------------------------------------------------------------------------
// ASIT Processing Function - Decode Processing
//
Int frame; // decoder input frame count
Int block; // (***) FL: formerly -- decoder output block count / input frame
#ifdef NON_CACHE_STATUS
- Int8 tempVar8;
+ Int8 tempVar8, temp2Var8;
#endif
pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
for (;;)
{
+ statusOp_read(&tempVar8,
+ &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ sizeof(tempVar8),
+ GATEMP_INDEX_DEC);
if (tempVar8 == PAF_SOURCE_NONE)
{
#else
gAsipInitCnt++;
Log_info0("TaskAsip: state=INIT");
- // (***) FL: revisit
-#if 1 // status for shared beta units can change (e.g. at-boot or alpha)
+#if 0 // Not necessary since decoder status is in uncached memory
+ // status for shared beta units can change (e.g. at-boot or alpha)
+
// 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;
+ 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_DDP]->size;
Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
- Cache_wait();*/
+ 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();
#endif
-#if 0
+#if 0 // Not necessary since decoder status is in uncached memory
////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;
break;
}
-#if 1
- // (***) FL: revisit
+ //
+ // Not necessary since decoder status is in uncached memory
+ //
+
+#if 0 // Not necessary since decoder status is in uncached memory
// 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);
- Cache_wait();*/
+ 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();
#endif
frame = 0;
// Establish primary timing
if (errno = pP->fxns->decodeInfo(pP, pQ, pC, frame, block))
{
+ gAsipInfo1_PrimaryErrCnt++;
TRACE_TERSE1("INFO1: errno 0x%x after decodeInfo, primary timing", errno);
break;
}
&(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
sizeof(tempVar8),
GATEMP_INDEX_DEC);
+ statusOp_read(&temp2Var8,
+ &(pAstCfg->xDec[zMD].decodeStatus.sampleRate),
+ sizeof(tempVar8),
+ GATEMP_INDEX_DEC);
// Don't start decode until major access unit is found.
if (((tempVar8 == PAF_SOURCE_THD) ||
(tempVar8 == PAF_SOURCE_DXP) ||
(tempVar8 == PAF_SOURCE_DTSHD)) &&
- (pAstCfg->xStr[zMS].pAudioFrame->sampleRate == PAF_SAMPLERATE_UNKNOWN))
+ (temp2Var8 == PAF_SAMPLERATE_UNKNOWN))
#else
// Don't start decode until major access unit is found.
if (((pAstCfg->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_THD) ||
(pAstCfg->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_DXP) ||
(pAstCfg->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_DTSHD)) &&
- (pAstCfg->xStr[zMS].pAudioFrame->sampleRate == PAF_SAMPLERATE_UNKNOWN))
+ (pAstCfg->xDec[zMD].decodeStatus.sampleRate == PAF_SAMPLERATE_UNKNOWN))
#endif
{
Int z;
if (SIO_issue(pAstCfg->xInp[zI].hRxSio, &pAstCfg->xInp[zI].inpBufConfig,
sizeof(pAstCfg->xInp[zI].inpBufConfig), PAF_SIO_REQUEST_NEWFRAME))
{
+ gProbe2Err++;
TRACE_TERSE0("PAF_ASIT_decodeProcessing. %d: INFO1, return (ASPERR_ISSUE)");
return (ASPERR_ISSUE);
}
}
}
TRACE_VERBOSE1("PAF_ASIT_decodeProcessing: INFO1: frame %d, not major access unit", frame);
+ gMajorAuMissed++; // debug
frame++;
state = INFO1;
continue;
if (errno = pP->fxns->decodeInfo1(pP, pQ, pC, frame, block))
{
TRACE_VERBOSE1("PAF_ASIT_decodeProcessing: INFO1, errno 0x%x. break after decodeInfo1", errno);
+ gAsipInfo1_ErrCnt++;
break;
}
Int zMI;
ASP_Msg* pAspMsg; /* Messaging */
Int argIdx;
- Int decErrno;
Int status;
#ifdef NON_CACHE_STATUS
Int8 tempVar8;
TRACE_MSG1("decErrno=%d", pAspMsg->buf[0]);
argIdx = 0; // get decErrno
- decErrno = *(Int32 *)&pAspMsg->buf[argIdx];
- if (decErrno != 0)
- {
- return decErrno;
- }
+ errno = *(Int32 *)&pAspMsg->buf[argIdx];
}
else
{
+ //
+ // Invalid message received
+ //
TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
SW_BREAKPOINT; // temporary
return -1; // temporary
{
SW_BREAKPOINT;
}
-
+
// (***) FL: revisit
// invalidate Dec configuration
Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
- Cache_wait();
+ Cache_wait();
#if 0 // FL: decoder reset call, slave
if (dec->fxns->reset
&pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus)))
return errno;
#endif
+ if (errno != 0)
+ {
+ return errno;
+ }
#ifdef NON_CACHE_STATUS
gear = 0; // due to size difference
return ASPERR_RECLAIM;
}
- // FL: debug, capture input buffer AFTER cache_inv
- //Cache_inv (pAstCfg->xInp[zMI].pInpBuf->pntr.pSmInt, (pAstCfg->xInp[zMI].pInpBuf->frameLength * pAstCfg->xInp[zMI].pInpBuf->sizeofElement), Cache_Type_ALLD, 0);
- //Cache_wait();
-
+ // FL: debug, capture input buffer
capIb(pAstCfg->xInp[zMI].pInpBuf);
- gcapIb_cnt++;
+ gCapIb_cnt++;
+#if 0 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
+ // (***) debug // B5
+ {
+ static Uint8 toggleState = 0;
+ if (toggleState == 0)
+ GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_99);
+ else
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_99);
+ toggleState = ~(toggleState);
+ }
+#endif
+
//
// Simulate Rx SIO_reclaim() pend
//
SW_BREAKPOINT;
return -1; // temporary
}
- if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
- (pAspMsg->cmd != ASP_MASTER_DEC_INFO_DONE) ||
- (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+ if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) &&
+ (pAspMsg->cmd == ASP_MASTER_DEC_INFO_DONE) &&
+ (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+ {
+ hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
+ TRACE_TERSE3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+ TRACE_MSG1("decErrno=%d", pAspMsg->buf[0]);
+
+ argIdx = 0; // get decErrno
+ errno = *(Int32 *)&pAspMsg->buf[argIdx];
+ }
+ else
{
+ //
+ // Invalid message received
+ //
TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
SW_BREAKPOINT; // temporary
- }
- hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
- TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+ return -1; // temporary
+ }
// free the message
status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
if (status != MessageQ_S_SUCCESS)
TRACE_TERSE1("return error errno 0x%x.", errno);
return errno;
}
+
#ifdef NON_CACHE_STATUS
statusOp_read(&tempVar,
&(pAstCfg->xDec[z].decodeStatus.frameCount),
hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- argIdx = 0;
+ argIdx = 0; // get decErrno
errno = *(Int32 *)&pAspMsg->buf[argIdx];
- argIdx += sizeof(Int32);
+ argIdx += sizeof(Int32); // get cbErrno
cbErrno = *(Int32 *)&pAspMsg->buf[argIdx];
if (cbErrno != 0)
{
+ gCbWrtAfErrCnt++;
TRACE_TERSE1("CB write error=%d", cbErrno);
- SW_BREAKPOINT; // temporary
+ //SW_BREAKPOINT; // temporary
}
}
else
{
+ //
+ // Invalid message received
+ //
TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
SW_BREAKPOINT; // temporary
}