diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.c b/pasdk/test_dsp/framework/audioStreamInpProc.c
index 4c8dfc333c97e7184a259c38ade6c3da48512798..f03d8907e13ccfbe0f79c216463bf97584c2f3d5 100644 (file)
#include <sio.h>
#include <pafsio_ialg.h>
+#include "ioConfig.h"
+
#include "common.h"
#include "paf_heapMgr.h"
#include "aspMsg_common.h"
Int32 gNumPfpAsit1=0; // debug
Int32 gNumPfpAsit2=0;
-
-
-// FL: debug
-#include "dbgCapAf.h"
+// debug
+//#include "dbgCapAf.h"
// -----------------------------------------------------------------------------
#define TR_MOD trace
// Allow a developer to selectively enable tracing.
-#define CURRENT_TRACE_MASK 0x21
+#define CURRENT_TRACE_MASK 0x27
#define TRACE_MASK_TERSE 0x01 // only flag errors and show init
#define TRACE_MASK_GENERAL 0x02 // half dozen lines per frame
//
//#define DEC_Handle PCM_Handle /* works for all: SNG, PCM, AC3, DTS, AAC */
-//#define ENC_Handle PCE_Handle /* works for all: PCE */
#define __TASK_NAME__ "TaskAsip"
//
-// Audio Stream Output Task definitions
+// Audio Stream Input Task definitions
//
#define ASIP_FRAMELEN_SS_DEFAULT ( 256 )
-// FL: pP->frameLength
-//#define ASIP_FRAMELEN_SS_PCM ( FRAMELENGTH )
-// FL: (***) hard-coded
-#define ASIP_FRAMELEN_SS_DDP_AC3 ( 1536 )
-// FL: (***) hard-coded
-#define ASIP_FRAMELEN_SS_THD ( 1536 ) //QIN FIX ME
+#define ASIP_FRAMELEN_SS_PCM ( FRAMELENGTH ) // pP->frameLength
+#define ASIP_FRAMELEN_SS_DDP_AC3 ( 1536 ) // hard-coded
+#define ASIP_FRAMELEN_SS_THD ( 1536 ) // hard-coded
+#define ASIP_FRAMELEN_SS_DTS ( 512 )
// Compute decoder frame length based on selected source
-static Int getFrameLengthSourceSel(
+Int getFrameLengthSourceSel(
const PAF_ASIT_Params *pP,
Int8 sourceSelect
);
LINNO_DEFN(TaskAsip); /* Line number macros */
ERRNO_DEFN(TaskAsip); /* Error number macros */
+// ASIT ASP messaging
+AspMsgMaster_Module gAsitAspMsgMaster; // ASIT message master
+
// ASIT configuration
#pragma DATA_SECTION(gPAF_ASIT_config, ".globalSectionPafAsitConfig")
PAF_ASIT_Config gPAF_ASIT_config = {
NULL, // taskHandle
NULL, // acp
+ &gAsitAspMsgMaster, // hAspMsgMaster
&gPAF_ASPM_config, // pAspmCfg, shared ASIT/ASOT configuration
- &gPAF_AST_config // pAstCfg, shared ASIT/ASOT/ASDT configuration
+ &gPAF_AST_config, // pAstCfg, shared ASIT/ASOT/ASDT configuration
+ NULL, // pIoInp, ASIT IO configuration
+ 0 // inpDec, ASIT state
};
+// For writeDECCommandRestart
+volatile UInt32 gCommandOutputTask_SYNC =0;
+volatile UInt32 gCommandOutputTask_ACK =0;
+
// Global debug counters */
-UInt32 gTaskAsipCnt =0;
+UInt32 gAsipRxSioReclaimCnt =0;
UInt32 gAsipInitCnt =0;
UInt32 gAsipInfo1Cnt =0;
UInt32 gAsipInfo2Cnt =0;
UInt32 gAsipInfo1_ErrCnt =0;
UInt32 gAsipInfo2_PrimaryErrCnt =0;
UInt32 gAsipInfo2_ErrCnt =0;
+// debug
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" // debug
extern struct {
IALG_Status *pStatus[512];
} IACP_STD_BETA_TABLE;
-// FL: debug
-#include "evmc66x_gpio_dbg.h"
+// debug
+//#include "evmc66x_gpio_dbg.h"
/*
- * ======== taskAsipFxn ========
- * Audio Stream Input Processing task function
+ * ======== taskAsipFxnInit ========
+ * Audio Stream Input Processing initialization function
*/
-Void taskAsipFxn(
-// Int betaPrimeValue, // FL: revisit
+Void taskAsipFxnInit(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ
)
{
- PAF_ASIT_Config *pAsitCfg; /* ASIT configuration pointer */
- PAF_AST_Config *pAstCfg; /* AST Common (shared) configuration pointer */
- Int as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* input/encode/stream/decode/output counter */
- Int i; /* phase */
- Int errno; /* error number */
- Int zMD, zMI, zMS, zX;
- Int loopCount = 0; // used to stop trace to see startup behavior.
- UInt32 curTime;
+ PAF_ASIT_Config *pAsitCfg; // ASIT configuration pointer
+ PAF_AST_Config *pAstCfg; // AST Common (shared) configuration pointer
+ PAF_AST_IoInp *pInp; /* Input I/O components */
+ AspMsgMaster_Handle hAspMsgMaster; // ASIT message master handle
+ Int as; // Audio Stream Number (1, 2, etc.)
+ Int z; // input/encode/stream/decode/output counter
+ Int i; // phase
+ Int zMI, zMS, zX;
Int size;
- // Messaging
- ASP_Msg *pAspMsg;
Int status;
-#ifdef NON_CACHE_STATUS
- Int8 tempVar8;
-#endif
- Log_info0("Enter taskAsipFxn()");
+ Log_info0("Enter taskAsipFxnInit()");
//
// Audio Stream Input Task Parameters & Patch (*pP, *pQ)
//
- if (!pP)
+ if (!pP)
{
TRACE_TERSE0("TaskAsip: No Parameters defined. Exiting.");
LINNO_RPRT(TaskAsip, -1);
TRACE_TERSE0("TaskAsip: No Patchs defined. Exiting.");
LINNO_RPRT(TaskAsip, -1);
return;
- }
-
+ }
+
//
// Audio Stream Input Task Configuration (*pAsitCfg):
//
- pAsitCfg = &gPAF_ASIT_config; // initialize pointer to task configuration
- pAsitCfg->taskHandle = Task_self(); // set task handle
- pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ pAsitCfg = &gPAF_ASIT_config; // initialize pointer to task configuration
+ pAsitCfg->taskHandle = Task_self(); // set task handle
+ pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ hAspMsgMaster = pAsitCfg->hAspMsgMaster; // get message master handle
/* Set Audio Stream Number (1, 2, etc.) */
as = gBetaPrimeValue + 1;
- pAstCfg->as = as;
+ pAstCfg->as = as;
TRACE_TERSE1("TaskAsip: Started with AS%d.", as);
//
TRACE_TERSE1("TaskAsip: AS%d: initiated", as+z);
}
LINNO_RPRT(TaskAsip, -1);
-
+
//
// Determine decoder and stream indices associated with the master input
//
break;
}
}
- zMD = pAstCfg->masterDec;
zMS = pAstCfg->masterStr;
// Initialize as per parametrized phases:
// - AlgKey: Dec/Enc chain to Array Initialization
// - Device: I/O Device Initialization
// - DecOpCircBuf: Decoder Output Circular Buffer
- // - Unused: (available)
+ // - OutIS: Output Init-Sync
//
LINNO_RPRT(TaskAsip, -2);
for (i=0; i < lengthof(pP->fxns->initPhase); i++)
if (pP->fxns->initPhase[i])
{
linno = pP->fxns->initPhase[i](pP, pQ, pAsitCfg);
- if (linno)
+ if (linno)
{
LINNO_RPRT(TaskAsip, linno);
return;
}
}
- else
+ else
{
TRACE_TERSE1("TaskAsip: AS%d: initialization phase - null", as+zMS);
}
if (pP->fxns->memStatusPrint)
{
pP->fxns->memStatusPrint("ASIT MEMSTAT REPORT",
- HEAP_INTERNAL, HEAP_INTERNAL1, HEAP_EXTERNAL,
+ HEAP_INTERNAL, HEAP_INTERNAL1, HEAP_EXTERNAL,
HEAP_INTERNAL1_SHM, HEAP_EXTERNAL_SHM, HEAP_EXTERNAL_NONCACHED_SHM);
}
-
- // (***) FL: revisit
+
// write back AST shared configuration
Cache_wb(pAstCfg, sizeof(PAF_AST_Config), 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();
- // (***) FL: revisit
// write back entire beta table
Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[0]), 512*sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_wait();
-
- // FL: send start initialization 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 */
- pAspMsg->cmd = ASP_SLAVE_START; /* fill in message payload */
- pAspMsg->procId = hAspMsgMaster->masterProcId;
- pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
- pAspMsg->expectResp = TRUE;
- TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg); /* send message */
- if (status != MessageQ_S_SUCCESS)
+
+ // send start initialization message to slave
+ status = AspMsgSnd(hAspMsgMaster, ASP_SLAVE_START, NULL);
+ if (status != ASP_MSG_NO_ERR)
{
SW_BREAKPOINT;
}
+
// wait for initialization complete message from slave
+ // no other thread is allowed to run until Slave finishes startup
do {
- //status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, 0); // FL: no other thread is allowed to run until Slave finished startup
- } while ((status != MessageQ_S_SUCCESS) || (pAspMsg->cmd != ASP_MASTER_START_DONE));
- if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
- (pAspMsg->cmd != ASP_MASTER_START_DONE) ||
- (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
- {
- TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- SW_BREAKPOINT;
- }
- 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);
- status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
- if (status != MessageQ_S_SUCCESS)
+ status = AspMsgRcvAck(hAspMsgMaster, ASP_MASTER_START_DONE, NULL, FALSE);
+ } while (status == ASP_MSG_ERR_QUEUE_TIMEOUT);
+ if (status != ASP_MSG_NO_ERR)
{
SW_BREAKPOINT;
}
- // (***) FL: revisit
// invalidate Status structure addresses for Beta Units initialized on Slave
Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+ Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+ Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+ Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
Cache_wait();
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]) Log_info0("ERROR: beta unit for Dec==NULL");
- if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]) Log_info0("ERROR: beta unit for Dec==NULL");
-
- // (***) FL: revisit
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]) Log_info0("WARNING: beta unit for Dec==NULL");
+ if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]) Log_info0("WARNING: beta unit for Dec==NULL");
+
// invalidate Status structures for Beta Units initialized on Slave
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(Int), Cache_Type_ALLD, 0);
- 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);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), sizeof(Int), Cache_Type_ALLD, 0);
- 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);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), size, Cache_Type_ALLD, 0);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(Int), 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_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(Int), 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_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(Int), Cache_Type_ALLD, 0);
- size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]->size;
- Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), size, Cache_Type_ALLD, 0);
- Cache_wait();
-
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(Int), Cache_Type_ALLD, 0);
+ 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);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), sizeof(Int), Cache_Type_ALLD, 0);
+ 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);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(Int), 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();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(Int), 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();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+ if (IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2] != NULL)
+ {
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), sizeof(Int), Cache_Type_ALLD, 0);
+ size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]->size;
+ Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), size, Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
+
#ifdef NON_CACHE_STATUS
// Get the shared status structure GateMP handles. Initialized at slave.
if (statusOp_Init(GATEMP_INDEX_DEC) == STATUSOP_INIT_FAIL)
{
Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_THD);
}
+ if (statusOp_Init(GATEMP_INDEX_DTS) == STATUSOP_INIT_FAIL)
+ {
+ Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_DTS);
+ }
#endif
- // (***) FL: revisit
// invalidate Dec configuration
Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
+
+ pInp = &pAsitCfg->pIoInp[zMI]; // pointer to input I/O components
+ pInp->asipState = ASIT_RESET;
+ pInp->firstTimeInit = TRUE;
+ pInp->numAsitRestart = 0;
+ pInp->hMcaspChan = NULL;
+
+} /* taskAsipFxnInit */
+
+/*
+ * ======== taskAsipFxn ========
+ * Audio Stream Input Processing task function
+ */
+#ifdef PASDK_SIO_DEV
+Void taskAsipFxn(
+#else
+Void taskAsipFxn_Not_Used(
+#endif
+ const PAF_ASIT_Params *pP,
+ const PAF_ASIT_Patchs *pQ
+)
+{
+ PAF_ASIT_Config *pAsitCfg; // ASIT configuration pointer
+ PAF_AST_Config *pAstCfg; // AST Common (shared) configuration pointer
+ AspMsgMaster_Handle hAspMsgMaster; // ASIT message master handle
+ Int as; // Audio Stream Number (1, 2, etc.)
+ Int z; // input/encode/stream/decode/output counter
+ Int errno; // error number
+ Int zMD, zMI, zMS;
+ Int loopCount = 0; // used to stop trace to see startup behavior.
+ // Messaging
+ Int8 tempVar8;
+ char asipMsgBuf[ASP_MSG_BUF_LEN];
+ Int status;
+
+ Log_info0("Enter taskAsipFxn()");
+
+ taskAsipFxnInit(pP, pQ); // initialization of input task
+
+ //
+ // Audio Stream Input Task Configuration (*pAsitCfg):
+ //
+ pAsitCfg = &gPAF_ASIT_config; // initialize pointer to task configuration
+ pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ hAspMsgMaster = pAsitCfg->hAspMsgMaster; // get message master handle
+
+ /* Set Audio Stream Number (1, 2, etc.) */
+ as = pAstCfg->as;
+
+ //
+ // Determine decoder and stream indices associated with the master input
+ //
+ zMI = pP->zone.master;
+ zMD = pAstCfg->masterDec;
+ zMS = pAstCfg->masterStr;
//
// Main processing loop
// any error forces idling of input
if (errno)
{
+ // If gCommandOutputTask_SYNC invoked by writeDECCommandRestart, wait for output task in sync ...
+ if (gCommandOutputTask_SYNC) {
+ TRACE_VERBOSE1("TaskAsip: writeDECCommandRestart issued ... Wait for ack from output task side (errno=%d)", errno);
+ // Wait for ack
+ while (gCommandOutputTask_ACK == 0) {
+ Task_sleep(1);
+ }
+ TRACE_VERBOSE0("TaskAsip: writeDECCommandRestart issued ... Sync-ed! Startover the process");
+ gCommandOutputTask_ACK = 0;
+ gCommandOutputTask_SYNC = 0;
+ }
+
for (z=INPUT1; z < INPUTN; z++)
{
if (pAstCfg->xInp[z].hRxSio)
// so set to unknown and skip any remaining processing
if (!pAstCfg->xInp[zMI].hRxSio)
{
-#ifdef NON_CACHE_STATUS
- tempVar8 = PAF_SOURCE_UNKNOWN;
- statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
- &tempVar8,
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
-#else
- pAstCfg->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_UNKNOWN;
-#endif
+ sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
+ (Int8)PAF_SOURCE_UNKNOWN, GATEMP_INDEX_DEC);
+
TRACE_VERBOSE1("TaskAsip: AS%d: No input selected...", as+zMS);
continue;
}
TRACE_VERBOSE1("TaskAsip: continue as updateInputStatus returns 0x%x", errno);
continue;
}
-
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.mode),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+
// If master decoder is not enabled, or the input is unlocked, then do nothing
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (!tempVar8 || !pAstCfg->xInp[zMI].inpBufStatus.lock)
{
TRACE_VERBOSE0("TaskAsip: Not locked, continue");
continue;
}
-#else
- // If master decoder is not enabled, or the input is unlocked, then do nothing
- if (!pAstCfg->xDec[zMD].decodeStatus.mode || !pAstCfg->xInp[zMI].inpBufStatus.lock)
- {
- TRACE_VERBOSE0("TaskAsip: Not locked, continue");
- continue;
- }
-#endif
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
// If no source selected then do nothing
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
if (tempVar8 == PAF_SOURCE_NONE)
{
- tempVar8 = PAF_SOURCE_NONE;
- statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
- &tempVar8,
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
+ (Int8)PAF_SOURCE_NONE, GATEMP_INDEX_DEC);
TRACE_VERBOSE1("TaskAsip: AS%d: no source selected, continue", as+zMS);
continue;
}
-#else
- // If no source selected then do nothing
- if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_NONE)
- {
- pAstCfg->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_NONE;
- TRACE_VERBOSE1("TaskAsip: AS%d: no source selected, continue", as+zMS);
- continue;
- }
-#endif
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
// If we want pass processing then proceed directly
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
if (tempVar8 == PAF_SOURCE_PASS)
{
TRACE_VERBOSE1("TaskAsip: AS%d: Pass processing ...", as+zMS);
+ sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
+ (Int8)PAF_SOURCE_PASS, GATEMP_INDEX_DEC);
- tempVar8 = PAF_SOURCE_PASS;
- statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
- &tempVar8,
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
-#else
- // If we want pass processing then proceed directly
- if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_PASS)
- {
- TRACE_VERBOSE1("TaskAsip: AS%d: Pass processing ...", as+zMS);
- pAstCfg->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_PASS;
-#endif
pP->fxns->sourceDecode(pP, pQ, pAsitCfg, PAF_SOURCE_PASS);
if (pP->fxns->passProcessing)
{
continue;
}
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
// .....................................................................
// At this point we have an enabled input and want to decode something.
// If no decoder selected then do nothing. Need to reset the sourceProgram, since
// when no decoder is selected there are no calls to IB
- //if (errno = pP->fxns->autoProcessing(pP, pQ, pC, pC->xDec[zMD].decodeStatus.sourceSelect, pC->xDec[zMD].decAlg[PAF_SOURCE_PCM]))
-
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
pfpBegin(PFP_ID_ASIT_1, pAsitCfg->taskHandle); // PFP begin
gNumPfpAsit1++;
- // (***) FL: re-visit, hard-coded to use FRAMELENGTH (pP->frameLength) inside function
errno = pP->fxns->autoProcessing(pP, pQ, pAsitCfg, tempVar8, NULL);
pfpEnd(PFP_ID_ASIT_1, PFP_FINISH_MEAS); // PFP end
gNumPfpAsit1--;
TRACE_VERBOSE1("TaskAsip: autoProcessing returns 0x%x, continue", errno);
continue;
}
-#else
- // .....................................................................
- // At this point we have an enabled input and want to decode something.
- // If no decoder selected then do nothing. Need to reset the sourceProgram, since
- // when no decoder is selected there are no calls to IB
-
- //if (errno = pP->fxns->autoProcessing(pP, pQ, PC, pC->xDec[zMD].decodeStatus.sourceSelect, pC->xDec[zMD].decAlg[PAF_SOURCE_PCM]))
- // (***) FL: re-visit this, hard-coded to use FRAMELENGTH (pP->frameLength) inside function
- if (errno = pP->fxns->autoProcessing(pP, pQ, pAsitCfg, pAstCfg->xDec[zMD].decodeStatus.sourceSelect, NULL))
- {
- TRACE_VERBOSE1("TaskAsip: autoProcessing returns 0x%x, continue", errno);
- continue;
- }
-#endif
// query for input type
errno = SIO_ctrl(pAstCfg->xInp[zMI].hRxSio, PAF_SIO_CONTROL_GET_SOURCEPROGRAM, (Arg )&sourceProgram);
errno = ASPERR_AUTO_PROGRAM;
continue;
}
-#ifdef NON_CACHE_STATUS
- statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
- &(sourceProgram),
- sizeof(sourceProgram),
- GATEMP_INDEX_DEC);
-#else
- pAstCfg->xDec[zMD].decodeStatus.sourceProgram = sourceProgram;
-#endif
+
+ sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
+ sourceProgram, GATEMP_INDEX_DEC);
// if input is unclassifiable then do nothing
if (sourceProgram == PAF_SOURCE_UNKNOWN)
// input frame, we determine whether or not to call decodeProcessing and with
// what decAlg.
sourceSelect = PAF_SOURCE_NONE;
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
switch (tempVar8)
{
-#else
- switch (pAstCfg->xDec[zMD].decodeStatus.sourceSelect)
- {
-#endif
// If autodetecting, decoding everything, and input is something
// (i.e. bitstream or PCM) then decode.
case PAF_SOURCE_AUTO:
// If user made specific selection then program must match select.
// (NB: this compare relies on ordering of PAF_SOURCE)
default:
-#ifdef NON_CACHE_STATUS
- sourceSelect = 0; // due to size difference
- statusOp_read(&sourceSelect,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
-#else
- sourceSelect = pAstCfg->xDec[zMD].decodeStatus.sourceSelect;
-#endif
+ sourceSelect = (Int)sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
if ((sourceSelect >= PAF_SOURCE_PCM) && (sourceSelect <= PAF_SOURCE_N))
{
if (sourceProgram != sourceSelect)
continue;
}
- // FL: debug, reset IB capture buffer
+#if 0 // debug
+ // reset IB capture buffer
capIbReset();
gCapIbReset_cnt++;
Log_info0("capIbReset()");
+#endif
- // FL: send source select 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 */
- pAspMsg->cmd = ASP_SLAVE_DEC_SOURCE_SELECT; /* fill in message payload */
- pAspMsg->procId = hAspMsgMaster->masterProcId;
- pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
- pAspMsg->expectResp = TRUE;
- *(Int32 *)&pAspMsg->buf[0] = sourceSelect;
- TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- TRACE_MSG1("sourceSelect=%d", pAspMsg->buf[0]);
- status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg); /* send message */
- if (status != MessageQ_S_SUCCESS)
- {
- SW_BREAKPOINT;
- }
- // wait for source select complete message from slave
- //do {
- // status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- //} while (status != MessageQ_S_SUCCESS);
- status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- if (status != MessageQ_S_SUCCESS)
- {
- TRACE_TERSE0("MessageQ_get() failure.");
- SW_BREAKPOINT; // temporary
- }
- if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
- (pAspMsg->cmd != ASP_MASTER_DEC_SOURCE_SELECT_DONE) ||
- (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+ // send source select message to slave
+ *(Int32 *)&asipMsgBuf[0] = sourceSelect;
+ status = AspMsgSnd(hAspMsgMaster, ASP_SLAVE_DEC_SOURCE_SELECT, asipMsgBuf);
+ if (status != ASP_MSG_NO_ERR)
{
- TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- SW_BREAKPOINT;
+ TRACE_VERBOSE0("TaskAsip: error in sending SOURCE_SELECT message");
+ SW_BREAKPOINT;
}
- 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);
- status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
- if (status != MessageQ_S_SUCCESS)
+ // receive source select acknowledge message from slave
+ status = AspMsgRcvAck(hAspMsgMaster, ASP_MASTER_DEC_SOURCE_SELECT_DONE, NULL, TRUE);
+ if (status != ASP_MSG_NO_ERR)
{
- SW_BREAKPOINT;
+ TRACE_VERBOSE0("TaskAsip: error in receiving SOURCE_SELECT_DONE ack message");
+ SW_BREAKPOINT;
}
// set to unknown so that we can ensure, for IOS purposes, that sourceDecode = NONE
// Increase priority level since decoding complete
Task_setPri(pAsitCfg->taskHandle, Task_getPri(pAsitCfg->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 */
- pAspMsg->cmd = ASP_SLAVE_DEC_EXIT; /* fill in message payload */
- pAspMsg->procId = hAspMsgMaster->masterProcId;
- pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
- pAspMsg->expectResp = TRUE;
- TRACE_MSG2("Tx ASP message: procId=%d, cmd=%d.", pAspMsg->procId, pAspMsg->cmd);
- status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg); /* send message */
- if (status != MessageQ_S_SUCCESS)
- {
- SW_BREAKPOINT;
- }
- // wait for dec exit complete message from slave
- //do {
- // status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- //} while ((status < 0) || (pAspMsg->cmd != ASP_MASTER_DEC_EXIT_DONE));
- status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- if (status != MessageQ_S_SUCCESS)
+ // send dec exit message to slave
+ status = AspMsgSnd(hAspMsgMaster, ASP_SLAVE_DEC_EXIT, NULL);
+ if (status != ASP_MSG_NO_ERR)
{
- TRACE_TERSE0("MessageQ_get() failure.");
- SW_BREAKPOINT; // temporary
+ TRACE_VERBOSE0("TaskAsip: error in sending DEC_EXIT message");
+ SW_BREAKPOINT;
}
- if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
- (pAspMsg->cmd != ASP_MASTER_DEC_EXIT_DONE) ||
- (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+ // receive dec exit acknowledge message from slave
+ status = AspMsgRcvAck(hAspMsgMaster, ASP_MASTER_DEC_EXIT_DONE, NULL, TRUE);
+ if (status != ASP_MSG_NO_ERR)
{
- TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- SW_BREAKPOINT;
- }
- 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);
- // free the message
- status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
- if (status != MessageQ_S_SUCCESS)
- {
- SW_BREAKPOINT;
+ TRACE_VERBOSE0("TaskAsip: error in receiving DEC_EXIT_DONE ack message");
+ SW_BREAKPOINT;
}
} // End of main processing loop for (;;)
//Log_info0("Exit taskAsipFxn()");
}
+Int PAF_ASIT_ioCompCreate(PAF_AST_IoInp *pIoInp, int numInp, IHeap_Handle iHeapHandle)
+{
+ int i, j, num_alloc;
+ lib_mem_rec_t *mem_rec;
+ ioBuffHandle_t ioBufHandle;
+ ioPhyHandle_t ioPhyHandle;
+ ioDataHandle_t ioDataHandle;
+ Error_Block eb;
+
+ for(i=0; i<numInp; i++)
+ {
+ // Create an I/O BUFF instance
+ // Obtain number of memory blocks required by I/O BUFF
+ num_alloc = ioBuffNumAlloc();
+
+ // Obtain requirements of each memory block
+ mem_rec = (lib_mem_rec_t *)malloc(sizeof(lib_mem_rec_t)*num_alloc);
+ if(ioBuffAlloc(mem_rec) != IOBUFF_NOERR) {
+ return __LINE__;
+ }
+
+ /* Allocate memory and create I/O BUFF instance */
+ for(j=0; j<num_alloc; j++) {
+ mem_rec[j].base = Memory_calloc(iHeapHandle, mem_rec[j].size,
+ (1<<mem_rec[j].alignment), &eb);
+ }
+
+ if(ioBuffCreate(&ioBufHandle, mem_rec) != IOBUFF_NOERR) {
+ return __LINE__;
+ }
+
+ pIoInp[i].hIoBuff = ioBufHandle;
+
+ free(mem_rec);
+
+ // Create an I/O PHY instance
+ // Obtain number of memory blocks required by I/O PHY
+ num_alloc = ioPhyNumAlloc();
+
+ // Obtain requirements of each memory block
+ mem_rec = (lib_mem_rec_t *)malloc(sizeof(lib_mem_rec_t)*num_alloc);
+ if(ioPhyAlloc(mem_rec) != IOBUFF_NOERR) {
+ return __LINE__;
+ }
+
+ /* Allocate memory and create I/O PHY instance */
+ for(j=0; j<num_alloc; j++) {
+ mem_rec[j].base = Memory_calloc(iHeapHandle, mem_rec[j].size,
+ (1<<mem_rec[j].alignment), &eb);
+ }
+
+ if(ioPhyCreate(&ioPhyHandle, mem_rec) != IOBUFF_NOERR) {
+ return __LINE__;
+ }
+
+ pIoInp[i].hIoPhy = ioPhyHandle;
+
+ free(mem_rec);
+
+ // Create an I/O DATA instance
+ // Obtain number of memory blocks required by I/O DATA
+ num_alloc = ioDataNumAlloc();
+
+ // Obtain requirements of each memory block
+ mem_rec = (lib_mem_rec_t *)malloc(sizeof(lib_mem_rec_t)*num_alloc);
+ if(ioDataAlloc(mem_rec) != IOBUFF_NOERR) {
+ return __LINE__;
+ }
+
+ /* Allocate memory and create I/O DATA instance */
+ for(j=0; j<num_alloc; j++) {
+ mem_rec[j].base = Memory_calloc(iHeapHandle, mem_rec[j].size,
+ (1<<mem_rec[j].alignment), &eb);
+ }
+
+ if(ioDataCreate(&ioDataHandle, mem_rec) != IOBUFF_NOERR) {
+ return __LINE__;
+ }
+
+ pIoInp[i].hIoData = ioDataHandle;
+
+ free(mem_rec);
+
+ } // end of for loop
+
+ return 0;
+} // PAF_ASIT_ioCompCreate
+
// -----------------------------------------------------------------------------
// ASIT Initialization Function - Memory Allocation
//
{
PAF_AST_Config *pAstCfg;
Int as; /* Audio Stream Number (1, 2, etc.) */
- Int zMS;
+ Int zMS, errLineNum;
Error_Block eb;
+ IHeap_Handle decHeapHandle;
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
as = pAstCfg->as;
INPUTN * sizeof (*pAstCfg->xInp),
HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xInp);
-#ifdef NON_CACHE_STATUS
- /* Decode memory */
- if (!(pAstCfg->xDec = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM,
- DECODEN * sizeof (*pAstCfg->xDec), 4, &eb)))
+ /* Input I/O data structure memory */
+ if (!(pAsitCfg->pIoInp = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM,
+ INPUTN * sizeof (*pAsitCfg->pIoInp), 4, &eb)))
{
TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
SW_BREAKPOINT;
return __LINE__;
}
-#else
+ TRACE_TERSE3("PAF_ASIT_initPhaseMalloc. (pAsitCfg->pIoInp) %d bytes from space %d at 0x%x.",
+ INPUTN * sizeof (*pAsitCfg->pIoInp),
+ HEAP_ID_INTERNAL1_SHM, (IArg)pAsitCfg->pIoInp);
+
+ /* I/O components memory for input */
+ errLineNum = PAF_ASIT_ioCompCreate(pAsitCfg->pIoInp, INPUTN, (IHeap_Handle)HEAP_INTERNAL1_SHM);
+ if(errLineNum)
+ {
+ SW_BREAKPOINT;
+ return errLineNum;
+ }
+
/* Decode memory */
- if (!(pAstCfg->xDec = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM,
+#ifdef NON_CACHE_STATUS
+ decHeapHandle = (IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM;
+#else
+ decHeapHandle = (IHeap_Handle)HEAP_INTERNAL1_SHM;
+#endif
+ if (!(pAstCfg->xDec = Memory_calloc(decHeapHandle,
DECODEN * sizeof (*pAstCfg->xDec), 4, &eb)))
{
TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
SW_BREAKPOINT;
return __LINE__;
}
-#endif
+
TRACE_TERSE3("PAF_ASIT_initPhaseMalloc. (pAstCfg->xDec) %d bytes from space %d at 0x%x.",
DECODEN * sizeof (*pAstCfg->xDec),
HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xDec);
-
+#if 0
+ if (!(pAsitCfg->pInpDec = Memory_calloc(decHeapHandle,
+ DECODEN * sizeof (*pAsitCfg->pInpDec), 4, &eb)))
+ {
+ TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+ SW_BREAKPOINT;
+ return __LINE__;
+ }
+ TRACE_TERSE3("PAF_ASIT_initPhaseMalloc. (pAsitCfg->pInpDec) %d bytes from space %d at 0x%x.",
+ DECODEN * sizeof (*pAsitCfg->pInpDec),
+ HEAP_ID_INTERNAL1_SHM, (IArg)pAsitCfg->pInpDec);
+#endif
TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: initialization phase - memory allocation complete.", as+zMS);
return 0;
} //PAF_ASIT_initPhaseMalloc
Int zI = pP->inputsFromDecodes[z];
pAstCfg->xDec[z].decodeControl.size = sizeof(pAstCfg->xDec[z].decodeControl);
pAstCfg->xDec[z].decodeControl.pInpBufConfig = (const PAF_InpBufConfig *)&pAstCfg->xInp[zI].inpBufConfig;
- //pC->xDec[z].decodeStatus = *pP->z_pDecodeStatus[z]; // FL: slave
}
TRACE_TERSE1("PAF_ASIT_initPhaseConfig: AS%d: initialization phase - configuration complete.", as+zMS);
return 0;
} //PAF_ASIT_initPhaseCommon
-// (***) FL: candidate for removal
// -----------------------------------------------------------------------------
// ASIT Initialization Function - Algorithm Keys
//
TRACE_VERBOSE1("PAF_ASIT_initPhaseAlgKey: AS%d: initialization phase - Algorithm Keys", as);
-#if 0 // FL: slave
- for (z=DECODE1; z < DECODEN; z++)
- {
- for (s=0; s < pP->pDecAlgKey->length; s++)
- {
- if ((pP->pDecAlgKey->code[s].full != 0) &&
- (that = PAF_ASP_chainFind (&pC->xDec[z].decChainData, pP->pDecAlgKey->code[s])))
- {
- pC->xDec[z].decAlg[s] = (ALG_Handle )that->alg;
- /* Cast in interface, for now --Kurt */
- }
- else
- {
- pC->xDec[z].decAlg[s] = NULL;
- }
- }
- }
-#endif
-
return 0;
} //PAF_ASIT_initPhaseAlgKey
Int errno; /* error number */
Error_Block eb;
Int i;
+ ACP_Handle acp;
+ Int betaPrimeOffset;
+ Int zS;
- // FL: (***)revisit
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
as = pAstCfg->as;
zMS = pAstCfg->masterStr;
- /* Decode output circular buffer memory */
- if (!(pAstCfg->xDecOpCb = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM,
+ // Decode output circular buffer memory
+ if (!(pAstCfg->xDecOpCb = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM,
DECODEN * sizeof (*pAstCfg->xDecOpCb), 4, &eb)))
{
TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
TRACE_TERSE3("PAF_ASIT_initPhaseDecOpCircBuf. (pAsitCfg->xDecOpCb) %d bytes from space %d at 0x%x.",
DECODEN * sizeof (*pAstCfg->xDecOpCb),
HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xDecOpCb);
-
+
for (z=DECODE1; z < DECODEN; z++)
{
pCb = &pAstCfg->xDecOpCb[z];
SW_BREAKPOINT;
}
#endif
+ }
- // (***) FL: revisit, here PCM is hard-coded for 256 sample dec op frame length
- // Initialize decoder output circular buffer for PCM
+ for (z = DECODE1; z < DECODEN; z++)
+ {
+ //
+ // Initialize decoder output circular
+ //
+
+ // Initialize status
+ pAstCfg->xDecOpCb[z].cbStatus = *pP->z_pDecOpCircBufStatus[z];
+
+ // Default initialization
errno = cbInit(pCb);
if (errno)
{
- SW_BREAKPOINT; // FL: debug
+ //SW_BREAKPOINT; // debug
return errno;
}
}
-
- return 0;
-} //PAF_ASIT_initPhaseDecOpCircBuf
+
+ // Get ASIT ACP handle
+ acp = pAsitCfg->acp;
+ if (!acp)
+ {
+ TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: ACP algorithm instance creation failed", as+zMS);
+ return __LINE__;
+ }
+
+ // Get Beta Prime offset
+ ((ALG_Handle)acp)->fxns->algControl((ALG_Handle) acp,
+ ACP_GETBETAPRIMEOFFSET, (IALG_Status *)&betaPrimeOffset);
+
+ for (z = DECODE1; z < DECODEN; z++)
+ {
+ // ACP attach CB
+ zS = pP->streamsFromDecodes[z];
+ acp->fxns->attach(acp, ACP_SERIES_STD,
+ STD_BETA_DECOPCB + betaPrimeOffset * (as-1+zS),
+ (IALG_Status *)&pAstCfg->xDecOpCb[z].cbStatus);
+ }
+
+ return 0;
+} //PAF_ASIT_initPhaseDecOpCircBuf
// -----------------------------------------------------------------------------
TRACE_VERBOSE2("PAF_ASIT_autoProcessing: AS%d: source select returns 0x%x", as+zMS, errno);
return errno;
}
- //frameLength = pP->fxns->computeFrameLength (pcmAlgMaster, FRAMELENGTH,
- // pC->xDec[zMD].decodeStatus.bufferRatio);
- frameLength = FRAMELENGTH; // (***) FL: fix PCM frameLength
+ frameLength = FRAMELENGTH; // fix PCM frameLength
if (errno = SIO_ctrl(pAstCfg->xInp[zMI].hRxSio,
PAF_SIO_CONTROL_SET_PCMFRAMELENGTH, frameLength))
{
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
+#if 0 // debug
+ // Shows timing of autosync restart
+ // ADC B5
{
static Uint8 toggleState = 0;
if (toggleState == 0)
enum { INIT, INFO1, INFO2, DECODE, FINAL, QUIT } state;
ALG_Handle alg[DECODEN_MAX];
Int zMD;
- Int zMS;
- Int size;
- //PAF_InpBufConfig *pIpBufConfig;
+ //Int zMS;
Int frame; // decoder input frame count
- Int block; // (***) FL: formerly -- decoder output block count / input frame
-#ifdef NON_CACHE_STATUS
+ Int block; // decoder output block count / input frame
Int8 tempVar8, temp2Var8;
-#endif
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
zMD = pAstCfg->masterDec;
- zMS = pAstCfg->masterStr;
+ //zMS = pAstCfg->masterStr;
for (z=DECODE1; z < DECODEN; z++)
{
alg[z] = pAstCfg->xDec[z].decAlg[PAF_SOURCE_PCM];
}
- alg[zMD] = NULL; // decAlgMaster; // FL: alg[] init is on slave
+ alg[zMD] = NULL; // decAlgMaster; // alg[] init is on slave
//
// Receive and process the data in single-frame buffers
state = INIT;
errno = 0; /* error number */
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
TRACE_TERSE1("PAF_ASIT_decodeProcessing: sourceSelect is %d", tempVar8);
for (;;)
{
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
if (tempVar8 == PAF_SOURCE_NONE)
{
-#else
- TRACE_TERSE1("PAF_ASIT_decodeProcessing: sourceSelect is %d", pAstCfg->xDec[zMD].decodeStatus.sourceSelect);
-
- for (;;)
- {
- if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_NONE)
- {
-#endif
TRACE_VERBOSE0("PAF_ASIT_decodeProcessing: sourceSelect == PAF_SOURCE_NONE");
state = QUIT;
}
break;
}
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
- statusOp_read(&temp2Var8,
- &(pAstCfg->xDec[zMD].decodeStatus.sampleRate),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
+ GATEMP_INDEX_DEC);
+ temp2Var8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sampleRate),
+ 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)) &&
(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->xDec[zMD].decodeStatus.sampleRate == PAF_SAMPLERATE_UNKNOWN))
-#endif
{
Int z;
for (z=DECODE1; z < DECODEN; z++)
{
Int zI = pP->inputsFromDecodes[z];
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.mode),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (pAstCfg->xInp[zI].hRxSio && tempVar8)
{
-#else
- if (pAstCfg->xInp[zI].hRxSio && pAstCfg->xDec[z].decodeStatus.mode)
- {
-#endif
TRACE_VERBOSE0("TaskAsip: PAF_ASIT_decodeProcessing: INFO1, SIO_issue");
if (SIO_issue(pAstCfg->xInp[zI].hRxSio, &pAstCfg->xInp[zI].inpBufConfig,
sizeof(pAstCfg->xInp[zI].inpBufConfig), PAF_SIO_REQUEST_NEWFRAME))
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode counter */
Int zS;
-#ifdef NON_CACHE_STATUS
Int8 tempVar8;
-#endif
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
as = pAstCfg->as;
for (z=DECODE1; z < DECODEN; z++)
{
zS = pP->streamsFromDecodes[z];
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.command2),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
+ GATEMP_INDEX_DEC);
if (!(tempVar8 & 0x80))
{
switch (tempVar8)
{
case 0: // command none - process
tempVar8 |= 0x80;
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
- &tempVar8,
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
+ tempVar8, GATEMP_INDEX_DEC);
break;
case 1: // command abort - leave now
TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command abort (0x%02x)", as+zS, 1);
tempVar8 |= 0x80;
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
- &tempVar8,
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
+ tempVar8, GATEMP_INDEX_DEC);
return (ASPERR_ABORT);
case 2: // command restart - leave later
TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command quit (0x%02x)", as+zS, 2);
tempVar8 |= 0x80;
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
- &tempVar8,
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
- return (ASPERR_QUIT);
- default: // command unknown - ignore
- break;
- }
- }
-#else
- if (!(pAstCfg->xDec[z].decodeStatus.command2 & 0x80))
- {
- switch (pAstCfg->xDec[z].decodeStatus.command2)
- {
- case 0: // command none - process
- pAstCfg->xDec[z].decodeStatus.command2 |= 0x80;
- break;
- case 1: // command abort - leave now
- TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command abort (0x%02x)", as+zS, 1);
- pAstCfg->xDec[z].decodeStatus.command2 |= 0x80;
- return (ASPERR_ABORT);
- case 2: // command restart - leave later
- TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command quit (0x%02x)", as+zS, 2);
- pAstCfg->xDec[z].decodeStatus.command2 |= 0x80;
+ sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
+ tempVar8, GATEMP_INDEX_DEC);
+
+ // Invoke command to output task to break the loop
+ gCommandOutputTask_SYNC = 1;
+
return (ASPERR_QUIT);
default: // command unknown - ignore
break;
}
}
-#endif
}
return 0;
)
{
PAF_AST_Config *pAstCfg;
- PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
+ //PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
+ AspMsgMaster_Handle hAspMsgMaster;
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/encode counter */
Int errno; /* error number */
Int zI, zS;
Int zMD;
Int zMI;
- ASP_Msg* pAspMsg; /* Messaging */
Int argIdx;
- Int status;
-#ifdef NON_CACHE_STATUS
Int8 tempVar8;
- Int tempVar;
-#endif
+ char decMsgBuf[ASP_MSG_BUF_LEN];
+ Int status;
- pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ hAspMsgMaster = pAsitCfg->hAspMsgMaster; // get message master handle
as = pAstCfg->as;
zMD = pAstCfg->masterDec;
zMI = pP->zone.master;
(void)as; // clear compiler warning in case not used with tracing disabled
- pCbCtl = &pAsitCfg->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
+ //pCbCtl = &pAsitCfg->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
-#ifdef NON_CACHE_STATUS
// reset frameCount
for (z=DECODE1; z < DECODEN; z++)
{
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.mode),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (tempVar8)
{
- tempVar = 0;
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.frameCount),
- &tempVar,
- sizeof(tempVar),
- GATEMP_INDEX_DEC);
+ sharedMemWriteInt(&(pAstCfg->xDec[z].decodeStatus.frameCount),
+ (Int)0, GATEMP_INDEX_DEC);
}
}
zI = pP->inputsFromDecodes[z];
zS = pP->streamsFromDecodes[z];
(void)zS; // clear compiler warning in case not used with tracing disabled
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.mode),
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (pAstCfg->xInp[zI].hRxSio && tempVar8)
{
-#else
- // reset frameCount
- for (z=DECODE1; z < DECODEN; z++)
- {
- if (pAstCfg->xDec[z].decodeStatus.mode)
- {
- pAstCfg->xDec[z].decodeStatus.frameCount = 0;
- }
- }
- for (z=DECODE1; z < DECODEN; z++)
- {
- zI = pP->inputsFromDecodes[z];
- zS = pP->streamsFromDecodes[z];
- (void)zS; // clear compiler warning in case not used with tracing disabled
- if (pAstCfg->xInp[zI].hRxSio && pAstCfg->xDec[z].decodeStatus.mode)
- {
-#endif
Uns gear;
Int frameLength;
TRACE_VERBOSE1("AS%d: PAF_ASIT_decodeInit: initializing decode", as+zS);
Cache_wb(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
- // FL: send dec activate message to slave
- pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
- if (pAspMsg == NULL)
- {
- TRACE_TERSE0("MessageQ_alloc() failure.");
- SW_BREAKPOINT; // temporary
- return -1; // temporary
- }
- MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg); /* set the return address in the message header */
- pAspMsg->cmd = ASP_SLAVE_DEC_ACTIVATE; /* fill in message payload */
- pAspMsg->procId = hAspMsgMaster->masterProcId;
- pAspMsg->expectResp = TRUE;
- pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+ // send dec activate message to slave
argIdx = 0; // set decIdx (zone index)
- *(Int32 *)&pAspMsg->buf[argIdx] = z;
- TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
- status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg); /* send message */
- if (status != MessageQ_S_SUCCESS)
+ *(Int32 *)&decMsgBuf[argIdx] = z;
+ status = AspMsgSnd(hAspMsgMaster, ASP_SLAVE_DEC_ACTIVATE, decMsgBuf);
+ if (status != ASP_MSG_NO_ERR)
{
- SW_BREAKPOINT;
- }
- // wait for dec activate complete message from slave
- status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- if (status != MessageQ_S_SUCCESS)
- {
- TRACE_TERSE0("MessageQ_get() failure.");
+ TRACE_TERSE0("decodeInit: error in sending DEC_ACTIVATE message");
SW_BREAKPOINT; // temporary
return -1; // temporary
- }
- if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
- (pAspMsg->cmd != ASP_MASTER_DEC_ACTIVATE_DONE) ||
- (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+ }
+ status = AspMsgRcvAck(hAspMsgMaster, ASP_MASTER_DEC_ACTIVATE_DONE, NULL, TRUE);
+ if (status != ASP_MSG_NO_ERR)
{
- TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+ TRACE_TERSE0("decodeInit: error in receiving DEC_ACTIVATE_DONE message");
SW_BREAKPOINT; // temporary
return -1; // 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);
- // free the message
- status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
- if (status != MessageQ_S_SUCCESS)
- {
- SW_BREAKPOINT;
- }
-
-#if 0 // FL: decoder activate call, slave
- if (decAlg[z]->fxns->algActivate)
- decAlg[z]->fxns->algActivate (decAlg[z]);
-#endif
+ }
- // FL: send dec reset message to slave
- pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
- if (pAspMsg == NULL)
- {
- TRACE_TERSE0("MessageQ_alloc() failure.");
- SW_BREAKPOINT; // temporary
- return -1; // temporary
- }
- MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg); /* set the return address in the message header */
- pAspMsg->cmd = ASP_SLAVE_DEC_RESET; /* fill in message payload */
- pAspMsg->procId = hAspMsgMaster->masterProcId;
- pAspMsg->expectResp = TRUE;
- pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+ // send dec reset message to slave
argIdx = 0; // set decIdx
- *(Int32 *)&pAspMsg->buf[argIdx] = z;
- TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
- // wait for dec reset complete message from slave
- status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg); /* send message */
- if (status != MessageQ_S_SUCCESS)
+ *(Int32 *)&decMsgBuf[argIdx] = z;
+ status = AspMsgSnd(hAspMsgMaster, ASP_SLAVE_DEC_RESET, decMsgBuf);
+ if (status != ASP_MSG_NO_ERR)
{
- SW_BREAKPOINT;
- }
- status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- if (status != MessageQ_S_SUCCESS)
- {
- TRACE_TERSE0("MessageQ_get() failure.");
+ TRACE_TERSE0("decodeInit: error in sending DEC_RESET message ");
SW_BREAKPOINT; // temporary
return -1; // temporary
}
- if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) &&
- (pAspMsg->cmd == ASP_MASTER_DEC_RESET_DONE) &&
- (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31))))
- {
- 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);
- TRACE_MSG1("decErrno=%d", pAspMsg->buf[0]);
-
- argIdx = 0; // get decErrno
- errno = *(Int32 *)&pAspMsg->buf[argIdx];
- }
- else
+ status = AspMsgRcvAck(hAspMsgMaster, ASP_MASTER_DEC_RESET_DONE, decMsgBuf, TRUE);
+ if (status != ASP_MSG_NO_ERR)
{
- //
- // Invalid message received
- //
- TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+ TRACE_TERSE0("decodeInit: error in receiving DEC_RESET_DONE ack message ");
SW_BREAKPOINT; // temporary
return -1; // temporary
}
- // free the message
- status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
- if (status != MessageQ_S_SUCCESS)
+ else
{
- SW_BREAKPOINT;
+ argIdx = 0; // get decErrno
+ errno = *(Int32 *)&decMsgBuf[argIdx];
}
-
- // (***) FL: revisit
+
// invalidate Dec configuration
Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
-#if 0 // FL: decoder reset call, slave
- if (dec->fxns->reset
- && (errno = dec->fxns->reset (dec, NULL,
- &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
- statusOp_read(&gear,
- &(pAstCfg->xDec[z].decodeStatus.aspGearControl),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+ gear = (Uns)sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.aspGearControl),
+ GATEMP_INDEX_DEC);
tempVar8 = gear < GEARS ? gear : 0;
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.aspGearStatus),
- &tempVar8,
- sizeof(tempVar8),
- GATEMP_INDEX_DEC);
-#else
- gear = pAstCfg->xDec[z].decodeStatus.aspGearControl;
- pAstCfg->xDec[z].decodeStatus.aspGearStatus = gear < GEARS ? gear : 0;
-#endif
+ sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.aspGearStatus),
+ tempVar8, GATEMP_INDEX_DEC);
-#if 0 // FL: change handle to decIdx (zone index)
- frameLength = pP->fxns->computeFrameLength(decAlg[z],
- FRAMELENGTH,
- pC->xDec[z].decodeStatus.bufferRatio);
-#endif
-#if 0 // (***) FL: revisit. Bypass decoder computeFrameLength() function.
- frameLength = pP->fxns->computeFrameLength(z,
- FRAMELENGTH,
- pC->xDec[z].decodeStatus.bufferRatio);
-#else
// Compute decoder frame length based on source selection
frameLength = getFrameLengthSourceSel(pP, sourceSelect);
-#endif
pAstCfg->xDec[z].decodeControl.frameLength = frameLength;
pAstCfg->xDec[z].decodeInStruct.sampleCount = frameLength;
pAstCfg->xDec[z].decodeControl.sampleRate = PAF_SAMPLERATE_UNKNOWN;
-#if 0 // FL: Moved to ARM:ASDT:INFO
- // Initialize decoder output circular buffer for selected source
- errno = cbInitSourceSel(pCbCtl, z, sourceSelect, frameLength, FRAMELENGTH, 0);
- if (errno)
- {
- SW_BREAKPOINT; // debug
- return errno;
- }
- // debug
- cbLog(pCbCtl, z, 1, "PAF_ASIT_decodeInit:cbInitSourceSel");
-#endif
-
if (z != zMD)
{
if (errno = SIO_idle(pAstCfg->xInp[zI].hRxSio))
}
}
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.sourceSelect),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
if (errno = SIO_ctrl(pAstCfg->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_SOURCESELECT,
DECSIOMAP(tempVar8)))
{
return errno;
}
-#else
- if (errno = SIO_ctrl(pAstCfg->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_SOURCESELECT,
- DECSIOMAP(pAstCfg->xDec[z].decodeStatus.sourceSelect)))
- {
- return errno;
- }
-#endif
+
if (errno = SIO_ctrl(pAstCfg->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_PCMFRAMELENGTH,
frameLength))
{
)
{
PAF_AST_Config *pAstCfg;
+ AspMsgMaster_Handle hAspMsgMaster;
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* input/decode/stream counter */
Int errno; /* error number */
Int zMD;
Int zMI;
Int zMS;
- UInt32 curTime;
- ASP_Msg *pAspMsg; /* Messaging */
Int argIdx;
- Int status;
-#ifdef NON_CACHE_STATUS
Int8 tempVar8;
Int tempVar;
-#endif
- // FL: revisit
- //Int size;
- //PAF_InpBufConfig *pIpBufConfig;
+ char decMsgBuf[ASP_MSG_BUF_LEN];
+ Int status;
- pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+
+ pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ hAspMsgMaster = pAsitCfg->hAspMsgMaster; // get message master handle
as = pAstCfg->as;
zMD = pAstCfg->masterDec;
zMS = pAstCfg->masterStr;
}
else
{
- TRACE_TERSE1("AS%d: return error ASPERR_INFO_RATECHANGE", as+pAstCfg->masterStr);
+ //TRACE_TERSE1("PAF_ASIT_decodeInfo: AS%d: return error ASPERR_INFO_RATECHANGE", as+pAstCfg->masterStr);
TRACE_TERSE2("inpBufStatus.sampleRateStatus: 0x%x, decodeControl.sampleRate: 0x%x",
pAstCfg->xInp[z].inpBufStatus.sampleRateStatus,
pAstCfg->xDec[zD].decodeControl.sampleRate);
// return (ASPERR_INFO_RATECHANGE);
}
}
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zD].decodeStatus.sourceDecode),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zD].decodeStatus.sourceDecode),
+ GATEMP_INDEX_DEC);
pAstCfg->xDec[zD].decodeControl.emphasis =
tempVar8 != PAF_SOURCE_PCM
? PAF_IEC_PREEMPHASIS_NO // fix for Mantis ID #119
: pAstCfg->xInp[z].inpBufStatus.emphasisStatus;
-#else
- pAstCfg->xDec[zD].decodeControl.emphasis =
- pAstCfg->xDec[zD].decodeStatus.sourceDecode != PAF_SOURCE_PCM
- ? PAF_IEC_PREEMPHASIS_NO // fix for Mantis ID #119
- : pAstCfg->xInp[z].inpBufStatus.emphasisStatus;
-#endif
}
else
{
return ASPERR_RECLAIM;
}
- // FL: debug, capture input buffer
+#if 0 // debug
+ // capture input buffer
capIb(pAstCfg->xInp[zMI].pInpBuf);
gCapIb_cnt++;
+#endif
-#if 0 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
- // (***) debug // B5
+#if 0 // debug
+ // Shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
+ // ADC B5
{
static Uint8 toggleState = 0;
if (toggleState == 0)
}
#endif
- //
- // Simulate Rx SIO_reclaim() pend
- //
- //Semaphore_pend(semaphoreRxAudio, BIOS_WAIT_FOREVER);
- gTaskAsipCnt++;
- curTime = Clock_getTicks();
- //System_printf("System time in TaskAsipFxn Rx audio = %lu\n", (ULong)curTime);
- //Log_info1("System time in TaskAsipFxn Rx audio = %u", curTime);
- //Log_info1("decodeInfo():Rx SIO reclaim(), system time = %u", curTime);
+ gAsipRxSioReclaimCnt++;
} //pAstCfg->xInp[zMI].hRxSio
// Decode info
zI = pP->inputsFromDecodes[z];
zS = pP->streamsFromDecodes[z];
(void)zS; // clear compiler warning in case not used with tracing disabled
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.mode),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (pAstCfg->xInp[zI].hRxSio && tempVar8)
{
-#else
- if (pAstCfg->xInp[zI].hRxSio && pAstCfg->xDec[z].decodeStatus.mode)
- {
-#endif
TRACE_GEN2("PAF_ASIT_decodeInfo: AS%d: processing frame %d -- info", as+zS, frame);
if (errno = pP->fxns->updateInputStatus(pAstCfg->xInp[zI].hRxSio,
return errno;
}
-#if 1
- // (***) FL: revisit
// write back Inp configuration
Cache_wb(&pAstCfg->xInp[zI], sizeof(PAF_AST_InpBuf), Cache_Type_ALLD, 0);
// write back Dec configuration
Cache_wb(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
-#endif
- // FL: send info message to slave
- pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
- if (pAspMsg == NULL)
- {
- TRACE_TERSE0("MessageQ_alloc() failure.");
- SW_BREAKPOINT; // temporary
- return -1; // temporary
- }
- MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg); /* set the return address in the message header */
- pAspMsg->cmd = ASP_SLAVE_DEC_INFO; /* fill in message payload */
- pAspMsg->procId = hAspMsgMaster->masterProcId;
- pAspMsg->expectResp = TRUE;
- pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+ // send info message to slave
argIdx = 0; // set decIdx
- *(Int32 *)&pAspMsg->buf[argIdx] = z;
- TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
- status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg); /* send message to slave */
- if (status != MessageQ_S_SUCCESS)
- {
- SW_BREAKPOINT;
- }
- // wait for dec info complete message from slave -- temporary
- status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- if (status != MessageQ_S_SUCCESS)
+ *(Int32 *)&decMsgBuf[argIdx] = z;
+ status = AspMsgSnd(hAspMsgMaster, ASP_SLAVE_DEC_INFO, decMsgBuf);
+ if (status != ASP_MSG_NO_ERR)
{
- TRACE_TERSE0("MessageQ_get() failure.");
- SW_BREAKPOINT;
- return -1; // temporary
- }
- 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];
+ TRACE_TERSE0("decodeInfo: error in sending DEC_INFO message ");
+ SW_BREAKPOINT; // temporary
+ return -1; // temporary
}
- else
+ status = AspMsgRcvAck(hAspMsgMaster, ASP_MASTER_DEC_INFO_DONE, decMsgBuf, TRUE);
+ if (status != ASP_MSG_NO_ERR)
{
- //
- // Invalid message received
- //
- TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+ TRACE_TERSE0("decodeInfo: error in receiving DEC_INFO_DONE ack message");
SW_BREAKPOINT; // temporary
- return -1; // temporary
+ return -1; // temporary
}
- // free the message
- status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
- if (status != MessageQ_S_SUCCESS)
+ else
{
- SW_BREAKPOINT;
+ argIdx = 0; // get decErrno
+ errno = *(Int32 *)&decMsgBuf[argIdx];
}
-
-#if 1
- // (***) FL: revisit
+
// invalidate Dec configuration
Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
-#endif
-#if 0 // FL: decoder info call, slave
- if (dec->fxns->info
- && (errno = dec->fxns->info (dec, NULL,
- &pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus)))
-#endif
if (errno)
{
TRACE_TERSE1("return error errno 0x%x.", errno);
return errno;
}
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar,
- &(pAstCfg->xDec[z].decodeStatus.frameCount),
- sizeof(Int),
- GATEMP_INDEX_DEC);
// increment decoded frame count
+ tempVar = sharedMemReadInt(&(pAstCfg->xDec[z].decodeStatus.frameCount),
+ GATEMP_INDEX_DEC);
tempVar += 1;
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.frameCount),
- &tempVar,
- sizeof(Int),
- GATEMP_INDEX_DEC);
-#else
- // increment decoded frame count
- pAstCfg->xDec[z].decodeStatus.frameCount += 1;
-#endif
+ sharedMemWriteInt(&(pAstCfg->xDec[z].decodeStatus.frameCount),
+ tempVar, GATEMP_INDEX_DEC);
}
} // z=DECODE1 to DECODEN
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.mode),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
// query IB for latest sourceProgram (needed if we started decoding due to a force mode)
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (tempVar8)
{
XDAS_Int8 sourceProgram;
TRACE_TERSE1("return error ASPERR_AUTO_PROGRAM. errno 0x%x.", errno);
return ASPERR_AUTO_PROGRAM;
}
- statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
- &(sourceProgram),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+
+ sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
+ sourceProgram, GATEMP_INDEX_DEC);
}
// since now decoding update decode status for all enabled decoders
for (z=DECODE1; z < DECODEN; z++)
{
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.mode),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (tempVar8)
{
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.sourceProgram),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
- &tempVar8,
- sizeof(Int8),
- GATEMP_INDEX_DEC);
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.sourceSelect),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.sourceProgram),
+ GATEMP_INDEX_DEC);
+ sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
+ tempVar8, GATEMP_INDEX_DEC);
+
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
if (tempVar8 == PAF_SOURCE_SNG)
{
tempVar8 = PAF_SOURCE_SNG;
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
- &tempVar8,
- sizeof(Int8),
- GATEMP_INDEX_DEC);
- }
- }
- }
-#else
- // query IB for latest sourceProgram (needed if we started decoding due to a force mode)
- if (pAstCfg->xDec[zMD].decodeStatus.mode)
- {
- XDAS_Int8 sourceProgram;
- if (errno = SIO_ctrl(pAstCfg->xInp[zMI].hRxSio, PAF_SIO_CONTROL_GET_SOURCEPROGRAM,
- (Arg)&sourceProgram))
- {
- TRACE_TERSE1("return error ASPERR_AUTO_PROGRAM. errno 0x%x.", errno);
- return ASPERR_AUTO_PROGRAM;
- }
- pAstCfg->xDec[zMD].decodeStatus.sourceProgram = sourceProgram;
- }
-
- // since now decoding update decode status for all enabled decoders
- for (z=DECODE1; z < DECODEN; z++)
- {
- if (pAstCfg->xDec[z].decodeStatus.mode)
- {
- pAstCfg->xDec[z].decodeStatus.sourceDecode = pAstCfg->xDec[z].decodeStatus.sourceProgram;
- if (pAstCfg->xDec[z].decodeStatus.sourceSelect == PAF_SOURCE_SNG)
- {
- pAstCfg->xDec[z].decodeStatus.sourceDecode = PAF_SOURCE_SNG;
+ sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
+ tempVar8, GATEMP_INDEX_DEC);
}
}
}
-#endif
-
-#if 0 // FL: ASDT (slave)
- // TODO: move this to start of this function so that it doesn't affect IO timing
- // Initialize audio frame(s)
- // Re-initialize audio frame if there is an associated decode and
- // that decode doesn't have a valid input or is turned off
- for (z=STREAM1; z < STREAMN; z++)
- {
- Int reset = 0;
- for (zX = DECODE1; zX < DECODEN; zX++)
- {
- if (pP->streamsFromDecodes[zX] == z)
- {
- zI = pP->inputsFromDecodes[zX];
- if (!pC->xDec[zX].decodeStatus.mode || !pC->xInp[zI].hRxSio)
- {
- reset = 1;
- }
- }
- }
- if (reset)
- {
- TRACE_VERBOSE2("PAF_ASIT_decodeInfo: AS%d: initializing block %d -- info", as+z, frame);
- pP->fxns->initFrame1 (pP, pQ, pC, z, 0);
- }
- else
- {
- TRACE_VERBOSE2("PAF_ASIT_decodeInfo: AS%d: initializing block %d -- info <ignored>", as+z, frame);
- }
- }
-#endif
return 0;
} //PAF_ASIT_decodeInfo
Int z; /* decode counter */
Int zI, zS;
Int zMD;
-#ifdef NON_CACHE_STATUS
Int8 tempVar8;
-#endif
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
zI = pP->inputsFromDecodes[z];
zS = pP->streamsFromDecodes[z];
(void)zS;
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.mode),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (z == zMD
|| ! pAstCfg->xInp[zI].hRxSio
|| ! tempVar8)
continue;
-#else
- if (z == zMD
- || ! pAstCfg->xInp[zI].hRxSio
- || ! pAstCfg->xDec[z].decodeStatus.mode)
- continue;
-#endif
TRACE_VERBOSE2("PAF_AST_decodeCont: AS%d: awaiting frame %d -- data", as+zS, frame);
if (SIO_reclaim(pAstCfg->xInp[zI].hRxSio, (Ptr)&pAstCfg->xInp[zI].pInpBuf, NULL)
!= sizeof (pAstCfg->xInp[zI].inpBufConfig))
)
{
PAF_AST_Config *pAstCfg;
+ AspMsgMaster_Handle hAspMsgMaster;
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/stream counter */
Int errno; /* error number */
//Int ch;
- ASP_Msg *pAspMsg; /* Messaging */
Int argIdx;
- Int status;
Int cbErrno;
Int frameLength;
+ char decMsgBuf[ASP_MSG_BUF_LEN];
+ Int status;
- pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ hAspMsgMaster = pAsitCfg->hAspMsgMaster; // get message master handle
as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
-#if 0 // FL: slave
- // Clear samsiz for all channels - MID 208.
- for (z=STREAM1; z < STREAMN; z++)
- {
- for (ch=0; ch < PAF_MAXNUMCHAN_AF; ch++)
- {
- pC->xStr[z].pAudioFrame->data.samsiz[ch] = 0;
- }
- }
-#endif
-
// Decode data
for (z=DECODE1; z < DECODEN; z++)
{
(IArg)pAstCfg->xInp[z].pInpBuf->base.pVoid,
(IArg)pAstCfg->xInp[z].pInpBuf->head.pVoid);
- // FL: debug, capture input buffer
- //capIbPcm(pAstCfg->xInp[z].pInpBuf);
+#if 0 // debug
+ // capture input buffer
+ capIbPcm(pAstCfg->xInp[z].pInpBuf);
+#endif
- // (***) FL: revisit
// write back Dec configuration
Cache_wb(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
- // FL: send decode message to slave
- pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
- if (pAspMsg == NULL)
- {
- TRACE_TERSE0("MessageQ_alloc() failure.");
- SW_BREAKPOINT; // temporary
- return -1; // temporary
- }
- MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg); /* set the return address in the message header */
- pAspMsg->cmd = ASP_SLAVE_DEC_DECODE; /* fill in message payload */
- pAspMsg->procId = hAspMsgMaster->masterProcId;
- pAspMsg->expectResp = TRUE;
- pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+ // send decode message to slave
argIdx = 0; // set decIdx
- *(Int32 *)&pAspMsg->buf[argIdx] = z;
- TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- TRACE_MSG1("decIdx=%d", pAspMsg->buf[argIdx]);
- status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg); /* send message */
- if (status != MessageQ_S_SUCCESS)
+ *(Int32 *)&decMsgBuf[argIdx] = z;
+ status = AspMsgSnd(hAspMsgMaster, ASP_SLAVE_DEC_DECODE, decMsgBuf);
+ if (status != ASP_MSG_NO_ERR)
{
- SW_BREAKPOINT;
+ TRACE_TERSE0("decodeDecode: error in sending DEC_DECODE message ");
+ SW_BREAKPOINT; // temporary
+ return -1; // temporary
}
- // wait for decode complete message from slave -- temporary
- status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- if (status != MessageQ_S_SUCCESS)
+ status = AspMsgRcvAck(hAspMsgMaster, ASP_MASTER_DEC_DECODE_DONE, decMsgBuf, TRUE);
+ if (status != ASP_MSG_NO_ERR)
{
- TRACE_TERSE0("MessageQ_get() failure.");
+ TRACE_TERSE0("decodeDecode: error in receiving DEC_DECODE_DONE ack message ");
SW_BREAKPOINT; // temporary
- return -1; // temporary
+ return -1; // temporary
}
- if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) &&
- (pAspMsg->cmd == ASP_MASTER_DEC_DECODE_DONE) &&
- (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+ else
{
- 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; // get decErrno
- errno = *(Int32 *)&pAspMsg->buf[argIdx];
+ errno = *(Int32 *)&decMsgBuf[argIdx];
argIdx += sizeof(Int32); // get cbErrno
- cbErrno = *(Int32 *)&pAspMsg->buf[argIdx];
+ cbErrno = *(Int32 *)&decMsgBuf[argIdx];
if (cbErrno != 0)
{
gCbWrtAfErrCnt++;
TRACE_TERSE1("CB write error=%d", cbErrno);
//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
- }
- // free the message
- status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
- if (status != MessageQ_S_SUCCESS)
- {
- SW_BREAKPOINT;
+ }
}
-
- // (***) FL: revisit
+
// invalidate Dec configuration
Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
-#if 0 // FL: decoder decode call, slave
+#if 0 // decoder decode call, slave
if (dec->fxns->decode
&& (errno = dec->fxns->decode (dec, NULL,
&pC->xDec[z].decodeInStruct, &pC->xDec[z].decodeOutStruct)))
as_traceChannels(pC, z);
#endif
-#if 0 // FL: change handle to decIdx (zone index)
- frameLength = pP->fxns->computeFrameLength(decAlg[z],
- FRAMELENGTH,
- pC->xDec[z].decodeStatus.bufferRatio);
-#endif
-#if 0 // (***) FL: revisit. Bypass decoder computeFrameLength() function.
- frameLength = pP->fxns->computeFrameLength(z,
- FRAMELENGTH,
- pC->xDec[z].decodeStatus.bufferRatio);
-#else
// Compute decoder frame length based on source selection
frameLength = getFrameLengthSourceSel(pP, sourceSelect);
-#endif
-
//#ifdef PROFILER
// // modify for different decoders
}
} // z=DECODE1 to DECODEN
-#if 0 // FL: ASDT (slave)
- // Set up audio frames not decoded into
- // Re-initialize audio frame if there is an assocatiated decode and
- // that decode doesn't have a valid input or is turned off
- for (z=STREAM1; z < STREAMN; z++)
- {
- Int zX;
- Int reset = 0;
- for (zX = DECODE1; zX < DECODEN; zX++)
- {
- if (pP->streamsFromDecodes[zX] == z)
- {
- Int zI = pP->inputsFromDecodes[zX];
- if (!pC->xDec[zX].decodeStatus.mode || !pC->xInp[zI].hRxSio)
- reset = 1;
- }
- }
- if (reset)
- {
- TRACE_VERBOSE2("PAF_ASIT_decodeDecode: AS%d: initializing block %d -- decode", as+z, frame);
- pP->fxns->initFrame1 (pP, pQ, pC, z, 0);
- }
- else
- TRACE_VERBOSE2("PAF_ASIT_decodeDecode: AS%d: initializing block %d -- decode <ignored>", as+z, frame);
- }
-#endif
-
return 0;
} //PAF_ASIT_decodeDecode
Int zMD;
Int sourceSelect;
Int sourceProgram;
-#ifdef NON_CACHE_STATUS
Int8 tempVar8, temp2Var8;
-#endif
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
zMD = pAstCfg->masterDec;
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
- sourceSelect = tempVar8;
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
- sourceProgram = tempVar8;
-#else
- sourceSelect = pAstCfg->xDec[zMD].decodeStatus.sourceSelect;
- sourceProgram = pAstCfg->xDec[zMD].decodeStatus.sourceProgram;
-#endif
+ sourceSelect = (Int)sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
+ sourceProgram = (Int)sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
+ GATEMP_INDEX_DEC);
if ((sourceSelect == PAF_SOURCE_NONE) || (sourceSelect == PAF_SOURCE_PASS))
{
}
else
{
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
- statusOp_read(&temp2Var8,
- &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
+ GATEMP_INDEX_DEC);
+ temp2Var8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+ GATEMP_INDEX_DEC);
if (temp2Var8 != tempVar8)
{
return 1;
}
-#else
- if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect != pAstCfg->xDec[zMD].decodeStatus.sourceDecode)
- {
- return 1;
- }
-#endif
}
}
)
{
PAF_AST_Config *pAstCfg;
+ AspMsgMaster_Handle hAspMsgMaster;
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/encode counter */
- ASP_Msg* pAspMsg;
Int argIdx;
- Int errno; /* error number */
- Int status;
-#ifdef NON_CACHE_STATUS
Int8 tempVar8;
-#endif
-
+ char decMsgBuf[ASP_MSG_BUF_LEN];
+ Int status;
- pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ hAspMsgMaster = pAsitCfg->hAspMsgMaster; // get message master handle
as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
DEC_Handle dec = (DEC_Handle )decAlg[z];
#endif /* PAF_ASP_FINAL */
Int zI = pP->inputsFromDecodes[z];
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.mode),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (pAstCfg->xInp[zI].hRxSio && tempVar8)
{
-#else
- if (pAstCfg->xInp[zI].hRxSio && pAstCfg->xDec[z].decodeStatus.mode)
- {
-#endif
TRACE_VERBOSE1("PAF_ASIT_decodeComplete: AS%d: finalizing decode", as+z);
#ifdef PAF_ASP_FINAL
if (dec->fxns->final)
dec->fxns->final(dec, NULL, &pAstCfg->xDec[z].decodeControl,
&pAstCfg->xDec[z].decodeStatus);
#endif /* PAF_ASP_FINAL */
- // FL: send dec deactivate message to slave
- pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
- if (pAspMsg == NULL)
- {
- TRACE_TERSE0("MessageQ_alloc() failure.");
- errno = -1; // temporary
- return errno;
- }
- MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg); /* set the return address in the message header */
- pAspMsg->cmd = ASP_SLAVE_DEC_DEACTIVATE; /* fill in message payload */
- pAspMsg->procId = hAspMsgMaster->masterProcId;
- pAspMsg->expectResp = TRUE;
- pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+
+ // send dec deactivate message to slave
argIdx = 0; // set decIdx
- *(Int32 *)&pAspMsg->buf[argIdx] = z;
- TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
- status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg); /* send message */
- if (status != MessageQ_S_SUCCESS)
+ *(Int32 *)&decMsgBuf[argIdx] = z;
+ status = AspMsgSnd(hAspMsgMaster, ASP_SLAVE_DEC_DEACTIVATE, decMsgBuf);
+ if (status != ASP_MSG_NO_ERR)
{
+ TRACE_TERSE0("decodeComplete: error in sending DEC_DEACTIVATE message.");
SW_BREAKPOINT;
+ return -1;
}
- // wait for dec deactivate complete message from slave
- status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
- if (status != MessageQ_S_SUCCESS)
- {
- TRACE_TERSE0("MessageQ_get() failure.");
- return errno;
- }
- if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
- (pAspMsg->cmd != ASP_MASTER_DEC_DEACTIVATE_DONE) ||
- (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
- {
- TRACE_MSG3("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_TERSE3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
- // free the message
- status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
- if (status != MessageQ_S_SUCCESS)
+ status = AspMsgRcvAck(hAspMsgMaster, ASP_MASTER_DEC_DEACTIVATE_DONE, NULL, TRUE);
+ if (status != ASP_MSG_NO_ERR)
{
+ TRACE_TERSE0("decodeComplete: error in receiving DEC_DEACTIVATE ack message.");
SW_BREAKPOINT;
+ return -1;
}
-
-#if 0 // FL: decoder deactivate call, slave
- if (decAlg[z]->fxns->algDeactivate)
- decAlg[z]->fxns->algDeactivate (decAlg[z]);
-#endif
}
else
{
{
PAF_AST_Config *pAstCfg;
Int z; /* decode counter */
-#ifdef NON_CACHE_STATUS
Int8 tempVar8;
-#endif
pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
for (z=DECODE1; z < DECODEN; z++)
{
-#ifdef NON_CACHE_STATUS
- statusOp_read(&tempVar8,
- &(pAstCfg->xDec[z].decodeStatus.mode),
- sizeof(Int8),
- GATEMP_INDEX_DEC);
+ tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+ GATEMP_INDEX_DEC);
if (tempVar8)
{
tempVar8 = x;
- statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
- &tempVar8,
- sizeof(Int8),
- GATEMP_INDEX_DEC);
- }
-#else
- if (pAstCfg->xDec[z].decodeStatus.mode)
- {
- pAstCfg->xDec[z].decodeStatus.sourceDecode = x;
+ sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
+ tempVar8, GATEMP_INDEX_DEC);
}
-#endif
}
return 0;
// -----------------------------------------------------------------------------
-#if 0 // (***) FL: no longer used w/ removal of CONTINUOUS mode
-Int
-PAF_AST_decodeHandleErrorInput (const PAF_AST_Params *pP, const PAF_AST_Patchs *pQ, PAF_AST_Config *pC, ALG_Handle decAlg[], Int z, Int error)
-{
- Int errno = 0;
- Int zMD = pC->masterDec;
- Int zI = pP->inputsFromDecodes[z];
-
- // only handle real errors, on primary input, for writeDECModeContinuous
- if ( !( error &&
- z == zMD ))
- return error;
-
- TRACE_TIME((&TIME_MOD, "AS%d: PAF_AST_decodeHandleErrorInput: (primary) input error caught = %d", pC->as+z, error));
- TRACE_TIME((&TIME_MOD, "AS%d: PAF_AST_decodeHandleErrorInput: old sourceProgram = %d", pC->as+z, pC->xDec[z].decodeStatus.sourceProgram));
-
- if (pC->xInp[zI].hRxSio) {
- DEC_Handle dec;
-
- if (errno = SIO_idle (pC->xInp[zI].hRxSio))
- return errno;
-
- // indicates (primary) input not running
- pC->xDec[z].decodeStatus.sourceDecode = PAF_SOURCE_NONE;
-
- pC->xInp[zI].inpBufConfig.deliverZeros = 1;
-
- // will be changed after next reclaim, to PAF_SOURCE_UNKNOWN or other
- pC->xDec[z].decodeStatus.sourceProgram = PAF_SOURCE_NONE;
-
- if (decAlg[z]->fxns->algDeactivate)
- decAlg[z]->fxns->algDeactivate (decAlg[z]);
-
- decAlg[z] = pC->xDec[z].decAlg[PAF_SOURCE_PCM];
- dec = (DEC_Handle )decAlg[z];
-
- TRACE_TIME((&TIME_MOD, "AS%d: PAF_AST_decodeHandleErrorInput: resetting to PCM decoder",
- pC->as+z));
-
- if (decAlg[z]->fxns->algActivate)
- decAlg[z]->fxns->algActivate (decAlg[z]);
-
- if (dec->fxns->reset
- && (errno = dec->fxns->reset (dec, NULL,
- &pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus)))
- return errno;
- }
-
- return errno;
-} //PAF_AST_decodeHandleErrorInput
-#endif
-
#if (CURRENT_TRACE_MASK & TRACE_MASK_DATA)
//------------------------------------------------------------------------------
#endif
// Compute decoder frame length based on selected source
-static Int getFrameLengthSourceSel(
+Int getFrameLengthSourceSel(
const PAF_ASIT_Params *pP,
Int8 sourceSelect
)
case PAF_SOURCE_PCM:
frameLength = FRAMELENGTH;
break;
+ case PAF_SOURCE_AAC:
+ frameLength = 1024;
+ break;
case PAF_SOURCE_AC3:
case PAF_SOURCE_DDP:
frameLength = ASIP_FRAMELEN_SS_DDP_AC3;
case PAF_SOURCE_THD:
frameLength = ASIP_FRAMELEN_SS_THD;
break;
+ case PAF_SOURCE_DTS:
+ case PAF_SOURCE_DTSHD:
+ case PAF_SOURCE_DTS12:
+ case PAF_SOURCE_DTS13:
+ case PAF_SOURCE_DTS14:
+ case PAF_SOURCE_DTS16:
+ case PAF_SOURCE_DTSALL:
+ frameLength = ASIP_FRAMELEN_SS_DTS;
+ break;
default:
frameLength = ASIP_FRAMELEN_SS_DEFAULT;
break;