author | Frank Livingston <frank-livingston@ti.com> | |
Mon, 23 Apr 2018 19:26:45 +0000 (14:26 -0500) | ||
committer | Frank Livingston <frank-livingston@ti.com> | |
Mon, 23 Apr 2018 19:26:45 +0000 (14:26 -0500) |
16 files changed:
diff --git a/pasdk/test_arm/framework/audioStreamDecodeProc.c b/pasdk/test_arm/framework/audioStreamDecodeProc.c
index c6bc8526428406c5d1c3f876a6043ab083c25957..2abec192a85a0abecea06fd4c8b46a9452734d6b 100644 (file)
//
pfpBegin(PFP_ID_ASDT_2, pAsdtCfg->taskHandle);
errno = dec->fxns->decode(dec, NULL, &pAstCfg->xDec[z].decodeInStruct, &pAstCfg->xDec[z].decodeOutStruct);
+ //decode is done
pfpEnd(PFP_ID_ASDT_2, PFP_FINISH_MEAS);
if (errno < 0)
{
cbLog(pCbCtl, z, 1, "cbInitSourceSel");
// Perform Dec Decode1 Init-Sync
+ // - Write Dec Decode1 output audio frame
// - Set Dec Decode1 decoder stage flag
- outIsErrno = outIsWriteDecStageFlag(pOutIsCtl, z,
- ASP_OUTIS_DEC_STAGE_DECODE1_IDX, 1);
+ outIsErrno = outIsWriteDecStageFlagAndAf(pOutIsCtl, z,
+ ASP_OUTIS_DEC_STAGE_DECODE1_IDX, 1, pAfWrt);
if (outIsErrno < 0)
{
SW_BREAKPOINT; // debug
index da220cb66986ba400fe0bcba03fb9ce60a05b770..eb061dcd845d705bc9c7fdf82379b2a0e7d1ebbb 100644 (file)
--- a/pasdk/test_dsp/.cproject
+++ b/pasdk/test_dsp/.cproject
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/application/itopo/evmk2g/alpha""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/application/itopo/evmk2g""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/common""/>
- <listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/shared""/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.2.compilerID.DEBUGGING_MODEL.1482379904" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.2.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.C6000_8.2.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.2.compilerID.DISPLAY_ERROR_NUMBER.438364409" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.2.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
<listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/board/lib/evmK2G/c66/release""/>
<listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/drv/mcasp/lib/k2g/c66/release""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/paf/pa/build/c66x/release""/>
- <listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/paf/pa/util/da10x_misc/c66x/release""/>
<listOptionValue builtIn="false" value=""${TI_MAS_DSPLIB_C66X_INSTALL_DIR}/packages/ti/dsplib/lib""/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.2.linkerID.DIAG_WRAP.1615944037" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.2.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C6000_8.2.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
diff --git a/pasdk/test_dsp/application/itopo/evmk2g/mcasp_cfg.c b/pasdk/test_dsp/application/itopo/evmk2g/mcasp_cfg.c
index 9c165fad8533d02e1fe8a302eb7f66892f42e5db..63085999fbac9554cfaf30dfca5c2ed99c503b59 100644 (file)
/* .xstat = */ 0x000001FF, /* reset any existing status bits */
/* .xevtctl = */ 0x00000000, /* DMA request is enabled or disabled */
{
- /* .aclkxctl = */ 0X000000E1, // Transmit bit clock divide ratio = 2
+// /* .aclkxctl = */ 0X000000E1, // Transmit bit clock divide ratio = 2 --> works for 48khz PCM but not for DDP
+ /* .aclkxctl = */ 0X000000E7, // Transmit bit clock divide ratio = 8 --> working for DDP/MAT/THD 48khz but not for PCM
+// /* .aclkxctl = */ 0X000000E3, // Transmit bit clock divide ratio = 4 --> THD 96khz
+// /* .aclkxctl = */ 0X000000E1, // Transmit bit clock divide ratio = 2 --> THD 192khz
/* .ahclkxctl = */ 0x00004000,
/* .xclkchk = */ 0x00000000
},
Mcasp_WordLength_32, /* wordWidth */
NULL, /* void * userLoopJobBuffer */
0, /* userLoopJobLength */
- NULL, /* edmaHandle */
+ NULL, /* edmaHandle */
GblErr,
2, /* number of TDM channels */
Mcasp_BufferFormat_MULTISER_MULTISLOT_SEMI_INTERLEAVED_1,
status = mcaspBindDev(&mcaspDevHandles[lldCfg->mcaspPort], lldCfg->mcaspPort, &mcaspParams);
if((status != MCASP_COMPLETED) || (mcaspDevHandles[lldCfg->mcaspPort] == NULL)) {
- return (Aud_EFAIL);
+ return (Audk2g_EFAIL);
}
}
index 421477fae02357c2c722b0ffb9c6ee7b2095b14b..e96055ca8978e1bd4fb0d4e0a9ae7da32bbc881f 100644 (file)
#define DEC_MINSAMGEN PCM_MINSAMGEN
#define DEC_MAXSAMGEN PCM_MAXSAMGEN
#endif
-
+#if 0
Int
PAF_DEC_computeFrameLength(
Int decIdx,
return m;
} /* PAF_DEC_computeFrameLength */
+#endif
//
// Audio Stream Task / Decode Processing - Input Status Update
diff --git a/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c b/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c
index b54a0f979b4401d8410c251d3e4ab0d058acbbd9..0813dfb38e5af1856a4567916f28ade8eeb68039 100644 (file)
Cache_inv(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
Cache_wait();
- if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
- {
- //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
- for (i = 0; i < pAfCb->data.nChannels; i++)
- {
- pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
- }
- }
- else
- {
- // Read CB AF samsiz array
- for (i = 0; i < pCb->maxAFChanNum; i++)
- {
- if ((streamMask >> i) & 0x1)
- {
- pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
- }
- }
- }
+ if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
+ {
+ //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+ for (i = 0; i < pAfCb->data.nChannels; i++)
+ {
+ pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
+ }
+ }
+ else
+ {
+ // Read CB AF samsiz array
+ for (i = 0; i < pCb->maxAFChanNum; i++)
+ {
+ if ((streamMask >> i) & 0x1)
+ {
+ pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
+ }
+ }
+ }
// FL: This brute force approach to clearing metadata isn't
// necessary if decoders properly set, and downstream
Cache_wait();
// Cache invalidate CB AF PCM samples
- if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
- {
- //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
- for (i = 0; i < pAfCb->data.nChannels; i++)
- {
- Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
- }
- }
- else
- {
- for (i = 0; i < pCb->maxAFChanNum; i++)
- {
- if ((streamMask >> i) & 0x1)
- {
- Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
- }
- }
- }
+ if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
+ {
+ //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+ for (i = 0; i < pAfCb->data.nChannels; i++)
+ {
+ Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+ }
+ }
+ else
+ {
+ for (i = 0; i < pCb->maxAFChanNum; i++)
+ {
+ if ((streamMask >> i) & 0x1)
+ {
+ Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+ }
+ }
+ }
Cache_wait();
// Read PCM samples from CB AF
- if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
- {
- //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
- for (i = 0; i < pAfCb->data.nChannels; i++)
- {
- for (j = 0; j < numSampsRd; j++)
- {
- pAfRd->data.sample[i][pcmWrtIdx+j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
- }
- }
- }
- else
- {
- for (i = 0; i < pCb->maxAFChanNum; i++)
- {
- if ((streamMask >> i) & 0x1)
- {
- for (j = 0; j < numSampsRd; j++)
- {
- pAfRd->data.sample[i][pcmWrtIdx+j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
- }
- }
- }
- }
+ if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
+ {
+ //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+ for (i = 0; i < pAfCb->data.nChannels; i++)
+ {
+ for (j = 0; j < numSampsRd; j++)
+ {
+ pAfRd->data.sample[i][pcmWrtIdx+j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
+ }
+ }
+ }
+ else
+ {
+ for (i = 0; i < pCb->maxAFChanNum; i++)
+ {
+ if ((streamMask >> i) & 0x1)
+ {
+ for (j = 0; j < numSampsRd; j++)
+ {
+ pAfRd->data.sample[i][pcmWrtIdx+j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
+ }
+ }
+ }
+ }
// Cache invalidate CB AF unused metadata
for (i = pCb->prvMdRdIdx; i < pAfCb->numPrivateMetadata; i++)
{
if (totNumSampsRd < pCb->strFrameLen)
{
+ pAfRd->sampleCount = pCb->strFrameLen; // update Read AF sample count for partial frame
+
// Clear remaining Read AF PCM samples
- if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
- {
- //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
- for (i = 0; i < pAfCb->data.nChannels; i++)
- {
- memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
- }
- }
- else{
- for (i = 0; i < pCb->maxAFChanNum; i++)
- {
- if ((streamMask >> i) & 0x1)
- {
- memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
- }
- }
- }
+ if (pAfRd->bsMetadata_type == PAF_bsMetadata_DTS_X)
+ {
+ //DTSX needs up to 8 to 16 channels to transfer metadata depends on sampling rate.
+ for (i = 0; i < pAfCb->data.nChannels; i++)
+ {
+ memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
+ }
+ }
+ else{
+ for (i = 0; i < pCb->maxAFChanNum; i++)
+ {
+ if ((streamMask >> i) & 0x1)
+ {
+ memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
+ }
+ }
+ }
+
if (pCb->writerActiveFlag == 1)
{
//
for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
{
if ((streamMask >> i) & 0x1)
- {
+ {
memset(pAfRd->data.sample[i], 0, pAfRd->sampleCount*sizeof(PAF_AudioData));
}
pAfRd->data.samsiz[i] = 0;
pAfRd->numPrivateMetadata = 0; /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
pAfRd->bsMetadata_offset = 0; /* offset into audio frame for change in bsMetadata_type field */
//Following parameters are used in DTSX
- pAfRd->mode = 0; /* mode used by PARMA */
- pAfRd->numChansUsedForMetadata = 15; /* constant of 15 */
- pAfRd->pafBsFixedData = TRUE; /* if true, do not convert float to fixed in DTSX metadata transfer */
- pAfRd->root = 0x1BF; /* used for channel MASK in DTSX. 0x1BF = 7.1 as defined in dtshd_dec_api_common.h */
+ pAfRd->mode = 0; /* mode used by PARMA */
+ pAfRd->numChansUsedForMetadata = 15; /* constant of 15 */
+ pAfRd->pafBsFixedData = TRUE; /* if true, do not convert float to fixed in DTSX metadata transfer */
+ pAfRd->root = 0x1BF; /* used for channel MASK in DTSX. 0x1BF = 7.1 as defined in dtshd_dec_api_common.h */
pAfRd->resetCount = 0; /* used for communication between DTSX and PARMA */
}
+// Read CB stream frame length
+Int cbReadStrFrameLen(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index, or indicator combined drain state desired
+ Int16 *pStrFrameLen // stream frame length
+)
+{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_DecOpCircBuf *pCb;
+
+ // Get gate handle
+ gateHandle = pCbCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ // Get circular buffer base pointer
+ pCb = &((*pCbCtl->pXDecOpCb)[cbIdx]);
+
+ // Invalidate circular buffer configuration
+ Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
+
+ // Set output frame length
+ *pStrFrameLen = pCb->strFrameLen;
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_DECOP_CB_SOK;
+}
+
// Check circular buffer drain state
Int cbCheckDrainState(
PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
diff --git a/pasdk/test_dsp/framework/aspDecOpCircBuf_master.h b/pasdk/test_dsp/framework/aspDecOpCircBuf_master.h
index 24c33b1853d26aff9804308a8031018f5f59c909..b62689117927777ef2ffc70f58906fa64cb3ed88 100644 (file)
PAF_AudioFrame *pAfRd // audio frame into which to read
);
+// Read CB stream frame length
+Int cbReadStrFrameLen(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index, or indicator combined drain state desired
+ Int16 *pStrFrameLen // stream frame length
+);
+
// Check circular buffer drain state
Int cbCheckDrainState(
PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
diff --git a/pasdk/test_dsp/framework/audioStreamInpDec.c b/pasdk/test_dsp/framework/audioStreamInpDec.c
index 0e65ea2673842506c11d1e74d60fd56a6d7b2d30..e98dceb6d8190a67fd270cc486c4eb183052f26e 100644 (file)
}
}
}
-
- if (decMsg & DEC_MSGMSK_INPDATA) {
+ // If both INPDATA and RXACK are received, INPDATA message will be
+ // processed in next iteration, in state DEC_STATE_INFO_SND.
+ else if (decMsg & DEC_MSGMSK_INPDATA) {
// If we're here, it means decode acknowledgment from decoder
// is delayed, i.e., a new frame of input data is ready before
// current frame decoding is finished.
TRACE_VERBOSE0("decDecodeFsm: receiving INPDATA in DEC_STATE_DECODE_ACK");
}
-
- if (decMsg != 0) {
+ else {
decErr = DEC_ERR_WRONG_MSG;
}
break;
diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.c b/pasdk/test_dsp/framework/audioStreamInpProc.c
index 680dd79bd303c102926d242b625954e930b7c1c0..6bad180a2819db6b1d66f734ff8e9cdc118cb9d0 100644 (file)
zMS = pAstCfg->masterStr;
// Decode output circular buffer memory
- if (!(pAstCfg->xDecOpCb = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM,
+ if (!(pAstCfg->xDecOpCb = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM,
DECODEN * sizeof (*pAstCfg->xDecOpCb), 4, &eb)))
{
TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
diff --git a/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c b/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c
index 8ee9140bea4869cf32c0e24a64cd496e22145728..6a88397e5b092e3396db46b6844256e237af0c72 100644 (file)
ioDataCfg.ioBuffHandle = pInpIo->hIoBuff;
ioDataCfg.unknownSourceTimeOut = pInpBuf->inpBufConfig.pBufStatus->unknownTimeout;
ioDataCfg.frameLengthsIEC = (uint_least16_t *)&iecFrameLength[0];
- ioDataCfg.frameLengthPCM = INPUT_FRAME_SIZE_PCM / WORD_SIZE_PCM;
- ioDataCfg.frameLengthDef = INPUT_FRAME_SIZE_DEF / WORD_SIZE_BITSTREAM;
+ ioDataCfg.frameLengthPCM = pInpIo->stride * NUM_CYCLE_PER_FRAME_DEF;
+ ioDataCfg.frameLengthDef = pInpIo->stride * NUM_CYCLE_PER_FRAME_DEF;
ioDataCfg.ibMode = pInpBuf->inpBufConfig.pBufStatus->mode;
ioDataCfg.zeroRunRestart = pInpBuf->inpBufConfig.pBufStatus->zeroRunRestart;
ioDataCfg.zeroRunTrigger = pInpBuf->inpBufConfig.pBufStatus->zeroRunTrigger;
@@ -1156,7 +1156,7 @@ Int asitSelectDevices(const PAF_ASIT_Patchs *pQ, PAF_AST_Config *pAstCfg, PAF_AS
pInp->pRxParams = pQ->devinp->x[interface];
pInp->hMcaspChan = lldCfg->hMcaspChan;
- pInp->stride = lldCfg->mcaspChanParams->noOfSerRequested * 2; // 2 for stereo
+ pInp->stride = lldCfg->mcaspChanParams->noOfSerRequested * lldCfg->mcaspChanParams->noOfChannels;
/* Set flag to swap HDMI data if it is 4xI2S and word length is 16 */
if( (lldCfg->mcaspChanParams->wordWidth == Mcasp_WordLength_16)
return ASIT_NO_ERR;
} /* asitUpdateIoComps */
-
+#if 0
#ifndef IO_LOOPBACK_TEST
#if OUTPUT_FRAME_LENGTH == INPUT_FRAME_LENGTH
U8 pcmbuf[OUTPUT_FRAME_SIZE];
}
#endif
+#endif
+
Int asitEvtErrCheck(UInt actualEvents, UInt expectedEvents)
{
TRACE_VERBOSE2("ASIT events error: actual events are: %d, expected events are: %d.",
diff --git a/pasdk/test_dsp/framework/audioStreamOutDec.c b/pasdk/test_dsp/framework/audioStreamOutDec.c
index cbab851de909de9f6ab7f1015d584a56538eef6d..989e9923ad01d0af2f900980cfb19492c048041f 100644 (file)
#include "audioStreamOutProc.h"
#include "audioStreamOutIo.h"
#include "audioStreamOutDec.h"
+#include "ioConfig.h" //TODO: remove this header
+#include "ioPhy.h"
#define ENC_Handle PCE_Handle /* works for all: PCE */
// Reset ASP chain
//
TRACE_VERBOSE0("asopDecOutProcInfo1: calling streamChainFunction.");
- errno = streamChainFunction(pP, pQ, pAsotCfg, PAF_ASP_CHAINFRAMEFXNS_RESET, 1, frame);
+ errno = streamChainFunction(pP, pQ, pAsotCfg, PAF_ASP_CHAINFRAMEFXNS_RESET, 1, frame); // SRC reset is called inside;
if (errno)
{
TRACE_TERSE1("asopDecOutProcInfo1: streamChainFunction returns errno 0x%x ", errno);
for (z=DECODE1; z < DECODEN; z++)
{
+#if 0 // FL: moved to PAF_ASOT_initSyncDecDecode1()
// Initialize decoder output circular buffer for stream reads
errno = cbInitStreamRead(pCbCtl, z);
if (errno)
status = ASOP_DOP_ERR_INIT_CBINITREAD;
return status;
}
+#endif
// Start decoder output circular buffer reads
errno = cbReadStart(pCbCtl, z);
#if 0 // debug, capture audio frame
if (capAfWrite(pAfRd, PAF_LEFT) != CAP_AF_SOK)
+// if (capAfWrite(pAfRd, PAF_RIGHT) != CAP_AF_SOK)
{
Log_info0("asopDecOutProcStream:capAfWrite() error");
}
if (pOut[z].hIoPhy)
{
- // update length (e.g. ARC may have changed)
- pAstCfg->xOut[z].outBufConfig.lengthofFrame =
+ //uint32_t phyXferSizeOld;
+
+ // update length (e.g. ARC may have changed) - moved out of this function
+/* pAstCfg->xOut[z].outBufConfig.lengthofFrame =
pAstCfg->xEnc[zE].encodeInStruct.pAudioFrame->sampleCount;
-
+*/
TRACE_GEN2("asopDecodeEncode: AS%d: processing frame %d -- idle", as+zS, frame);
#if 0 // FL, New IO: add similar thing to be figured out
// Update framework Phy transfer size
- pOut[z].phyXferSize = pAstCfg->xOut[z].outBufConfig.lengthofFrame * OUTPUT_STRIDE * WORD_SIZE_PCM;
+ phyXferSizeOld = pOut[z].phyXferSize;
+ pOut[z].phyXferSize = pAstCfg->xOut[z].outBufConfig.lengthofFrame * pOut[z].stride * WORD_SIZE_PCM;
// Update IO Phy transfer size
ioPhyCtl.code = IOPHY_CTL_FRAME_SIZE;
ioPhyCtl.params.xferFrameSize = pOut[z].phyXferSize;
ioPhyControl(pOut[z].hIoPhy, &ioPhyCtl);
// Update IO Buff delay to match Phy transfer size
- ioBuffAdjustDelay(pOut[z].hIoBuff, pOut[z].phyXferSize * (NUM_PRIME_XFERS+1));
-
+ if(pOut[z].phyXferSize != phyXferSizeOld) {
+ ioBuffAdjustDelay(pOut[z].hIoBuff, pOut[z].phyXferSize * (NUM_PRIME_XFERS+1));
+ }
+/*
errno = SIO_reclaim(pAstCfg->xOut[z].hTxSio,(Ptr *) &pAstCfg->xOut[z].pOutBuf, NULL);
if (errno < 0)
{
TRACE_TERSE2("PAF_ASOT_decodeEncode: AS%d: SIO_reclaim returns error %d", as+zS, -errno);
return -errno; // SIO negates error codes
}
+*/
#endif
#if 0 // debug
? "asopStreamChainFunction: AS%d: processing frame %d -- audio stream (final)"
: "asopStreamChainFunction: AS%d: processing frame %d -- audio stream (?????)",
as+z, logArg);
- errno = (*func) (chain, frame);
+ errno = (*func) (chain, frame); // ASP chain reset function: SRC is the 1st in the chain and reset
TRACE_VERBOSE2("asopStreamChainFunction: AS%d: errno 0x%x.", as+z, errno);
if (errno && abortOnError)
diff --git a/pasdk/test_dsp/framework/audioStreamOutIo.c b/pasdk/test_dsp/framework/audioStreamOutIo.c
index 6768889362bfeac37d6063a866749057ae7e4c95..b93a5f052e03b516b7eaf668f5773dce2595c848 100644 (file)
}
pOut->hMcaspChan = mcaspChanHandle;
+ pOut->stride = lldCfg->mcaspChanParams->noOfSerRequested * lldCfg->mcaspChanParams->noOfChannels;
}
return 0;
// Need to Revisit: Starting Clocks here seems logical & also manages the McASP without spurious underruns .
#if 0
// if device selected and valid then enable stat tracking if
- // required and start clocking
- if ((pAstCfg->xOut[z].outBufStatus.sioSelect < 0) && (pAstCfg->xOut[z].hTxSio))
- {
- TRACE_VERBOSE0("PAF_ASOT_startOutput: start SIO clocks");
- errme = SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_OUTPUT_START_CLOCKS, 0);
- if (errno)
- {
- TRACE_VERBOSE2("PAF_ASOT_startOutput: errme 0x%x, errno 0x%x", errme, errno);
- SIO_idle(pAstCfg->xOut[z].hTxSio);
- if (!errno)
- {
- errno = ASPERR_DEVOUT + errme;
- }
- }
- }
+ // required and start clocking
+ if ((pAstCfg->xOut[z].outBufStatus.sioSelect < 0) && (pAstCfg->xOut[z].hTxSio))
+ {
+ TRACE_VERBOSE0("PAF_ASOT_startOutput: start SIO clocks");
+ errme = SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_OUTPUT_START_CLOCKS, 0);
+ if (errno)
+ {
+ TRACE_VERBOSE2("PAF_ASOT_startOutput: errme 0x%x, errno 0x%x", errme, errno);
+ SIO_idle(pAstCfg->xOut[z].hTxSio);
+ if (!errno)
+ {
+ errno = ASPERR_DEVOUT + errme;
+ }
+ }
+ }
#endif
// Set sample count so that DOB knows how much data to send
#if 1 // FL, New IO: add similar thing to be figured out
// Update framework Phy transfer size
- pOut[z].phyXferSize = pAstCfg->xOut[z].outBufConfig.lengthofFrame * OUTPUT_STRIDE * WORD_SIZE_PCM;
- // Update IO Phy transfer size
+ pOut[z].phyXferSize = pAstCfg->xOut[z].outBufConfig.lengthofFrame * pOut[z].stride * WORD_SIZE_PCM;
+ // Update IO Phy transfer size
ioPhyCtl.code = IOPHY_CTL_FRAME_SIZE;
ioPhyCtl.params.xferFrameSize = pOut[z].phyXferSize;
ioPhyControl(pOut[z].hIoPhy, &ioPhyCtl);
// Update IO Buff delay to match Phy transfer size
ioBuffAdjustDelay(pOut[z].hIoBuff, pOut[z].phyXferSize * (NUM_PRIME_XFERS+1));
-#endif
+#endif
if (pAstCfg->xOut[z].outBufStatus.markerMode == PAF_OB_MARKER_ENABLED)
{
ioBuffParams.base = pOutBuf->outBufConfig.base.pVoid;
ioBuffParams.size = pOutBuf->outBufConfig.allocation/STRIDE_WORST_CASE*STRIDE_WORST_CASE;
ioBuffParams.sync = IOBUff_READ_SYNC;
- ioBuffParams.nominalDelay = OUTPUT_FRAME_SIZE * (NUM_PRIME_XFERS+1);
+ ioBuffParams.nominalDelay = NUM_CYCLE_PER_OUTPUT_FRAME_DEF * pOutIo->stride * WORD_SIZE_PCM * (NUM_PRIME_XFERS+1);
if(ioBuffInit(pOutIo->hIoBuff, &ioBuffParams) != IOBUFF_NOERR)
{
return -1; // to remove magic number
}
ioPhyParams.ioBuffHandle = pOutIo->hIoBuff;
- ioPhyParams.xferFrameSize = OUTPUT_FRAME_SIZE;
+ ioPhyParams.xferFrameSize = NUM_CYCLE_PER_FRAME_DEF * pOutIo->stride * WORD_SIZE_PCM;
ioPhyParams.mcaspChanHandle = pOutIo->hMcaspChan;
ioPhyParams.ioBuffOp = IOPHY_IOBUFFOP_READ;
if(ioPhyInit(pOutIo->hIoPhy, &ioPhyParams) != IOPHY_NOERR)
pOutBufCfg = &pOutBuf->outBufConfig;
hIoBuff = pOutIo->hIoBuff;
- pOutBufCfg->stride = OUTPUT_STRIDE;
+ pOutBufCfg->stride = pOutIo->stride;
pOutBufCfg->sizeofElement = WORD_SIZE_PCM;
pOutBufCfg->precision = 24;
ioBuffGetInfo(hIoBuff, &outBuffInfo);
- pOutBufCfg->base.pLgInt = outBuffInfo.base;
- pOutBufCfg->sizeofBuffer = outBuffInfo.size;
+ pOutBufCfg->base.pLgInt = outBuffInfo.base;
+ pOutBufCfg->sizeofBuffer = outBuffInfo.size;
- pOutBuf->pOutBuf = &(pOutBuf->outBufConfig);
+ pOutBuf->pOutBuf = &(pOutBuf->outBufConfig);
return 0;
}
+Int asopGetOutBufPtrs(
+ PAF_AST_IoOut *pOutIo,
+ size_t writeSize
+)
+{
+ void *buff1, *buff2;
+ size_t size1, size2;
+ Int status;
+
+ status = ioBuffGetWritePtrs(pOutIo->hIoBuff, writeSize,
+ &buff1, &size1, &buff2, &size2);
+ if (status == IOBUFF_ERR_OVERFLOW)
+ {
+ pOutIo->errIoBuffOvrCnt++;
+ //System_printf ("asopGetOutBufPtrs: output buff overflow\n"); // debug
+
+ // skip processing since output buffer overflows
+ return -1;
+ }
+ else if (status == IOBUFF_ERR_UNDERFLOW)
+ {
+ pOutIo->errIoBuffUndCnt++;
+ //System_printf ("asopGetOutBufPtrs: output buff underflow\n"); // debug
+
+ // already underflows and remain in underflow
+ }
+
+ // save buffer pointers & sizes for later write complete
+ pOutIo->buff1 = buff1;
+ pOutIo->size1 = size1;
+ pOutIo->buff2 = buff2;
+ pOutIo->size2 = size2;
+
+ return 0;
+}
+
+#if 0
// Update Output buffer configuration.
// This is needed for proper operation of PCM encoder.
Int asopUpdateOutBufConfig(
// FL, New IO: original code can change these values in every DOB issue
// Need to determine if this is required or not.
- pOutBufCfg->stride = OUTPUT_STRIDE;
+ pOutBufCfg->stride = pOutIo->stride;
pOutBufCfg->sizeofElement = WORD_SIZE_PCM;
pOutBufCfg->precision = 24;
//JXTODO: to replace hard coded write size
// Get write pointers of output memory pool
- total_write_size = pOutBufCfg->lengthofFrame * pOutBufCfg->stride * pOutBufCfg->sizeofElement;
+ total_write_size = pOutBufCfg->lengthofFrame * pOutBufCfg->stride * pOutBufCfg->sizeofElement;
status = ioBuffGetWritePtrs(hIoBuff, total_write_size,
&buff1, &size1, &buff2, &size2);
if (status == IOBUFF_ERR_OVERFLOW)
// already underflows and remain in underflow
}
-
+#if 0
// Update Output buffer pointer for Encoder
- pOutBufCfg->pntr.pLgInt = buff1;
+ pOutBufCfg->pntr.pLgInt = buff1;
if ((buff2 != NULL) || (size2 != 0))
{
// buff2 should always be NULL for Output & size2 should always be 0 for Output.
// Track this here.
pOutIo->ioBuffBuf2AllocCnt++; // debug
}
-
+#endif
// save buffer pointers & sizes for later write complete
pOutIo->buff1 = buff1;
pOutIo->size1 = size1;
return 0;
}
+#endif
// Mark Output buffers write complete
Int asopMarkOutBuffsWriteComplete(
diff --git a/pasdk/test_dsp/framework/audioStreamOutIo.h b/pasdk/test_dsp/framework/audioStreamOutIo.h
index cbebe02f8d80be5ca02848f599d5547ee959d412..605438489066252ceb8428cc1af87aa6d530c12d 100644 (file)
PAF_AST_IoOut *pOutIo
);
+// Get output buffer write pointers for encoder to write
+Int asopGetOutBufPtrs(
+ PAF_AST_IoOut *pOutIo,
+ size_t writeSize
+);
+
// Update Output buffer configuration
Int asopUpdateOutBufConfig(
PAF_AST_OutBuf *pOutBuf,
diff --git a/pasdk/test_dsp/framework/audioStreamOutProc.c b/pasdk/test_dsp/framework/audioStreamOutProc.c
index 3515ac05cf05839ee40e2d62e2dd65c17db0daac..f3818abe10f2094d85543a8885180713f457c804 100644 (file)
#include <ti/sysbios/BIOS.h>
#include "aspOutInitSync_master.h"
+#include "aspDecOpCircBuf_master.h"
#include "audioStreamProc_common.h"
#include "audioStreamOutProc.h"
#include "audioStreamOutInit.h"
#include "audioStreamOutDec.h"
#include "audioStreamOutIo.h"
+#include "common.h"
//#include "pfp/pfp.h"
//#include "pfp_app.h" /* contains all PFP ID's */
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
PAF_ASOT_Config *pAsotCfg,
+ PAF_AudioFrame *pDecDecode1Af,
Int frame
);
// ASOT SM function
// Purpose: Init-Sync Re-Sync state function.
-// Performs Init-Sync using stored Dec Reset/Info1 AFs.
+// Performs Init-Sync using stored Init-Sync AFs.
static Int PAF_ASOT_initSyncResync(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
PAF_ASOT_Config *pAsotCfg,
PAF_AudioFrame *pDecResetAf,
PAF_AudioFrame *pDecInfo1Af,
+ PAF_AudioFrame *pDecDecode1Af,
Int frame
);
+static Int asopDecOutProcEncodeWrap(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg,
+ Int frame,
+ Int zO
+);
+
// ASOT SM function
// Purpose: Re-select devices used for Output.
-// Performs Init-Sync using stored Dec Reset/Info1 AFs.
+// Performs Init-Sync using stored Init-Sync AFs.
static Int PAF_ASOT_reselectDevices(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
PAF_ASOT_Config *pAsotCfg,
PAF_AudioFrame *pDecResetAf,
PAF_AudioFrame *pDecInfo1Af,
+ PAF_AudioFrame *pDecDecode1Af,
Int frame,
Bool *pOutDevSel
);
Bool outDevSel; // whether output device selected
PAF_AudioFrame decResetAf;
PAF_AudioFrame decInfo1Af;
+ PAF_AudioFrame decDecode1Af;
UInt events; // latched event flags
Bool procEvents; // process events flags
Bool procOutFirstTime; // first time process output flag
}
asopLoopCount++;
- TRACE_GEN1("TaskAsop (begin Main loop %d)", asopLoopCount);
+ //TRACE_GEN1("TaskAsop (begin Main loop %d)", asopLoopCount);
switch (pAsotCfg->state)
{
gInitSyncDecDecode1State_EvtWakeTimer_cnt++;
events &= ~Evt_Id_AsotWakeTimer; // clear event
- status = PAF_ASOT_initSyncDecDecode1(pP, pQ, pAsotCfg, asopFrameCount);
+ status = PAF_ASOT_initSyncDecDecode1(pP, pQ, pAsotCfg, &decDecode1Af, asopFrameCount);
if (status < 0)
{
// FL, New IO:
gReselOutDevState_EvtWakeTimer_cnt++;
events &= ~Evt_Id_AsotWakeTimer; // clear event
- status = PAF_ASOT_reselectDevices(pP, pQ, pAsotCfg, &decResetAf, &decInfo1Af, asopFrameCount, &outDevSel);
+ status = PAF_ASOT_reselectDevices(pP, pQ, pAsotCfg, &decResetAf, &decInfo1Af, &decDecode1Af, asopFrameCount, &outDevSel);
if (status < 0)
{
// FL, New IO:
case ASOT_STATE_INITSYNC_RESYNC: // not event driven state
gAsotInitSyncResyncState_Cnt++;
- status = PAF_ASOT_initSyncResync(pP, pQ, pAsotCfg, &decResetAf, &decInfo1Af, asopFrameCount);
+ status = PAF_ASOT_initSyncResync(pP, pQ, pAsotCfg, &decResetAf, &decInfo1Af, &decDecode1Af, asopFrameCount);
if (status < 0)
{
// FL, New IO:
)
{
PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
- Int zMD, zMS; // Dec and Stream Master indices
+ Int zMD; // Dec Master index
+ Int zMS; // Stream Master index
PAF_AudioFrame *pStrAf; // stream audio frame
PAF_AST_OutInitSyncCtl *pOutIsCtl; // Output Init-Sync control
Int8 decFlag; // dec stage flag
)
{
PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
- Int zMD, zMS; // Dec and Stream Master indices
- PAF_AudioFrame *pStrAf; // stream audio frame
+ Int zMD; // Dec Master index
+ //Int zMS; // Stream Master index
+ //PAF_AudioFrame *pStrAf; // stream audio frame
PAF_AST_OutInitSyncCtl *pOutIsCtl; // Output Init-Sync control
Int8 decFlag; // dec stage flag
Int status; // status code
+ //PAF_AST_DecOpCircBufCtl *pCbCtl; // Decoder output circular buffer control
pAstCfg = pAsotCfg->pAstCfg;
zMD = pAstCfg->masterDec;
pOutIsCtl = &pAsotCfg->pAspmCfg->outIsCtl;
- // Check for Dec Reset,
- // Store dec reset AF
+ // Check for Dec Info1,
+ // Store Dec Info1 AF
status = outIsReadDecStageFlagAndAf(pOutIsCtl, zMD,
ASP_OUTIS_DEC_STAGE_INFO1_IDX, &decFlag, pDecInfo1Af);
if (status < 0)
}
else
{
+// FL: moved to PAF_ASOT_initSyncDecDecode1()
+// Decode parameters necessary for CB stream FL auto config are known at that time.
+// CB stream FL used to configure Stream AF sample count.
+// ASP chain reset can adjust Stream AF sample count, depending on whether SRC enabled & decimation factor.
+#if 0
+ // Get pointer to circular buffer control
+ pCbCtl = &pAsotCfg->pAspmCfg->decOpCircBufCtl;
+
+ // Initialize decoder output circular buffer for stream reads
+ cbInitStreamRead(pCbCtl, zMD);
+
+ // Get pointer to stream audio frame
zMS = pAstCfg->masterStr;
pStrAf = pAstCfg->xStr[zMS].pAudioFrame;
- // Set ASOT output frame length.
- // THD sets this to 256 (hard-coded in Dec Info)
- // DDP sets this to 0 (audio frame pass through, 0 from ASDT AF frame length)
- // PCM sets this to 256 (decodeControl.frameLength)
- pDecInfo1Af->sampleCount = gOutFrameLen; // !!!! GJ: Revisit !!!!
-
+ // Set ASOT output frame length
+ //pDecInfo1Af->sampleCount = gOutFrameLen; // !!!! GJ: Revisit !!!!
+ cbReadStrFrameLen(pCbCtl, zMD, &pDecInfo1Af->sampleCount);
+
// Update Stream Audio Frame.
- // Copy Dec Reset AF to Stream AF.
+ // Copy Dec Info1 AF to Stream AF.
outIsCpyAf(pDecInfo1Af, pStrAf);
// outputInfo1():
// - Enc Info,
// - Start Output
status = asopDecOutProcInfo1(pP, pQ, pAsotCfg, frame);
+
if (status < 0)
{
return status;
}
+#endif
return ASOP_SOK;
}
static Int PAF_ASOT_initSyncDecDecode1(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
- PAF_ASOT_Config *pAsotCfg,
+ PAF_ASOT_Config *pAsotCfg,
+ PAF_AudioFrame *pDecDecode1Af,
Int frame
)
{
PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
Int zMD; // Dec Master index
+ Int zMS; // Stream Master index
+ PAF_AudioFrame *pStrAf; // stream audio frame
PAF_AST_OutInitSyncCtl *pOutIsCtl; // Output Init-Sync control
Int8 decFlag; // dec stage flag
Int z;
Int zS, zO;
Int status; // status code
+ PAF_AST_DecOpCircBufCtl *pCbCtl; // Decoder output circular buffer control
pAstCfg = pAsotCfg->pAstCfg;
zMD = pAstCfg->masterDec;
- pOutIsCtl = &pAsotCfg->pAspmCfg->outIsCtl;
+ pOutIsCtl = &pAsotCfg->pAspmCfg->outIsCtl; // get pointer to output init-sync control
+
- // Check for Dec Reset,
- // Store dec reset AF
- status = outIsReadDecStageFlag(pOutIsCtl, zMD,
- ASP_OUTIS_DEC_STAGE_DECODE1_IDX, &decFlag);
+ // Check for Dec Decode1,
+ // Store Dec Decode1 AF
+ status = outIsReadDecStageFlagAndAf(pOutIsCtl, zMD,
+ ASP_OUTIS_DEC_STAGE_DECODE1_IDX, &decFlag, pDecDecode1Af);
if (status < 0)
{
return status;
}
else
{
+#if 1
+ // Get pointer to circular buffer control
+ pCbCtl = &pAsotCfg->pAspmCfg->decOpCircBufCtl;
+
+ // Initialize decoder output circular buffer for stream reads
+ cbInitStreamRead(pCbCtl, zMD);
+
+ // Get pointer to stream audio frame
+ zMS = pAstCfg->masterStr;
+ pStrAf = pAstCfg->xStr[zMS].pAudioFrame;
+
+ // Set ASOT output frame length.
+ // Frame length is initialized to CB stream (read) frame length.
+ // CB stream frame length modified via SRC reset in ASP chain reset if SRC enabled.
+ //pDecDecode1Af->sampleCount = 256; // 48/96/192 kHz pass through
+ //pDecDecode1Af->sampleCount = 512; // 96 kHz, SRC DF=2
+ //pDecDecode1Af->sampleCount = 1024; // 192 kHz, SRC DF=4
+ //pDecDecode1Af->sampleCount = gOutFrameLen; // !!!! GJ: Revisit !!!!
+ cbReadStrFrameLen(pCbCtl, zMD, &pDecDecode1Af->sampleCount);
+
+ // Update Stream Audio Frame.
+ // Copy Dec Reset AF to Stream AF.
+ outIsCpyAf(pDecDecode1Af, pStrAf);
+
+ // outputInfo1():
+ // - ASP chain reset,
+ // - Enc Info,
+ // - Start Output
+ status = asopDecOutProcInfo1(pP, pQ, pAsotCfg, frame);
+ if (status < 0)
+ {
+ return status;
+ }
+#endif
+
// Find first Output associated with Master Stream
zO = OUTPUT1;
for (z=ENCODE1; z < ENCODEN; z++)
// FL, New IO: API for single Output
// I/O physical layer prime operation required by McASP LLD
- asopIoPhyPrime(&pAsotCfg->pIoOut[zO]);
+ asopIoPhyPrime(&pAsotCfg->pIoOut[zO]);
+ TRACE_VERBOSE0("PAF_ASOT_initSyncDecDecode1: ASOP McASP LLD primed.");
return ASOP_SOK;
}
if (status == ASOP_SOK)
{
- // Update Output buffer configuration
- asopUpdateOutBufConfig(&pAstCfg->xOut[zO], &pAsotCfg->pIoOut[zO]);
-
- // Execute encode
- errno = asopDecOutProcEncode(pP, pQ, pAsotCfg, frame);
+ size_t totalOutputSize;
+
+ // Calculate the total size that encoder will write to output buffer
+ totalOutputSize = pAstCfg->xEnc[zO].encodeInStruct.pAudioFrame->sampleCount
+ * pAstCfg->xOut[zO].outBufConfig.stride
+ * pAstCfg->xOut[zO].outBufConfig.sizeofElement;
+
+ // Get output buffer pointers for encoder to write. Pointers are stored in pAsotCfg->pIoOut[zO]
+ asopGetOutBufPtrs(&pAsotCfg->pIoOut[zO], totalOutputSize);
+
+ // Invoke the encoder
+ errno = asopDecOutProcEncodeWrap(pP, pQ, pAsotCfg, frame, zO);
if (errno < 0)
{
status = errno;
return status;
}
+static Int asopDecOutProcEncodeWrap(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg,
+ Int frame,
+ Int zO
+)
+{
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Int errno; // error number
+ Int status; // status code
+ PAF_OutBufConfig *pOutBufCfg;
+ PAF_AudioFrame * pAf;
+
+ status = ASOP_SOK;
+ pAstCfg = pAsotCfg->pAstCfg;
+ pOutBufCfg = &(pAstCfg->xOut[zO].outBufConfig);
+ pAf = pAstCfg->xEnc[zO].encodeInStruct.pAudioFrame;
+
+ if(pAsotCfg->pIoOut[zO].buff2 == NULL)
+ {
+ // Output buffer won't wrap around - to invoke the encoder once
+ pOutBufCfg->lengthofFrame = pAf->sampleCount;
+ pOutBufCfg->pntr.pLgInt = pAsotCfg->pIoOut[zO].buff1;
+
+ // Execute encode
+ errno = asopDecOutProcEncode(pP, pQ, pAsotCfg, frame);
+ if (errno < 0)
+ {
+ status = errno;
+ }
+ }
+ else
+ {
+ // Output buffer will wrap around - to invoke the encoder twice
+ XDAS_Int16 sampleCountSave;
+ PAF_AudioData *afDataAddrSave[16];
+ PAF_AudioData **afDataAddr;
+ int i, ch;
+
+ sampleCountSave = pAf->sampleCount; // save sample count for restoring later
+
+ // Invoke the encoder to write data to the end of output buffer
+ pOutBufCfg->lengthofFrame = pAsotCfg->pIoOut[zO].size1 / (pOutBufCfg->stride * pOutBufCfg->sizeofElement);
+ pAf->sampleCount = pOutBufCfg->lengthofFrame;
+ pOutBufCfg->pntr.pLgInt = pAsotCfg->pIoOut[zO].buff1;
+
+ // Execute encode
+ errno = asopDecOutProcEncode(pP, pQ, pAsotCfg, frame);
+ if (errno < 0)
+ {
+ status = errno;
+ }
+
+ // Adjust audio frame buffer addresses for second invoking of the encoder
+ afDataAddr = pAf->data.sample;
+ for(i=0; i<pOutBufCfg->stride; i++)
+ {
+ ch = pAstCfg->xEnc[zO].encodeStatus.channelMap.from[i];
+ afDataAddrSave[i] = afDataAddr[ch]; // save audio frame buffer addresses
+ afDataAddr[ch] = &afDataAddr[ch][pOutBufCfg->lengthofFrame];
+ }
+
+ // Invoke the encoder to write data to the beginning of output buffer (wrapping around)
+ pOutBufCfg->lengthofFrame = pAsotCfg->pIoOut[zO].size2 / (pOutBufCfg->stride * pOutBufCfg->sizeofElement);
+ pAf->sampleCount = pOutBufCfg->lengthofFrame;
+ pOutBufCfg->pntr.pLgInt = pAsotCfg->pIoOut[zO].buff2;
+
+ // Execute encode
+ errno = asopDecOutProcEncode(pP, pQ, pAsotCfg, frame);
+ if (errno < 0)
+ {
+ status = errno;
+ }
+
+ // Restore sample count and audio frame buffer addresses
+ pAf->sampleCount = sampleCountSave;
+ for(i=0; i<pOutBufCfg->stride; i++)
+ {
+ ch = pAstCfg->xEnc[zO].encodeStatus.channelMap.from[i];
+ afDataAddr[ch] = afDataAddrSave[i];
+ }
+
+ pAsotCfg->pIoOut[zO].ioBuffBuf2AllocCnt++; // debug
+ }
+
+ return status;
+}
+
// ASOT SM function
// Purpose: Init-Sync Re-Sync state function.
-// Performs Init-Sync using stored Dec Reset/Info1 AFs.
+// Performs Init-Sync using stored Init-Sync AFs.
static Int PAF_ASOT_initSyncResync(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
PAF_ASOT_Config *pAsotCfg,
PAF_AudioFrame *pDecResetAf,
PAF_AudioFrame *pDecInfo1Af,
+ PAF_AudioFrame *pDecDecode1Af,
Int frame
)
{
- PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
- Int zMS; // Stream Master index
- PAF_AudioFrame *pStrAf; // stream audio frame
- Int status; // status code
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Int zMD; // Dec Master index
+ Int zMS; // Stream Master index
+ PAF_AudioFrame *pStrAf; // stream audio frame
+ Int status; // status code
+ PAF_AST_DecOpCircBufCtl *pCbCtl; // Decoder output circular buffer control
pAstCfg = pAsotCfg->pAstCfg;
+ zMD = pAstCfg->masterDec;
zMS = pAstCfg->masterStr;
pStrAf = pAstCfg->xStr[zMS].pAudioFrame;
// Dec Info1 re-sync using stored Dec Info1 AF
//
+#if 0
// Update Stream Audio Frame.
// Copy Dec Info1 AF to Stream AF.
outIsCpyAf(pDecInfo1Af, pStrAf);
{
return status;
}
+#endif
+
+ //
+ // Dec Decode1 re-sync using stored Dec Decode1 AF
+ //
+
+ // Get pointer to circular buffer control
+ pCbCtl = &pAsotCfg->pAspmCfg->decOpCircBufCtl;
+
+ // Initialize decoder output circular buffer for stream reads
+ cbInitStreamRead(pCbCtl, zMD);
+
+ // Set ASOT output frame length.
+ // Frame length is initialized to CB stream (read) frame length.
+ // CB stream frame length modified via SRC reset in ASP chain reset if SRC enabled.
+ cbReadStrFrameLen(pCbCtl, zMD, &pDecDecode1Af->sampleCount);
- return ASOP_SOK;
+ // Update Stream Audio Frame.
+ // Copy Dec Info1 AF to Stream AF.
+ outIsCpyAf(pDecInfo1Af, pStrAf);
+
+ // outputInfo1():
+ // - ASP chain reset,
+ // - Enc Info,
+ // - Start Output
+ status = asopDecOutProcInfo1(pP, pQ, pAsotCfg, frame);
+ if (status < 0)
+ {
+ return status;
+ }
+
+ return ASOP_SOK;
}
// ASOT SM function
// Purpose: Re-select devices used for Output.
-// Performs Init-Sync using stored Dec Reset/Info1 AFs.
+// Performs Init-Sync using stored Init-Sync AFs.
static Int PAF_ASOT_reselectDevices(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
PAF_ASOT_Config *pAsotCfg,
PAF_AudioFrame *pDecResetAf,
PAF_AudioFrame *pDecInfo1Af,
+ PAF_AudioFrame *pDecDecode1Af,
Int frame,
Bool *pOutDevSel
)
else
{
// Init-Sync Resync
- status = PAF_ASOT_initSyncResync(pP, pQ, pAsotCfg, pDecResetAf, pDecInfo1Af, frame);
+ status = PAF_ASOT_initSyncResync(pP, pQ, pAsotCfg, pDecResetAf, pDecInfo1Af, pDecDecode1Af, frame);
if (status < 0)
{
outDevSel = FALSE;
diff --git a/pasdk/test_dsp/framework/audioStreamOutProc.h b/pasdk/test_dsp/framework/audioStreamOutProc.h
index 4a909bc37a3de888a7d9a102aebf174a455f43cc..88d5483b60ab7f819292f3cc1c9d7e75f66abbd3 100644 (file)
ioBuffHandle_t hIoBuff; /* handle to I/O buffer management */
Ptr hMcaspChan; /* handle to McASP LLD channel for output */
uint32_t phyXferSize;
+ uint32_t stride;
void *mcaspTxBuf1;
void *mcaspTxBuf2;
index 0ade8152bc66ba5d16264d820a9ae8e03b092c80..fb1906aa395a80f4f3aad0b879677d9deebd580b 100644 (file)
return (IOBUFF_ERR_BAD_PARAMS);
}
- if((params->base == NULL) || (params->nominalDelay > params->size)) {
+ if((params->base == NULL) || (params->nominalDelay >= params->size)) {
return (IOBUFF_ERR_BAD_PARAMS);
}
index 27a67d12af0dadb25f1a018bf7ed4b88ef882bd5..10c4b4e436693219499eae524d8edb0b7fb4caaf 100644 (file)
//#define IO_LOOPBACK_TEST // define this to run a DSP-only standalone loopback test without PASDK framework
//#define PCM_LOOPBACK_TEST // define this to run DSP-only PCM loopback test in PASDK framework
-#define INPUT_HDMI_4xI2S // HDMI, 4 Rx serializers
+//#define INPUT_HDMI_4xI2S // HDMI, 4 Rx serializers
//#define INPUT_HDMI_STEREO // HDMI, 1 Rx serializer
//#define INPUT_SPDIF // S/PDIF, 1 Rx serializer
//#define INPUT_PCM_ONLY // debugging, input fixed to PCM
+#define TX_MCASP_USE_MULT_SER // This is the normal operation. Undefine this for debugging and loopback
+
#ifdef INPUT_PCM_ONLY
#define SWAP_INPUT_DATA FALSE
#else
#ifdef INPUT_HDMI_4xI2S
#define RX_MCASP_USE_MULT_SER
-#define TX_MCASP_USE_MULT_SER // This is the normal operation. Undefine this for debugging and loopback
#define IO_HW_INTERFACE 2
//#define ASIP_ELEMENT_SIZE 2
//#define ASIP_STRIDE 8 // 4 lane, stereo
// Define McASP transfer element size: number of bytes in one word
#define WORD_SIZE_BITSTREAM 2
#define WORD_SIZE_PCM 4
-#define NUM_CYCLE_PER_FRAME_DEF 1024 //128
+#define NUM_CYCLE_PER_FRAME_DEF 1024
+#define NUM_CYCLE_PER_OUTPUT_FRAME_DEF 256
// Input frame length: number of words to be transfered in 1 transfer of McASP LLD Rx
// These numbers are according to existing SIO/DEV based I/O.