author | Frank Livingston <frank-livingston@ti.com> | |
Wed, 23 Aug 2017 19:13:57 +0000 (14:13 -0500) | ||
committer | Frank Livingston <frank-livingston@ti.com> | |
Wed, 23 Aug 2017 19:13:57 +0000 (14:13 -0500) |
65 files changed:
diff --git a/build_all.bat b/build_all.bat
index fb7a3140e3ce3735a49e541a7ffecbccf6ea1309..b7faa35de5b50a8dfd6cb301a8aae95baffc4208 100644 (file)
--- a/build_all.bat
+++ b/build_all.bat
:: *** Build
:: *************************************************************************
:: Build DSP PDK LLD libraries
-@pushd scripts
-@cmd /c build_pdk_libs.bat
-@popd
+::@pushd scripts
+::@cmd /c build_pdk_libs.bat
+::@popd
:: Build ARM/DSP PAF libraries
@pushd scripts
diff --git a/clean_and_jerk.bat b/clean_and_jerk.bat
--- /dev/null
+++ b/clean_and_jerk.bat
@@ -0,0 +1,16 @@
+set PATH_ORG=%path%
+set path=c:\cygwin\bin;%path%
+
+git clean -fdx --exclude=clean_and_jerk.bat
+git submodule foreach git clean -fdx
+
+git ls-files -m | xargs git checkout --
+git submodule foreach "git ls-files -m | xargs git checkout --"
+
+git branch -vv > repos_before_build.txt && git submodule foreach git branch -vv >> repos_before_build.txt
+
+call build_all.bat SuperRepo Debug > build_all_log.txt 2>&1
+
+git branch -vv > repos_after_build.txt && git submodule foreach git branch -vv >> repos_after_build.txt
+
+set path=%PATH_ORG%
diff --git a/dolby_ip/ddp b/dolby_ip/ddp
index f05bd663d840eb601ec5b4a811610fa4a491c813..5b60e98edc62c2a84267488fdcc8c6c4fc6a05d0 160000 (submodule)
--- a/dolby_ip/ddp
+++ b/dolby_ip/ddp
-Subproject commit f05bd663d840eb601ec5b4a811610fa4a491c813
+Subproject commit 5b60e98edc62c2a84267488fdcc8c6c4fc6a05d0
diff --git a/dolby_ip/mat-thd b/dolby_ip/mat-thd
index 9475de21022b325745024f5e59aca9c1003b6867..c8e954f627835eca7fefb06e5846f0ff5be175a5 160000 (submodule)
--- a/dolby_ip/mat-thd
+++ b/dolby_ip/mat-thd
-Subproject commit 9475de21022b325745024f5e59aca9c1003b6867
+Subproject commit c8e954f627835eca7fefb06e5846f0ff5be175a5
diff --git a/dolby_ip/oar b/dolby_ip/oar
index 6ebac42b2a3c8adacfaa3dfe79ae232dc91ee7b4..318ac56eed7d57c299fa38689ff4e01b9d288769 160000 (submodule)
--- a/dolby_ip/oar
+++ b/dolby_ip/oar
-Subproject commit 6ebac42b2a3c8adacfaa3dfe79ae232dc91ee7b4
+Subproject commit 318ac56eed7d57c299fa38689ff4e01b9d288769
index 2ca01bcbd626680522046fd0d772e8ba17e442e4..e0192d0e669952701c0b8946a4957aabdb427049 100644 (file)
#include "aspDecOpCircBuf_common.h"
+// Initialize circular buffer control
+Int cbCtlInit(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 numDecOpCb, // number of circular buffers
+ PAF_AST_DecOpCircBuf **pXDecOpCb // address of decoder output circular buffer base pointer
+)
+{
+#ifdef _TMS320C6X
+ GateMP_Params gateParams;
+ GateMP_Handle gateHandle;
+
+ GateMP_Params_init(&gateParams);
+ gateParams.localProtect = GateMP_LocalProtect_THREAD;
+ gateParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
+ gateParams.name = ASP_DECODE_CB_GATE_NAME;
+ gateParams.regionId = ASP_DECODE_CB_GATE_REGION_ID;
+ gateHandle = GateMP_create(&gateParams);
+ if (gateHandle != NULL)
+ {
+ pCbCtl->gateHandle = gateHandle;
+ }
+ else
+ {
+ pCbCtl->gateHandle = NULL;
+ return ASP_DECOP_CB_CTL_INIT_INV_GATE;
+ }
+
+ pCbCtl->numDecOpCb = numDecOpCb; // init number of circular buffers
+ pCbCtl->pXDecOpCb = pXDecOpCb; // init base address of circular buffers
+
+ return ASP_DECOP_CB_SOK;
+
+#elif defined(ARMCOMPILE)
+ GateMP_Handle gateHandle;
+ Int status;
+
+ do {
+ status = GateMP_open(ASP_DECODE_CB_GATE_NAME, &gateHandle);
+ } while (status == GateMP_E_NOTFOUND);
+ if (status == GateMP_S_SUCCESS)
+ {
+ pCbCtl->gateHandle = gateHandle;
+ }
+ else
+ {
+ pCbCtl->gateHandle = NULL;
+ return ASP_DECOP_CB_CTL_INIT_INV_GATE;
+ }
+
+ pCbCtl->numDecOpCb = numDecOpCb; // init number of circular buffers
+ pCbCtl->pXDecOpCb = pXDecOpCb; // init base address of circular buffers
+
+ return ASP_DECOP_CB_SOK;
+
+#else
+ #error "Unsupported platform"
+
+#endif
+}
+
// Reset circular buffer
Int cbReset(
PAF_AST_DecOpCircBufCtl *pCbCtl,
Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
Cache_wait();
+ // Initialize CB primed flag
+ pCb->primedFlag = 0;
+ // Initialize delta samples
+ pCb->deltaSamps = 0;
+
+ // Reset circular buffer:
+ // - AF write, read indices
if (pCb->sourceSel == PAF_SOURCE_PCM)
{
- // 2*256 in behind
pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_PCM;
pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_PCM;
- pCb->pcmRdIdx = 0;
}
else if (pCb->sourceSel == PAF_SOURCE_DDP)
{
- // 4*256 in behind
pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_DDP;
pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_DDP;
- pCb->pcmRdIdx = pCb->decOpFrameLen - ASP_DECOP_CB_INIT_LAG_DDP*pCb->strFrameLen;
}
else if (pCb->sourceSel == PAF_SOURCE_THD)
{
- // 0 in behind
pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_THD;
pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_THD;
- pCb->pcmRdIdx = 0;
}
+ else
+ {
+ //
+ // Currently unsupported source select
+ //
+ return ASP_DECOP_CB_RESET_INV_SOURCE_SEL;
+ }
+
+ // Reset circular buffer:
+ // - PCM read index
+ // - Private metadata read index
+ // - number of PCM samples in CB
+ pCb->pcmRdIdx = 0;
+ pCb->prvMdRdIdx = 0;
+ pCb->numPcmSampsPerCh = 0;
// initialize circular buffer current number of frames
pCb->numAfCb = pCb->afWrtIdx - pCb->afRdIdx;
{
pAfCb = &pCb->afCb[n];
- // clear PCM data
+ // Clear PCM data
for (i=0; i<pCb->maxAFChanNum; i++)
{
memset(pAfCb->data.sample[i], 0, pCb->maxAFSampCount);
+ pAfCb->data.samsiz[i] = 0;
}
- // clear metadata
- pAfCb->numPrivateMetadata = 0;
+ // Clear metadata
+ pAfCb->bsMetadata_type = PAF_bsMetadata_none; /* non zero if metadata is attached. */
+ pAfCb->pafBsMetadataUpdate = 0; /* indicates whether bit-stream metadata update */
+ pAfCb->numPrivateMetadata = 0; /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
+ pAfCb->bsMetadata_offset = 0; /* offset into audio frame for change in bsMetadata_type field */
+ for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++)
+ {
+ pAfCb->pafPrivateMetadata[i].offset = 0;
+ pAfCb->pafPrivateMetadata[i].size = 0;
+ }
}
- // reset error counts
- pCb->errUndCnt = 0;
- pCb->errOvrCnt = 0;
+ // reset stats
+ pCb->readAfWriterInactiveCnt = 0;
+ pCb->readAfNdCnt = 0;
+ pCb->wrtAfReaderInactiveCnt = 0;
+ pCb->wrtAfZeroSampsCnt = 0;
+ pCb->errAfUndCnt = 0;
+ pCb->errAfOvrCnt = 0;
+ pCb->errPcmUndCnt = 0;
+ pCb->errPcmOvrCnt = 0;
// Write back circular buffer configuration
Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
return ASP_DECOP_CB_SOK;
}
+// Get circular buffer statistics
+Int cbGetStats(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ PAF_AST_DecOpCircBufStats *pCbStats // decoder output circular buffer statistics
+
+)
+{
+ 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();
+
+ // Populate statistics
+ pCbStats->readAfWriterInactiveCnt = pCb->readAfWriterInactiveCnt;
+ pCbStats->readAfNdCnt = pCb->readAfNdCnt;
+ pCbStats->wrtAfReaderInactiveCnt = pCb->wrtAfReaderInactiveCnt;
+ pCbStats->wrtAfZeroSampsCnt = pCb->wrtAfZeroSampsCnt;
+ pCbStats->errAfUndCnt = pCb->errAfUndCnt;
+ pCbStats->errAfOvrCnt = pCb->errAfOvrCnt;
+ pCbStats->errPcmUndCnt = pCb->errPcmUndCnt;
+ pCbStats->errPcmOvrCnt = pCb->errPcmOvrCnt;
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_DECOP_CB_SOK;
+}
+
+
// Output log of circular buffer control variables (debug)
Int cbLog(
PAF_AST_DecOpCircBufCtl *pCbCtl,
Cache_wait();
Log_info1("CB: %s", (IArg)locInfo);
- Log_info3("CB: readerActiveFlag=%d, writerActiveFlag=%d, emptyFlag=%d", pCb->readerActiveFlag, pCb->writerActiveFlag, pCb->emptyFlag);
- Log_info4("CB: afRdIdx=%d, pcmRdIdx=%d, afWrtIdx=%d, numAfCb=%d", pCb->afRdIdx, pCb->pcmRdIdx,
- pCb->afWrtIdx,
- pCb->numAfCb);
+ Log_info3("CB: readerActiveFlag=%d, writerActiveFlag=%d, drainFlag=%d", pCb->readerActiveFlag, pCb->writerActiveFlag, pCb->drainFlag);
+ Log_info5("CB: afRdIdx=%d, pcmRdIdx=%d, prvMdRdIdx=%d, afWrtIdx=%d, numAfCb=%d", pCb->afRdIdx, pCb->pcmRdIdx, pCb->prvMdRdIdx, pCb->afWrtIdx, pCb->numAfCb);
if (fullLog)
{
Log_info1("CB: maxNumAfCb=%d", pCb->maxNumAfCb);
index 2303d6960ed7e482f6dcf0baac43eb62d92997fb..d6e443af9c9f565825e2db71f64678c16331cece 100644 (file)
#include "paftyp.h"
#include "pafdec.h"
+//#include "dbgBenchmark.h" // PCM high-sampling rate + SRC + CAR benchmarking
+
//#define CB_RW_OP_CAP_PP // debug
#ifdef CB_RW_OP_CAP_PP
#define CB_OP_NONE 0
#define CB_OP_COUNT_MAX 10000
#endif
+// CB control
+#define ASP_DECODE_CB_GATE_NAME ( "AspDecOpCbGate" ) // name of GateMP used for circular buffer shared memory protection
+#define ASP_DECODE_CB_GATE_REGION_ID ( 0 ) // IPC shared region ID used for CB gate allocation
+
// error return codes
-#define ASP_DECOP_CB_SOK ( 0 ) // ok
-#define ASP_DECOP_CB_CTL_INIT_INV_GATE ( ASP_DECOP_CB_SOK-1 ) // error: invalid gate handle
-#define ASP_DECOP_CB_ERR_START ( ASP_DECOP_CB_CTL_INIT_INV_GATE ) // start error return ID for master & slave error return definitions
+#define ASP_DECOP_CB_SOK ( 0 ) // ok
+#define ASP_DECOP_CB_CTL_INIT_INV_GATE ( ASP_DECOP_CB_SOK-1 ) // error: invalid gate handle
+#define ASP_DECOP_CB_RESET_INV_SOURCE_SEL ( ASP_DECOP_CB_CTL_INIT_INV_GATE - 1 ) // error: invalid source selection on init
+#define ASP_DECOP_CB_ERR_START ( ASP_DECOP_CB_RESET_INV_SOURCE_SEL ) // start error return ID for master & slave error return definitions
#define ASP_DECOP_CB_MAX_NUM_AF ( 30 ) // decoder output circular buffer maximum number audio frames
#define ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT ( 32 ) // decoder output circular buffer maximum number audio PCM channels for MAT
#define ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kMAT ( 4*256 ) // decoder output circular buffer maximum PCM frame length at 48kHz sampling rate
-#define ASP_DECOP_CB_PCM_BUF_SZ ( ASP_DECOP_CB_MAX_NUM_PCM_CH * ASP_DECOP_CB_MAX_NUM_PCM_FRAMES * ASP_DECOP_CB_MAX_PCM_FRAME_LEN )
-#define ASP_DECOP_CB_PCM_BUF_SZ_32CH48kMAT ( ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT * ASP_DECOP_CB_MAX_NUM_PCM_FRAMES * ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kMAT )
+// (***) FL: !!! REVISIT!!! THD 192 kHz "fudge factor" for CB PCM buffer size.
+// Using this factor in PCM buffer size definition, buffer large enough to execute 192 kHz w/o CB OVR/UND.
+// Need to define CB size in different terms than existing macros.
+// (***) FL: !!! REVISIT!!! Allocating memory for max # channels (e.g. 32 for THD).
+// GROSS over allocation for THD 192 kHz, 6ch max.
+#define THD_HSR_FUDGE_FACTOR ( 368640 + 240000 )
+#define ASP_DECOP_CB_PCM_BUF_SZ ( ASP_DECOP_CB_MAX_NUM_PCM_CH * ASP_DECOP_CB_MAX_NUM_PCM_FRAMES * ASP_DECOP_CB_MAX_PCM_FRAME_LEN + THD_HSR_FUDGE_FACTOR)
+// FL: unused
+//#define ASP_DECOP_CB_PCM_BUF_SZ_32CH48kMAT ( ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT * ASP_DECOP_CB_MAX_NUM_PCM_FRAMES * ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kMAT )
#define ASP_DECOP_CB_MAX_NUM_AF_PCM ( 4 )
#if (ASP_DECOP_CB_MAX_NUM_AF_PCM > ASP_DECOP_CB_MAX_NUM_AF)
#endif
#define ASP_DECOP_CB_INIT_WRTIDX_PCM ( 0 )
#define ASP_DECOP_CB_INIT_RDIDX_PCM ( 0 )
-#define ASP_DECOP_CB_INIT_LAG_PCM ( 2 )
-#define ASP_DECOP_CB_TARGET_ND_SAMPS_48kPCM ( ASP_DECOP_CB_INIT_LAG_PCM * 256 ) // PCM target Nominal Delay in number of samples, fs=48 kHz
+//#define ASP_DECOP_CB_INIT_LAG_PCM ( 2 )
+#define ASP_DECOP_CB_TARGET_ND_SAMPS_48kPCM ( (4+1) * 256 ) // PCM target Nominal Delay in number of samples, fs=48 kHz
-#define ASP_DECOP_CB_MAX_NUM_AF_DDP ( 2 )
+#define ASP_DECOP_CB_MAX_NUM_AF_DDP ( 3 )
#if (ASP_DECOP_CB_MAX_NUM_AF_DDP > ASP_DECOP_CB_MAX_NUM_AF)
#error "CB Max AF DDP error"
#endif
#define ASP_DECOP_CB_INIT_WRTIDX_DDP ( 0 )
#define ASP_DECOP_CB_INIT_RDIDX_DDP ( 0 )
-#define ASP_DECOP_CB_INIT_LAG_DDP ( 1 )
-#define ASP_DECOP_CB_TARGET_ND_SAMPS_48kDDP ( ASP_DECOP_CB_INIT_LAG_DDP * 1536 ) // DDP target Nominal Delay in number of samples, fs=48 kHz
+//#define ASP_DECOP_CB_INIT_LAG_DDP ( 1 )
+#define ASP_DECOP_CB_TARGET_ND_SAMPS_DDP ( (6+6) * 256 ) // DDP target Nominal Delay in number of samples
#define ASP_DECOP_CB_MAX_NUM_AF_THD ( 30 ) //( 15 )
#if (ASP_DECOP_CB_MAX_NUM_AF_THD > ASP_DECOP_CB_MAX_NUM_AF)
#define ASP_DECOP_CB_INIT_WRTIDX_THD ( 0 )
#define ASP_DECOP_CB_INIT_RDIDX_THD ( 0 )
//#define ASP_DECOP_CB_INIT_LAG_THD ( 5 ) // 5*20ms = 100 ms, For the worst case of 100 ms
-#define ASP_DECOP_CB_TARGET_ND_SAMPS_48kTHD ( 3504 )//( 2224 ) // THD target Nominal Delay in number of samples, fs=48 kHz
+#define ASP_DECOP_CB_TARGET_ND_SAMPS_48kTHD ( 3600 ) //( 3504 ) //( 2224 ) // THD target Nominal Delay in number of samples, fs=48 kHz
+#define ASP_DECOP_CB_TARGET_ND_SAMPS_96kTHD ( 2*ASP_DECOP_CB_TARGET_ND_SAMPS_48kTHD ) // THD target Nominal Delay in number of samples, fs=96 kHz
+#define ASP_DECOP_CB_TARGET_ND_SAMPS_192kTHD ( 4*ASP_DECOP_CB_TARGET_ND_SAMPS_48kTHD ) // THD target Nominal Delay in number of samples, fs=192 kHz
-#define ASP_DECODE_CB_GATE_NAME ( "AspDecOpCbGate" ) // name of GateMP used for circular buffer shared memory protection
-#define ASP_DECODE_CB_GATE_REGION_ID ( 0 ) // IPC shared region ID used for CB gate allocation
+//#define DEF_SOURCE_SEL ( PAF_SOURCE_PCM ) // default source select
+//#define DEF_DEC_OP_FRAME_LEN ( PAF_SYS_FRAMELENGTH ) // default decoder output frame length
+//#define DEF_STR_FRAME_LEN ( PAF_SYS_FRAMELENGTH ) // default stream frame length
+// Decoder output circular buffer status
+typedef struct PAF_AST_DecOpCircBufStatus
+{
+ Int size;
+ Int16 strFrameLen; // stream frame length (output transaction size)
+} PAF_AST_DecOpCircBufStatus;
// Decoder output circular buffer
typedef struct PAF_AST_DecOpCircBuf
{
- PAF_AudioFrame *afCb; // audio frame CB
- PAF_AudioData *pcmBuf; // PCM buffer, contains PCM data associated with audio frames
- UInt8 *metaBuf; // metadata buffer, contains metadata associated with audio frames
- Int8 sourceSel; // selected source
- Int8 primedFlag; // flag indicated whether CB is primed: FALSE - CB not primed, TRUE - CB primed
- Int16 targetNDSamps; // target CB Nominal Delay number of samples
- Int16 deltaSamps; // number of 256 (N) sample output frames to block reader
- Int8 afRdIdx; // audio frame CB read index
- Int8 afWrtIdx; // audio frame CB write index
- //Int8 afLagIdx; // audio frame CB Lag idx,
- //Int8 afInitialLag; // Initial delay/lag between CB write and read
- Int16 pcmRdIdx; // pcm buffer read index
- Int8 numAfCb; // current number frames in CB
- Int8 maxNumAfCb; // maximum number of audio frames in CB
- Int16 decOpFrameLen; // selected decoder output frame length (input transaction size)
- Int16 strFrameLen; // stream frame length (output transaction size)
- Int8 writerActiveFlag; // flag indicates whether CB writer is active: FALSE - writer not active, TRUE - writer active
- Int8 readerActiveFlag; // flag indicates whether CB reader is active: FALSE - reader not active, TRUE - reader active
- Int8 emptyFlag; // flag indicates whether reader should empty (drain) remaining frames in CB: FALSE - reader should not drain, TRUE - reader should drain
- Int8 errUndCnt; // underflow count
- Int8 errOvrCnt; // overflow count
- PAF_AudioData *pcmBufEnd; // PCM buffer, contains PCM data associated with audio frames end
- UInt8 *metaBufEnd; // metadata buffer, contains metadata associated with audio frames end
- Int8 maxAFChanNum; // maximum number of audio data channels in audio frame
- Int16 maxAFSampCount; // maximum number of sample counts in audio frame
- PAF_AudioFrame lastAf; // used to store the last valid read out audio frame info to generate mute frame
- #ifdef CB_RW_OP_CAP_PP // debug
- UInt32 *cb_samples_op; // should be in shared memory, preferred NON cache
- UInt8 *cb_op_owner; // should be in shared memory, preferred NON cache
- UInt8 *cb_afRdIdx; // should be in shared memory, preferred NON cache
- UInt8 *cb_afWrtIdx; // should be in shared memory, preferred NON cache
- UInt8 *cb_numAfCb; // should be in shared memory, preferred NON cache
- UInt32 cb_opCnt; // range (0 - CB_OP_COUNT_MAX)
- #endif
+ PAF_AudioFrame *afCb; // audio frame CB
+ PAF_AudioData *pcmBuf; // PCM buffer, contains PCM data associated with audio frames
+ UInt8 *metaBuf; // metadata buffer, contains metadata associated with audio frames
+ Int8 sourceSel; // selected source
+ Int8 primedFlag; // flag indicated whether CB is primed: FALSE - CB not primed, TRUE - CB primed
+ Int16 targetNDSamps; // target CB Nominal Delay number of samples
+ Int16 deltaSamps; // number of 256 (N) sample output frames to block reader
+ Int8 afRdIdx; // audio frame CB read index
+ Int8 afWrtIdx; // audio frame CB write index
+ //Int8 afLagIdx; // audio frame CB Lag idx,
+ //Int8 afInitialLag; // Initial delay/lag between CB write and read
+ Int16 pcmRdIdx; // pcm buffer read index
+ Int8 prvMdRdIdx; // private metadata read index
+ Int8 numAfCb; // current number frames in CB
+ Int8 maxNumAfCb; // maximum number of audio frames in CB
+ Int32 numPcmSampsPerCh; // current number of PCM samples per channel in CB
+ Int32 maxNumPcmSampsPerCh; // max number of PCM samples per channel in CB
+ Int16 decOpFrameLen; // selected decoder output frame length (input transaction size)
+ Int16 strFrameLen; // stream frame length (output transaction size)
+ Int8 writerActiveFlag; // flag indicates whether CB writer is active: FALSE - writer not active, TRUE - writer active
+ Int8 readerActiveFlag; // flag indicates whether CB reader is active: FALSE - reader not active, TRUE - reader active
+ Int8 drainFlag; // flag indicates whether reader should drain (empty) remaining frames in CB: FALSE - reader should not drain, TRUE - reader should drain
+ Int32 readAfWriterInactiveCnt; // count of read audio frames with inactive writer & not draining
+ Int32 readAfNdCnt; // count of read audio frames for nominal delay
+ Int32 wrtAfReaderInactiveCnt; // count of write audio frames with inactive reader
+ Int32 wrtAfZeroSampsCnt; // count of write audio frames with zero samples
+ Int32 errAfUndCnt; // read error AF underflow count
+ Int32 errAfOvrCnt; // write error AF overflow count
+ Int32 errPcmUndCnt; // read error PCM underflow count
+ Int32 errPcmOvrCnt; // write error PCM overflow count
+ PAF_AudioData *pcmBufEnd; // PCM buffer, contains PCM data associated with audio frames end
+ UInt8 *metaBufEnd; // metadata buffer, contains metadata associated with audio frames end
+ Int8 maxAFChanNum; // maximum number of audio data channels in audio frame
+ Int16 maxAFSampCount; // maximum number of sample counts in audio frame
+ PAF_AudioFrame lastAf; // used to store the last valid read out audio frame info to generate mute frame
+ PAF_AST_DecOpCircBufStatus cbStatus; // CB status
+#ifdef CB_RW_OP_CAP_PP // debug
+ UInt32 *cb_samples_op; // should be in shared memory, preferred NON cache
+ UInt8 *cb_op_owner; // should be in shared memory, preferred NON cache
+ UInt8 *cb_afRdIdx; // should be in shared memory, preferred NON cache
+ UInt8 *cb_afWrtIdx; // should be in shared memory, preferred NON cache
+ UInt8 *cb_numAfCb; // should be in shared memory, preferred NON cache
+ UInt32 cb_opCnt; // range (0 - CB_OP_COUNT_MAX)
+#endif
} PAF_AST_DecOpCircBuf;
+// Decoder output circular buffer statistics
+typedef struct PAF_AST_DecOpCircBufStats
+{
+ Int32 readAfWriterInactiveCnt; // count of read audio frames with inactive writer & not draining
+ Int32 readAfNdCnt; // count of read audio frames for nominal delay
+ Int32 wrtAfReaderInactiveCnt; // count of write audio frames with inactive reader
+ Int32 wrtAfZeroSampsCnt; // count of write audio frames with zero samples
+ Int32 errAfUndCnt; // read error AF underflow count
+ Int32 errAfOvrCnt; // write error AF overflow count
+ Int32 errPcmUndCnt; // read error PCM underflow count
+ Int32 errPcmOvrCnt; // write error PCM overflow count
+} PAF_AST_DecOpCircBufStats;
+
// Decoder output circular buffer control
typedef struct PAF_AST_DecOpCircBufCtl
{
GateMP_Handle gateHandle; // circular buffer gate handle
+ Int8 numDecOpCb; // number of circular buffers
PAF_AST_DecOpCircBuf **pXDecOpCb; // address of decoder output circular buffer base pointer
} PAF_AST_DecOpCircBufCtl;
// Initialize circular buffer control
Int cbCtlInit(
PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 numDecOpCb, // number of circular buffers
PAF_AST_DecOpCircBuf **pXDecOpCb // address of decoder output circular buffer base pointer
);
Int8 cbIdx
);
+// Get circular buffer statistics
+Int cbGetStats(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ PAF_AST_DecOpCircBufStats *pCbStats // decoder output circular buffer statistics
+
+);
+
// Output log of circular buffer control variables (debug)
Int cbLog(
PAF_AST_DecOpCircBufCtl *pCbCtl,
char *locInfo
);
+
#endif /* _ASP_DECOP_CB_COMMON_H_ */
diff --git a/pasdk/common/aspOutInitSync_common.c b/pasdk/common/aspOutInitSync_common.c
--- /dev/null
@@ -0,0 +1,113 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+#include <xdc/std.h>
+#include <ti/ipc/GateMP.h>
+
+#include "aspOutInitSync_common.h"
+
+// Initialize Output Processing Init-Sync control
+Int outIsCtlInit(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // output init-sync control to initialize
+ PAF_AST_OutInitSyncInfo **pXOutIsInfo // pointer to base address of output init-sync info array
+)
+{
+#ifdef _TMS320C6X
+ GateMP_Params gateParams;
+ GateMP_Handle gateHandle;
+
+ GateMP_Params_init(&gateParams);
+ gateParams.localProtect = GateMP_LocalProtect_THREAD;
+ gateParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
+ gateParams.name = ASP_OUTIS_GATE_NAME;
+ gateParams.regionId = ASP_OUTIS_GATE_REGION_ID;
+ gateHandle = GateMP_create(&gateParams);
+ if (gateHandle != NULL)
+ {
+ pOutIsCtl->gateHandle = gateHandle;
+ }
+ else
+ {
+ pOutIsCtl->gateHandle = NULL;
+ return ASP_OUTIS_CTL_INIT_INV_GATE;
+ }
+
+ pOutIsCtl->pXOutIsInfo = pXOutIsInfo;
+
+ return ASP_OUTIS_SOK;
+
+#elif defined(ARMCOMPILE)
+ GateMP_Handle gateHandle;
+ Int status;
+
+ do {
+ status = GateMP_open(ASP_OUTIS_GATE_NAME, &gateHandle);
+ } while (status == GateMP_E_NOTFOUND);
+ if (status == GateMP_S_SUCCESS)
+ {
+ pOutIsCtl->gateHandle = gateHandle;
+ }
+ else
+ {
+ pOutIsCtl->gateHandle = NULL;
+ return ASP_OUTIS_CTL_INIT_INV_GATE;
+ }
+
+ pOutIsCtl->pXOutIsInfo = pXOutIsInfo;
+
+ return ASP_OUTIS_SOK;
+
+#else
+ #error "Unsupported platform"
+
+#endif
+}
+
+// Copy audio frame
+// See CPL_setAudioFrame_
+// (***) FL: Note similar functionality present in CB, check usage there.
+Void outIsCpyAf(
+ PAF_AudioFrame *pSrcAf,
+ PAF_AudioFrame *pDstAf
+)
+{
+ // Write AF members written by CPL_setAudioFrame_();
+ pDstAf->sampleDecode = pSrcAf->sampleDecode;
+ PAF_PROCESS_COPY(pDstAf->sampleProcess, pSrcAf->sampleProcess);
+ pDstAf->sampleRate = pSrcAf->sampleRate;
+ pDstAf->sampleCount = pSrcAf->sampleCount;
+ pDstAf->channelConfigurationRequest = pSrcAf->channelConfigurationRequest;
+ pDstAf->channelConfigurationStream = pSrcAf->channelConfigurationStream;
+}
diff --git a/pasdk/common/aspOutInitSync_common.h b/pasdk/common/aspOutInitSync_common.h
--- /dev/null
@@ -0,0 +1,93 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+#ifndef _ASP_OUT_INIT_SYNC_H_
+#define _ASP_OUT_INIT_SYNC_H_
+
+#include <xdc/std.h>
+#include <ti/ipc/GateMP.h>
+#include "paftyp.h"
+
+// error return codes
+#define ASP_OUTIS_SOK ( 0 ) // ok
+#define ASP_OUTIS_CTL_INIT_INV_GATE ( ASP_OUTIS_SOK-1 ) // error: invalid gate handle
+#define ASP_OUTIS_ERR_START ( ASP_OUTIS_CTL_INIT_INV_GATE ) // start error return ID for master & slave error return definitions
+
+// Output Init-Sync number of decoder stages
+// 2 stages: Dec Reset, Dec Info
+#define ASP_OUTIS_NUM_DEC_STAGES ( 3 )
+
+// Output Init-Sync decoder stages indices
+#define ASP_OUTIS_DEC_STAGE_RESET_IDX ( 0 )
+#define ASP_OUTIS_DEC_STAGE_INFO1_IDX ( ASP_OUTIS_DEC_STAGE_RESET_IDX+1 )
+#define ASP_OUTIS_DEC_STAGE_DECODE1_IDX ( ASP_OUTIS_DEC_STAGE_INFO1_IDX+1 )
+
+#define ASP_OUTIS_GATE_NAME ( "AspOutISGate" ) // name of GateMP used OutIS info protection
+#define ASP_OUTIS_GATE_REGION_ID ( 0 ) // IPC shared region ID used for OutIS gate allocation
+
+// Decoder Stage Output Processing Init-Sync Information
+typedef struct PAF_AST_DecStageOutInitSyncInfo
+{
+ Int8 decFlag; // decoder stage flag: 0:dec stage not executed; 1:dec stage executed
+ PAF_AudioFrame decAf; // decoder output audio frame
+} PAF_AST_DecStageOutInitSyncInfo;
+
+// Output Processing Init-Sync Information
+typedef struct PAF_AST_OutInitSyncInfo
+{
+ PAF_AST_DecStageOutInitSyncInfo decStageOutInitSyncInfo[ASP_OUTIS_NUM_DEC_STAGES];
+} PAF_AST_OutInitSyncInfo;
+
+// Output Processing Init-Sync control
+typedef struct PAF_AST_OutInitSyncCtl
+{
+ GateMP_Handle gateHandle; // output init-sync gate handle
+ PAF_AST_OutInitSyncInfo **pXOutIsInfo; // address of output init-sync info base pointer
+} PAF_AST_OutInitSyncCtl;
+
+// Initialize Output Processing Init-Sync control
+Int outIsCtlInit(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // output init-sync control to initialize
+ PAF_AST_OutInitSyncInfo **pXOutIsInfo // pointer to base address of output init-sync info array
+);
+
+// Copy audio frame
+// Note similar functionality present in CB, check usage there.
+Void outIsCpyAf(
+ PAF_AudioFrame *pSrcAf,
+ PAF_AudioFrame *pDstAf
+);
+
+#endif /* _ASP_OUT_INIT_SYNC_H_ */
index 7e7a1cceb13d7d30b83cdfa7776de7c138bf5bf6..f186a5324b8de0332c6cc891238ec15c3a01fd58 100644 (file)
#include "asp0.h"
#include "aspDecOpCircBuf_common.h"
+#include "aspOutInitSync_common.h"
#ifdef HSE_MSGQ
#include <msgq.h>
#endif
typedef struct PAF_AST_Config {
- Int as;
- PAF_AST_InpBuf *xInp; /* INPUT1 -INPUTN */
- PAF_AST_Decode *xDec; /* DECODE1-DECODEN */
- PAF_AST_Stream *xStr; /* STREAM1-STREAMN */
- PAF_AST_Encode *xEnc; /* ENCODE1-ENCODEN */
- PAF_AST_OutBuf *xOut; /* OUTPUT1-OUTPUTN */
- PAF_AST_DecOpCircBuf *xDecOpCb; /* DECODE1-DECODEN */
- SmInt masterDec; // these two are computed based on MASTER input
- SmInt masterStr;
+ Int as;
+ PAF_AST_InpBuf *xInp; /* INPUT1 -INPUTN */
+ PAF_AST_Decode *xDec; /* DECODE1-DECODEN */
+ PAF_AST_Stream *xStr; /* STREAM1-STREAMN */
+ PAF_AST_Encode *xEnc; /* ENCODE1-ENCODEN */
+ PAF_AST_OutBuf *xOut; /* OUTPUT1-OUTPUTN */
+ PAF_AST_DecOpCircBuf *xDecOpCb; /* DECODE1-DECODEN */
+ PAF_AST_OutInitSyncInfo *xOutIsi; /* DECODE1-DECODEN */
+ SmInt masterDec; // these two are computed based on MASTER input
+ SmInt masterStr;
#ifdef HSE_MSGQ
- PAF_AST_MQ mq;
+ PAF_AST_MQ mq;
#endif
} PAF_AST_Config;
-extern PAF_AST_Config *pC; /* Global configuration pointer */
-
#endif /* _ASP_CONFIG_H_ */
index 2747a6cf3e5a8d4cbf3095443ec5f9489b50ccd0..bad5bed515aceaee5b8a3c5896c0a074cbe871e8 100644 (file)
IALG_MemSpace space[PAF_MAXNUMCHAN];
}PAF_AudioFrameBufStatus;
+#if 0
//
// Audio Framework Functions
//
const PAF_MetadataBufStatus *pMetadataBufStatus;
const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
} PAF_AST_Params;
+#endif // #if 0
#endif /* _ASP_PARAMS_H_ */
index 587caca05cb22b745c6adccad01cfec31e1e9b6e..0fc569f3af677c121ed01cf6d59654ff28dfaf99 100644 (file)
//#define _ENABLE_BENCHMARK_PCMHSR_SRC_CAR_
#ifndef _ENABLE_BENCHMARK_PCMHSR_SRC_CAR_
-#define PAF_SYS_FRAMELENGTH ( 256 )
-#define PAF_MAX_SYS_FRAMELENGTH ( 256 )
+#define PAF_SYS_FRAMELENGTH ( 1024 )
+#define PAF_MAX_SYS_FRAMELENGTH ( 1024 )
#else // _ENABLE_BENCHMARK_PCMHSR_SRC_CAR_
#define PAF_SYS_FRAMELENGTH ( 512 ) // 512 or 1024
index b420283aa0845f1211d4f28940102e8de628c0a1..1675e568b57af5361362d0845e68097da97c0f3b 100644 (file)
--- a/pasdk/common/dbgCapAf.c
+++ b/pasdk/common/dbgCapAf.c
return CAP_AF_INV_CHNUM;
}
- nSamp = pAf->data.nSamples;
+ nSamp = pAf->sampleCount; //pAf->data.nSamples;
pSamp = pAf->data.sample[chNum];
if ((CAP_AF_MAX_NUM_SAMP - gCapAfBufIdx) < nSamp)
diff --git a/pasdk/paf b/pasdk/paf
index 768e579920deca65633cfb0ab1434e49595c9664..7728b45c854c28fc45d965aad9d727af7b0426cc 160000 (submodule)
--- a/pasdk/paf
+++ b/pasdk/paf
-Subproject commit 768e579920deca65633cfb0ab1434e49595c9664
+Subproject commit 7728b45c854c28fc45d965aad9d727af7b0426cc
index 480aad2614658f753ab93f22bfdbfe52fb48b7e0..90c148118f777f9fed027798c69ed52cdec42c47 100644 (file)
--- a/pasdk/shared/config.bld
+++ b/pasdk/shared/config.bld
* -------------------------------------------------------------
* 0C00_0000 0008_0000 ( 512 KB) SR_MSMC (ipc:data)
* 0C08_0000 0004_0000 ( 256 KB) HOST_MSMC (code, data)
- * 0C0C_0000 0004_0000 ( 256 KB) CORE_MSMC (code, data)
+ * 0C0C_0000 0004_0000 ( 256 KB) CORE0_MSMC (code, data)
* 8000_0000 0020_0000 ( 2 MB) SR_0 (ipc)
- * 8020_0000 00E0_0000 ( 14 MB) SR_DDR3 (ipc:data)
+ * 8020_0000 0060_0000 ( 6 MB) COMMON_DDR3 (data)
* 8100_0000 0100_0000 ( 16 MB) COMMON2_DDR3(code, data) // aligned to MAR memory region
- * 8200_0000 0060_0000 ( 6 MB) COMMON_DDR3 (data)
- * 8260_0000 0320_0000 ( 50 MB) HOST_DDR3 (code, data)
- * 8580_0000 0400_0000 ( 64 MB) CORE0_DDR3 (code, data)
- * 8980_0000 7680_0000 (1896 MB) DDR3 (code, data)
+ * 8200_0000 0100_0000 ( 16 MB) SR_DDR3 (ipc:data)
+ * 8300_0000 0300_0000 ( 48 MB) HOST_DDR3 (code, data)
+ * 8600_0000 0400_0000 ( 64 MB) CORE0_DDR3 (code, data)
+ * 8A00_0000 7600_0000 (1888 MB) DDR3 (code, data)
*/
var SR_MSMC = {
var SR_DDR3 = {
name: "SR_DDR3", space: "data", access: "RW",
- base: 0x80200000, len: 0x00E00000,
+ base: 0x82000000, len: 0x01000000,
comment: "SR DDR3 Memory"
};
var COMMON_DDR3 = {
name: "COMMON_DDR3", space: "data", access: "RW",
- base: 0x82000000, len: 0x00600000,
+ base: 0x80200000, len: 0x00600000,
comment: "COMMON DDR3 Memory"
};
var DDR3 = {
name: "DDR3", space: "code/data", access: "RW",
- base: 0x89800000, len: 0x76800000,
+ base: 0x8A000000, len: 0x76000000,
comment: "DDR3 Memory"
};
[ "HOST_DDR3", {
name: "HOST_DDR3", space: "code/data", access: "RWX",
- base: 0x82600000, len: 0x03200000,
+ base: 0x83000000, len: 0x03000000,
comment: "HOST DDR3"
}],
[ "CORE0_DDR3", {
name: "CORE0_DDR3", space: "code/data", access: "RWX",
- base: 0x85800000, len: 0x04000000,
+ base: 0x86000000, len: 0x04000000,
comment: "CORE0 DDR3"
}],
index 0f88fe9db3d35a730ec23c545dc178c411a89842..3ad14d6e1d4ba01c52c73d0486cea3a1519ac483 100644 (file)
--- a/pasdk/test_arm/.cproject
+++ b/pasdk/test_arm/.cproject
<stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/pdk_k2g_1_0_6/packages"/>
<stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
</macros>
<externalSettings/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/common""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/shared""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_arm/framework""/>
- <listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_arm/application""/>
+ <listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_arm/framework/itopo""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sio""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sio_dev2""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/dolby_ip/ddp/Dolby_Digital_Plus_Decoder_Imp/Source_Code/alg""/>
<stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
</macros>
<externalSettings/>
<stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/pdk_k2g_1_0_6/packages"/>
<stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
</macros>
<externalSettings/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/common""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/shared""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_arm/framework""/>
+ <listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_arm/framework/itopo""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sio""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sio_dev2""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/dolby_ip/dh-ip/dec/rel/ddp2/alg""/>
index c733de24da895b2658fef30f1ad17971b6f9af7d..52de06588ba2520f275b5702ef489b20663f655d 100644 (file)
--- a/pasdk/test_arm/.project
+++ b/pasdk/test_arm/.project
</variable>
<variable>
<name>PDK_INSTALL_PATH</name>
- <value>file:/C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages</value>
+ <value>file:/C:/ti/pdk_k2g_1_0_6/packages</value>
</variable>
<variable>
<name>PKTLIB_INSTALL_PATH</name>
diff --git a/pasdk/test_arm/framework/aspDecOpCircBuf_slave.c b/pasdk/test_arm/framework/aspDecOpCircBuf_slave.c
index 31532010ce5082b43cfd48d598efb42756a1b9e6..f82709b398c6b8e3d8c485615df90ca31c39e6b3 100644 (file)
#include "evmc66x_gpio_dbg.h" // Debug
+// Init last audio frame configuration info
+static Void cbInitLastAfInfo(
+ PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer control
+ PAF_AudioFrame *pAfInit // audio frame used for init
+);
+
+
+#if 0 // FL: moved to common
// Initialize circular buffer control
Int cbCtlInit(
PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
}
else
{
- pCbCtl->gateHandle = NULL;
+ pCbCtl->gateHandle = NULL;
return ASP_DECOP_CB_CTL_INIT_INV_GATE;
}
- pCbCtl->pXDecOpCb = pXDecOpCb;
+ pCbCtl->numCb = numCb; // init number of circular buffers
+ pCbCtl->pXDecOpCb = pXDecOpCb; // init base address of circular buffers
return ASP_DECOP_CB_SOK;
+}
+#endif
+
+// debug
+//Int8 gCbInitDecWriteCnt=0;
+//Int8 gCbInitDecWriteThdCnt=0;
+
+/// Initialize circular buffer for Decoder writes
+Int cbInitDecWrite(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ Int8 sourceSelect, // source select (PCM, DDP, etc.)
+ Int16 decOpFrameLen, // decoder output frame length (PCM samples)
+ Int8 resetRwFlags, // whether to reset reader, writer, and drain flags
+ PAF_AudioFrame *pDecInitAf // pointer to Dec output audio frame used for CB initialization
+)
+{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_DecOpCircBuf *pCb;
+ PAF_AudioFrame *pAfCb;
+ PAF_AudioData *pPcmBuf;
+ UInt8 *pMetaBuf;
+ Int8 n;
+ Int8 i;
+
+ //gCbInitDecWriteCnt++; // debug
+ // 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();
+
+ //Log_info1("cbInitDecWrite:afCb=0x%04x", (IArg)pCb->afCb); // debug
+
+ // Set source select
+ pCb->sourceSel = sourceSelect;
+
+ // Set input frame length
+ pCb->decOpFrameLen = decOpFrameLen;
+
+ //pCb->afInitialLag = 0; // default No lag
+ //pCb->afLagIdx = 0;
+ // Initialize CB primed flag
+ pCb->primedFlag = 0;
+ // Initialize delta samples
+ pCb->deltaSamps = 0;
+
+ // Initialize circular buffer:
+ // - maximum number of AFs
+ // - target nominal delay
+ // - AF write, read indices
+ // - maximum AF channel and sample counts
+ // - maximum number of PCM samples per channel
+ if (sourceSelect == PAF_SOURCE_PCM)
+ {
+ pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_PCM;
+
+ //pCb->afInitialLag = ASP_DECOP_CB_INIT_LAG_PCM;
+ pCb->targetNDSamps = ASP_DECOP_CB_TARGET_ND_SAMPS_48kPCM;
+
+ pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_PCM;
+ pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_PCM;
+
+ pCb->maxAFChanNum = ASP_DECOP_CB_MAX_NUM_PCM_CH;
+ pCb->maxAFSampCount = DEF_DEC_OP_FRAME_LEN;
+
+ pCb->maxNumPcmSampsPerCh = (Int32)(pCb->pcmBufEnd - pCb->pcmBuf)/pCb->maxAFChanNum;
+ }
+ else if ((sourceSelect == PAF_SOURCE_DDP) || (sourceSelect == PAF_SOURCE_AC3))
+ {
+ pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_DDP;
+
+ //pCb->afInitialLag = ASP_DECOP_CB_INIT_LAG_DDP;
+ pCb->targetNDSamps = ASP_DECOP_CB_TARGET_ND_SAMPS_DDP;
+
+ pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_DDP;
+ pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_DDP;
+
+ pCb->maxAFChanNum = ASP_DECOP_CB_MAX_NUM_PCM_CH_DDP;
+ pCb->maxAFSampCount = ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kDDP;
+
+ pCb->maxNumPcmSampsPerCh = (Int32)(pCb->pcmBufEnd - pCb->pcmBuf)/pCb->maxAFChanNum;
+ }
+ else if (sourceSelect == PAF_SOURCE_THD)
+ {
+ //gCbInitSourceSelThdCnt++; //debug
+
+ pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_THD;
+
+ //pCb->afInitialLag = ASP_DECOP_CB_INIT_LAG_THD;
+ // FL: (***) set nominal delay per sampling rate -- need to review these settings
+ switch (pDecInitAf->sampleRate)
+ {
+ case PAF_SAMPLERATE_44100HZ:
+ case PAF_SAMPLERATE_48000HZ:
+ pCb->targetNDSamps = ASP_DECOP_CB_TARGET_ND_SAMPS_48kTHD;
+ break;
+ case PAF_SAMPLERATE_88200HZ:
+ case PAF_SAMPLERATE_96000HZ:
+ pCb->targetNDSamps = ASP_DECOP_CB_TARGET_ND_SAMPS_96kTHD;
+ break;
+ case PAF_SAMPLERATE_176400HZ:
+ case PAF_SAMPLERATE_192000HZ:
+ pCb->targetNDSamps = ASP_DECOP_CB_TARGET_ND_SAMPS_192kTHD;
+ break;
+ default:
+ pCb->targetNDSamps = ASP_DECOP_CB_TARGET_ND_SAMPS_48kTHD;
+ break;
+ }
+
+ pCb->afWrtIdx = ASP_DECOP_CB_INIT_WRTIDX_THD;
+ pCb->afRdIdx = ASP_DECOP_CB_INIT_RDIDX_THD;
+
+ pCb->maxAFChanNum = ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT;
+ pCb->maxAFSampCount = ASP_DECOP_CB_MAX_PCM_FRAME_LEN_48kMAT;
+
+ pCb->maxNumPcmSampsPerCh = (Int32)(pCb->pcmBufEnd - pCb->pcmBuf)/pCb->maxAFChanNum;
+ }
+ else
+ {
+ //
+ // Currently unsupported source select
+ //
+
+ SW_BREAKPOINT; // debug
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_DECOP_CB_INIT_INV_SOURCE_SEL;
+ }
+
+ // Initialize circular buffer:
+ // - PCM read index
+ // - Private metadata read index
+ // - number of PCM samples in CB
+ pCb->pcmRdIdx = 0;
+ pCb->prvMdRdIdx = 0;
+ pCb->numPcmSampsPerCh = 0;
+
+ // Initialize audio frames
+ for (n = 0; n < pCb->maxNumAfCb; n++)
+ {
+ pAfCb = &pCb->afCb[n]; // get pointer to CB AF
+
+ // Dec init AF sample count not correct for CB AFs.
+ // Dec Op frame length is computed in framework based on selected source.
+ pAfCb->sampleCount = decOpFrameLen;
+
+ // initialize CB AF using Dec init AF
+ pAfCb->sampleDecode = pDecInitAf->sampleDecode;
+ PAF_PROCESS_COPY(pAfCb->sampleProcess, pDecInitAf->sampleProcess);
+ pAfCb->sampleRate = pDecInitAf->sampleRate;
+ pAfCb->channelConfigurationRequest.full = pDecInitAf->channelConfigurationRequest.full;
+ pAfCb->channelConfigurationStream.full = pDecInitAf->channelConfigurationStream.full;
+
+ // initialize metadata information updated by decoder
+ pAfCb->bsMetadata_type = PAF_bsMetadata_none; /* non zero if metadata is attached. */
+ pAfCb->pafBsMetadataUpdate = 0; /* indicates whether bit-stream metadata update */
+ pAfCb->numPrivateMetadata = 0; /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
+ pAfCb->bsMetadata_offset = 0; /* offset into audio frame for change in bsMetadata_type field */
+ }
+
+ // Initialize circular buffer current number of frames
+ pCb->numAfCb = pCb->afWrtIdx - pCb->afRdIdx;
+
+ // Initialize audio frame PCM buffers
+ pPcmBuf = pCb->pcmBuf;
+ pMetaBuf = pCb->metaBuf;
+ for (n=0; n<pCb->maxNumAfCb; n++)
+ {
+ pAfCb = &pCb->afCb[n]; // get pointer to CB AF
+
+ pAfCb->data.nChannels = pCb->maxAFChanNum;
+ pAfCb->data.nSamples = decOpFrameLen;
+ for (i=0; i<pCb->maxAFChanNum; i++)
+ {
+ pAfCb->data.sample[i] = pPcmBuf;
+ memset(pAfCb->data.sample[i], 0, pCb->maxAFSampCount);
+ pPcmBuf += pCb->maxAFSampCount;
+
+ pAfCb->data.samsiz[i] = 0;
+ }
+
+ // Initialize metadata buffers
+ for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++)
+ {
+ pAfCb->pafPrivateMetadata[i].offset = 0;
+ pAfCb->pafPrivateMetadata[i].size = 0;
+ pAfCb->pafPrivateMetadata[i].pMdBuf = pMetaBuf;
+ pMetaBuf += PAF_MAX_PRIVATE_MD_SZ;
+ }
+ }
+
+ // Initialize last audio frame configuration info
+ cbInitLastAfInfo(pCb, pDecInitAf);
+
+ // Reset read/write flags
+ if (resetRwFlags != 0)
+ {
+ pCb->writerActiveFlag = 0;
+ pCb->readerActiveFlag = 0;
+ pCb->drainFlag = 0;
+ }
+
+ // Reset stats
+ pCb->readAfWriterInactiveCnt = 0;
+ pCb->readAfNdCnt = 0;
+ pCb->wrtAfReaderInactiveCnt = 0;
+ pCb->wrtAfZeroSampsCnt = 0;
+ pCb->errAfUndCnt = 0;
+ pCb->errAfOvrCnt = 0;
+ pCb->errPcmUndCnt = 0;
+ pCb->errPcmOvrCnt = 0;
+
+ // Write back circular buffer configuration
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ // Write back AF circular buffer
+ Cache_wb(pCb->afCb, pCb->maxNumAfCb*sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
+ // Write back PCM data
+ for (n=0; n<pCb->maxNumAfCb; n++)
+ {
+ pAfCb = &pCb->afCb[n];
+ Cache_wb(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+ Cache_wb(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
+ for (i=0; i<pCb->maxAFChanNum; i++)
+ {
+ Cache_wb(pAfCb->data.sample[i], pCb->maxAFSampCount*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+ }
+ }
+ Cache_wait();
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_DECOP_CB_SOK;
}
//Int8 gCbWriteStartCnt=0; // debug
// update flags
pCb->writerActiveFlag = 1;
- pCb->emptyFlag = 0;
+ pCb->drainFlag = 0;
//pCb->afLagIdx = 0;
// Write back circular buffer configuration
// update flags
pCb->writerActiveFlag = 0;
- pCb->emptyFlag = 1;
+ pCb->drainFlag = 1;
// Write back circular buffer configuration
Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
PAF_ChannelMask_HD streamMask;
Int8 i;
Int16 j;
- PAF_AudioData *pPcmBuf;UInt8 *pMetaBuf; int nextWrtIdx;PAF_AudioFrame *pAfCbNextAf;
-
+ PAF_AudioData *pPcmBuf; UInt8 *pMetaBuf; int nextWrtIdx;PAF_AudioFrame *pAfCbNextAf;
+ PAF_AudioFrame *pAfCbRd;
+ PAF_AudioData *pPcmBufRd, *pPcmBufWrt;
+ Int8 pcmOvr;
+
// Get gate handle
gateHandle = pCbCtl->gateHandle;
// Enter gate
//Log_info1("cbWriteAf:afCb=0x%04x", (IArg)pCb->afCb); // debug
//Log_info2("cbWriteAf:pCb->readerActiveFlag=%d, pCb->writerActiveFlag=%d", (IArg)pCb->readerActiveFlag, (IArg)pCb->writerActiveFlag); // debug
- if ((pCb->readerActiveFlag == 1) && (pAfWrt->sampleCount)) //QIN ?
- {
- //
- // Normal case, reader active.
- // If reader not active, don't write to circular buffer or check OVRflow.
-
-#if 0
- if (pCb->cbWriteAfInit == 0)
- {
- // Invalidate AF circular buffer
- Cache_inv(pCb->afCb, pCb->maxNumAfCb*sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
- for (n=0; n<pCb->maxNumAfCb; n++)
- {
- pAfCb = &pCb->afCb[n];
- Cache_inv(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
- }
- Cache_wait();
-
- pCb->cbWriteAfInit = 1;
- }
-#endif
-
- //Log_info2("cbWriteAf:pCb->numAfCb=%d, pCb->maxNumAfCb=%d", (IArg)pCb->readerActiveFlag, (IArg)pCb->maxNumAfCb); // debug
-
- // check overflow
- //while (pCb->numAfCb >= pCb->maxNumAfCb); // debug
- if (pCb->numAfCb >= pCb->maxNumAfCb)
+ //if (pCb->readerActiveFlag == 1)
+ //{
+ // //
+ // // Normal case, reader active.
+ // //
+
+ if (pAfWrt->sampleCount != 0)
{
- pCb->errOvrCnt++;
+ //Log_info2("cbWriteAf:pCb->numAfCb=%d, pCb->maxNumAfCb=%d", (IArg)pCb->readerActiveFlag, (IArg)pCb->maxNumAfCb); // debug
- //SW_BREAKPOINT;
- Log_info1("cbWriteAf: ERROR: overflow, numAfCb=%d", pCb->numAfCb);
+ // check AF overflow
+ if (pCb->numAfCb >= pCb->maxNumAfCb)
+ {
+ pCb->errAfOvrCnt++;
- // Write back circular buffer configuration
- Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ //SW_BREAKPOINT;
+ Log_info1("cbWriteAf: ERROR: AF CB overflow, numAfCb=%d", pCb->numAfCb);
- // Leave the gate
- GateMP_leave(gateHandle, key);
+ // Write back circular buffer configuration
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
- //Log_info2("cbWriteAf:gate leave, gateHandle=0x%04x, key=%d", (IArg)gateHandle, (IArg)key); // debug
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
- return ASP_DECOP_CB_WRITE_OVERFLOW;
- }
+ //Log_info2("cbWriteAf:gate leave, gateHandle=0x%04x, key=%d", (IArg)gateHandle, (IArg)key); // debug
- pAfCb = &pCb->afCb[pCb->afWrtIdx];
- pPcmBuf = pAfCb->data.sample[0];
- pMetaBuf = pAfCb->pafPrivateMetadata[0].pMdBuf;
- if((pPcmBuf + (pAfWrt->sampleCount * pCb->maxAFChanNum )) > (pCb->pcmBufEnd))
- {
- pPcmBuf = pCb->pcmBuf;
- }
-
- for (i=0; i<pCb->maxAFChanNum; i++)
- {
- pAfCb->data.sample[i] = pPcmBuf;
- pPcmBuf += pAfWrt->sampleCount;
- pAfCb->data.samsiz[i] = 0;
- }
- Cache_inv(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0); // FL: this is write back and invalidate??
- Cache_wait();
+ return ASP_DECOP_CB_AF_WRITE_OVERFLOW;
+ }
+
+ // FL: this won't reliably detect overflow because of PCM buffer write address wrap
+ // check PCM overflow
+ //if ((pCb->numPcmSampsPerCh + pAfWrt->sampleCount) > pCb->maxNumPcmSampsPerCh)
+ //{
+ // pCb->errPcmOvrCnt++;
+ //
+ // Log_info3("cbWriteAf: ERROR: PCM CB overflow, sampleCount=%d, numPcmSampsPerCh=%d, maxNumPcmSampsPerCh=%d",
+ // pCb->numPcmSampsPerCh, pAfWrt->sampleCount, pCb->maxNumPcmSampsPerCh);
+ //
+ // // Write back circular buffer configuration
+ // Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ // Cache_wait();
+ //
+ // // Leave the gate
+ // GateMP_leave(gateHandle, key);
+ //
+ // return ASP_DECOP_CB_PCM_WRITE_OVERFLOW;
+ //}
+
+ // get CB AF write info
+ pAfCb = &pCb->afCb[pCb->afWrtIdx]; // get CB AF to be written
+ pPcmBufWrt = pAfCb->data.sample[0]; // get current location in PCM buffer to be written
+ // (***) FL: currently no metadata buffer overflow detection
+ pMetaBuf = pAfCb->pafPrivateMetadata[0].pMdBuf; // get current location in MD buffer to be written
+
+ // get CB AF read info
+ pAfCbRd = &pCb->afCb[pCb->afRdIdx]; // get CB AF being read
+ //pPcmBufRd = pAfCbRd->data.sample[0]; // FL: starting location of PCM samples for AF being read
+ pPcmBufRd = pAfCbRd->data.sample[0] + pCb->pcmRdIdx; // FL: current location of PCM samples for AF being read
+
+ // Check PCM buffer overflow
+ pPcmBuf = pPcmBufWrt;
+ pcmOvr = 0;
+ for (i = 0; i < pCb->maxAFChanNum; i++)
+ {
+ //
+ // Writes of PCM to PCM CB use CC stream, but this isn't considered here.
+ // For each channel which *can* be written, check the current reader location won't be overwritten.
+ // The current reader location is the earliest channel which *could have been* written for that CB AF.
+ //
+ if ((pPcmBuf + pAfWrt->sampleCount) >= pCb->pcmBufEnd)
+ {
+ // this write will wrap
+
+ // check OVR before wrap
+ if ((pPcmBuf < pPcmBufRd) &&
+ ((pPcmBuf + pAfWrt->sampleCount) >= pPcmBufRd))
+ {
+ pCb->errPcmOvrCnt++;
+ pcmOvr = 1;
+ }
+
+ if (pcmOvr == 0)
+ {
+ // wrap pointer
+ pPcmBuf = pCb->pcmBuf;
+ // check OVR after wrap
+ if ((pPcmBuf < pPcmBufRd) &&
+ ((pPcmBuf + pAfWrt->sampleCount) >= pPcmBufRd))
+ {
+ pCb->errPcmOvrCnt++;
+ pcmOvr = 1;
+ }
+ }
+ }
+ else if ((pPcmBuf < pPcmBufRd) &&
+ ((pPcmBuf + pAfWrt->sampleCount) >= pPcmBufRd))
+ {
+ // this write won't wrap
+
+ pCb->errPcmOvrCnt++;
+ pcmOvr = 1;
+ }
+ else
+ {
+ // update pointer
+ pPcmBuf += pAfWrt->sampleCount;
+ }
+
+ if (pcmOvr == 1)
+ {
+ Log_info2("cbWriteAf: ERROR: PCM CB overflow, sampleCount=%d, numPcmSampsPerCh=%d",
+ pAfWrt->sampleCount, pCb->numPcmSampsPerCh);
+
+ //SW_BREAKPOINT; // debug
+
+ // Write back circular buffer configuration
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_DECOP_CB_PCM_WRITE_OVERFLOW;
+ }
+ }
+
+ // (***) FL: !!! REVISIT!!!
+ // Allocating memory for max # channels (e.g. 32 for THD).
+ // GROSS over allocation for THD 192 kHz, 6ch max.
+ // configure AF sample pointers
+ pPcmBuf = pPcmBufWrt;
+ for (i = 0; i < pCb->maxAFChanNum; i++)
+ {
+ // check PCM buffer wrap
+ if ((pPcmBuf + pAfWrt->sampleCount) >= pCb->pcmBufEnd)
+ {
+ pPcmBuf = pCb->pcmBuf;
+ }
+
+ pAfCb->data.sample[i] = pPcmBuf;
+ pPcmBuf += pAfWrt->sampleCount;
+ pAfCb->data.samsiz[i] = 0;
+ }
+ Cache_inv(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0); // FL: this is write back and invalidate??
+ Cache_wait();
- for (i=0; i<pCb->maxAFChanNum; i++){
- }
- for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++)
- {
- pAfCb->pafPrivateMetadata[i].offset = 0;
- pAfCb->pafPrivateMetadata[i].size = 0;
- pAfCb->pafPrivateMetadata[i].pMdBuf = pMetaBuf;
- pMetaBuf += PAF_MAX_PRIVATE_MD_SZ;
- }
+ // FL: brute force reset of all metadata in CB AF?
+ for (i=0; i<PAF_MAX_NUM_PRIVATE_MD; i++)
+ {
+ pAfCb->pafPrivateMetadata[i].offset = 0;
+ pAfCb->pafPrivateMetadata[i].size = 0;
+ pAfCb->pafPrivateMetadata[i].pMdBuf = pMetaBuf;
+ pMetaBuf += PAF_MAX_PRIVATE_MD_SZ;
+ }
- nextWrtIdx = 0;
- if ((pCb->afWrtIdx +1) >= pCb->maxNumAfCb)
- {
- //Log_info0("cbWriteAf: AF Wrap around **** ");
- // next audio frame will be audio frame 0
+#if 0 // FL: unused
nextWrtIdx = 0;
- }else{
- // next audio frame will be current audio frame + 1
- nextWrtIdx = pCb->afWrtIdx + 1;
- }
+ if ((pCb->afWrtIdx + 1) >= pCb->maxNumAfCb)
+ {
+ //Log_info0("cbWriteAf: AF Wrap around **** ");
+ // next audio frame will be audio frame 0
+ nextWrtIdx = 0;
+ }
+ else
+ {
+ // next audio frame will be current audio frame + 1
+ nextWrtIdx = pCb->afWrtIdx + 1;
+ }
+
+ pAfCbNextAf = &pCb->afCb[nextWrtIdx]; // +1 or last AF if overflow
+ pAfCbNextAf->data.sample[0] = &pAfCb->data.sample[pCb->maxAFChanNum - 1][pAfWrt->sampleCount]; // pAfCb->data.sample[15] + (pAfCb->sampleCount * sizeof(PAF_AudioData));
+#endif
+
+ // write audio frame information updated by decoder
+ pAfCb->sampleDecode = pAfWrt->sampleDecode;
+ PAF_PROCESS_COPY(pAfCb->sampleProcess, pAfWrt->sampleProcess);
+ pAfCb->sampleRate = pAfWrt->sampleRate;
+ pAfCb->sampleCount = pAfWrt->sampleCount;
+ pAfCb->channelConfigurationRequest = pAfWrt->channelConfigurationRequest;
+ pAfCb->channelConfigurationStream = pAfWrt->channelConfigurationStream;
+ // write metadata information updated by decoder
+ pAfCb->bsMetadata_type = pAfWrt->bsMetadata_type; /* non zero if metadata is attached. */
+ pAfCb->pafBsMetadataUpdate = pAfWrt->pafBsMetadataUpdate; /* indicates whether bit-stream metadata update */
+ pAfCb->numPrivateMetadata = pAfWrt->numPrivateMetadata; /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
+ pAfCb->bsMetadata_offset = pAfWrt->bsMetadata_offset; /* offset into audio frame for change in bsMetadata_type field */
+
+ // write PCM samples
+ streamMask = pAfWrt->fxns->channelMask(pAfWrt, pAfCb->channelConfigurationStream);
+ for (i = 0; i < pCb->maxAFChanNum; i++)
+ {
+ if ((streamMask >> i) & 0x1)
+ {
+ for (j = 0; j < pAfWrt->sampleCount; j++)
+ {
+ pAfCb->data.sample[i][j] = pAfWrt->data.sample[i][j];
+ }
- pAfCbNextAf = &pCb->afCb[nextWrtIdx]; // +1 or last AF if overflow
- pAfCbNextAf->data.sample[0] = &pAfCb->data.sample[pCb->maxAFChanNum - 1][pAfWrt->sampleCount];// pAfCb->data.sample[15] + (pAfCb->sampleCount * sizeof(PAF_AudioData));
-
- // write audio frame information updated by decoder
- pAfCb->sampleDecode = pAfWrt->sampleDecode;
- PAF_PROCESS_COPY(pAfCb->sampleProcess, pAfWrt->sampleProcess);
- pAfCb->sampleRate = pAfWrt->sampleRate;
- pAfCb->sampleCount = pAfWrt->sampleCount;
- pAfCb->channelConfigurationRequest = pAfWrt->channelConfigurationRequest;
- pAfCb->channelConfigurationStream = pAfWrt->channelConfigurationStream;
- // write metadata information updated by decoder
- pAfCb->bsMetadata_type = pAfWrt->bsMetadata_type; /* non zero if metadata is attached. */
- pAfCb->pafBsMetadataUpdate = pAfWrt->pafBsMetadataUpdate; /* indicates whether bit-stream metadata update */
- pAfCb->numPrivateMetadata = pAfWrt->numPrivateMetadata; /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
- pAfCb->bsMetadata_offset = pAfWrt->bsMetadata_offset; /* offset into audio frame for change in bsMetadata_type field */
- // write PCM samples
- streamMask = pAfWrt->fxns->channelMask(pAfWrt, pAfCb->channelConfigurationStream);
- for (i = 0; i < pCb->maxAFChanNum; i++)
- {
- if ((streamMask >> i) & 0x1)
+ pAfCb->data.samsiz[i] = pAfWrt->data.samsiz[i];
+ }
+ }
+
+ // Update PCM samples per channel
+ pCb->numPcmSampsPerCh += pAfWrt->sampleCount;
+
+ #ifdef CB_RW_OP_CAP_PP // debug
+ if (pCb->cb_opCnt < CB_OP_COUNT_MAX)
+ {
+ if ((pCb->cb_samples_op != NULL) && (pCb->cb_op_owner != NULL))
+ {
+ // log sample count
+ pCb->cb_samples_op[pCb->cb_opCnt] = pAfWrt->sampleCount;
+ pCb->cb_op_owner[pCb->cb_opCnt] = CB_OP_W;
+ // log idxs
+ pCb->cb_afRdIdx[pCb->cb_opCnt] = pCb->afRdIdx;
+ pCb->cb_afWrtIdx[pCb->cb_opCnt] = pCb->afWrtIdx;
+ pCb->cb_numAfCb[pCb->cb_opCnt] = pCb->numAfCb; // numAfCb might not be pointing to this instance
+ pCb->cb_opCnt++;
+ }
+ }
+ #endif
+
+ // prepare metadata buffer pointers according to the metadata and buffer sizes
+ for (i = 0; i < pAfWrt->numPrivateMetadata; i++)
{
- for (j = 0; j < pAfWrt->sampleCount; j++)
+ UInt8 *nextMdBuf;
+ if (i == 0)
+ {
+ nextMdBuf = (pAfCb->pafPrivateMetadata[0].pMdBuf + pAfWrt->pafPrivateMetadata[0].size);
+ }
+ else
+ {
+ nextMdBuf = (pAfCb->pafPrivateMetadata[i-1].pMdBuf + pAfWrt->pafPrivateMetadata[i-1].size);
+ }
+ if (nextMdBuf >= pCb->metaBufEnd) // metadata buffer overflow
{
- pAfCb->data.sample[i][j] = pAfWrt->data.sample[i][j];
+ pAfCb->pafPrivateMetadata[i].pMdBuf = pCb->metaBuf;
}
+ else if (i != 0)
+ {
+ pAfCb->pafPrivateMetadata[i].pMdBuf = nextMdBuf;
+ }
+ Cache_inv(pAfCb->pafPrivateMetadata[i].pMdBuf, sizeof(UInt8 *), Cache_Type_ALLD, 0);
+ }
- pAfCb->data.samsiz[i] = pAfWrt->data.samsiz[i];
+ // Write metadata to circular buffer
+ for (i = 0; i < pAfWrt->numPrivateMetadata; i++) // only copy numPrivateMetadata
+ {
+ pAfCb->pafPrivateMetadata[i].offset = pAfWrt->pafPrivateMetadata[i].offset;
+ pAfCb->pafPrivateMetadata[i].size = pAfWrt->pafPrivateMetadata[i].size;
+ memcpy(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfWrt->pafPrivateMetadata[i].pMdBuf, pAfWrt->pafPrivateMetadata[i].size);
}
- }
- #ifdef CB_RW_OP_CAP_PP // debug
- if (pCb->cb_opCnt < CB_OP_COUNT_MAX)
- {
- if ((pCb->cb_samples_op != NULL) && (pCb->cb_op_owner != NULL))
+ Cache_inv(pAfCb->pafPrivateMetadata, pAfWrt->numPrivateMetadata*sizeof(PAF_PrivateMetadata *), Cache_Type_ALLD, 0); // FL: this is write back and invalidate??
+ Cache_wait();
+ for (i = 0; i < pAfCb->numPrivateMetadata; i++) // only write back numPrivateMetadata
{
- // log sample count
- pCb->cb_samples_op[pCb->cb_opCnt] = pAfWrt->sampleCount;
- pCb->cb_op_owner[pCb->cb_opCnt] = CB_OP_W;
- // log idxs
- pCb->cb_afRdIdx[pCb->cb_opCnt] = pCb->afRdIdx;
- pCb->cb_afWrtIdx[pCb->cb_opCnt] = pCb->afWrtIdx;
- pCb->cb_numAfCb[pCb->cb_opCnt] = pCb->numAfCb; // numAfCb might not be pointing to this instance
- pCb->cb_opCnt++;
+ //Log_info4("cbWriteAf: AF: %d nummd: %d offset: %d size: %d ", pCb->afWrtIdx, pAfCb->numPrivateMetadata, pAfCb->pafPrivateMetadata[i].offset, pAfCb->pafPrivateMetadata[i].size);
+ Cache_wb(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size, Cache_Type_ALLD, 0);
+ }
+ // update audio frame write index
+ pCb->afWrtIdx++;
+ if (pCb->afWrtIdx >= pCb->maxNumAfCb)
+ {
+ pCb->afWrtIdx = 0;
}
- }
- #endif
- // prepare metadata buffer pointers according to the metadata and buffer sizes
- for (i=0; i < pAfWrt->numPrivateMetadata; i++)
- {
- UInt8 *nextMdBuf;
- if(i == 0)
- nextMdBuf = (pAfCb->pafPrivateMetadata[0].pMdBuf + pAfWrt->pafPrivateMetadata[0].size);
+ pCb->afCb[pCb->afWrtIdx].data.sample[0] = &pAfCb->data.sample[pCb->maxAFChanNum - 1][pAfWrt->sampleCount];
+ if (pAfWrt->numPrivateMetadata > 0)
+ {
+ pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf = pAfCb->pafPrivateMetadata[pAfWrt->numPrivateMetadata - 1].pMdBuf + pAfWrt->pafPrivateMetadata[pAfWrt->numPrivateMetadata - 1].size;
+ }
else
- nextMdBuf = (pAfCb->pafPrivateMetadata[i-1].pMdBuf + pAfWrt->pafPrivateMetadata[i-1].size);
- if(nextMdBuf >= pCb->metaBufEnd) // metadata buffer overflow
{
- pAfCb->pafPrivateMetadata[i].pMdBuf = pCb->metaBuf;
+ pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf = pAfCb->pafPrivateMetadata[0].pMdBuf;
+ Cache_wb(pCb->afCb , ASP_DECOP_CB_MAX_NUM_PCM_FRAMES*sizeof(PAF_AudioFrame *), Cache_Type_ALLD, 0);
+ Cache_wait();
}
- else if(i != 0)
+ Cache_inv(pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf, sizeof(UInt8 *), Cache_Type_ALLD, 0);
+ Cache_wait();
+ // update number of audio frames in circular buffer
+ pCb->numAfCb++;
+
+ // Update CB Lag index
+ //if (pCb->afLagIdx < pCb->afInitialLag)
+ //{
+ // pCb->afLagIdx += 1;
+ //}
+
+ // Update CB primed flag
+ // calculate number of delta samples before allowing CB read
+ if (pCb->primedFlag == 0)
{
- pAfCb->pafPrivateMetadata[i].pMdBuf = nextMdBuf;
+ pCb->primedFlag = 1;
+
+ // Calculate number of output frames to block reader.
+ // This is sample count reader waits before allowed to actually read samples from the CB.
+ //pCb->deltaSamps = (pCb->targetNDSamps - pAfWrt->sampleCount + (pCb->strFrameLen-1)) / pCb->strFrameLen * pCb->strFrameLen;
+ // FL: CB read decrements by strFrameLen and tests for >0, so rounding to strFrameLen is unnecessary
+ pCb->deltaSamps = pCb->targetNDSamps - pAfWrt->sampleCount;
+
+ // debug
+ //gSampleCountBuf[gPrimedFlagCnt] = pAfWrt->sampleCount;
+ //gCalcDeltaSampsBuf[gPrimedFlagCnt] = pCb->deltaSamps;
+ //if (gPrimedFlagCnt < 10)
+ // gPrimedFlagCnt++;
}
- Cache_inv(pAfCb->pafPrivateMetadata[i].pMdBuf, sizeof(UInt8 *), Cache_Type_ALLD, 0);
- }
- // Write metadata to circular buffer
- for (i = 0; i < pAfWrt->numPrivateMetadata; i++) // only copy numPrivateMetadata
- {
- pAfCb->pafPrivateMetadata[i].offset = pAfWrt->pafPrivateMetadata[i].offset;
- pAfCb->pafPrivateMetadata[i].size = pAfWrt->pafPrivateMetadata[i].size;
- memcpy(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfWrt->pafPrivateMetadata[i].pMdBuf, pAfWrt->pafPrivateMetadata[i].size);
- }
+ // Write back circular buffer configuration
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ // write back audio frame
+ Cache_wb(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
+ Cache_wb(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+ Cache_wb(pAfCb->pafPrivateMetadata, pAfWrt->numPrivateMetadata*sizeof(PAF_PrivateMetadata *), Cache_Type_ALLD, 0);
+ Cache_wait();
+ // write back PCM data
+ for (i = 0; i < pCb->maxAFChanNum; i++)
+ {
+ if ((streamMask >> i) & 0x1)
+ {
+ Cache_wb(pAfCb->data.sample[i], pAfWrt->sampleCount * sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+ }
+ }
+ Cache_wait();
- Cache_inv(pAfCb->pafPrivateMetadata, pAfWrt->numPrivateMetadata*sizeof(PAF_PrivateMetadata *), Cache_Type_ALLD, 0); // FL: this is write back and invalidate??
- Cache_wait();
- for (i=0; i<pAfCb->numPrivateMetadata; i++) // only write back numPrivateMetadata
- {
- //Log_info4("cbWriteAf: AF: %d nummd: %d offset: %d size: %d ", pCb->afWrtIdx, pAfCb->numPrivateMetadata, pAfCb->pafPrivateMetadata[i].offset, pAfCb->pafPrivateMetadata[i].size);
- Cache_wb(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size, Cache_Type_ALLD, 0);
- }
- // update audio frame write index
- pCb->afWrtIdx++;
- if (pCb->afWrtIdx >= pCb->maxNumAfCb)
- {
- pCb->afWrtIdx = 0;
- }
+#if 0 // (***) FL: shows timing of CB write
+ // debug
+ {
+ static Uint8 toggleState = 0;
+ if (toggleState == 0)
+ GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_99);
+ else
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_99);
+ toggleState = ~(toggleState);
+ }
+#endif
- pCb->afCb[pCb->afWrtIdx].data.sample[0] = &pAfCb->data.sample[pCb->maxAFChanNum - 1][pAfWrt->sampleCount];
- if(pAfWrt->numPrivateMetadata > 0)
- {
- pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf = pAfCb->pafPrivateMetadata[pAfWrt->numPrivateMetadata - 1].pMdBuf + pAfWrt->pafPrivateMetadata[pAfWrt->numPrivateMetadata - 1].size;
+ Log_info3("wrote %d samples into AF %d sourceSel: %d", pAfCb->sampleCount, pCb->afWrtIdx, pCb->sourceSel);
+ Log_info4("CBWMETA num=%d size=%d offset=%d chrequest=0x%04x", pAfCb->numPrivateMetadata, pAfCb->pafPrivateMetadata[0].size, pAfCb->pafPrivateMetadata[0].offset, pAfCb->channelConfigurationRequest.full);
}
else
{
- pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf = pAfCb->pafPrivateMetadata[0].pMdBuf;
- Cache_wb(pCb->afCb , ASP_DECOP_CB_MAX_NUM_PCM_FRAMES*sizeof(PAF_AudioFrame *), Cache_Type_ALLD, 0);
+ //
+ // Skip write in case of 0 sample count
+ //
+
+ // writing audio frame w/ zero samples
+ // update stat
+ pCb->wrtAfZeroSampsCnt++;
+
+ // Write back circular buffer configuration
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
Cache_wait();
}
- Cache_inv(pCb->afCb[pCb->afWrtIdx].pafPrivateMetadata[0].pMdBuf, sizeof(UInt8 *), Cache_Type_ALLD, 0);
- Cache_wait();
- // update number of audio frames in circular buffer
- pCb->numAfCb++;
-
- // Update CB Lag index
- //if (pCb->afLagIdx < pCb->afInitialLag)
- //{
- // pCb->afLagIdx += 1;
- //}
+ //}
+ //else if (pCb->readerActiveFlag == 0)
+ if (pCb->readerActiveFlag == 0)
+ {
+ //
+ // Reader inactive, don't write to circular buffer or check OVRflow.
+ //
- // Update CB primed flag
- // calculate number of delta samples before
- if (pCb->primedFlag == 0)
- {
- pCb->primedFlag = 1;
-
- // Calculate number of output frames to block reader.
- // This is sample count reader waits before allowed to actually read samples from the CB.
- pCb->deltaSamps = (pCb->targetNDSamps - pAfWrt->sampleCount + (pCb->strFrameLen-1)) / pCb->strFrameLen * pCb->strFrameLen;
-
- // debug
- //gSampleCountBuf[gPrimedFlagCnt] = pAfWrt->sampleCount;
- //gCalcDeltaSampsBuf[gPrimedFlagCnt] = pCb->deltaSamps;
- //if (gPrimedFlagCnt < 10)
- // gPrimedFlagCnt++;
- }
+ // writing AF w/ inactive reader
+ // update stat
+ pCb->wrtAfReaderInactiveCnt++;
// Write back circular buffer configuration
Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
- // write back audio frame
- Cache_wb(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
- Cache_wb(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
- Cache_wb(pAfCb->pafPrivateMetadata, pAfWrt->numPrivateMetadata*sizeof(PAF_PrivateMetadata *), Cache_Type_ALLD, 0);
- Cache_wait();
- // write back PCM data
- for (i = 0; i < pCb->maxAFChanNum; i++)
- {
- if ((streamMask >> i) & 0x1)
- {
- Cache_wb(pAfCb->data.sample[i], pAfWrt->sampleCount * sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
- }
- }
Cache_wait();
-
- {
- static Uint8 toggleState = 0;
- if (toggleState == 0)
- GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_99);
- else
- GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_99);
- toggleState = ~(toggleState);
- }
- Log_info3("wrote %d samples into AF %d sourceSel: %d", pAfCb->sampleCount, pCb->afWrtIdx, pCb->sourceSel);
- Log_info4("CBWMETA num=%d size=%d offset=%d chrequest=0x%04x", pAfCb->numPrivateMetadata, pAfCb->pafPrivateMetadata[0].size, pAfCb->pafPrivateMetadata[0].offset, pAfCb->channelConfigurationRequest.full);
}
// Leave the gate
return ASP_DECOP_CB_SOK;
}
+#if 0
// Get next audio frame to write in circular buffer
Int cbGetNextWriteAf(
PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
return ASP_DECOP_CB_SOK;
}
+#endif
+
+// Init last audio frame configuration info
+static Void cbInitLastAfInfo(
+ PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer control
+ PAF_AudioFrame *pAfInit // audio frame used for init
+)
+{
+ memset(&pCb->lastAf, 0, sizeof(PAF_AudioFrame));
+
+ pCb->lastAf.sampleDecode = pAfInit->sampleDecode;
+ pCb->lastAf.sampleRate = pAfInit->sampleRate;
+ pCb->lastAf.channelConfigurationRequest.full = pAfInit->channelConfigurationRequest.full;
+ pCb->lastAf.channelConfigurationStream.full = pAfInit->channelConfigurationStream.full;
+}
diff --git a/pasdk/test_arm/framework/aspDecOpCircBuf_slave.h b/pasdk/test_arm/framework/aspDecOpCircBuf_slave.h
index 4e4dbf1433e028f515b011e8a01623ff506b7918..dcc830b1a1b9cc62055184293af81b51313d601c 100644 (file)
#include "paftyp.h"
#include "aspDecOpCircBuf_common.h"
-#define ASP_DECOP_CB_WRITE_OVERFLOW ( ASP_DECOP_CB_ERR_START-1 ) // error: write overflow
+#include "dbgBenchmark.h" // PCM high-sampling rate + SRC + CAR benchmarking
+
+#define ASP_DECOP_CB_INIT_INV_SOURCE_SEL ( ASP_DECOP_CB_ERR_START-1 ) // error: invalid source selection on init
+#define ASP_DECOP_CB_AF_WRITE_OVERFLOW ( ASP_DECOP_CB_ERR_START-2 ) // error: write audio frame overflow
+#define ASP_DECOP_CB_PCM_WRITE_OVERFLOW ( ASP_DECOP_CB_ERR_START-3 ) // error: write PCM overflow
+
+#define DEF_DEC_OP_FRAME_LEN ( PAF_SYS_FRAMELENGTH ) // default decoder output frame length
+
+// Initialize circular buffer for Decoder writes
+Int cbInitDecWrite(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ Int8 sourceSelect, // source select (PCM, DDP, etc.)
+ Int16 decOpFrameLen, // decoder output frame length (PCM samples)
+ Int8 resetRwFlags, // whether to reset reader, writer, and drain flags
+ PAF_AudioFrame *pDecInitAf // pointer to Dec output audio frame used for CB initialization
+);
// Start writes to circular buffer
Int cbWriteStart(
PAF_AudioFrame *pAfWrt // audio frame from which to write
);
+#if 0
// Get next audio frame to write in circular buffer
Int cbGetNextWriteAf(
PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
Int8 cbIdx, // decoder output circular buffer index
PAF_AudioFrame **ppAfWrt // audio frame next to be written
);
+#endif
#endif /* _ASP_DECOP_CB_SLAVE_H_ */
index aa40a46d724333de4be188915285d3dcc62e850e..51d3e656f743537b5df21e7c075f50d8aa6aae56 100644 (file)
#include <xdc/std.h>
#include <ti/ipc/MessageQ.h>
+#include "aspOutInitSync_common.h"
+
#define ASP_MSG_SLAVE_DEF_NUMMSGS ( 4 )
/* module structure */
#endif /* _ASP_MSG_SLAVE_H_ */
-
diff --git a/pasdk/test_arm/framework/aspOutInitSync_slave.c b/pasdk/test_arm/framework/aspOutInitSync_slave.c
--- /dev/null
@@ -0,0 +1,160 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+/*
+ * ======== aspOutInitSync_slave.c ========
+ */
+
+
+#include <xdc/std.h>
+
+#include "aspOutInitSync_common.h"
+#include "aspOutInitSync_slave.h"
+
+// Reset dec stage flags
+Int outIsResetDecStageFlags(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Control
+ Int8 outIsiIdx // Output Init-Sync Info index
+)
+{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_OutInitSyncInfo *pOutIsi;
+ Int8 i;
+
+ // Get gate handle
+ gateHandle = pOutIsCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ //
+ // Reset decoder stage flags
+ //
+
+ // Get address of Output Init-Sync Info
+ pOutIsi = &((*pOutIsCtl->pXOutIsInfo)[outIsiIdx]);
+
+ // Reset flags
+ for (i = 0; i < ASP_OUTIS_NUM_DEC_STAGES; i++)
+ {
+ pOutIsi->decStageOutInitSyncInfo[i].decFlag = 0;
+ }
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_OUTIS_SOK;
+}
+
+// Write dec stage flag
+Int outIsWriteDecStageFlag(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Control
+ Int8 outIsiIdx, // Output Init-Sync Info index
+ Int8 decStageIdx, // dec stage index
+ Int8 decFlag // flag value to write (0/1)
+)
+{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_OutInitSyncInfo *pOutIsi;
+ PAF_AST_DecStageOutInitSyncInfo *pDecStageOutIsi;
+
+ // Get gate handle
+ gateHandle = pOutIsCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ //
+ // Write decoder stage flag
+ //
+
+ // Get address of Output Init-Sync Info
+ pOutIsi = &((*pOutIsCtl->pXOutIsInfo)[outIsiIdx]);
+ // Get address of Decoder Output Init-Sync Info
+ pDecStageOutIsi = &pOutIsi->decStageOutInitSyncInfo[decStageIdx];
+
+ // Write flag value
+ pDecStageOutIsi->decFlag = decFlag;
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_OUTIS_SOK;
+}
+
+// Write dec stage flag and AF.
+// Flag must be non-zero for write of AF.
+Int outIsWriteDecStageFlagAndAf(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Control
+ Int8 outIsiIdx, // Output Init-Sync Info index
+ Int8 decStageIdx, // dec stage index
+ Int8 decFlag, // flag value to write (0/1)
+ PAF_AudioFrame *pDecAfWrt // audio frame to write
+)
+{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_OutInitSyncInfo *pOutIsi;
+ PAF_AST_DecStageOutInitSyncInfo *pDecStageOutIsi;
+
+ // Get gate handle
+ gateHandle = pOutIsCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ //
+ // Write decoder stage audio frame
+ // Write decoder stage flag
+ //
+
+ // Get address of Output Init-Sync Info
+ pOutIsi = &((*pOutIsCtl->pXOutIsInfo)[outIsiIdx]);
+ // Get address of Decoder Output Init-Sync Info
+ pDecStageOutIsi = &pOutIsi->decStageOutInitSyncInfo[decStageIdx];
+
+ if (decFlag != 0)
+ {
+ // Write audio frame to Out IS
+ outIsCpyAf(pDecAfWrt, &pDecStageOutIsi->decAf);
+ }
+
+ // Write flag value
+ pDecStageOutIsi->decFlag = decFlag;
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_OUTIS_SOK;
+}
diff --git a/pasdk/test_arm/framework/aspOutInitSync_slave.h b/pasdk/test_arm/framework/aspOutInitSync_slave.h
--- /dev/null
@@ -0,0 +1,72 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+/*
+ * ======== aspOutInitSync_slave.h ========
+ */
+
+#ifndef _ASP_OUTIS_SLAVE_H_
+#define _ASP_OUTIS_SLAVE_H_
+
+#include <xdc/std.h>
+
+#include "aspOutInitSync_common.h"
+
+// Reset dec stage flags
+Int outIsResetDecStageFlags(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Control
+ Int8 outIsiIdx // Output Init-Sync Info index
+);
+
+// Write dec stage flag
+Int outIsWriteDecStageFlag(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Control
+ Int8 outIsiIdx, // Output Init-Sync Info index
+ Int8 decStageIdx, // dec stage index
+ Int8 decFlag // flag value to write (0/1)
+);
+
+// Write dec stage AF and flag
+// Flag must be non-zero for write of AF.
+Int outIsWriteDecStageFlagAndAf(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Control
+ Int8 outIsiIdx, // Output Init-Sync Info index
+ Int8 decStageIdx, // dec stage index
+ Int8 decFlag, // flag value to write (0/1)
+ PAF_AudioFrame *pDecAfWrt // audio frame to write
+);
+
+
+#endif /* ASP_OUTIS_SLAVE_H_ */
diff --git a/pasdk/test_arm/framework/audioStreamDecodeProc.c b/pasdk/test_arm/framework/audioStreamDecodeProc.c
index b8b6ba122600a576301a39c9ef807dbb2f0f3fd3..a3b16baa15f02a209ed4c9525b26a79cebb8fee3 100644 (file)
#include "aspMsg_common.h"
#include "aspMsg_slave.h"
#include "aspDecOpCircBuf_slave.h"
+#include "aspOutInitSync_slave.h"
#include "audioStreamProc_common.h"
#include "audioStreamDecodeProc.h"
#include "statusOp_common.h"
#define __TASK_NAME__ "TaskAsdp"
+// Check decoder sync using information in INFO audio frame
+static Int8 checkDecSync(
+ PAF_AudioFrame *pAf
+);
+
extern struct {
Int size;
IALG_Status *pStatus[512];
__attribute__ ((section(".globalSectionPafAsdtConfig"))) = {
NULL, // taskHandle
NULL, // acp
- {NULL, NULL}, // decOpCircBufCtl
+ {NULL, 0, NULL}, // decOpCircBufCtl
+ {NULL, NULL}, // outIsCtl
&gPAF_AST_config // ASIT/ASOT/ASDT shared configuration
};
int tempCap_decSampleOut[CAP_FRAME_MAX] = {0};
#endif
+
/*
* ======== taskAsdpFxn ========
* Audio Stream Decode Processing task function
const PAF_ASDT_Patchs *pQ
)
{
- PAF_ASDT_Config *pAsdtCfg; /* ASDT configuration pointer */
- PAF_AST_Config *pAstCfg; /* Common (shared) configuration pointer */
- Int as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* input/encode/stream/decode/output counter */
- Int i; /* phase */
+ PAF_ASDT_Config *pAsdtCfg; // ASDT configuration pointer
+ PAF_AST_Config *pAstCfg; // Common (shared) configuration pointer
+ Int as; // Audio Stream Number (1, 2, etc.)
+ Int z; // input/encode/stream/decode/output counter
+ Int i; // phase
Int zMD, zMS;
Bool done;
Bool decDone;
ASP_Slave_Cmd slaveCmd;
Int sourceSelect;
DEC_Handle dec;
- IALG_Cmd decCtrlCmd; // decoder control command
- Int decCtrlRet; // decoder control return
- Int errno; /* error number */
+ IALG_Cmd decCtrlCmd; // decoder control command
+ Int decCtrlRet; // decoder control return
+ Int errno; // error number
Int size;
Int argIdx;
// Decoder output circular buffer
- PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
- PAF_AudioFrame *pAfWrt;
- Int cbErrno;
+ PAF_AST_DecOpCircBufCtl *pCbCtl; // Decoder output Circular Buffer control
+ PAF_AudioFrame *pAfWrt; // pointer to audio frame written to CB
+ Int cbErrno; // CB error number
+ // Output Init-Sync
+ PAF_AudioFrame *pDecCtrlAf; // pointer to Dec Control audio frame
+ PAF_AST_OutInitSyncCtl *pOutIsCtl; // OutIS control
+ Int8 outIsDecInfo1Flag; // indicates whether Dec Info Init-Sync has executed
+ Int8 outIsDecDecode1Flag; // indicates whether Dec Decode1 Init-Sync has executed
+ Int outIsErrno; // OutIS error number
// Messaging
- PAF_InpBufConfig *pIpBufConfig;
- ASP_Msg *pAspMsg;
- MessageQ_QueueId queId;
+ PAF_InpBufConfig *pIpBufConfig; // IB buffer configuration
+ ASP_Msg *pAspMsg; // Rx/Tx MessageQ message
+ MessageQ_QueueId queId; // MessageQ ID
Int status;
Int zI;
Int bufEnd, wrapSize, currentBufSize, chunkSize;
pAsdtCfg->taskHandle = Task_self(); // set task handle
pAstCfg = pAsdtCfg->pAstCfg; // get pointer to AST common (shared) configuration
pCbCtl = &pAsdtCfg->decOpCircBufCtl; // get pointer to circular buffer control
-
+ pOutIsCtl = &pAsdtCfg->outIsCtl; // get pointer to output init-sync control
+
// wait for initialization message from master
do {
status = MessageQ_get(hAspMsgSlave->slaveQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
}
alg[zMD] = pAstCfg->xDec[zMD].decAlg[sourceSelect];
- // FL: debug, reset IB capture buffer
+ // Reset IB capture buffer (debug)
//capIbReset();
//Log_info0("capIbReset()");
- // FL: debug, reset audio frame capture buffer
+ // Reset audio frame capture buffer (debug)
//capAfReset();
decDone = FALSE;
case ASP_SLAVE_DEC_CONTROL:
gSlaveDecControlCnt++;
- // simulate dec control load
- //simLoad(DEC_CONTROL_LOAD);
argIdx = 0; // get decIdx
z = *(Int32 *)&pAspMsg->buf[argIdx];
case ASP_SLAVE_DEC_ACTIVATE:
gSlaveDecActivateCnt++;
- // simulate dec activate load
- //simLoad(DEC_ACTIVATE_LOAD);
// (***) FL: revisit
// invalidate Status structures for shared Beta Units
}
// Start writes to circular buffer
- //pCb = &pAstCfg->xDecOpCb[z];
cbErrno = cbWriteStart(pCbCtl, z);
if (cbErrno < 0)
{
gDecOpCbWrtAfOvr=0; // reset decoder output circular buffer overflow count
gMaxDecOpCbWrtAfOvr=0; // reset max decoder output circular buffer overflow count
gSlaveCbResetCnt=0; // reset slave circular buffer reset count
- // FL: debug, log circular buffer control variables
+ // Log circular buffer control variables (debug)
cbLog(pCbCtl, z, 1, "cbWriteStart");
// Reset audio frame
resetAf(pP, z, sourceSelect);
+ // Initialize OutIS Dec flags
+ outIsDecInfo1Flag = 0; // OutIS Dec Info1 hasn't executed
+ outIsDecDecode1Flag = 0; // OutIS Dec Decode1 hasn't executed
+
// send dec activate complete message to master
queId = MessageQ_getReplyQueue(pAspMsg);
pAspMsg->procId = hAspMsgSlave->slaveProcId;
case ASP_SLAVE_DEC_RESET:
gSlaveDecResetCnt++;
- // simulate dec reset load
- //simLoad(DEC_RESET_LOAD);
argIdx = 0; // get decIdx
z = *(Int32 *)&pAspMsg->buf[argIdx];
errno = 0;
if (dec->fxns->reset)
{
+ //
+ // Execute decode reset
+ //
errno = dec->fxns->reset(dec, NULL, &pAstCfg->xDec[z].decodeControl, &pAstCfg->xDec[z].decodeStatus);
+
+ // Get pointer to Dec Reset output audio frame
+ pDecCtrlAf = pAstCfg->xDec[z].decodeControl.pAudioFrame;
+
+ // Perform Dec Reset Init-Sync
+ // - Write Dec Reset output audio frame
+ // - Set Dec Reset decoder stage flag
+ outIsErrno = outIsWriteDecStageFlagAndAf(pOutIsCtl, z,
+ ASP_OUTIS_DEC_STAGE_RESET_IDX, 1, pDecCtrlAf);
+ if (outIsErrno < 0)
+ {
+ SW_BREAKPOINT; // debug
+ }
}
// write back Dec configuration
size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
Cache_wait();*/
-
+
// send dec reset complete message to master
queId = MessageQ_getReplyQueue(pAspMsg);
pAspMsg->procId = hAspMsgSlave->slaveProcId;
case ASP_SLAVE_DEC_INFO:
gSlaveDecInfoCnt++;
- // simulate dec info load
- //simLoad(DEC_INFO_LOAD);
argIdx = 0; // get decIdx
z = *(Int32 *)&pAspMsg->buf[argIdx];
errno = 0;
if (dec->fxns->info)
{
+ //
+ // Execute decode info
+ //
pfpBegin(PFP_ID_ASDT_1, pAsdtCfg->taskHandle);
- errno = dec->fxns->info(dec, NULL, &pAstCfg->xDec[z].decodeControl, &pAstCfg->xDec[z].decodeStatus);
+ errno = dec->fxns->info(dec, NULL,
+ &pAstCfg->xDec[z].decodeControl,
+ &pAstCfg->xDec[z].decodeStatus);
pfpEnd(PFP_ID_ASDT_1, PFP_FINISH_MEAS);
+
+ //
+ // Execute Dec Info1 Init-Sync if required
+ //
+ if (outIsDecInfo1Flag == 0)
+ {
+ // Get pointer to Dec Info1 output audio frame
+ pDecCtrlAf = pAstCfg->xDec[z].decodeControl.pAudioFrame;
+
+ if (checkDecSync(pDecCtrlAf) == 1)
+ {
+ // Perform Dec Info1 Init-Sync
+ // - Write Dec Info1 output audio frame
+ // - Set Dec Info1 decoder stage flag
+ outIsErrno = outIsWriteDecStageFlagAndAf(pOutIsCtl, z,
+ ASP_OUTIS_DEC_STAGE_INFO1_IDX, 1, pDecCtrlAf);
+ if (outIsErrno < 0)
+ {
+ SW_BREAKPOINT; // debug
+ }
+
+ outIsDecInfo1Flag = 1; // OutIS Dec Info1 has executed
+ }
+ }
}
// write back Dec configuration
case ASP_SLAVE_DEC_DECODE:
gSlaveDecDecodeCnt++;
- // simulate dec info load
- //simLoad(DEC_DECODE_LOAD);
argIdx = 0; // get decIdx
z = *(Int32 *)&pAspMsg->buf[argIdx];
// Reset AF samsiz
resetAfSamsiz(z);
- // invalidate Dec configuration
+ // Invalidate Dec configuration
Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
Cache_wait();
//TRACE_TERSE0("Dec:cache wb done");
cbErrno = 0;
if (dec->fxns->decode)
{
- // FL: debug, capture input buffer
+ // Capture input buffer (debug)
//capIb(pAstCfg->xInp[z].pInpBuf);
-
+
+ //
+ // Execute decode
+ //
pfpBegin(PFP_ID_ASDT_2, pAsdtCfg->taskHandle);
errno = dec->fxns->decode(dec, NULL, &pAstCfg->xDec[z].decodeInStruct, &pAstCfg->xDec[z].decodeOutStruct);
pfpEnd(PFP_ID_ASDT_2, PFP_FINISH_MEAS);
//SW_BREAKPOINT;
}
TRACE_TERSE0("Dec:decode done");
+
+ // Get pointer to Dec Decode output audio frame
+ pAfWrt = pAstCfg->xDec[z].decodeOutStruct.pAudioFrame;
+ TRACE_TERSE2("Dec:pAfWrt=0x%04x, nSamples=%d", (IArg)pAfWrt, pAfWrt->data.nSamples);
- // copy decoder output to decoder output circular buffers
- //pCb = &pAstCfg->xDecOpCb[z];
- //TRACE_TERSE1("Dec:pCb=0x%04x", (IArg)pCb);
-
- pAfWrt = pAstCfg->xDec[z].decodeOutStruct.pAudioFrame;
- TRACE_TERSE1("Dec:pAfWrt=0x%04x", (IArg)pAfWrt);
- //TRACE_TERSE1("nSamples=%d",pAfWrt->data.nSamples);
-
- // FL: debug, capture audio frame
- //if (capAfWrite(pAfWrt, PAF_CNTR) != CAP_AF_SOK)
+ // Capture audio frame (debug)
+ //if (capAfWrite(pAfWrt, PAF_LEFT) != CAP_AF_SOK)
//{
// Log_info0("capAfWrite() error");
- //}
+ //}
#ifdef CAPTURE_DECODER_OUTSAMPLES_PP
-
if (tempCap_frameCnt < CAP_FRAME_MAX)
{
tempCap_decSampleOut[tempCap_frameCnt] = pAfWrt->sampleCount;
}
#endif
- //GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_107);
+ //
+ // Execute Dec Decode1 Init-Sync if required
+ //
+ if (outIsDecDecode1Flag == 0)
+ {
+ //
+ // FL: cbInitSourceSel() moved from DSP:ASIT:INIT:decodeInit()
+ // frameLength: changed to decodeControl.frameLength.
+ // Written by ASIT:decodeInit:getFrameLengthSourceSel().
+
+ // Initialize decoder output circular buffer
+ errno = cbInitDecWrite(pCbCtl, z, sourceSelect,
+ pAstCfg->xDec[z].decodeControl.frameLength,
+ 0, pAfWrt);
+ if (errno)
+ {
+ SW_BREAKPOINT; // debug
+ }
+ // debug
+ cbLog(pCbCtl, z, 1, "cbInitSourceSel");
+
+ // Perform Dec Decode1 Init-Sync
+ // - Set Dec Decode1 decoder stage flag
+ outIsErrno = outIsWriteDecStageFlag(pOutIsCtl, z,
+ ASP_OUTIS_DEC_STAGE_DECODE1_IDX, 1);
+ if (outIsErrno < 0)
+ {
+ SW_BREAKPOINT; // debug
+ }
+
+ outIsDecDecode1Flag = 1; // OutIS Dec Decode1 has executed
+ }
+
+ //
+ // Write decoder output audio frame to circular buffer
+ //
+
+ // debug
+ //pCb = &pAstCfg->xDecOpCb[z];
+ //TRACE_TERSE1("Dec:pCb=0x%04x", (IArg)pCb);
+
+ GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_99); // debug
cbErrno = cbWriteAf(pCbCtl, z, pAfWrt);
- if ((cbErrno < 0) && (cbErrno != ASP_DECOP_CB_WRITE_OVERFLOW))
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_99);
+ if ((cbErrno < 0) &&
+ (cbErrno != ASP_DECOP_CB_AF_WRITE_OVERFLOW) &&
+ (cbErrno != ASP_DECOP_CB_PCM_WRITE_OVERFLOW))
{
gCbWrtAfErrCnt++;
- //SW_BREAKPOINT; // FL: debug
+ //SW_BREAKPOINT; // debug
}
- // Handle overflows
- if (cbErrno == ASP_DECOP_CB_WRITE_OVERFLOW)
+ // Handle circular buffer overflows
+ if ((cbErrno == ASP_DECOP_CB_AF_WRITE_OVERFLOW) ||
+ (cbErrno == ASP_DECOP_CB_PCM_WRITE_OVERFLOW))
{
gDecOpCbWrtAfOvr++; // increment circular buffer overflow count
if (gDecOpCbWrtAfOvr >= DEC_OP_CB_WRTAF_OVR_THR)
}
#endif
- // FL: debug, log circular buffer control variables
+ // Log circular buffer control variables (debug)
cbLog(pCbCtl, z, 1, "cbWriteAf");
}
case ASP_SLAVE_DEC_DEACTIVATE:
gSlaveDecDeactivateCnt++;
- // simulate dec info load
- //simLoad(DEC_DEACTIVATE_LOAD);
argIdx = 0; // get decIdx
z = *(Int32 *)&pAspMsg->buf[argIdx];
}
// Stop writes to circular buffer
- //pCb = &pAstCfg->xDecOpCb[z];
cbErrno = cbWriteStop(pCbCtl, z);
if (cbErrno < 0)
{
- SW_BREAKPOINT;
+ SW_BREAKPOINT; // debug
}
- // FL: debug, log circular buffer control variables
+ // Log circular buffer control variables (debug)
cbLog(pCbCtl, z, 1, "cbWriteStop");
+ // Reset Output Init-Sync decoder stage flags
+ outIsErrno = outIsResetDecStageFlags(pOutIsCtl, z);
+ if (outIsErrno < 0)
+ {
+ SW_BREAKPOINT; // debug
+ }
+
// send dec deactivate complete message to master
queId = MessageQ_getReplyQueue(pAspMsg);
pAspMsg->procId = hAspMsgSlave->slaveProcId;
}
// Reinitialize audio frame elements
- pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_NONE;
- pAudioFrame->channelConfigurationStream.legacy = PAF_CC_NONE;
+ pAudioFrame->sampleDecode = PAF_SOURCE_UNKNOWN;
pAudioFrame->sampleRate = PAF_SAMPLERATE_UNKNOWN;
pAudioFrame->sampleCount = 0;
- pAudioFrame->data.nChannels = PAF_MAXNUMCHAN;
+ pAudioFrame->channelConfigurationRequest.full = PAF_CC_UNKNOWN;
+ pAudioFrame->channelConfigurationStream.full = PAF_CC_UNKNOWN;
+ pAudioFrame->data.nChannels = PAF_MAXNUMCHAN;
switch (sourceSelect)
{
case PAF_SOURCE_PCM:
pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
pAudioFrame->numPrivateMetadata = 0;
pAudioFrame->bsMetadata_offset = 0;
- pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
+ pAudioFrame->bsMetadata_type = PAF_bsMetadata_none;
for (i=0; i<pP->pMetadataBufStatus->NumBuf; i++)
{
pAudioFrame->pafPrivateMetadata[i].offset = 0;
return 0;
}
+
+// (***) FL: Check correct behavior for other decs, esp DTSHD & DXP
+// Check decoder sync using information in INFO audio frame
+static Int8 checkDecSync(
+ PAF_AudioFrame *pAf
+)
+{
+ if ((pAf->sampleDecode == PAF_SOURCE_THD) &&
+ (pAf->sampleRate == PAF_SAMPLERATE_UNKNOWN))
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
diff --git a/pasdk/test_arm/framework/audioStreamDecodeProc.h b/pasdk/test_arm/framework/audioStreamDecodeProc.h
index 51916d98b02c605b49c0f46329881f533f4050b9..272dc890f2a9f36172619ee83e5bab45a8c2916b 100644 (file)
*/
/*
- * ======== audioStreamDecdeProc.h ========
+ * ======== audioStreamDecodeProc.h ========
*/
#ifndef _ASDP_H_
Task_Handle taskHandle; // ASDT handle
ACP_Handle acp; // ASDT local ACP handle
PAF_AST_DecOpCircBufCtl decOpCircBufCtl; // decoder output circular buffer control
+ PAF_AST_OutInitSyncCtl outIsCtl; // output init-sync control
PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
} PAF_ASDT_Config;
diff --git a/pasdk/test_arm/framework/itopo/params.h b/pasdk/test_arm/framework/itopo/params.h
--- /dev/null
@@ -0,0 +1,46 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+#ifndef _PARAMS_H_
+#define _PARAMS_H_
+
+#include "audioStreamDecodeProc.h"
+
+#define asdp_params asdp_params_PAi
+
+// ASDT parameters
+extern const PAF_ASDT_Params asdp_params_PAi;
+
+#endif // _PARAMS_H_
index 54dfced28c90cdcc6bf8ced1b9d22115810e3f54..d5aa781b96803fca7259f042b3c59bd6fe8f3178 100644 (file)
#include <ti/ipc/SharedRegion.h>
#include <ti/ipc/Ipc.h>
+#include "params.h"
#include "pafhjt.h"
#include "paf_heapMgr.h"
+#include "aspMsg_common.h"
+#include "aspMsg_slave.h"
#include "aspDecOpCircBuf_slave.h"
#include "audioStreamProc_common.h"
#include "audioStreamDecodeProc.h"
extern PAF_ASDT_Fxns PAF_ASDT_params_fxns;
#endif
-#include "aspMsg_common.h"
-#include "aspMsg_slave.h"
-
#define TASK_ASDP_PRI ( 3 )
#define __TASK_NAME__ "TaskSysInit"
/* Initialize decoder output circular buffer control */
Log_info0("taskSysInitFxn:cbCtlInit()");
- status = cbCtlInit(&gPAF_ASDT_config.decOpCircBufCtl, &gPAF_AST_config.xDecOpCb);
+ status = cbCtlInit(&gPAF_ASDT_config.decOpCircBufCtl, asdp_params.zone.decodeN, &gPAF_AST_config.xDecOpCb);
if (status < 0)
{
Log_info1("%s: unable to initialize Decoder Output Circular Buffer Control. Exiting.", (IArg)__TASK_NAME__);
return;
}
+ /* Initialize Output Processing Init-Sync control */
+ Log_info0("taskSysInitFxn:outIsCtlInit()");
+ status = outIsCtlInit(&gPAF_ASDT_config.outIsCtl, &gPAF_AST_config.xOutIsi);
+ if (status < 0)
+ {
+ Log_info1("%s: unable to initialize Output Init-Sync Control. Exiting.", (IArg)__TASK_NAME__);
+ return;
+ }
regionId = SharedRegion_getIdByName("COMMON2_DDR3");
srHeapNonCacheDdr3 = (IHeap_Handle)SharedRegion_getHeap(regionId);
index 29cebf1b76f0d74fa5567dd3a9b514ee45066189..2e1ac03a4d66c3f47d92b5c35135a40d7c94f43c 100644 (file)
--- a/pasdk/test_dsp/.cproject
+++ b/pasdk/test_dsp/.cproject
<stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/pdk_k2g_1_0_6/packages"/>
<stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
</macros>
<externalSettings/>
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
<listOptionValue builtIn="false" value="RTSC_MBS_VERSION=2.2.0"/>
<listOptionValue builtIn="false" value="XDC_VERSION=3.32.0.06_core"/>
- <listOptionValue builtIn="false" value="RTSC_PRODUCTS=ti.mas.dsplib.c66x:3.4.0.0;com.ti.sdo.edma3:2.12.1;com.ti.rtsc.IPC:3.43.0.00_eng;com.ti.rtsc.SYSBIOS:6.45.1.29;com.ti.uia:2.0.3.43;com.ti.rtsc.XDAIS:7.24.0.04;com.ti.pdk.k2g:1.0.1.2_eng;"/>
+ <listOptionValue builtIn="false" value="RTSC_PRODUCTS=ti.mas.dsplib.c66x:3.4.0.0;com.ti.sdo.edma3:2.12.4;com.ti.rtsc.IPC:3.43.0.00_eng;com.ti.rtsc.SYSBIOS:6.45.1.29;com.ti.uia:2.0.3.43;com.ti.rtsc.XDAIS:7.24.0.04;com.ti.pdk.k2g:1.0.6;"/>
<listOptionValue builtIn="false" value="EXPANDED_REPOS="/>
<listOptionValue builtIn="false" value="OUTPUT_TYPE=rtscApplication:executable"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP.844860326" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.INCLUDE_PATH.1905793105" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.INCLUDE_PATH" valueType="includePath">
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
- <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/drv/mcasp""/>
- <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/platform""/>
<listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/csl""/>
- <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/platform/evmk2g/platform_lib/include""/>
+ <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/addon/audk2g/include""/>
+ <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/board""/>
<listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sap""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/mib""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sio""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/framework""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/framework/itopo""/>
+ <listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/framework/alpha""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/application/itopo/evmk2g/alpha""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/common""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/shared""/>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.SEARCH_PATH.1348341304" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.SEARCH_PATH" valueType="libPaths">
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/lib""/>
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
- <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/platform/evmk2g/platform_lib/lib/debug""/>
+ <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/addon/audk2g/lib/k2g/c66/release""/>
+ <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/board/lib/evmK2G/c66/release""/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.LIBRARY.1649450405" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.LIBRARY" valueType="libs">
<listOptionValue builtIn="false" value=""libc.a""/>
- <listOptionValue builtIn="false" value="ti.platform.evmk2g.ae66"/>
+ <listOptionValue builtIn="false" value="ti.addon.audk2g.ae66"/>
+ <listOptionValue builtIn="false" value="ti.board.ae66"/>
</option>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD_SRCS.406788628" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD2_SRCS.1238226142" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD2_SRCS"/>
<listOptionValue builtIn="false" value=""${COM_TI_UIA_INSTALL_DIR}/packages""/>
<listOptionValue builtIn="false" value=""${XDAIS_CG_ROOT}/packages""/>
<listOptionValue builtIn="false" value=""${XDAIS_CG_ROOT}/examples""/>
- <listOptionValue builtIn="false" value=""${EDMA3_LLD_INSTALL_DIR}/packages""/>
<listOptionValue builtIn="false" value=""${TI_MAS_DSPLIB_C66X_INSTALL_DIR}/packages""/>
<listOptionValue builtIn="false" value=""${TI_PDK_INSTALL_DIR}/packages""/>
+ <listOptionValue builtIn="false" value=""${EDMA3_LLD_INSTALL_DIR}/packages""/>
<listOptionValue builtIn="false" value=""${TARGET_CONTENT_BASE}""/>
</option>
<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS.1787273230" name="Additional compiler options (--compileOptions)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.COMPILE_OPTIONS" value=""-g --optimize_with_debug"" valueType="string"/>
<stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
</macros>
<externalSettings/>
<stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/pdk_k2g_1_0_6/packages"/>
<stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
</macros>
<externalSettings/>
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
<listOptionValue builtIn="false" value="RTSC_MBS_VERSION=2.2.0"/>
<listOptionValue builtIn="false" value="XDC_VERSION=3.32.0.06_core"/>
- <listOptionValue builtIn="false" value="RTSC_PRODUCTS=ti.mas.dsplib.c66x:3.4.0.0;com.ti.sdo.edma3:2.12.1;com.ti.rtsc.IPC:3.43.0.00_eng;com.ti.rtsc.SYSBIOS:6.45.1.29;com.ti.uia:2.0.3.43;com.ti.rtsc.XDAIS:7.24.0.04;com.ti.pdk.k2g:1.0.1.0_eng;"/>
+ <listOptionValue builtIn="false" value="RTSC_PRODUCTS=ti.mas.dsplib.c66x:3.4.0.0;com.ti.sdo.edma3:2.12.4;com.ti.rtsc.IPC:3.43.0.00_eng;com.ti.rtsc.SYSBIOS:6.45.1.29;com.ti.uia:2.0.3.43;com.ti.rtsc.XDAIS:7.24.0.04;com.ti.pdk.k2g:1.0.6;"/>
<listOptionValue builtIn="false" value="EXPANDED_REPOS="/>
<listOptionValue builtIn="false" value="OUTPUT_TYPE=rtscApplication:executable"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP.1285694022" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.INCLUDE_PATH.765358980" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.INCLUDE_PATH" valueType="includePath">
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
- <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/drv/mcasp""/>
- <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/platform""/>
<listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/csl""/>
- <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/platform/evmk2g/platform_lib/include""/>
+ <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/addon/audk2g/include""/>
+ <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/board""/>
<listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sap""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/mib""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/sio""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/framework""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/framework/itopo""/>
+ <listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/framework/alpha""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/test_dsp/application/itopo/evmk2g/alpha""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/common""/>
<listOptionValue builtIn="false" value=""${PROC_AUDIO_SDK_ROOT}/pasdk/shared""/>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.SEARCH_PATH.1820820550" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.SEARCH_PATH" valueType="libPaths">
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/lib""/>
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
- <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/platform/evmk2g/platform_lib/lib/debug""/>
+ <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/addon/audk2g/lib/k2g/c66/release""/>
+ <listOptionValue builtIn="false" value=""${PDK_INSTALL_PATH}/ti/board/lib/evmK2G/c66/release""/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.LIBRARY.1116961870" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.linkerID.LIBRARY" valueType="libs">
<listOptionValue builtIn="false" value=""libc.a""/>
- <listOptionValue builtIn="false" value="ti.platform.evmk2g.ae66"/>
+ <listOptionValue builtIn="false" value="ti.addon.audk2g.ae66"/>
+ <listOptionValue builtIn="false" value="ti.board.ae66"/>
</option>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD_SRCS.1903451418" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD_SRCS"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD2_SRCS.1879986734" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exeLinker.inputType__CMD2_SRCS"/>
<stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages"/>
<stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
- <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+ <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
<stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
</macros>
<externalSettings/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM2_SRCS.1237856306" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM2_SRCS"/>
</tool>
</fileInfo>
- <fileInfo id="com.ti.ccstudio.buildDefinitions.C6000.Debug.2083839127.249844620.543350190" name="mib.c" rcbsApplicability="disable" resourcePath="mib/mib.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.C6000_8.1.exe.compilerDebug.106674691.984972002">
- <tool id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exe.compilerDebug.106674691.984972002" name="C6000 Compiler" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exe.compilerDebug.106674691">
- <option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.OPT_LEVEL.53836185" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.OPT_LEVEL.3" valueType="enumerated"/>
- <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__C_SRCS.622075618" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__C_SRCS"/>
- <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__CPP_SRCS.1922876896" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__CPP_SRCS"/>
- <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM_SRCS.376443321" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM_SRCS"/>
- <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM2_SRCS.1607701921" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM2_SRCS"/>
- </tool>
- </fileInfo>
<folderInfo id="com.ti.ccstudio.buildDefinitions.C6000.Debug.2083839127.249844620.common" name="/" resourcePath="common">
<toolChain id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exe.DebugToolchain.2093052442" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exe.DebugToolchain" unusedChildren="">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1997130179.38556327.52846953" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1997130179"/>
<inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM2_SRCS.1467997897" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM2_SRCS"/>
</tool>
</fileInfo>
+ <fileInfo id="com.ti.ccstudio.buildDefinitions.C6000.Debug.2083839127.249844620.543350190" name="mib.c" rcbsApplicability="disable" resourcePath="mib/mib.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.C6000_8.1.exe.compilerDebug.106674691.984972002">
+ <tool id="com.ti.ccstudio.buildDefinitions.C6000_8.1.exe.compilerDebug.106674691.984972002" name="C6000 Compiler" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.exe.compilerDebug.106674691">
+ <option id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.OPT_LEVEL.53836185" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.C6000_8.1.compilerID.OPT_LEVEL.3" valueType="enumerated"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__C_SRCS.622075618" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__C_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__CPP_SRCS.1922876896" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__CPP_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM_SRCS.376443321" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM2_SRCS.1607701921" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.C6000_8.1.compiler.inputType__ASM2_SRCS"/>
+ </tool>
+ </fileInfo>
<sourceEntries>
<entry excluding="common/components/clk.c|sio/dap|sio/dbgDob.c|framework/fwkSim.c|application/app_pkgs.cmd|boards|src|application/src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
index f48ff3c2538a8aa6745f3f4c08123b2a4f472aac..0d602c77a6e0edbdc106c2dbc44db347c481a1eb 100644 (file)
--- a/pasdk/test_dsp/.project
+++ b/pasdk/test_dsp/.project
</variable>
<variable>
<name>PDK_INSTALL_PATH</name>
- <value>file:/C:/ti/processor_audio_sdk_1_00_00_03/psdk_cust/pdk_k2g_1_0_1_2_eng/packages</value>
+ <value>file:/C:/ti/pdk_k2g_1_0_6/packages</value>
</variable>
<variable>
<name>PKTLIB_INSTALL_PATH</name>
index 395eeeddbcf1d12d4134953f867a6c07c1e8ace7..c9ab5466aca45e8f38ce21186fff432eeb9c0a14 100644 (file)
/* Add L2 SRAM heap */ // formerly IRAM
var heapMem0Params = new HeapMem.Params();
heapMem0Params.instance.name = "heapMemL2Sram";
-heapMem0Params.size = 256*1024; // 96000; // from pa.cfg
+heapMem0Params.size = 550*1024; // 550 kB temporary setting for OB in L2
heapMem0Params.sectionName = ".l2SramHeap";
Program.global.heapMemL2Sram = HeapMem.create(heapMem0Params);
Program.sectMap[".l2SramHeap"] = "L2SRAM";
index 067130253383b76f61b3a95790a2787ac9a61b3f..4e2f82aea2f6da7658cfe41350b705920f42d6d6 100644 (file)
.gCapIbBuf :> DDR3
.gCapObBuf :> CORE0_DDR3
.gCapAfBuf :> CORE0_DDR3
-
+ .sap_UNDER :> L2SRAM
/*
platform_lib :> L2SRAM
platform_text :> L2SRAM
index 9c7b4f500a469f980e247e53f11d44d73f98c5c8..3c8a053a5baadb297122e23be00bd893a7ad5b0c 100644 (file)
.gCapIbBuf :> DDR3
.gCapObBuf :> CORE0_DDR3
.gCapAfBuf :> CORE0_DDR3
-
+ .sap_UNDER :> L2SRAM
/*
platform_lib :> L2SRAM
platform_text :> L2SRAM
diff --git a/pasdk/test_dsp/application/itopo/evmk2g/alpha/i13_a.h b/pasdk/test_dsp/application/itopo/evmk2g/alpha/i13_a.h
index e1fdda084f1874d675035b292f0695099264c5ed..55368b74c491397489c44fd0cbfd236680e7adea 100644 (file)
#include <oar_a.h>
#include <bmda_a.h>
//#include <dap_a.h>
+#include <pafdecopcb_a.h>
#endif /* _I13_A_H_ */
diff --git a/pasdk/test_dsp/application/itopo/evmk2g/dcs7_params.c b/pasdk/test_dsp/application/itopo/evmk2g/dcs7_params.c
index bee8226b559c2477321880ab3d1a397a9315d32b..0baad99ff20c93dff987cf636e1801e454d30f50 100644 (file)
{0, NULL, NULL, NULL} /* SPI transfer info */
};
+#if 0 // FL: temporary remove this since "I2C_SLAVE" is a PDK 1.0.1.2_eng customization not present in PDK 1.0.6
const DCS7_Params_Dev_I2c DCS7_PARAMS_DEV_I2C =
{
sizeof(DCS7_Params_Dev_I2c), /* size of the structure */
0,0,0, /* reserved */
0 /* Error mask */
};
+#endif
const DCS7_Params_Dev_Uart DCS7_PARAMS_DEV_UART =
{
index ccf98aae2dbdd08d3b45709d846f6f02aea888ae..41e959c7cb2e5132f5d1a10d21696b01c1bc3232 100644 (file)
#include <ti/ipc/Ipc.h>
#include <ti/sysbios/hal/Cache.h>
-#include <platform.h>
-#include <platform_audio.h>
+#include <board.h>
+#include "evmc66x_i2c.h"
+#include <audk2g.h>
+#include <audk2g_audio.h>
#include "audio_dc_cfg.h"
#include "edma_cfg.h"
#include "pfp_app.h" /* contains all PFP ID's */
extern Void initDev2(Void);
-
+extern void evmI2CInit(uint8_t i2cportnumber); // missing in evmc66x_i2c.h
/*
* ======== main ========
Int main()
{
Int status;
- Platform_STATUS pfStatus;
+ Audk2g_STATUS AudStatus;
Int k;
+ Board_initCfg cfg;
Log_info0("Enter main()");
pfpDisable(0); /* Disable profile point #0 */
#endif
- //Platform setup!!!
- /*
- * use ROV->SysMin to view the characters in the circular buffer
- */
- //System_printf("enter Platform Setup\n");
- Log_info0("enter Platform Setup");
-
- platform_init_flags init_flags;
- platform_init_config init_config;
-
- /* Set request to configure PLL, DDR and Time Stamp Counter */
- init_flags.pll = 0; //1; // FL: turn this off for now since handled by gel file
- init_flags.ddr = 0;
- init_flags.tcsl = 1; // FL: not used by platform_init()
- init_flags.phy = 0;
- init_flags.ecc = 0;
-
- /* PLL configuration shall be done based on default values */
- init_config.pllm = 0;
- init_config.plld = 0;
- init_config.postdiv = 0;
- init_config.mastercore = 1; // FL: not used by platform_init()
-
- pfStatus = platform_init(&init_flags, &init_config);
- if (pfStatus != Platform_EOK)
- {
- //System_printf("Error in Platform Initialization\n");
- Log_info0("Error in Platform Initialization");
- }
- platform_delay(10000);
- //System_printf("\n****************************************************\n");
- //System_printf( " Audio DC Digital to Analog Loopback Test \n");
- //System_printf( "****************************************************\n");
+ /* initialize board */
+ cfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK;
+ Board_init(cfg);
+ evmI2CInit(I2C_PORT_0);
+ evmI2CInit(I2C_PORT_1);
+ evmI2CInit(I2C_PORT_2);
Log_info0("exit Platform Setup");
Log_info0("Configure EDMA");
/* Configure eDMA module */
- pfStatus = eDmaConfig();
- if(pfStatus != Platform_EOK)
+ AudStatus = eDmaConfig();
+ if(AudStatus != Audk2g_EOK)
{
//System_printf("eDMA Configuration Failed!\n");
Log_info0("eDMA Configuration Failed!");
diff --git a/pasdk/test_dsp/framework/alpha/pafdecopcb_a.h b/pasdk/test_dsp/framework/alpha/pafdecopcb_a.h
--- /dev/null
@@ -0,0 +1,47 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+#ifndef _PAF_DECOPCB_A_H_
+#define _PAF_DECOPCB_A_H_
+
+#include <acpbeta.h>
+
+#define readDECOPCBStreamFrameLength 0xc300+STD_BETA_DECOPCB,0x0004
+#define writeDECOPCBStreamFrameLength256 0xcb00+STD_BETA_DECOPCB,0x0004,0x0100
+#define writeDECOPCBStreamFrameLength512 0xcb00+STD_BETA_DECOPCB,0x0004,0x0200
+#define writeDECOPCBStreamFrameLength1024 0xcb00+STD_BETA_DECOPCB,0x0004,0x0400
+#define writeDECOPCBStreamFrameLengthN(N) 0xcb00+STD_BETA_DECOPCB,0x0004,(N&0xFFFF)
+
+#endif // _PAF_DECOPCB_A_H_
diff --git a/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c b/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c
index f79f85128dbdd25db0b9ec8491776a4374c830a0..f2331ae9240009e7683777ffe1bd3f93bfeeae0c 100644 (file)
#include "pafdec.h"
#include "aspDecOpCircBuf_master.h"
-#include "dbgBenchmark.h" // PCM high-sampling rate + SRC + CAR benchmarking
-
#include "evmc66x_gpio_dbg.h" // Debug
#ifdef CB_RW_OP_CAP_PP // debug
Uint8 *gCB_numAfCb = NULL;
#endif
-#define DEF_SOURCE_SEL ( PAF_SOURCE_PCM ) // default source select
-#define DEF_DEC_OP_FRAME_LEN ( PAF_SYS_FRAMELENGTH ) // ( 256 ) // default decoder output frame length
-#define DEF_STR_FRAME_LEN ( PAF_SYS_FRAMELENGTH ) // default stream frame length
-
#if 0
// Generate mute AF on circular buffer read
static Void cbReadAfMute(
);
#endif
+#if 0
// Init last audio frame configuration info
static Void cbInitLastAfInfo(
PAF_AudioFrame *pAfRd // last audio frame stored in CB instance
);
+#endif
+
+// Update last audio frame configuration info
+static Void cbUpdateLastAfInfo(
+ PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer control
+ PAF_AudioFrame *pAfUpd // audio frame used for update
+);
// Generate mute AF on circular buffer read using the last AF configuration info
-static Void cbReadMuteWithLastAfInfo (
+static Void cbReadMuteWithLastAfInfo(
PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer control
PAF_AudioFrame *pAfRd // audio frame into which to read
);
+#if 0 // FL: moved to common
// Initialize circular buffer control
Int cbCtlInit(
PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 numCb, // number of circular buffers
PAF_AST_DecOpCircBuf **pXDecOpCb // address of decoder output circular buffer base pointer
)
{
return ASP_DECOP_CB_CTL_INIT_INV_GATE;
}
- pCbCtl->pXDecOpCb = pXDecOpCb;
-
- return ASP_DECOP_CB_SOK;
+ pCbCtl->numCb = numCb; // init number of circular buffers
+ pCbCtl->pXDecOpCb = pXDecOpCb; // init base address of circular buffers
+ return ASP_DECOP_CB_SOK;
}
+#endif
// Initialize circular buffer
Int cbInit(
PAF_AST_DecOpCircBuf *pCb
)
{
+#if 0 // FL: unused
PAF_AudioFrame *pAfCb;
PAF_AudioData *pPcmBuf;
UInt8 *pMetaBuf;
pCb->strFrameLen = DEF_STR_FRAME_LEN;
// initialize circular buffer maximum number of audio frames
- pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_THD;//ASP_DECOP_CB_MAX_NUM_AF_PCM;
+ pCb->maxNumAfCb = ASP_DECOP_CB_MAX_NUM_AF_THD; //ASP_DECOP_CB_MAX_NUM_AF_PCM;
pCb->afWrtIdx = ASP_DECOP_CB_INIT_LAG_PCM;
pCb->afRdIdx = 0;
pCb->pcmRdIdx = 0;
// reset read/write flags
pCb->writerActiveFlag = 0;
pCb->readerActiveFlag = 0;
- pCb->emptyFlag = 0;
+ pCb->drainFlag = 0;
- // reset error counts
+ // reset stats
+ pCb->readAfWriterInactiveCnt = 0;
+ pCb->readAfNdCnt = 0;
+ pCb->wrtAfReaderInactiveCnt = 0;
+ pCb->wrtAfZeroSampsCnt = 0;
pCb->errUndCnt = 0;
pCb->errOvrCnt = 0;
}
}
Cache_wait();
+#endif
+
+ // set source select
+ pCb->sourceSel = PAF_SOURCE_UNKNOWN;
+
+ #ifdef CB_RW_OP_CAP_PP // debug
+ // Get address in global variables
+ gCB_samples_op = pCb->cb_samples_op;
+ gCB_op_owner = pCb->cb_op_owner;
+ gCB_opCnt = &pCb->cb_opCnt;
+ gCB_afRdIdx = pCb->cb_afRdIdx;
+ gCB_afWrtIdx = pCb->cb_afWrtIdx;
+ gCB_numAfCb = pCb->cb_numAfCb;
+ #endif
+
+ // Write back circular buffer configuration
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
return ASP_DECOP_CB_SOK;
}
+#if 0 // FL: moved to ARM
// debug
//Int8 gCbInitSourceSelCnt=0;
//Int8 gCbInitSourceSelThdCnt=0;
Int8 sourceSelect, // source select (PCM, DDP, etc.)
Int16 decOpFrameLen, // decoder output frame length (PCM samples)
Int16 strFrameLen, // stream frame length (PCM samples)
- Int8 resetRwFlags // whether to reset reader, writer, and empty flags
+ Int8 resetRwFlags // whether to reset reader, writer, and drain flags
)
{
IArg key;
{
pCb->writerActiveFlag = 0;
pCb->readerActiveFlag = 0;
- pCb->emptyFlag = 0;
+ pCb->drainFlag = 0;
}
- // reset error counts
+ // reset stats
+ pCb->readAfWriterInactiveCnt = 0;
+ pCb->readAfNdCnt = 0;
+ pCb->wrtAfReaderInactiveCnt = 0;
+ pCb->wrtAfZeroSampsCnt = 0;
pCb->errUndCnt = 0;
pCb->errOvrCnt = 0;
return ASP_DECOP_CB_SOK;
}
+#endif
+
+// Initialize circular buffer for Stream reads
+Int cbInitStreamRead(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx // decoder output circular buffer index
+)
+{
+ 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
+ pCb->strFrameLen = pCb->cbStatus.strFrameLen;
+
+ // Write back circular buffer configuration
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ //return ret;
+ return ASP_DECOP_CB_SOK;
+}
// Start reads from circular buffer
Int cbReadStart(
)
{
IArg key;
- GateMP_Handle gateHandle;
- PAF_AST_DecOpCircBuf *pCb;
- PAF_AudioFrame *pAfCb;
- PAF_ChannelMask_HD streamMask;
+ GateMP_Handle gateHandle; // CB gate handle to arbitrate CB r/w access
+ PAF_AST_DecOpCircBuf *pCb; // pointer to CB
+ PAF_AudioFrame *pAfCb; // pointer to current CB AF
+ PAF_ChannelMask_HD streamMask; // CB AF stream mask
+ Int16 numSampsRd; // number of samples to read from current CB AF
+ Int16 totNumSampsRd; // total number of samples read from CB
+ Int16 pcmWrtIdx; // read audio frame PCM write index
+ Int8 prvMdWrtIdx; // read audio frame metadata write index
Int8 i;
Int16 j;
- Int8 numMetadata = 0;
-
+
// Get gate handle
gateHandle = pCbCtl->gateHandle;
// Enter gate
//Log_info1("cbReadAf:afCb=0x%04x", (IArg)pCb->afCb); // debug
- if ((pCb->writerActiveFlag == 1) && (pCb->emptyFlag == 1))
+ //
+ // Check (writerActiveFlag,drainFlag)=(1,1)
+ //
+ if ((pCb->writerActiveFlag == 1) && (pCb->drainFlag == 1))
{
+ //
// This shouldn't occur:
- // writer is active AND draining circular buffer
- //Log_info2("cbReadAf: ERROR: writerActiveFlag=%d, emptyFlag=%d", pCb->writerActiveFlag, pCb->emptyFlag); // FL: debug
- SW_BREAKPOINT; // FL: debug
+ // writer is active AND draining circular buffer
+ //
+
+ //Log_info2("cbReadAf: ERROR: writerActiveFlag=%d, drainFlag=%d", pCb->writerActiveFlag, pCb->drainFlag); // debug
+ SW_BREAKPOINT; // debug
// Leave the gate
GateMP_leave(gateHandle, key);
return ASP_DECOP_CB_READ_INVSTATE;
}
- //if (((pCb->writerActiveFlag == 0) && (pCb->emptyFlag == 0)) || (pCb->afLagIdx < pCb->afInitialLag))
- if ((pCb->writerActiveFlag == 0) && (pCb->emptyFlag == 0))
+ //
+ // Check (writerActiveFlag,drainFlag)=(0,0)
+ //
+ //if (((pCb->writerActiveFlag == 0) && (pCb->drainFlag == 0)) || (pCb->afLagIdx < pCb->afInitialLag))
+ if ((pCb->writerActiveFlag == 0) && (pCb->drainFlag == 0))
{
//
- // No active writer, not draining circular buffer.
+ // Writer inactive, not draining circular buffer.
// Skip UNDerflow check, mute output.
//
+
+ pCb->readAfWriterInactiveCnt++;
+
+ // Mute output if write inactive and not draining CB
//cbReadAfMute(pAfRd, pCb->strFrameLen);
cbReadMuteWithLastAfInfo(pCb, pAfRd);
+ // Write back circular buffer configuration.
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
+
// Leave the gate
GateMP_leave(gateHandle, key);
return ASP_DECOP_CB_SOK;
}
+
+ if ((pCb->writerActiveFlag == 0) && (pCb->drainFlag == 1))
+ {
+ //
+ // Writer inactive, but remaining frames in circular buffer.
+ // Update drain flag.
+ //
+
+ if (pCb->numAfCb <= 0)
+ {
+ pCb->drainFlag = 0;
+
+ // Mute output if CB drained
+ cbReadMuteWithLastAfInfo(pCb, pAfRd);
+
+ // Write back circular buffer configuration.
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_DECOP_CB_SOK;
+ }
+ }
+ //
+ // Hold off read of PCM samples from CB until Nominal Delay satisfied
+ //
//if ((pCb->primedFlag == 0) || ((pCb->primedFlag==1) && (pCb->deltaSamps > 0))
if ((pCb->primedFlag == 0) || (pCb->deltaSamps > 0))
{
+ pCb->readAfNdCnt++;
+
if (pCb->primedFlag == 1)
{
pCb->deltaSamps = pCb->deltaSamps - pCb->strFrameLen;
return ASP_DECOP_CB_SOK;
}
-
- // (writerActiveFlag,emptyFlag)=(1,0) and (0,1) are left
- // Here we are checking (1,0) state here
+ //
+ // (writerActiveFlag,drainFlag)= (0,0) and (1,1) states checked above
+ // (writerActiveFlag,drainFlag)=(1,0) and (0,1) states are left
+ // Checking (writerActiveFlag,drainFlag)=(1,0) state here
+ //
if (pCb->writerActiveFlag == 1)
{
// check underflow
if (pCb->numAfCb <= 0)
{
//
- // Increment underflow count.
- // Mute output on underflow.
+ // Increment underflow count
//
- pCb->errUndCnt++;
+ pCb->errAfUndCnt++;
+
+ // Mute output on underflow
//cbReadAfMute(pAfRd, pCb->strFrameLen);
cbReadMuteWithLastAfInfo(pCb, pAfRd);
- //SW_BREAKPOINT; // FL: debug
+ //SW_BREAKPOINT; // debug
+#if 0 // (***) FL: shows timing of CB underflow
+ // debug
{
static Uint8 toggleState = 0;
if (toggleState == 0)
GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_107);
toggleState = ~(toggleState);
}
+#endif
#ifdef CB_RW_OP_CAP_PP // debug
if (pCb->cb_opCnt < CB_OP_COUNT_MAX)
// Leave the gate
GateMP_leave(gateHandle, key);
- return ASP_DECOP_CB_READ_UNDERFLOW;
+ return ASP_DECOP_CB_AF_READ_UNDERFLOW;
}
}
- if ((pCb->writerActiveFlag == 1) || (pCb->emptyFlag == 1))
+ //
+ // Checking (writerActiveFlag,drainFlag)=(1,0) state above and here
+ // Checking (writerActiveFlag,drainFlag)=(0,1) state here
+ //
+ if ((pCb->writerActiveFlag == 1) || (pCb->drainFlag == 1))
{
//
// Writer active or draining remaining frames in circular buffer.
- // Get next output audio frame.
+ // Read next audio frame.
+ //
+
+ //
+ // Read Audio Frame from CB Audio Frames.
+ // Read PCM & associated metadata from CB AFs until Read AF is filled.
+ //
+ // If multiple CB AFs are read in creating Read AF, CB AF parameters
+ // can *change* between read CB AFs. Since only one Read AF is produced
+ // per CB read, this is a "data collision", i.e. can't have more than
+ // one set of CB AF parameters in Read AF.
+ //
+ // Currently applying parameters from earliest read CB AF to Read Af.
+ // This can result in delay (or skip) w.r.t. application of additional
+ // CB AF parameters not used for creating Read AF. This is reasonable
+ // given there's no way to "interpolate" AF parameters, e.g. how to
+ // interpolation change in in bit-stream metadata type, or CC stream?
//
- // get pointer to current audio frame in circular buffer
+ // Get pointer to current CB Audio Frame
pAfCb = &pCb->afCb[pCb->afRdIdx];
- // Invalidate audio frame
+ // Cache invalidate CB AF
Cache_inv(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
- Cache_inv(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
- for (i=0; i<pAfCb->numPrivateMetadata; i++) // only invalidate numPrivateMetadata
- {
- Cache_inv(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size, Cache_Type_ALLD, 0); // only update metadata package size
- }
- Cache_wait();
-
- // compute stream mask
- streamMask = pAfRd->fxns->channelMask(pAfRd, pAfCb->channelConfigurationStream);
-
- // Invalidate channel pointers
- Cache_inv(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
Cache_wait();
-
- // Invalidate PCM data
- for (i = 0; i < pCb->maxAFChanNum; i++)
- {
- if ((streamMask >> i) & 0x1)
- {
- Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], pCb->strFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
- }
- }
- Cache_wait();
- // read audio frame information updated by decoder
+ // Read CB AF information updated by decoder
pAfRd->sampleDecode = pAfCb->sampleDecode;
PAF_PROCESS_COPY(pAfRd->sampleProcess, pAfCb->sampleProcess);
pAfRd->sampleRate = pAfCb->sampleRate;
- pAfRd->sampleCount = pCb->strFrameLen;
pAfRd->channelConfigurationRequest = pAfCb->channelConfigurationRequest;
pAfRd->channelConfigurationStream = pAfCb->channelConfigurationStream;
-
- // read metadata information updated by decoder
- pAfRd->bsMetadata_type = pAfCb->bsMetadata_type; /* non zero if metadata is attached. */
+ // Read CB AF bit-stream metadata information updated by decoder
+ pAfRd->bsMetadata_type = pAfCb->bsMetadata_type; /* non zero if private metadata is attached. */
pAfRd->pafBsMetadataUpdate = pAfCb->pafBsMetadataUpdate; /* indicates whether bit-stream metadata update */
- pAfRd->numPrivateMetadata = pAfCb->numPrivateMetadata; /* number of valid private metadata (0 or 1 if metadata filtering enabled) */
pAfRd->bsMetadata_offset = pAfCb->bsMetadata_offset; /* offset into audio frame for change in bsMetadata_type field */
- #ifdef CB_RW_OP_CAP_PP // debug
- if (pCb->cb_opCnt < CB_OP_COUNT_MAX)
- {
- if ((pCb->cb_samples_op != NULL) && (pCb->cb_op_owner != NULL))
- {
- // log sample count
- pCb->cb_samples_op[pCb->cb_opCnt] = pAfRd->sampleCount;
- pCb->cb_op_owner[pCb->cb_opCnt] = CB_OP_R;
- // log idxs
- pCb->cb_afRdIdx[pCb->cb_opCnt] = pCb->afRdIdx;
- pCb->cb_afWrtIdx[pCb->cb_opCnt] = pCb->afWrtIdx;
- pCb->cb_numAfCb[pCb->cb_opCnt] = pCb->numAfCb; // numAfCb might not be pointing to this instance
- pCb->cb_opCnt++;
- }
- }
- #endif
-
- // update Last Cb info as per actual stream
- pCb->lastAf.sampleCount = pCb->strFrameLen;
- pCb->lastAf.sampleRate = pAfCb->sampleRate;
+ // Compute stream mask for current CB AF.
+ // Mask indicates which channels are present in AF.
+ // Mask needed for cache invalidate and read of PCM samples in AF.
+ streamMask = pAfRd->fxns->channelMask(pAfRd, pAfCb->channelConfigurationStream);
- // read PCM samples
+ // Cache invalidate CB AF samsiz (volume scaling exponent) array
+ Cache_inv(pAfCb->data.samsiz, pCb->maxAFChanNum*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+ Cache_wait();
+
+ // Read CB AF samsiz array
for (i = 0; i < pCb->maxAFChanNum; i++)
{
if ((streamMask >> i) & 0x1)
{
- for (j = 0; j < pCb->strFrameLen; j++)
- {
- pAfRd->data.sample[i][j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
- }
-
pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
}
}
+
+ // FL: brute force clear of Read AF PCM data
+ // Reset Read AF PCM data
+ //for (i = 0; i < pCb->maxAFChanNum; i++)
+ //{
+ // if ((streamMask >> i) & 0x1)
+ // {
+ // memset(pAfRd->data.sample[i], 0, pCb->strFrameLen);
+ // }
+ //}
+ // FL: This brute force approach shouldn't be necessary if
+ // decoders properly set, and downstream components
+ // properly use, number of private metadata in frame
+ // Reset Read AF metadata
for (i = 0; i < PAF_MAX_NUM_PRIVATE_MD; i++)
{
pAfRd->pafPrivateMetadata[i].offset = 0;
pAfRd->pafPrivateMetadata[i].size = 0;
}
- // read metadata
- for (i = 0; i < pAfCb->numPrivateMetadata; i++) // only read numPrivateMetadata
+ totNumSampsRd = 0; // init total number of samples read from CB
+ pcmWrtIdx = 0; // init Read AF PCM write index
+ prvMdWrtIdx = 0; // init Read AF metadata write index
+ while ((totNumSampsRd < pCb->strFrameLen) && (pCb->numAfCb > 0))
{
- if ((pAfCb->pafPrivateMetadata[i].offset >= pCb->pcmRdIdx)
- &&(pAfCb->pafPrivateMetadata[i].offset < (pCb->pcmRdIdx + pCb->strFrameLen))
- &&(pAfCb->pafPrivateMetadata[i].size))
+ // Compute how many PCM samples can be read from CB AF
+ // Number of samples left in current CB AF: pAfCb->sampleCount - pCb->pcmRdIdx
+ // Number of samples left to write to Read AF: pCb->strFrameLen - totNumSampsRd
+ numSampsRd = (pAfCb->sampleCount - pCb->pcmRdIdx) < (pCb->strFrameLen - totNumSampsRd) ?
+ (pAfCb->sampleCount - pCb->pcmRdIdx) : (pCb->strFrameLen - totNumSampsRd);
+
+ // Cache invalidate CB AF PCM sample channel pointers
+ Cache_inv(pAfCb->data.sample, pCb->maxAFChanNum*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
+ Cache_wait();
+
+ // Cache invalidate CB AF PCM samples
+ for (i = 0; i < pCb->maxAFChanNum; i++)
{
- // the offset is adjusted for segment [pCb->pcmRdIdx, (pCb->pcmRdIdx + pCb->pafFrameLen)]
- pAfRd->pafPrivateMetadata[numMetadata].offset = pAfCb->pafPrivateMetadata[i].offset - pCb->pcmRdIdx;
- pAfRd->pafPrivateMetadata[numMetadata].size = pAfCb->pafPrivateMetadata[i].size;
- memcpy(pAfRd->pafPrivateMetadata[numMetadata].pMdBuf, pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size);
- numMetadata++; //number of metadata associated with current 256 segment of audio samples
+ if ((streamMask >> i) & 0x1)
+ {
+ Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], numSampsRd*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+ }
}
- else //reset un-used buf
+ Cache_wait();
+
+ // Read PCM samples from CB AF
+ for (i = 0; i < pCb->maxAFChanNum; i++)
{
- pAfRd->pafPrivateMetadata[i].offset = 0;
- pAfRd->pafPrivateMetadata[i].size = 0;
+ 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++)
+ {
+ Cache_inv(pAfCb->pafPrivateMetadata[i].pMdBuf, pAfCb->pafPrivateMetadata[i].size, Cache_Type_ALLD, 0); // only update metadata package size
+ }
+ Cache_wait();
+
+ // Read CB AF metadata
+ while (((pCb->prvMdRdIdx < pAfCb->numPrivateMetadata) &&
+ (pAfCb->pafPrivateMetadata[pCb->prvMdRdIdx].offset >= pCb->pcmRdIdx) &&
+ (pAfCb->pafPrivateMetadata[pCb->prvMdRdIdx].offset < (pCb->pcmRdIdx + numSampsRd)) &&
+ (pAfCb->pafPrivateMetadata[pCb->prvMdRdIdx].size)) &&
+ (prvMdWrtIdx < PAF_MAX_NUM_PRIVATE_MD))
+ {
+ // Write Read AF metadata offset.
+ // Compute relative offset of PCM samples being read from CB AF.
+ // Compute absolute offset of PCM samples written to Read AF by
+ // adding relative offset to Read AF PCM write index.
+ pAfRd->pafPrivateMetadata[prvMdWrtIdx].offset =
+ (pAfCb->pafPrivateMetadata[pCb->prvMdRdIdx].offset - pCb->pcmRdIdx) + // offset relative to samples being read from CB AF
+ pcmWrtIdx; // absolute offset into samples being written to read AF
+ // Write Read AF metadata size
+ pAfRd->pafPrivateMetadata[prvMdWrtIdx].size = pAfCb->pafPrivateMetadata[pCb->prvMdRdIdx].size;
+ // Write Read AF metadata payload
+ memcpy(pAfRd->pafPrivateMetadata[prvMdWrtIdx].pMdBuf, pAfCb->pafPrivateMetadata[pCb->prvMdRdIdx].pMdBuf, pAfCb->pafPrivateMetadata[pCb->prvMdRdIdx].size);
+
+ pCb->prvMdRdIdx++; // update CB metadata read index
+ prvMdWrtIdx++; // update CB metadata write index
+ }
+
+ // Update CB control
+ pCb->pcmRdIdx += numSampsRd; // update PCM read index
+ if (pCb->pcmRdIdx >= pAfCb->sampleCount)
+ {
+ // Finished reading PCM samples from current CB AF.
+ // Move to next AF in CB.
+
+ // Update audio frame read index.
+ // Wrap index if required.
+ pCb->afRdIdx++;
+ if (pCb->afRdIdx >= pCb->maxNumAfCb)
+ {
+ pCb->afRdIdx = 0;
+ }
+
+ // Reset PCM read index
+ pCb->pcmRdIdx = 0;
+ // Reset metadata read index
+ pCb->prvMdRdIdx = 0;
+
+ // Update number of audio frames in circular buffer
+ pCb->numAfCb--;
+ }
+
+ // Update PCM write index
+ pcmWrtIdx += numSampsRd;
+
+ // Update total number of samples read
+ totNumSampsRd += numSampsRd;
+
+ if (totNumSampsRd < pCb->strFrameLen)
+ {
+ //
+ // Need to read another AF from CB to obtain all PCM/metadata for Read AF
+ //
+
+ // Get pointer to current CB Audio Frame
+ pAfCb = &pCb->afCb[pCb->afRdIdx];
+
+ // Cache invalidate CB AF
+ Cache_inv(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
+ Cache_wait();
+ }
}
- pAfRd->numPrivateMetadata = numMetadata; //number of metadata associated with current 256 segment of audio samples
+
+ pAfRd->sampleCount = totNumSampsRd; // write Read AF sample count
+ pAfRd->numPrivateMetadata = prvMdWrtIdx; // write Read AF number of metadata
- pCb->pcmRdIdx += pCb->strFrameLen; // update PCM read index
- if (pCb->pcmRdIdx >= pAfCb->sampleCount)
+ pCb->numPcmSampsPerCh -= totNumSampsRd; // update PCM samples per channel
+
+ if (totNumSampsRd < pCb->strFrameLen)
{
- // update audio frame read index
- pCb->afRdIdx++;
- if (pCb->afRdIdx >= pCb->maxNumAfCb)
+ // Clear remaining Read AF PCM samples
+ for (i = 0; i < pCb->maxAFChanNum; i++)
{
- pCb->afRdIdx = 0;
+ if ((streamMask >> i) & 0x1)
+ {
+ memset(&pAfRd->data.sample[i][pcmWrtIdx], 0, (pCb->strFrameLen-totNumSampsRd));
+ }
}
- // update PCM read index
- pCb->pcmRdIdx = 0;
+ if (pCb->writerActiveFlag == 1)
+ {
+ //
+ // UNDerflow,
+ // read stopped due to insufficient PCM samples in CB to fill Read AF
+ //
- // update number of audio frames in circular buffer
- pCb->numAfCb--;
+ //
+ // Increment underflow count
+ //
+ pCb->errPcmUndCnt++;
+
+ // Mute output on underflow
+ cbReadMuteWithLastAfInfo(pCb, pAfRd);
+
+#if 0 // (***) FL: shows timing of CB underflow
+ // debug
+ {
+ static Uint8 toggleState = 0;
+ if (toggleState == 0)
+ GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_107);
+ else
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_107);
+ toggleState = ~(toggleState);
+ }
+#endif
+
+ #ifdef CB_RW_OP_CAP_PP // debug
+ if (pCb->cb_opCnt < CB_OP_COUNT_MAX)
+ {
+ if ((pCb->cb_samples_op != NULL) && (pCb->cb_op_owner != NULL))
+ {
+ // log sample count
+ pCb->cb_samples_op[pCb->cb_opCnt] = 0; // due to underflow
+ pCb->cb_op_owner[pCb->cb_opCnt] = CB_OP_R;
+ // log idxs
+ pCb->cb_afRdIdx[pCb->cb_opCnt] = pCb->afRdIdx;
+ pCb->cb_afWrtIdx[pCb->cb_opCnt] = pCb->afWrtIdx;
+ pCb->cb_numAfCb[pCb->cb_opCnt] = pCb->numAfCb; // numAfCb might not be pointing to this instance
+ pCb->cb_opCnt++;
+ }
+ }
+ #endif
+
+ // Write back circular buffer configuration.
+ Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_DECOP_CB_PCM_READ_UNDERFLOW;
+ }
}
- memcpy (&pCb->lastAf, pAfRd, sizeof(PAF_AudioFrame));
+
+ // Read AF complete, update Last CB AF Info
+ cbUpdateLastAfInfo(pCb, pAfRd);
+#if 0 // (***) FL: shows timing of successful CB read
{
static Uint8 toggleState = 0;
if (toggleState == 0)
GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
toggleState = ~(toggleState);
}
+#endif
+
+#ifdef CB_RW_OP_CAP_PP // debug
+ if (pCb->cb_opCnt < CB_OP_COUNT_MAX)
+ {
+ if ((pCb->cb_samples_op != NULL) && (pCb->cb_op_owner != NULL))
+ {
+ // log sample count
+ pCb->cb_samples_op[pCb->cb_opCnt] = pAfRd->sampleCount;
+ pCb->cb_op_owner[pCb->cb_opCnt] = CB_OP_R;
+ // log idxs
+ pCb->cb_afRdIdx[pCb->cb_opCnt] = pCb->afRdIdx;
+ pCb->cb_afWrtIdx[pCb->cb_opCnt] = pCb->afWrtIdx;
+ pCb->cb_numAfCb[pCb->cb_opCnt] = pCb->numAfCb; // numAfCb might not be pointing to this instance
+ pCb->cb_opCnt++;
+ }
+ }
+#endif
}
- if (pCb->emptyFlag == 1)
+#if 0
+ if (pCb->drainFlag == 1)
{
//
// Writer inactive, but remaining frames in circular buffer.
- // Update empty flag.
+ // Update drain flag.
//
if (pCb->numAfCb <= 0)
{
- pCb->emptyFlag = 0;
+ pCb->drainFlag = 0;
}
}
+#endif
// Write back circular buffer configuration.
// NOTE: Probably only a subset of this information needs to be updated.
}
#endif
+#if 0 // FL: unused
// Init last audio frame configuration info
static Void cbInitLastAfInfo(
PAF_AudioFrame *pAfRd // last audio frame stored in CB instance
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 */
}
+#endif
+
+// Update last audio frame configuration info
+static Void cbUpdateLastAfInfo(
+ PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer control
+ PAF_AudioFrame *pAfUpd // audio frame used for update
+)
+{
+ // FL: full copy shouldn't be necessary
+ // Note currently (data.nChannels, data.nSamples)=(32,256) is fixed in ASOT stream AF.
+ // There parameters aren't copied from CB on CB read.
+ //memcpy (&pCb->lastAf, pAfUpd, sizeof(PAF_AudioFrame));
+
+ // These are parameters used in cbReadMuteWithLastAfInfo()
+ pCb->lastAf.sampleDecode = pAfUpd->sampleDecode;
+ pCb->lastAf.sampleRate = pAfUpd->sampleRate;
+ pCb->lastAf.channelConfigurationRequest.full = pAfUpd->channelConfigurationRequest.full;
+ pCb->lastAf.channelConfigurationStream.full = pAfUpd->channelConfigurationStream.full;
+}
// Generate mute AF on circular buffer read using the last AF configuration info
-static Void cbReadMuteWithLastAfInfo (
+static Void cbReadMuteWithLastAfInfo(
PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer control
PAF_AudioFrame *pAfRd // audio frame into which to read
)
pAfRd->sampleRate = pCb->lastAf.sampleRate;
pAfRd->sampleCount = pCb->strFrameLen;
pAfRd->channelConfigurationRequest.full = pCb->lastAf.channelConfigurationRequest.full;
- pAfRd->channelConfigurationRequest.part.sat = pCb->lastAf.channelConfigurationRequest.part.sat;
- pAfRd->channelConfigurationRequest.part.sub = pCb->lastAf.channelConfigurationRequest.part.sub;
+ //pAfRd->channelConfigurationRequest.part.sat = pCb->lastAf.channelConfigurationRequest.part.sat; // FL: not necessary since full in union already copied
+ //pAfRd->channelConfigurationRequest.part.sub = pCb->lastAf.channelConfigurationRequest.part.sub;
pAfRd->channelConfigurationStream.full = pCb->lastAf.channelConfigurationStream.full;
- pAfRd->channelConfigurationStream.part.sat = pCb->lastAf.channelConfigurationStream.part.sat;
- pAfRd->channelConfigurationStream.part.sub = pCb->lastAf.channelConfigurationStream.part.sub;
+ //pAfRd->channelConfigurationStream.part.sat = pCb->lastAf.channelConfigurationStream.part.sat;
+ //pAfRd->channelConfigurationStream.part.sub = pCb->lastAf.channelConfigurationStream.part.sub;
// compute stream mask
streamMask = pAfRd->fxns->channelMask(pAfRd, pAfRd->channelConfigurationStream);
pAfRd->bsMetadata_offset = 0; /* offset into audio frame for change in bsMetadata_type field */
}
+// Check circular buffer drain state
+Int cbCheckDrainState(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index, or indicator combined drain state desired
+ Int8 *pDrainedFlag // output drain state indicator (combined or for selected circular buffer)
+)
+{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_DecOpCircBuf *pCb;
+ Int8 drainedFlag;
+ Int8 i;
+
+ // Get gate handle
+ gateHandle = pCbCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ if (cbIdx != ASP_DECOP_CHECK_DRAINSTATE_ALL)
+ {
+ //
+ // Check drain state for selected circular buffer
+ //
+
+ // 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();
+
+ drainedFlag = !pCb->writerActiveFlag && !pCb->drainFlag;
+ }
+ else
+ {
+ //
+ // Check combined drain state for all circular buffers.
+ // Combined drain state is logical AND of drain state for all circular buffers.
+ //
+
+ drainedFlag = 1; // init combined drained flag to TRUE
+ for (i = 0; i < pCbCtl->numDecOpCb; i++)
+ {
+ // Get circular buffer base pointer
+ pCb = &((*pCbCtl->pXDecOpCb)[i]);
+
+ // Invalidate circular buffer configuration
+ Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+ Cache_wait();
+
+ // Update combined drain state
+ drainedFlag = drainedFlag && (!pCb->writerActiveFlag && !pCb->drainFlag);
+ }
+ }
+
+ *pDrainedFlag = drainedFlag;
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_DECOP_CB_SOK;
+}
diff --git a/pasdk/test_dsp/framework/aspDecOpCircBuf_master.h b/pasdk/test_dsp/framework/aspDecOpCircBuf_master.h
index fb22448523d74151cd6612b3507ab836083eaaee..24c33b1853d26aff9804308a8031018f5f59c909 100644 (file)
#include "paftyp.h"
#include "aspDecOpCircBuf_common.h"
-#define ASP_DECOP_CB_INIT_INV_SOURCE_SEL ( ASP_DECOP_CB_ERR_START-1 ) // error: invalid source selection on init
-#define ASP_DECOP_CB_READ_UNDERFLOW ( ASP_DECOP_CB_ERR_START-2 ) // error: read underflow
-#define ASP_DECOP_CB_READ_INVSTATE ( ASP_DECOP_CB_ERR_START-3 ) // error: circular buffer invalid state on read
+#define ASP_DECOP_CB_AF_READ_UNDERFLOW ( ASP_DECOP_CB_ERR_START-1 ) // error: read AF underflow
+#define ASP_DECOP_CB_PCM_READ_UNDERFLOW ( ASP_DECOP_CB_ERR_START-2 ) // error: read PCM underflow
+#define ASP_DECOP_CB_READ_INVSTATE ( ASP_DECOP_CB_ERR_START-3 ) // error: circular buffer invalid state on read
+#define ASP_DECOP_CHECK_DRAINSTATE_ALL ( -1 ) // check circular buffer combined drain state
+
+#define DEF_STR_FRAME_LEN ( PAF_SYS_FRAMELENGTH ) // default stream frame length
// Initialize circular buffer
Int cbInit(
PAF_AST_DecOpCircBuf *pCb
);
+#if 0 // FL: moved to ARM
// Initialize circular buffer for selected source
Int cbInitSourceSel(
PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
Int8 sourceSelect, // source select (PCM, DDP, etc.)
Int16 decOpFrameLen, // decoder output frame length (PCM samples)
Int16 strFrameLen, // stream frame length (PCM samples)
- Int8 resetRwFlags // whether to reset reader, writer, and empty flags
+ Int8 resetRwFlags // whether to reset reader, writer, and drain flags
+);
+#endif
+
+// Initialize circular buffer for Stream reads
+Int cbInitStreamRead(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx // decoder output circular buffer index
);
// Start reads from circular buffer
PAF_AudioFrame *pAfRd // audio frame into which to read
);
+// Check circular buffer drain state
+Int cbCheckDrainState(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index, or indicator combined drain state desired
+ Int8 *pDrainedFlag // output drain state indicator (combined or for selected circular buffer)
+);
+
+
#endif /* _ASP_DECOP_CB_MASTER_H_ */
diff --git a/pasdk/test_dsp/framework/aspOutInitSync_master.c b/pasdk/test_dsp/framework/aspOutInitSync_master.c
--- /dev/null
@@ -0,0 +1,127 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+/*
+ * ======== aspOutInitSync_slave.c ========
+ */
+
+
+#include <xdc/std.h>
+
+#include "aspOutInitSync_common.h"
+#include "aspOutInitSync_master.h"
+
+
+// Read dec stage flag
+Int outIsReadDecStageFlag(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Info Control
+ Int8 outIsiIdx, // Output Init-Sync Info index
+ Int8 decStageIdx, // dec stage index
+ Int8 *pFlagVal // flag value read
+)
+{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_OutInitSyncInfo *pOutIsi;
+ PAF_AST_DecStageOutInitSyncInfo *pDecStageOutIsi;
+
+ // Get gate handle
+ gateHandle = pOutIsCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ //
+ // Read decoder stage flag
+ //
+
+ // Get address of Output Init-Sync Info
+ pOutIsi = &((*pOutIsCtl->pXOutIsInfo)[outIsiIdx]);
+ // Get address of Decoder Output Init-Sync Info
+ pDecStageOutIsi = &pOutIsi->decStageOutInitSyncInfo[decStageIdx];
+ // Read flag value
+ *pFlagVal = pDecStageOutIsi->decFlag;
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_OUTIS_SOK;
+}
+
+// Read dec stage flag and AF
+Int outIsReadDecStageFlagAndAf(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Info Control
+ Int8 outIsiIdx, // Output Init-Sync Info index
+ Int8 decStageIdx, // dec stage index
+ Int8 *pDecFlag, // audio frame valid flag
+ PAF_AudioFrame *pDecAfRd // audio frame read
+)
+{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_OutInitSyncInfo *pOutIsi;
+ PAF_AST_DecStageOutInitSyncInfo *pDecStageOutIsi;
+
+
+ // Get gate handle
+ gateHandle = pOutIsCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ //
+ // Read decoder stage audio frame
+ // Read decoder stage flag
+ //
+
+ // Get address of Output Init-Sync Info
+ pOutIsi = &((*pOutIsCtl->pXOutIsInfo)[outIsiIdx]);
+ // Get address of Decoder Output Init-Sync Info
+ pDecStageOutIsi = &pOutIsi->decStageOutInitSyncInfo[decStageIdx];
+
+ // Read flag value
+ *pDecFlag = pDecStageOutIsi->decFlag;
+
+ if (pDecStageOutIsi->decFlag != 0)
+ {
+ // audio frame valid
+
+ // Read audio frame from Out IS
+ outIsCpyAf(&pDecStageOutIsi->decAf, pDecAfRd);
+ }
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
+ return ASP_OUTIS_SOK;
+}
diff --git a/pasdk/test_dsp/framework/aspOutInitSync_master.h b/pasdk/test_dsp/framework/aspOutInitSync_master.h
--- /dev/null
@@ -0,0 +1,65 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+/*
+ * ======== aspOutInitSync_master.h ========
+ */
+
+#ifndef _ASP_OUTIS_MASTER_H_
+#define _ASP_OUTIS_MASTER_H_
+
+#include <xdc/std.h>
+
+#include "aspOutInitSync_common.h"
+
+// Read dec stage flag
+Int outIsReadDecStageFlag(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Info Control
+ Int8 outIsiIdx, // Output Init-Sync Info index
+ Int8 decStageIdx, // dec stage index
+ Int8 *pFlagVal // flag value read
+);
+
+// Read dec stage flag and AF.
+// Flag must be non-zero for read of AF.
+Int outIsReadDecStageFlagAndAf(
+ PAF_AST_OutInitSyncCtl *pOutIsCtl, // Output Init-Sync Info Control
+ Int8 outIsiIdx, // Output Init-Sync Info index
+ Int8 decStageIdx, // dec stage index
+ Int8 *pDecFlag, // audio frame valid flag
+ PAF_AudioFrame *pDecAfRd // audio frame read
+);
+
+#endif /* ASP_OUTIS_MASTER_H_ */
diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.c b/pasdk/test_dsp/framework/audioStreamInpProc.c
index a15feb73041832158099bf58b4169bbef0e49105..6d8580367872d10150cba449685e7af1bc0d776a 100644 (file)
#include "aspMsg_common.h"
#include "aspMsg_master.h"
#include "aspDecOpCircBuf_master.h"
+#include "aspOutInitSync_master.h"
#include "audioStreamProc_common.h"
#include "audioStreamProc_master.h"
#include "audioStreamInpProc.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 __TASK_NAME__ "TaskAsip"
+
+//
+// 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
+
+// Compute decoder frame length based on selected source
+static Int getFrameLengthSourceSel(
+ const PAF_ASIT_Params *pP,
+ Int8 sourceSelect
+);
+
LINNO_DEFN(TaskAsip); /* Line number macros */
ERRNO_DEFN(TaskAsip); /* Error number macros */
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--;
- if (errno) // (***) FL: re-visit this, hard-coded to use PCM framelength inside function
+ if (errno)
{
TRACE_VERBOSE1("TaskAsip: autoProcessing returns 0x%x, continue", errno);
continue;
} // End of main processing loop for (;;)
- Log_info0("Exit taskAsipFxn()");
+ //Log_info0("Exit taskAsipFxn()");
}
// -----------------------------------------------------------------------------
return 0;
} //PAF_ASIT_initPhaseDevice
+// (***) FL: move to ASOT
// -----------------------------------------------------------------------------
// ASIT Initialization Function - Decoder Output Circular Buffer
//
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 */
+ // Decode output circular buffer memory
if (!(pAstCfg->xDecOpCb = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM,
DECODEN * sizeof (*pAstCfg->xDecOpCb), 4, &eb)))
{
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)
{
return errno;
}
}
-
+
+ // 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
+// -----------------------------------------------------------------------------
+// ASIT Initialization Function - Output Init-Sync
+//
+// Name: PAF_ASIT_initPhaseOutIS
+// Purpose: Audio Stream Input Task Function for initialization of Output Init-Sync.
+//
+Int
+PAF_ASIT_initPhaseOutIS(
+ const PAF_ASIT_Params *pP,
+ const PAF_ASIT_Patchs *pQ,
+ PAF_ASIT_Config *pAsitCfg
+)
+{
+ PAF_AST_Config *pAstCfg;
+ Int as; /* Audio Stream Number (1, 2, etc.) */
+ Int z; /* decode counter */
+ PAF_AST_OutInitSyncInfo *pOutISI;
+ Error_Block eb;
+ Int i;
+
+
+ pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ as = pAstCfg->as;
+
+ /* Output Init-Sync memory */
+ if (!(pAstCfg->xOutIsi = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM,
+ DECODEN * sizeof (*pAstCfg->xOutIsi), 4, &eb)))
+ {
+ TRACE_TERSE1("PAF_ASIT_initPhaseOutIS: AS%d: Memory_calloc failed", as);
+ SW_BREAKPOINT;
+ return __LINE__;
+ }
+
+ // Reset all decoder stage flags
+ for (z=DECODE1; z < DECODEN; z++)
+ {
+ // Get address of Output Init-Sync Info
+ pOutISI = &pAstCfg->xOutIsi[z];
+ for (i = 0; i < ASP_OUTIS_NUM_DEC_STAGES; i++)
+ {
+ // Reset flag value
+ pOutISI->decStageOutInitSyncInfo[i].decFlag = 0;
+ }
+ }
+
+ return 0;
+} // PAF_ASIT_initPhaseOutIS
+
+
#if 0
// -----------------------------------------------------------------------------
// AST Processing Function - Pass-Through Processing
}
//frameLength = pP->fxns->computeFrameLength (pcmAlgMaster, FRAMELENGTH,
// pC->xDec[zMD].decodeStatus.bufferRatio);
- frameLength = FRAMELENGTH; // FL: fix PCM frameLength for alpha release.
-
+ frameLength = FRAMELENGTH; // (***) FL: fix PCM frameLength
+
if (errno = SIO_ctrl(pAstCfg->xInp[zMI].hRxSio,
PAF_SIO_CONTROL_SET_PCMFRAMELENGTH, frameLength))
{
errno = pP->fxns->decodeDecode(pP, pQ, pAsitCfg, sourceSelect, frame, block);
if (errno)
{
- gAsipDecodeErrCnt++;
- TRACE_TERSE1("PAF_ASIT_decodeProcessing: state: DECODE. decodeDecode err 0x%04x", errno);
+ gAsipDecodeErrCnt++;
+ TRACE_TERSE1("PAF_ASIT_decodeProcessing: state: DECODE. decodeDecode err 0x%04x", errno);
break;
}
)
{
PAF_AST_Config *pAstCfg;
- PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
+ //PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/encode counter */
Int errno; /* error number */
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
// reset frameCount
for (z=DECODE1; z < DECODEN; z++)
FRAMELENGTH,
pC->xDec[z].decodeStatus.bufferRatio);
#endif
-#if 0 // (***) FL: revisit. Bypass computeFrameLength().
+#if 0 // (***) FL: revisit. Bypass decoder computeFrameLength() function.
frameLength = pP->fxns->computeFrameLength(z,
FRAMELENGTH,
pC->xDec[z].decodeStatus.bufferRatio);
#else
- if (sourceSelect == PAF_SOURCE_PCM)
- {
- frameLength = PAF_SYS_FRAMELENGTH;
- }
- else if ((sourceSelect == PAF_SOURCE_DDP) || (sourceSelect == PAF_SOURCE_AC3))
- {
- frameLength = 1536;
- }
- else if (sourceSelect == PAF_SOURCE_THD)
- {
- frameLength = 1536; //QIN FIX ME
- }
- else
- {
- frameLength = 256;
- }
+ // 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; // FL: debug
+ SW_BREAKPOINT; // debug
return errno;
}
- // FL: debug
+ // debug
cbLog(pCbCtl, z, 1, "PAF_ASIT_decodeInit:cbInitSourceSel");
+#endif
if (z != zMD)
{
return ASPERR_RECLAIM;
}
- // FL: debug, capture input buffer
- capIb(pAstCfg->xInp[zMI].pInpBuf);
- gCapIb_cnt++;
+ //// FL: debug, capture input buffer
+ //capIb(pAstCfg->xInp[zMI].pInpBuf);
+ //gCapIb_cnt++;
#if 0 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
// (***) debug // B5
FRAMELENGTH,
pC->xDec[z].decodeStatus.bufferRatio);
#endif
-#if 0 // (***) FL: revisit. Bypass computeFrameLength().
+#if 0 // (***) FL: revisit. Bypass decoder computeFrameLength() function.
frameLength = pP->fxns->computeFrameLength(z,
FRAMELENGTH,
pC->xDec[z].decodeStatus.bufferRatio);
#else
- if (sourceSelect == PAF_SOURCE_PCM)
- {
- frameLength = PAF_SYS_FRAMELENGTH;
- }
- else if ((sourceSelect == PAF_SOURCE_DDP) || (sourceSelect == PAF_SOURCE_AC3))
- {
- frameLength = 1536;
- }
- else if (sourceSelect == PAF_SOURCE_THD)
- {
- frameLength = 1536; //QIN FIX ME
- }
- else
- {
- frameLength = 256;
- }
+ // Compute decoder frame length based on source selection
+ frameLength = getFrameLengthSourceSel(pP, sourceSelect);
#endif
// // modify for different decoders
// if (sourceSelect == PAF_SOURCE_THD)
// {
-// start_profiling = 1;
+// start_profiling = 1;
// }
// else
// {
}
}
#endif
+
+// Compute decoder frame length based on selected source
+static Int getFrameLengthSourceSel(
+ const PAF_ASIT_Params *pP,
+ Int8 sourceSelect
+)
+{
+ Int frameLength;
+
+ switch(sourceSelect)
+ {
+ case PAF_SOURCE_PCM:
+ frameLength = FRAMELENGTH;
+ break;
+ case PAF_SOURCE_AC3:
+ case PAF_SOURCE_DDP:
+ frameLength = ASIP_FRAMELEN_SS_DDP_AC3;
+ break;
+ case PAF_SOURCE_THD:
+ frameLength = ASIP_FRAMELEN_SS_THD;
+ break;
+ default:
+ frameLength = ASIP_FRAMELEN_SS_DEFAULT;
+ break;
+ }
+
+ return frameLength;
+}
diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.h b/pasdk/test_dsp/framework/audioStreamInpProc.h
index a34bf55f526005a294639828ae08c102a27ce428..2d765cd1af293b8f1b4960f1719b0723af1aa62d 100644 (file)
const PAF_ASP_outNumBufMap * const (*poutNumBufMap);
const PAF_MetadataBufStatus *pMetadataBufStatus;
const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
+ const PAF_AST_DecOpCircBufStatus * const *z_pDecOpCircBufStatus;
} PAF_ASIT_Params;
// Audio Stream Input Task (ASIT) patchs
PAF_ASIT_Config *pAsitCfg
);
+// Purpose: Audio Stream Input Task Function for initialization of Output Init-Sync.
+Int
+PAF_ASIT_initPhaseOutIS(
+ const PAF_ASIT_Params *pP,
+ const PAF_ASIT_Patchs *pQ,
+ PAF_ASIT_Config *pAsdtCfg
+);
+
+
#if 0
// Purpose: Audio Stream Task Function for initialization or reinitiali-
// zation of the Audio Frame(s) by loading of data values of a
diff --git a/pasdk/test_dsp/framework/audioStreamInpProc_paramsFxns.c b/pasdk/test_dsp/framework/audioStreamInpProc_paramsFxns.c
index 1a521e70228ddd63b5812d65592e32174fa32912..90c8baf54f4110fba62383d26371bf558c49ee35 100644 (file)
const PAF_ASIT_Fxns PAF_ASIT_params_fxns =
{
{ // initPhase[8]
- PAF_ASIT_initPhaseMalloc,
- PAF_ASIT_initPhaseConfig,
- PAF_ASIT_initPhaseAcpAlg,
- PAF_ASIT_initPhaseCommon,
- PAF_ASIT_initPhaseAlgKey,
- PAF_ASIT_initPhaseDevice,
- PAF_ASIT_initPhaseDecOpCircBuf,
- NULL
+ PAF_ASIT_initPhaseMalloc, // initPhaseMalloc,
+ PAF_ASIT_initPhaseConfig, // initPhaseConfig,
+ PAF_ASIT_initPhaseAcpAlg, // initPhaseAcpAlg,
+ PAF_ASIT_initPhaseCommon, // initPhaseCommon,
+ PAF_ASIT_initPhaseAlgKey, // initPhaseAlgKey,
+ PAF_ASIT_initPhaseDevice, // initPhaseDevice,
+ PAF_ASIT_initPhaseDecOpCircBuf, // initPhaseDecOpCircBuf,
+ PAF_ASIT_initPhaseOutIS, // initPhaseOutIS
},
NULL, // passProcessing
PAF_ASIT_autoProcessing, // autoProcessing
diff --git a/pasdk/test_dsp/framework/audioStreamOutProc.c b/pasdk/test_dsp/framework/audioStreamOutProc.c
index f7135cf862c7ab59c353898da43335591865af38..9fbe6638fa433d1932af4275a1a2cf1430a0c02d 100644 (file)
#include "aspMsg_common.h"
#include "aspMsg_master.h"
#include "aspDecOpCircBuf_master.h"
+#include "aspOutInitSync_master.h"
#include "audioStreamProc_common.h"
#include "audioStreamOutProc.h"
// FL: debug
#include "evmc66x_gpio_dbg.h"
+#include "dbgCapAf.h"
+// -----------------------------------------------------------------------------
+// Debugging Trace Control, local to this file.
+//
+#include "logp.h"
+
#define TRACE_TIME(a)
+// Allow a developer to selectively enable tracing.
+#define CURRENT_TRACE_MASK 0x07
+
+#define TRACE_MASK_TERSE 0x01 // only flag errors and show init
+#define TRACE_MASK_GENERAL 0x02 // half dozen lines per frame
+#define TRACE_MASK_VERBOSE 0x04 // trace full operation
+
+#if !(CURRENT_TRACE_MASK & TRACE_MASK_TERSE)
+ #undef TRACE_TERSE0
+ #undef TRACE_TERSE1
+ #undef TRACE_TERSE2
+ #undef TRACE_TERSE3
+ #undef TRACE_TERSE4
+ #define TRACE_TERSE0(a)
+ #define TRACE_TERSE1(a,b)
+ #define TRACE_TERSE2(a,b,c)
+ #define TRACE_TERSE3(a,b,c,d)
+ #define TRACE_TERSE4(a,b,c,d,e)
+#endif
+
+#if !(CURRENT_TRACE_MASK & TRACE_MASK_GENERAL)
+ #undef TRACE_GEN0
+ #undef TRACE_GEN1
+ #undef TRACE_GEN2
+ #undef TRACE_GEN3
+ #undef TRACE_GEN4
+ #define TRACE_GEN0(a)
+ #define TRACE_GEN1(a,b)
+ #define TRACE_GEN2(a,b,c)
+ #define TRACE_GEN3(a,b,c,d)
+ #define TRACE_GEN4(a,b,c,d,e)
+#endif
+
+#if !(CURRENT_TRACE_MASK & TRACE_MASK_VERBOSE)
+ #undef TRACE_VERBOSE0
+ #undef TRACE_VERBOSE1
+ #undef TRACE_VERBOSE2
+ #undef TRACE_VERBOSE3
+ #undef TRACE_VERBOSE4
+ #define TRACE_VERBOSE0(a)
+ #define TRACE_VERBOSE1(a,b)
+ #define TRACE_VERBOSE2(a,b,c)
+ #define TRACE_VERBOSE3(a,b,c,d)
+ #define TRACE_VERBOSE4(a,b,c,d,e)
+#endif
+
+// .............................................................................
+
//
// Audio Stream Definitions
//
#define __TASK_NAME__ "TaskAsop"
-/* FL: Check if at least one output selected */
+//
+// Audio Stream Output Task definitions
+//
+
+// status codes
+// Output FSM
+#define ASOP_INITSYNC_NOTREADY ( 1 ) // ok, init-sync not ready
+#define ASOP_SOK ( 0 ) // ok
+#define ASOP_FORWARD_ERR ( -1 ) // forward (ASIT) error
+#define ASOP_ENCRESET_ERR ( -2 ) // enc reset error
+#define ASOP_DECINFO1_ERR ( -3 ) // dec info1 error
+// Decode Processing
+#define ASOP_DP_OUT_SIO_UPDATE ( 3 ) // new output selected
+#define ASOP_DP_CB_DRAINED ( 2 ) // circular buffer drained
+#define ASOP_DP_SOK ( 0 ) // ok
+#define ASOP_DP_FORWARD_ERR ( -1 ) // forward (ASIT) error
+#define ASOP_DP_DECINIT_ERR ( -2 ) // decode init error
+#define ASOP_DP_DECSTREAM_ERR ( -3 ) // decode stream error
+#define ASOP_DP_DECENC_ERR ( -4 ) // decode encode error
+#define ASOP_DP_DECINFO2_ERR ( -5 ) // decode encode error
+#define ASOP_DP_DECFINALTEST_ERR ( -6 ) // decode final error
+
+
+
+/* Check if at least one output selected */
static Int checkOutSel(
const PAF_ASOT_Params *pP,
PAF_ASOT_Config *pAsotCfg,
Int *pOutSel
);
-/* FL: Check if at least one output sio changed */
+/* Check if at least one output sio changed */
static Int checkOutSio(
const PAF_ASOT_Params *pP,
PAF_ASOT_Config *pAsotCfg,
Int *pOutSioUpdate
);
+// Initialize Output Processing state function
+static Int PAF_ASOT_initOutProc(
+ const PAF_ASOT_Params *pP,
+ PAF_AST_Stream *xStr
+);
+
+// Initialize Output Processing state function
+static Int PAF_ASOT_initSyncDecReset(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg,
+ PAF_AudioFrame *pDecResetAf
+);
+
+// Purpose: ASOT Function for Output reset
+static Int PAF_ASOT_outputReset(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg
+);
+
+// Purpose: Init-Sync Dec Info1 state function.
+// Performes Dec Info1 Init-Sync.
+static Int PAF_ASOT_initSyncDecInfo1(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg,
+ PAF_AudioFrame *pDecInfo1Af
+);
+
+// Purpose: ASOT function for ASP chain reset and ENC info
+static Int PAF_ASOT_outputInfo1(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg
+);
+
+// Purpose: Init-Sync Dec Decode1 state function.
+// Performes Dec Decode1 Init-Sync.
+static Int PAF_ASOT_initSyncDecDecode1(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg
+);
+
+// Purpose: Init-Sync Re-Sync state function.
+// Peformed Init-Sync using stored Dec Reset/Info1 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
+);
+
+#if 0
+// Init-Sync update audio frame
+static Int initSyncUpdateAf(
+ PAF_AudioFrame *dstAf,
+ PAF_AudioFrame *srcAf
+);
+#endif
+
+// Reset audio frames
+static Void resetAfs(
+ const PAF_ASOT_Params *pP,
+ PAF_AST_Stream *xStr
+);
+
+// Reset audio frame pointers to original values
+static Void resetAfPointers(
+ const PAF_ASOT_Params *pP,
+ PAF_AST_Stream *xStr
+);
+
+// Reset audio frame meta data elements
+static Void resetAfMetadata(
+ const PAF_ASOT_Params *pP,
+ PAF_AST_Stream *xStr
+);
+
+
LINNO_DEFN(TaskAsop); /* Line number macros */
ERRNO_DEFN(TaskAsop); /* Error number macros */
PAF_ASOT_Config gPAF_ASOT_config = {
NULL, // taskHandle
NULL, // acp
+ 0,0,0, // CB drained flags (size DECODE_MAXN)
&gPAF_ASPM_config, // pAspmCfg
&gPAF_AST_config // pAstCfg
};
@@ -136,13 +298,19 @@ UInt32 gMaxDecOpCbRdAfUnd =0; // max (consecutive) decoder output circular buf
UInt32 gMasterCbResetCnt =0; // master circular buffer reset count
// Global debug counters */
-UInt32 gTaskAsopCnt=0; // debug
-UInt32 gAsopInitCnt =0;
-UInt32 gAsopStreamCnt =0;
-UInt32 gAsopEncodeCnt =0;
-UInt32 gAsopFinalCnt =0;
-UInt32 gAsopQuitCnt =0;
-
+UInt32 gAsopInitOutProcCnt =0;
+UInt32 gAsopInitSyncDecResetCnt =0;
+UInt32 gAsopInitSyncDecInfo1Cnt =0;
+UInt32 gAsopInitSyncDecDecode1Cnt =0;
+UInt32 gAsopInitSyncResyncCnt =0;
+UInt32 gAsopOutProcCnt =0;
+UInt32 gAsopInitCnt =0;
+UInt32 gAsopStreamCnt =0;
+UInt32 gAsopEncodeCnt =0;
+UInt32 gAsopFinalCnt =0;
+UInt32 gAsopOutSioUpdateCnt =0;
+UInt32 gAsopQuitCnt =0;
+UInt32 gAsopTxSioReclaimCnt =0;
/*
* ======== taskAsopFxn ========
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* input/encode/stream/decode/output counter */
Int i; /* phase */
- Int errno; /* error number */
Int zMS;
- Int loopCount = 0; // used to stop trace to see startup behavior.
+ Int errno; // error number
+ Int8 procSleep; // whether to sleep: 0: No, 1: Yes
+ Int8 procOutDevSel; // whether to perform output device selection: 0: No, 1:Yes
+ Int outSel; // whether output device selected
+ enum { INIT_OUT_PROC_STATE,
+ INITSYNC_DEC_RESET_STATE, INITSYNC_DEC_INFO1_STATE, INITSYNC_DEC_DECODE1_STATE,
+ INITSYNC_RESYNC_STATE,
+ OUT_PROC_STATE } state;
+ PAF_AudioFrame decResetAf;
+ PAF_AudioFrame decInfo1Af;
+ Int loopCount = 0; // used to stop trace to see startup behavior.
+
Log_info0("Enter taskAsopFxn()");
if (!pQ)
{
- TRACE_TERSE0("TaskAsip: No Patchs defined. Exiting.");
+ TRACE_TERSE0("TaskAsop: No Patchs defined. Exiting.");
LINNO_RPRT(TaskAsop, -1);
return;
}
//
for (z=STREAM1; z < STREAMN; z++)
{
- TRACE_VERBOSE1("TaskAsip: AS%d: running", as+z);
+ TRACE_VERBOSE1("TaskAsop: AS%d: running", as+z);
}
- errno = 0;
+ errno = 0; // init error indicator -- no error
+ procSleep = 1; // init sleep flag -- sleep
+ procOutDevSel = 1; // init device output selection flag -- perform output device selection
+ state = INIT_OUT_PROC_STATE; // init state
for (;;)
{
- Int outSel;
-
loopCount++;
TRACE_GEN2("TaskAsop (begin Main loop %d) (errno 0x%x)", loopCount, errno);
+ //
+ // Check forward (ASIT) error here, TBD
+ //
+
// any error forces idling of output
if (errno)
{
TRACE_TERSE1("TaskAsop: Trace stopped at loop %d.", loopCount);
ERRNO_RPRT(TaskAsop, errno);
}
-
- TRACE_VERBOSE1("TaskAsop: AS%d: ... sleeping ...", as+zMS);
- Task_sleep(1);
-
- TRACE_GEN1("TaskAsop: AS%d: Output device selection ...", as+zMS);
- errno = pP->fxns->selectDevices(pP, pQ, pAsotCfg);
- if (errno)
+
+ if (procSleep == 1)
{
- TRACE_TERSE2("TaskAsop: AS%d: selectDevices returned errno = 0x%04x", as+zMS, errno);
- continue;
+ TRACE_VERBOSE1("TaskAsop: AS%d: ... sleeping ...", as+zMS);
+ Task_sleep(1);
}
- // if no output selected skip any remaining processing
- errno = checkOutSel(pP, pAsotCfg, &outSel);
- if (errno)
- {
- TRACE_TERSE2("TaskAsop: AS%d: checkOutSel returned errno = 0x%04x", as+zMS, errno);
- continue;
- }
- else if (!outSel)
+ if (procOutDevSel == 1)
{
- TRACE_VERBOSE1("TaskAsop: AS%d: No output selected...", as+zMS);
- continue;
+ // select output devices
+ TRACE_GEN1("TaskAsop: AS%d: Output device selection ...", as+zMS);
+ errno = pP->fxns->selectDevices(pP, pQ, pAsotCfg);
+ if (errno)
+ {
+ TRACE_TERSE2("TaskAsop: AS%d: selectDevices returned errno = 0x%04x", as+zMS, errno);
+
+ procSleep = 1;
+ procOutDevSel = 1;
+
+ continue;
+ }
+
+ // if no output selected skip remaining processing
+ errno = checkOutSel(pP, pAsotCfg, &outSel);
+ if (errno < 0)
+ {
+ TRACE_TERSE2("TaskAsop: AS%d: checkOutSel returned errno = 0x%04x", as+zMS, errno);
+
+ procSleep = 1;
+ procOutDevSel = 1;
+
+ continue;
+ }
+ else if (!outSel)
+ {
+ TRACE_VERBOSE1("TaskAsop: AS%d: No output selected...", as+zMS);
+
+ procSleep = 1;
+ procOutDevSel = 1;
+
+ continue;
+ }
}
- TRACE_VERBOSE0("TaskAsop: calling outputProcessing.");
- errno = pP->fxns->decodeProcessing(pP, pQ, pAsotCfg, -1);
- if (errno)
+ switch (state)
{
- TRACE_TERSE1("TaskAsop: outputProcessing returns 0x%x, continue", errno);
+ case INIT_OUT_PROC_STATE:
+ gAsopInitOutProcCnt++;
+ Log_info0("TaskAsop: state=INIT_OUT_PROC_STATE");
+
+ //
+ // Output Processing initialization.
+ //
+ errno = PAF_ASOT_initOutProc(pP, pAstCfg->xStr);
+ if (errno < 0)
+ {
+ state = INIT_OUT_PROC_STATE;
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+ else
+ {
+ state = INITSYNC_DEC_RESET_STATE;
+ procSleep = 0;
+ procOutDevSel = 0;
+ }
+
+ break;
+
+ case INITSYNC_DEC_RESET_STATE:
+ gAsopInitSyncDecResetCnt++;
+ Log_info0("TaskAsop: state=INITSYNC_DEC_RESET_STATE");
+
+ //
+ // Dec Reset Init-Sync.
+ //
+
+ // Perform Dec Reset init-sync.
+ // Latch Dec Reset AF.
+ errno = PAF_ASOT_initSyncDecReset(pP, pQ, pAsotCfg, &decResetAf);
+ if (errno < 0)
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_RESET_STATE errno=%d", errno);
+
+ // sync error -- start over
+ state = INIT_OUT_PROC_STATE;
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+ else if (errno == ASOP_INITSYNC_NOTREADY)
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_RESET_STATE not sync'd errno=%d", errno);
+
+ // sync not ready -- try again
+ state = INITSYNC_DEC_RESET_STATE;
+ errno=0; // FL: temp hack
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+ else // errno==0
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_RESET_STATE sync'd, errno=%d", errno);
+
+ // sync'd -- move on
+ state = INITSYNC_DEC_INFO1_STATE;
+ procSleep = 0;
+ procOutDevSel = 0;
+ }
+
+ break;
+
+ case INITSYNC_DEC_INFO1_STATE:
+ gAsopInitSyncDecInfo1Cnt++;
+ Log_info0("TaskAsop: state=INITSYNC_DEC_INFO1_STATE");
+
+ //
+ // Dec Info1 Init-Sync.
+ //
+
+ // Perform Dec Info1 init-sync.
+ // Latch Dec Info1 AF.
+ errno = PAF_ASOT_initSyncDecInfo1(pP, pQ, pAsotCfg, &decInfo1Af);
+ if (errno < 0)
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_INFO1_STATE errno=%d", errno);
+
+ // sync error -- start over
+ state = INIT_OUT_PROC_STATE;
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+ else if (errno == ASOP_INITSYNC_NOTREADY)
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_INFO1_STATE not sync'd errno=%d", errno);
+
+ // sync not ready -- try again
+ state = INITSYNC_DEC_INFO1_STATE;
+ errno=0; // FL: temp hack
+ procSleep = 1;
+ procOutDevSel = 0;
+ }
+ else // errno = 0
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_INFO1_STATE sync'd errno=%d", errno);
+
+ // sync'd -- move on
+ state = INITSYNC_DEC_DECODE1_STATE;
+ procSleep = 0;
+ procOutDevSel = 0;
+ }
+
+ break;
+
+ case INITSYNC_DEC_DECODE1_STATE:
+ gAsopInitSyncDecDecode1Cnt++;
+ Log_info0("TaskAsop: state=INITSYNC_DEC_DECODE1_STATE");
+
+ //
+ // Dec Info1 Init-Sync.
+ //
+
+ // Perform Dec Info1 init-sync.
+ // Latch Dec Info1 AF.
+ errno = PAF_ASOT_initSyncDecDecode1(pP, pQ, pAsotCfg);
+ if (errno < 0)
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_DECODE1_STATE errno=%d", errno);
+
+ // sync error -- start over
+ state = INIT_OUT_PROC_STATE;
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+ else if (errno == ASOP_INITSYNC_NOTREADY)
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_DECODE1_STATE not sync'd errno=%d", errno);
+
+ // sync not ready -- try again
+ state = INITSYNC_DEC_DECODE1_STATE;
+ errno=0; // FL: temp hack
+ procSleep = 1;
+ procOutDevSel = 0;
+ }
+ else // errno = 0
+ {
+ Log_info1("TaskAsop: state=INITSYNC_DEC_DECODE1_STATE sync'd errno=%d", errno);
+
+ // sync'd -- move on
+ state = OUT_PROC_STATE;
+ procSleep = 0;
+ procOutDevSel = 0;
+ }
+
+ break;
+
+ case INITSYNC_RESYNC_STATE:
+ gAsopInitSyncResyncCnt++;
+ Log_info0("TaskAsop: state=INITSYNC_RESYNC_STATE");
+
+ //
+ // Re-Sync.
+ // Use stored AF info from init-sync.
+ // This is done in case of local error.
+ //
+
+ // Perform Dec Info1 init-sync.
+ errno = PAF_ASOT_initSyncResync(pP, pQ, pAsotCfg, &decResetAf,
+ &decInfo1Af);
+ if (errno < 0)
+ {
+ Log_info1("TaskAsop: state=INITSYNC_RESYNC_STATE errno=%d", errno);
+
+ // sync error -- start over
+ state = INIT_OUT_PROC_STATE;
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+ else
+ {
+ Log_info1("TaskAsop: state=INITSYNC_RESYNC_STATE sync'd errno=%d", errno);
+
+ // re-sync'd -- move on
+ state = OUT_PROC_STATE;
+ procSleep = 0;
+ procOutDevSel = 0;
+ }
+
+ break;
+
+ case OUT_PROC_STATE:
+ gAsopOutProcCnt++;
+ Log_info0("TaskAsop: state=OUT_PROC_STATE");
+
+ //
+ // Output Processing.
+ //
+
+ TRACE_VERBOSE0("TaskAsop: calling decodeProcessing.");
+ errno = pP->fxns->decodeProcessing(pP, pQ, pAsotCfg);
+ if (errno < 0)
+ {
+ Log_info1("TaskAsop: state=OUT_PROC_STATE errno=%d", errno);
+
+ //
+ // Output Processing exit, due to error
+ //
+
+ TRACE_TERSE1("TaskAsop: decodeProcessing returns 0x%x, continue", errno);
+ if (errno == ASOP_DP_FORWARD_ERR)
+ {
+ // forward (ASIT) error -- start over
+ state = INIT_OUT_PROC_STATE;
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+ else
+ {
+ // local (ASOT) error
+ state = INITSYNC_RESYNC_STATE;
+ procSleep = 1;
+ procOutDevSel = 0; // disallow device re-select if local error during output processing
+ }
+ }
+ else if (errno > 0)
+ {
+ Log_info1("TaskAsop: state=OUT_PROC_STATE errno=%d", errno);
+
+ //
+ // Output Processing exit, not due to error
+ //
+
+ TRACE_TERSE1("TaskAsop: decodeProcessing returns 0x%x, continue", errno);
+ if (errno == ASOP_DP_OUT_SIO_UPDATE)
+ {
+ // skip re-sync
+ // resume output processing after new output selected
+ state = OUT_PROC_STATE;
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+ }
+ else
+ {
+ Log_info1("TaskAsop: state=OUT_PROC_STATE errno=%d", errno);
+
+ //
+ // Output Processing exit, normal
+ //
+
+ TRACE_VERBOSE0("TaskAsop: outputProcessing complete with no error.");
+
+ // no error returned if CB drained
+ // (i.e. CB drained is normal behavior)
+ state = INIT_OUT_PROC_STATE;
+ procSleep = 1;
+ procOutDevSel = 1;
+ }
+
+ break;
+
+ default: // unknown state
+ TRACE_TERSE2("TaskAsop: AS%d: state: unknown, 0x%x", as+zMS, state);
+ break;
}
- else
- {
- TRACE_VERBOSE0("TaskAsop: outputProcessing complete with no error.");
- }
} // End of main processing loop for (;;)
- Log_info0("Exit taskAsopFxn()");
+ //Log_info0("Exit taskAsopFxn()");
}
// -----------------------------------------------------------------------------
}
}
+/* No need to start-clocks here, since only selecting the device. */
+#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))
}
}
}
+#endif
}
return errno;
PAF_ASOT_decodeProcessing(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
- PAF_ASOT_Config *pAsotCfg,
- Int sourceSelect
+ PAF_ASOT_Config *pAsotCfg
)
{
PAF_AST_Config *pAstCfg;
- Int z; /* decode counter */
Int errno; /* error number */
Int getVal;
- enum { INIT, STREAM, ENCODE, FINAL, QUIT } state;
+ enum { INIT, STREAM, ENCODE, FINAL, QUIT, OUT_SIO_UPDATE } state;
state = INIT;
errno = 0; /* error number */
Int frame; // (***) FL: formerly -- decoder input frame count
for (;;)
{
- // FL: Check if any change in output SIO, e.g. from Output shortcut.
+ //
+ // Check forward (ASIT) error here, TBD
+ //
+
+
+ // Check if any change in output SIO, e.g. from Output shortcut.
// Changes will break FSM and allow Output reconfiguration.
errno = checkOutSio(pP, pAsotCfg, &outSioUpdate);
- if (errno)
+ if (errno < 0)
{
TRACE_TERSE1("PAF_ASOT_decodeProcessing: checkOutSio returned errno = 0x%04x", errno);
break;
else if (outSioUpdate)
{
TRACE_VERBOSE0("PAF_ASOT_decodeProcessing: Change in Output SIO selection");
- state = QUIT;
+ state = OUT_SIO_UPDATE;
}
// Process commands (encode)
gAsopInitCnt++;
Log_info0("TaskAsop: state=INIT");
+ frame = 0;
+ block = 0;
+
+#if 0 // FL: moved to PAF_ASOT_initOutProc()
// Reset audio frame pointers to original values
// (may be needed if error occurred).
- for (z=STREAM1; z < STREAMN; z++)
- {
- Int ch;
- for (ch=PAF_LEFT; ch < PAF_MAXNUMCHAN_AF; ch++)
- {
- if (pAstCfg->xStr[z].audioFrameChannelPointers[ch])
- {
- pAstCfg->xStr[z].audioFrameChannelPointers[ch] =
- pAstCfg->xStr[z].origAudioFrameChannelPointers[ch];
- }
- }
- }
-
+ resetAfPointers(pP, pAstCfg->xStr);
// Reset audio frame meta data elements
- {
- Int i;
-
- for (z=STREAM1; z < STREAMN; z++)
- {
- pAstCfg->xStr[z].pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
- pAstCfg->xStr[z].pAudioFrame->numPrivateMetadata = 0;
- pAstCfg->xStr[z].pAudioFrame->bsMetadata_offset = 0;
- pAstCfg->xStr[z].pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
+ resetAfMetadata(pP, pAstCfg->xStr);
+#endif
- for (i=0; i<pP->pMetadataBufStatus->NumBuf; i++)
- {
- pAstCfg->xStr[z].pAudioFrame->pafPrivateMetadata[i].offset = 0;
- pAstCfg->xStr[z].pAudioFrame->pafPrivateMetadata[i].size = 0;
- }
- }
- }
-
- errno = pP->fxns->decodeInit(pP, pQ, pAsotCfg, sourceSelect);
+ errno = pP->fxns->decodeInit(pP, pQ, pAsotCfg);
if (errno)
{
TRACE_VERBOSE1("PAF_ASOT_decodeProcessing: INIT, errno 0x%x. break after decodeInit", errno);
+ errno = ASOP_DP_DECINIT_ERR;
break;
}
- // (***) FL: setup output (ASP chain reset, ENC reset, setCheckRateX, start output)
- // Contained in INFO1 in combined FSM.
+ //
+ // Setup output: setCheckRateX, start output
+ //
// Establish secondary timing
errno = pP->fxns->decodeInfo1(pP, pQ, pAsotCfg, frame, block);
if (errno)
TRACE_VERBOSE1("PAF_ASOT_decodeProcessing: INIT, errno 0x%x. break after decodeInfo1", errno);
break;
}
-
- frame = 0;
- block = 0;
-
+
TRACE_VERBOSE0("PAF_ASOT_decodeProcessing: state: INIT->STREAM");
state = STREAM;
continue;
if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeProcessing: state: STREAM. decodeStream err 0x%x", errno);
+ errno = ASOP_DP_DECSTREAM_ERR;
break;
}
if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeProcessing: state: ENCODE. decodeEncode err 0x%x", errno);
+ errno = ASOP_DP_DECENC_ERR;
break;
}
// (***) FL: do we need this?
// AF pointers come from CB read, any resets occur in Decoder AF.
+ //
// Reset audio frame pointers to original values
// (may have been adjusted by ARC or the like).
- for (z=STREAM1; z < STREAMN; z++)
- {
- Int ch;
- for (ch=PAF_LEFT; ch < PAF_MAXNUMCHAN_AF; ch++)
- {
- if (pAstCfg->xStr[z].audioFrameChannelPointers[ch])
- {
- pAstCfg->xStr[z].audioFrameChannelPointers[ch] =
- pAstCfg->xStr[z].origAudioFrameChannelPointers[ch];
- }
- }
- }
+ resetAfPointers(pP, pAstCfg->xStr);
- //
// (***) FL: update output (setCheckRateX)
// Contained in INFO2 in combined FSM.
errno = pP->fxns->decodeInfo2(pP, pQ, pAsotCfg, frame, block);
if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeProcessing: ENCODE break on decodeInfo2. errno 0x%x", errno);
+ errno = ASOP_DP_DECINFO2_ERR;
break;
}
// will probably always exit FSM if only Output running
// (2) Checking Dec Status info asych to input events (maybe ok)
//
-#if 0
// Check for final frame, and if indicated:
// - Update audio flag to cause output buffer flush rather than
// the default truncate in "complete" processing.
// - Exit state machine to "complete" processing.
+#if 0
if (pP->fxns->decodeFinalTest(pP, pQ, pAsotCfg, frame, block))
{
for (z=OUTPUT1; z < OUTPUTN; z++)
}
break;
}
-#endif
+#endif
+ errno = pP->fxns->decodeFinalTest(pP, pQ, pAsotCfg, frame, block);
+ if (errno < 0)
+ {
+ TRACE_TERSE1("PAF_ASOT_decodeProcessing: DECODE FINAL break. errno 0x%x", errno);
+ errno = ASOP_DP_DECFINALTEST_ERR;
+ break;
+ }
+ else if (errno == ASOP_DP_CB_DRAINED)
+ {
+ // EOS, exit normally
+ TRACE_TERSE1("PAF_ASOT_decodeProcessing: DECODE FINAL normal exit. errno 0x%x", errno);
+ errno = ASOP_DP_SOK;
+ break;
+ }
TRACE_VERBOSE0("PAF_ASOT_decodeProcessing: state: FINAL->STREAM");
state = STREAM;
continue;
+ case OUT_SIO_UPDATE:
+ gAsopOutSioUpdateCnt++;
+ Log_info0("TaskAsop: state=OUT_SIO_UPDATE");
+
+ TRACE_VERBOSE0("PAF_ASOT_decodeProcessing: state: OUT_SIO_UPDATE");
+ errno = ASOP_DP_OUT_SIO_UPDATE;
+ break;
+
case QUIT:
gAsopQuitCnt++;
Log_info0("TaskAsop: state=QUIT");
return 0;
} //PAF_ASOT_encodeCommand
+//debug -- allow dynamic config
+//Int16 gStrFrameLen=DEF_STR_FRAME_LEN; // stream frame length (PCM samples)
+
// Purpose: Decoding Function for reinitializing the decoding process.
Int
PAF_ASOT_decodeInit(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
- PAF_ASOT_Config *pAsotCfg,
- Int sourceSelect
+ PAF_ASOT_Config *pAsotCfg
)
{
- PAF_AST_Config *pAstCfg;
+ //PAF_AST_Config *pAstCfg;
PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
- Int as; /* Audio Stream Number (1, 2, etc.) */
+ //Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* decode/encode counter */
Int errno; /* error number */
- Int zO, zS;
-
+ //Int zO, zS;
- pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
- as = pAstCfg->as;
+ //pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ //as = pAstCfg->as;
pCbCtl = &pAsotCfg->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
for (z=DECODE1; z < DECODEN; z++)
{
+ // Initialize decoder output circular buffer for stream reads
+ //errno = cbInitStreamRead(pCbCtl, z, gStrFrameLen);
+ errno = cbInitStreamRead(pCbCtl, z);
+ if (errno)
+ {
+ TRACE_TERSE1("PAF_ASOT_decodeInit:cbInitStreamRead() error=%d", errno);
+ SW_BREAKPOINT; // debug
+ return errno;
+ }
+
// Start decoder output circular buffer reads
errno = cbReadStart(pCbCtl, z);
if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeInit:cbReadStart() error=%d", errno);
- SW_BREAKPOINT; // FL: debug
+ SW_BREAKPOINT; // debug
return errno;
}
+
gCbReadAfErr=0; // reset read circular buffer error count
gDecOpCbRdAfUnd=0; // reset decoder output circular buffer underflow count
gMaxDecOpCbRdAfUnd=0; // reset max decoder output circular buffer underflow count
cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeInit:cbReadStart");
}
+#if 0 // moved to PAF_ASOT_outputReset()
// TODO: move this to start of this function so that it doesn't affect IO timing
for (z=ENCODE1; z < ENCODEN; z++)
{
{
encAlg->fxns->algActivate (encAlg);
}
- if (enc->fxns->reset
- && (errno = enc->fxns->reset(enc, NULL,
- &pAstCfg->xEnc[z].encodeControl, &pAstCfg->xEnc[z].encodeStatus)))
+ if (enc->fxns->reset)
{
- return errno;
+ errno = enc->fxns->reset(enc, NULL,
+ &pAstCfg->xEnc[z].encodeControl, &pAstCfg->xEnc[z].encodeStatus);
+ if (errno)
+ {
+ return errno;
+ }
}
}
}
-
+#endif
return 0;
}
Int block
)
{
- PAF_AST_Config *pAstCfg;
- Int z; /* decode/encode counter */
+ //PAF_AST_Config *pAstCfg;
+ //Int z; /* decode/encode counter */
Int errno; /* error number */
+#if 0 // moved to PAF_ASOT_outputInfo1()
pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
// run the chain of ASP's on the stream.
TRACE_VERBOSE0("PAF_ASOT_decodeInfo1: calling streamChainFunction.");
- if (errno = pP->fxns->streamChainFunction(pP, pQ, pAsotCfg,
- PAF_ASP_CHAINFRAMEFXNS_RESET, 1, frame))
+ errno = pP->fxns->streamChainFunction(pP, pQ, pAsotCfg,
+ PAF_ASP_CHAINFRAMEFXNS_RESET, 1, frame);
+ if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeInfo1: streamChainFunction returns errno 0x%x ", errno);
return errno;
Int select = pAstCfg->xEnc[z].encodeStatus.select;
ALG_Handle encAlg = pAstCfg->xEnc[z].encAlg[select];
ENC_Handle enc = (ENC_Handle )encAlg;
- if (enc->fxns->info
- && (errno = enc->fxns->info(enc, NULL,
- &pAstCfg->xEnc[z].encodeControl, &pAstCfg->xEnc[z].encodeStatus)))
+
+ if (enc->fxns->info)
{
- TRACE_TERSE1("PAF_ASOT_decodeInfo1: info returns errno 0x%x ", errno);
- return errno;
+ errno = enc->fxns->info(enc, NULL,
+ &pAstCfg->xEnc[z].encodeControl,
+ &pAstCfg->xEnc[z].encodeStatus);
+ if (errno)
+ {
+ TRACE_TERSE1("PAF_ASOT_decodeInfo1: info returns errno 0x%x ", errno);
+ return errno;
+ }
}
}
}
+#endif
- if (errno = pP->fxns->setCheckRateX(pP, pQ, pAsotCfg, 0))
+ errno = pP->fxns->setCheckRateX(pP, pQ, pAsotCfg, 0);
+ if (errno)
{
// ignore if rateX has changed since we haven't, but are about to,
// start the output. If we didn't ignore this case then the state machine
}
}
- if (errno = pP->fxns->startOutput(pP, pQ, pAsotCfg))
+ errno = pP->fxns->startOutput(pP, pQ, pAsotCfg);
+ if (errno)
{
if (errno == 0x105)
{
TRACE_TERSE1("PAF_ASOT_decodeInfo1: startOutput returns errno 0x%x", errno);
}
return errno;
- }
+ }
return 0;
}
return errno;
} //PAF_ASOT_decodeInfo2
+
+PAF_AST_DecOpCircBufStats gCbStats; // FL: debug
// -----------------------------------------------------------------------------
// ASOT Decoding Function - Stream Processing
//
Int z; /* decode/stream counter */
PAF_AudioFrame *pAfRd;
Int cbErrno;
+ PAF_AST_DecOpCircBufStats cbStats; /* circular buffer statistics */
Int errno;
pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
pCbCtl = &pAsotCfg->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
-
+
for (z=DECODE1; z < DECODEN; z++)
{
Int zS = pP->streamsFromDecodes[z];
// Read decoder output circular buffer
//
pAfRd = pAstCfg->xStr[zS].pAudioFrame;
- //GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106);
+ GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106); // debug
cbErrno = cbReadAf(pCbCtl, z, pAfRd);
- if ((cbErrno < 0) && (cbErrno != ASP_DECOP_CB_READ_UNDERFLOW))
+ GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
+ if ((cbErrno < 0) &&
+ (cbErrno != ASP_DECOP_CB_AF_READ_UNDERFLOW) &&
+ (cbErrno != ASP_DECOP_CB_PCM_READ_UNDERFLOW))
{
gCbReadAfErr++;
TRACE_TERSE1("PAF_ASOT_decodeStream:cbReadAf() error=%d", cbErrno);
- //SW_BREAKPOINT; // FL: debug
+ //SW_BREAKPOINT; // debug
return cbErrno;
}
// Handle underflows
- if (cbErrno == ASP_DECOP_CB_READ_UNDERFLOW)
+ if ((cbErrno == ASP_DECOP_CB_AF_READ_UNDERFLOW) ||
+ (cbErrno == ASP_DECOP_CB_PCM_READ_UNDERFLOW))
{
- // FL: some number of underflows alway occur on start of stream when ASOT only depends on configured Output.
- // DDP: ~2 underflows
- // MAT-THD: ~16 underflows
- // Need to check behavior of cbReset().
+ // (***) FL: Need to check behavior of cbReset().
// Need to check behavior on exit/re-entry into Output processing.
-
gDecOpCbRdAfUnd++; // increment circular buffer underflow count
if (gDecOpCbRdAfUnd >= DEC_OP_CB_RDAF_UND_THR)
{
#endif
// FL: debug
+ // Get circular buffer statistics (debug)
+ //cbGetStats(pCbCtl, z, &cbStats);
+ cbGetStats(pCbCtl, z, &gCbStats);
+
+ // debug
cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeStream:cbReadAf");
- //if (capAfWrite(pAfRd, 0) != CAP_AF_SOK)
+ //if (capAfWrite(pAfRd, PAF_LEFT) != CAP_AF_SOK)
//{
// Log_info0("capAfWrite() error");
//}
pAstCfg->xOut[z].outBufConfig.lengthofFrame =
pAstCfg->xEnc[zE].encodeInStruct.pAudioFrame->sampleCount;
TRACE_GEN2("PAF_ASOT_decodeEncode: AS%d: processing block %d -- idle", as+zS, block);
+ //GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
errno = SIO_reclaim(pAstCfg->xOut[z].hTxSio,(Ptr *) &pAstCfg->xOut[z].pOutBuf, NULL);
+ //GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106); // debug
if (errno < 0)
{
SIO_idle(pAstCfg->xOut[z].hTxSio);
}
#endif
+ gAsopTxSioReclaimCnt++;
+
//
// Simulate Tx SIO_reclaim() pend
//
- //Semaphore_pend(semaphoreTxAudio, BIOS_WAIT_FOREVER);
- gTaskAsopCnt++;
+ //Semaphore_pend(semaphoreTxAudio, BIOS_WAIT_FOREVER);
curTime = Clock_getTicks();
- //System_printf("System time in TaskAsipFxn Tx audio = %lu\n", (ULong)curTime);
+ //System_printf("System time in TaskAsopFxn Tx audio = %lu\n", (ULong)curTime);
//Log_info1("outputEncode():Tx SIO reclaim(), system time = %u", curTime);
}
else
{
pAstCfg->xEnc[z].encodeOutStruct.bypassFlag =
pP->z_pEncodeStatus[z]->encBypass;
- if (errno = enc->fxns->encode(enc, NULL,
- &pAstCfg->xEnc[z].encodeInStruct, &pAstCfg->xEnc[z].encodeOutStruct))
+ errno = enc->fxns->encode(enc, NULL,
+ &pAstCfg->xEnc[z].encodeInStruct,
+ &pAstCfg->xEnc[z].encodeOutStruct);
+ if (errno)
{
if (errno != PCEERR_OUTPUT_POINTERNULL)
{
if (pAstCfg->xOut[z].hTxSio)
{
TRACE_GEN2("PAF_ASOT_decodeEncode: AS%d: processing block %d -- output", as+zS, block);
+ //GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106); // debug
errno = SIO_issue(pAstCfg->xOut[z].hTxSio,
&pAstCfg->xOut[z].outBufConfig, sizeof (pAstCfg->xOut[z].outBufConfig), 0);
+ //GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
if (errno)
{
SIO_idle(pAstCfg->xOut[z].hTxSio);
PAF_AST_Config *pAstCfg;
Int as; /* Audio Stream Number (1, 2, etc.) */
Int z; /* output counter */
- Int errno,nbufs; /* error number */
+ Int errno,nbufs, errme; /* error number */
Int zE, zS, zX;
Int zMD;
PAF_SIO_IALG_Obj *pObj;
}
}
+// Need to Revisit: Starting Clocks here seems logical & also manages the McASP without spurious underruns .
+
+#if 1
+ // 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;
+ }
+ }
+ }
+#endif
// Set sample count so that DOB knows how much data to send
pAstCfg->xOut[z].outBufConfig.lengthofFrame =
pAstCfg->xEnc[zE].encodeInStruct.pAudioFrame->sampleCount;
return errno;
} //PAF_ASOT_stopOutput
+
// -----------------------------------------------------------------------------
// ASOT Decoding Function Helper - SIO Driver Change
//
rateI = pAstCfg->xStr[zMS].pAudioFrame->fxns->sampleRateHz
(pAstCfg->xStr[zMS].pAudioFrame, inputRate, PAF_SAMPLERATEHZ_INV);
- for (z=OUTPUT1; z < OUTPUTN; z++) {
- if (pAstCfg->xOut[z].hTxSio && (pAstCfg->xOut[z].outBufStatus.clock & 0x01)) {
-
+ for (z=OUTPUT1; z < OUTPUTN; z++)
+ {
+ if (pAstCfg->xOut[z].hTxSio && (pAstCfg->xOut[z].outBufStatus.clock & 0x01))
+ {
// determine associated encoder
zE = z;
- for (zX = ENCODE1; zX < ENCODEN; zX++) {
- if (pP->outputsFromEncodes[zX] == z) {
+ for (zX = ENCODE1; zX < ENCODEN; zX++)
+ {
+ if (pP->outputsFromEncodes[zX] == z)
+ {
zE = zX;
break;
}
outputCount = pAstCfg->xEnc[zE].encodeStatus.frameLength;
rateO = pAstCfg->xStr[zMS].pAudioFrame->fxns->sampleRateHz
(pAstCfg->xStr[zMS].pAudioFrame, outputRate, PAF_SAMPLERATEHZ_STD);
- if (rateI > 0 && rateO > 0)
+ if ((rateI > 0) && (rateO > 0))
+ {
rateX = rateO /* std */ * rateI /* inv */;
+ }
else if (inputCount != 0)
+ {
rateX = (float )outputCount / inputCount;
+ }
else
- return ( ASPERR_INFO_RATERATIO );
+ {
+ return ASPERR_INFO_RATERATIO;
+ }
- getVal = SIO_ctrl (pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_RATEX, (Arg) &rateX);
- if (getVal == DOBERR_RATECHANGE) {
+ getVal = SIO_ctrl(pAstCfg->xOut[z].hTxSio, PAF_SIO_CONTROL_SET_RATEX, (Arg)&rateX);
+ if (getVal == DOBERR_RATECHANGE)
+ {
for (zx=OUTPUT1; zx < OUTPUTN; zx++)
+ {
if (pAstCfg->xOut[zx].hTxSio)
+ {
SIO_idle (pAstCfg->xOut[zx].hTxSio);
+ }
+ }
// this forces an exit from the calling state machine which will
// eventually call startOutput which calls setCheckRateX for all outputs
// exit this loop /function early.
return ASPERR_INFO_RATECHANGE;
}
- else if( getVal != SYS_OK )
+ else if (getVal != SYS_OK)
+ {
return ((getVal & 0xff) | ASPERR_RATE_CHECK);
+ }
}
}
return 0;
} //PAF_ASOT_streamChainFunction
-/* FL: Check if at least one output selected */
+/* Check if at least one output selected */
static Int checkOutSel(
const PAF_ASOT_Params *pP,
PAF_ASOT_Config *pAsotCfg,
*pOutSel = outSel;
- return 0;
+ return ASOP_SOK;
}
-/* FL: Check if at least one output sio changed */
+/* Check if at least one output sio changed */
static Int checkOutSio(
const PAF_ASOT_Params *pP,
PAF_ASOT_Config *pAsotCfg,
*pOutSioUpdate = outSioUpdate;
- return 0;
+ return ASOP_SOK;
+}
+
+// Reset audio frames
+static Void resetAfs(
+ const PAF_ASOT_Params *pP,
+ PAF_AST_Stream *xStr
+)
+{
+ // Reset audio frame pointers to original values
+ // (may be needed if error occurred).
+ resetAfPointers(pP, xStr);
+ // Reset audio frame meta data elements
+ resetAfMetadata(pP, xStr);
+}
+
+// Reset audio frame pointers to original values
+static Void resetAfPointers(
+ const PAF_ASOT_Params *pP,
+ PAF_AST_Stream *xStr
+)
+{
+ Int z;
+ Int ch;
+
+ // Reset audio frame pointers to original values
+ for (z = STREAM1; z < STREAMN; z++)
+ {
+ for (ch = PAF_LEFT; ch < PAF_MAXNUMCHAN_AF; ch++)
+ {
+ if (xStr[z].audioFrameChannelPointers[ch])
+ {
+ xStr[z].audioFrameChannelPointers[ch] =
+ xStr[z].origAudioFrameChannelPointers[ch];
+ }
+ }
+ }
+}
+
+// Reset audio frame meta data elements
+static Void resetAfMetadata(
+ const PAF_ASOT_Params *pP,
+ PAF_AST_Stream *xStr
+)
+{
+ Int z;
+ Int i;
+
+ for (z = STREAM1; z < STREAMN; z++)
+ {
+ xStr[z].pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
+ xStr[z].pAudioFrame->numPrivateMetadata = 0;
+ xStr[z].pAudioFrame->bsMetadata_offset = 0;
+ xStr[z].pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
+
+ for (i = 0; i < pP->pMetadataBufStatus->NumBuf; i++)
+ {
+ xStr[z].pAudioFrame->pafPrivateMetadata[i].offset = 0;
+ xStr[z].pAudioFrame->pafPrivateMetadata[i].size = 0;
+ }
+ }
+}
+
+// Initialize Output Processing state function
+static Int PAF_ASOT_initOutProc(
+ const PAF_ASOT_Params *pP,
+ PAF_AST_Stream *xStr
+)
+{
+ // Reset audio frames
+ resetAfs(pP, xStr);
+
+ return ASOP_SOK;
+}
+
+#if 0
+// Init-Sync update audio frame
+static Int initSyncUpdateAf(
+ PAF_AudioFrame *dstAf,
+ PAF_AudioFrame *srcAf
+)
+{
+ memcpy(dstAf, srcAf, sizeof(PAF_AudioFrame));
+
+ return ASOP_SOK;
+}
+#endif
+
+// Purpose: Init-Sync Dec Reset state function.
+// Performes Dec Reset Init-Sync.
+static Int PAF_ASOT_initSyncDecReset(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg,
+ PAF_AudioFrame *pDecResetAf
+)
+{
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Int zMD, zMS; // Dec and Stream Master indices
+ PAF_AudioFrame *pStrAf; // stream audio frame
+ PAF_AST_OutInitSyncCtl *pOutIsCtl; // Output Init-Sync control
+ Int8 decFlag; // dec stage flag
+ Int errno; // error number
+
+
+ pAstCfg = pAsotCfg->pAstCfg;
+ zMD = pAstCfg->masterDec;
+ pOutIsCtl = &pAsotCfg->pAspmCfg->outIsCtl;
+
+ // check for Dec Reset
+ // store dec reset AF
+ errno = outIsReadDecStageFlagAndAf(pOutIsCtl, zMD,
+ ASP_OUTIS_DEC_STAGE_RESET_IDX, &decFlag, pDecResetAf);
+ if (errno < 0)
+ {
+ return errno;
+ }
+
+ if (decFlag == 0)
+ {
+ return ASOP_INITSYNC_NOTREADY;
+ }
+ else
+ {
+ zMS = pAstCfg->masterStr;
+ pStrAf = pAstCfg->xStr[zMS].pAudioFrame;
+
+ // Update Stream Audio Frame.
+ // Copy Dec Reset AF to Stream AF.
+ //errno = initSyncUpdateAf(pStrAf, pDecResetAf);
+ //if (errno < 0)
+ //{
+ // return errno;
+ //}
+ outIsCpyAf(pDecResetAf, pStrAf);
+
+ // Enc activate
+ // Enc reset
+ errno = PAF_ASOT_outputReset(pP, pQ, pAsotCfg);
+ if (errno < 0)
+ {
+ return errno;
+ }
+
+ return ASOP_SOK;
+ }
+}
+
+// Purpose: ASOT Function for Output reset
+static Int PAF_ASOT_outputReset(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg
+)
+{
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Int as; // Audio Stream Number (1, 2, etc.) */
+ Int z; // encode counter
+ Int errno; // error number
+ Int zO, zS;
+
+
+ pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
+ as = pAstCfg->as;
+
+ for (z=ENCODE1; z < ENCODEN; z++)
+ {
+ zO = pP->outputsFromEncodes[z];
+ zS = pP->streamsFromEncodes[z];
+ if (pAstCfg->xOut[zO].hTxSio && pAstCfg->xEnc[z].encodeStatus.mode)
+ {
+ Int select = pAstCfg->xEnc[z].encodeStatus.select;
+ ALG_Handle encAlg = pAstCfg->xEnc[z].encAlg[select];
+ ENC_Handle enc = (ENC_Handle )encAlg;
+
+ TRACE_VERBOSE1("AS%d: PAF_ASOT_outputReset: initializing encode", as+zS);
+
+ if (encAlg->fxns->algActivate)
+ {
+ encAlg->fxns->algActivate(encAlg);
+ }
+
+ if (enc->fxns->reset)
+ {
+ errno = enc->fxns->reset(enc, NULL,
+ &pAstCfg->xEnc[z].encodeControl,
+ &pAstCfg->xEnc[z].encodeStatus);
+ if (errno)
+ {
+ return ASOP_ENCRESET_ERR;
+ }
+ }
+ }
+ }
+
+ return ASOP_SOK;
}
+
+// FL: debug, allow modification of output frame length via JTAG
+Int16 gOutFrameLen=PAF_ASOT_FRAMELENGTH; // output frame length (PCM samples)
+
+// Purpose: Init-Sync Dec Info1 state function.
+// Performes Dec Info1 Init-Sync.
+static Int PAF_ASOT_initSyncDecInfo1(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg,
+ PAF_AudioFrame *pDecInfo1Af
+)
+{
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Int zMD, zMS; // Dec and Stream Master indices
+ PAF_AudioFrame *pStrAf; // stream audio frame
+ PAF_AST_OutInitSyncCtl *pOutIsCtl; // Output Init-Sync control
+ Int8 decFlag; // dec stage flag
+ Int errno; // error number
+
+
+ pAstCfg = pAsotCfg->pAstCfg;
+ zMD = pAstCfg->masterDec;
+ pOutIsCtl = &pAsotCfg->pAspmCfg->outIsCtl;
+
+ // Check for Dec Reset,
+ // Store dec reset AF
+ errno = outIsReadDecStageFlagAndAf(pOutIsCtl, zMD,
+ ASP_OUTIS_DEC_STAGE_INFO1_IDX, &decFlag, pDecInfo1Af);
+ if (errno < 0)
+ {
+ return errno;
+ }
+
+ if (decFlag == 0)
+ {
+ return ASOP_INITSYNC_NOTREADY;
+ }
+ else
+ {
+ zMS = pAstCfg->masterStr;
+ pStrAf = pAstCfg->xStr[zMS].pAudioFrame;
+
+ // Update Stream Audio Frame.
+ // Copy Dec Reset AF to Stream AF.
+ //errno = initSyncUpdateAf(pStrAf, pDecInfo1Af);
+ //if (errno < 0)
+ //{
+ // return errno;
+ //}
+
+ // Hack to set ASOT output frame length.
+ // THD sets this to 256 (hard-coded in Dec Info)
+ // DDP sets this to 0 (audio frame passthrough, 0 from ASDT AF frame length)
+ // PCM sets this to 256 (decodeControl.frameLength)
+ //pDecInfo1Af->sampleCount = 256; // !!!! GJ: Revisit !!!!
+ pDecInfo1Af->sampleCount = gOutFrameLen;
+
+ outIsCpyAf(pDecInfo1Af, pStrAf);
+
+ // Hack to set ASOT output frame length
+ // THD sets this to 256 (hard-coded in Dec Info)
+ // DDP sets this to 0 (audio frame passthrough, 0 from ASDT AF frame length)
+ // PCM sets this to 256 (decodeControl.frameLength)
+ //pStrAf->sampleCount = 256; // !!!! GJ: Revisit !!!!
+
+ // outputInfo1():
+ // - ASP chain reset,
+ // - Enc Info
+ PAF_ASOT_outputInfo1(pP, pQ, pAsotCfg);
+ if (errno)
+ {
+ return ASOP_DECINFO1_ERR;
+ }
+
+ return ASOP_SOK;
+ }
+}
+
+// Purpose: ASOT function for ASP chain reset and ENC info
+static Int PAF_ASOT_outputInfo1(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg
+)
+{
+ PAF_AST_Config *pAstCfg;
+ Int z; /* decode/encode counter */
+ Int errno; /* error number */
+
+
+ pAstCfg = pAsotCfg->pAstCfg; // get pointer to AST common (shared) configuration
+
+ // FL: frame parameter hard-coded to 0
+ // run the chain of ASP's on the stream.
+ TRACE_VERBOSE0("PAF_ASOT_decodeInfo1: calling streamChainFunction.");
+ errno = pP->fxns->streamChainFunction(pP, pQ, pAsotCfg,
+ PAF_ASP_CHAINFRAMEFXNS_RESET, 1, 0);
+ if (errno)
+ {
+ TRACE_TERSE1("PAF_ASOT_outputInfo1: streamChainFunction returns errno 0x%x ", errno);
+ return errno;
+ }
+
+ TRACE_VERBOSE0("PAF_ASOT_outputInfo1: calling enc->info.");
+ for (z=ENCODE1; z < ENCODEN; z++)
+ {
+ Int zO = pP->outputsFromEncodes[z];
+ if (pAstCfg->xOut[zO].hTxSio && pAstCfg->xEnc[z].encodeStatus.mode)
+ {
+ Int select = pAstCfg->xEnc[z].encodeStatus.select;
+ ALG_Handle encAlg = pAstCfg->xEnc[z].encAlg[select];
+ ENC_Handle enc = (ENC_Handle )encAlg;
+
+ if (enc->fxns->info)
+ {
+ errno = enc->fxns->info(enc, NULL,
+ &pAstCfg->xEnc[z].encodeControl,
+ &pAstCfg->xEnc[z].encodeStatus);
+ if (errno)
+ {
+ TRACE_TERSE1("PAF_ASOT_outputInfo1: info returns errno 0x%x ", errno);
+ return errno;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+// Purpose: Init-Sync Dec Decode1 state function.
+// Performes Dec Decode1 Init-Sync.
+static Int PAF_ASOT_initSyncDecDecode1(
+ const PAF_ASOT_Params *pP,
+ const PAF_ASOT_Patchs *pQ,
+ PAF_ASOT_Config *pAsotCfg
+)
+{
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Int zMD; // Dec Master index
+ PAF_AST_OutInitSyncCtl *pOutIsCtl; // Output Init-Sync control
+ Int8 decFlag; // dec stage flag
+ Int errno; // error number
+
+
+ pAstCfg = pAsotCfg->pAstCfg;
+ zMD = pAstCfg->masterDec;
+ pOutIsCtl = &pAsotCfg->pAspmCfg->outIsCtl;
+
+ // Check for Dec Reset,
+ // Store dec reset AF
+ errno = outIsReadDecStageFlag(pOutIsCtl, zMD,
+ ASP_OUTIS_DEC_STAGE_DECODE1_IDX, &decFlag);
+ if (errno < 0)
+ {
+ return errno;
+ }
+
+ if (decFlag == 0)
+ {
+ return ASOP_INITSYNC_NOTREADY;
+ }
+ else
+ {
+ return ASOP_SOK;
+ }
+}
+
+// Purpose: Init-Sync Re-Sync state function.
+// Peformed Init-Sync using stored Dec Reset/Info1 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_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Int zMS; // Stream Master index
+ PAF_AudioFrame *pStrAf; // stream audio frame
+ Int errno; // error number
+
+
+ pAstCfg = pAsotCfg->pAstCfg;
+ zMS = pAstCfg->masterStr;
+ pStrAf = pAstCfg->xStr[zMS].pAudioFrame;
+
+ // Reset audio frames
+ resetAfs(pP, pAstCfg->xStr);
+
+ //
+ // Dec Reset re-sync using stored Dec Reset AF
+ //
+
+ // Update Stream Audio Frame.
+ // Copy Dec Reset AF to Stream AF.
+ //errno = initSyncUpdateAf(pStrAf, pDecResetAf);
+ //if (errno < 0)
+ //{
+ // return errno;
+ //}
+ outIsCpyAf(pDecResetAf, pStrAf);
+
+ // Enc activate,
+ // Enc reset
+ errno = PAF_ASOT_outputReset(pP, pQ, pAsotCfg);
+ if (errno)
+ {
+ return errno;
+ }
+
+ //
+ // Dec Info1 re-sync using stored Dec Info1 AF
+ //
+
+ // Update Stream Audio Frame.
+ // Copy Dec Info1 AF to Stream AF.
+ //errno = initSyncUpdateAf(pStrAf, pDecInfo1Af);
+ //if (errno < 0)
+ //{
+ // return errno;
+ //}
+ outIsCpyAf(pDecInfo1Af, pStrAf);
+
+ // decodeInfo1():
+ // - ASP chain reset,
+ // - Enc Info
+ errno = PAF_ASOT_outputInfo1(pP, pQ, pAsotCfg);
+ if (errno)
+ {
+ return errno;
+ }
+
+ return ASOP_SOK;
+}
+
+// Purpose: Decoding Function for determining whether processing of the
+// current stream is complete.
+Int
+PAF_ASOT_decodeFinalTest(
+ const struct PAF_ASOT_Params *pP,
+ const struct PAF_ASOT_Patchs *pQ,
+ struct PAF_ASOT_Config *pAsotCfg,
+ Int frame,
+ Int block
+)
+{
+ PAF_AST_DecOpCircBufCtl *pCbCtl; // decoder output circular buffer control
+ Int8 drainedFlag; // CB drained indicator flag
+ Int zMD; // master Dec index
+ Int errno; // error number
+
+
+ pCbCtl = &pAsotCfg->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
+ zMD = pAsotCfg->pAstCfg->masterDec; // get master Dec index
+
+ // Check circular buffer drain state
+ //GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_107);
+ errno = cbCheckDrainState(pCbCtl, zMD, &drainedFlag);
+ //GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_107);
+ if (errno < 0)
+ {
+ return errno;
+ }
+
+ if (drainedFlag == 1)
+ {
+ return ASOP_DP_CB_DRAINED;
+ }
+
+ return ASOP_DP_SOK;
+}
diff --git a/pasdk/test_dsp/framework/audioStreamOutProc.h b/pasdk/test_dsp/framework/audioStreamOutProc.h
index b3580ae2925791df39b4a2efa4e60f4ccc8f0e82..c6c24eba29a379839c43d86bb3cdd803f8e3ff89 100644 (file)
#include "audioStreamProc_config.h"
#include "audioStreamProc_master.h"
+/* !!!!!!!!! Revisit !!!!!!!!!!!!!!
+ * Purpose : Temporary ASOT FL sizes.
+ * Deprecate PAF_SYS_FRAMELENGTH in phases.*/
+#define PAF_ASOT_FRAMELENGTH 256
+#define PAF_ASOT_MAX_FRAMELENGTH 1024
+
// Global debug counter */
extern Uint32 gTaskAsopCnt; // debug counter for ASOP task
//Int (*passProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
//Int (*passProcessingCopy) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
//Int (*autoProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, ALG_Handle);
- Int (*decodeProcessing) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int);
+
+ //Int (*decodeProcessing) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int);
+ Int (*decodeProcessing) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
+
//Int (*decodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
Int (*encodeCommand) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
- Int (*decodeInit) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int);
+
+ //Int (*decodeInit) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int);
+ Int (*decodeInit) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
+
//Int (*decodeInfo) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
Int (*decodeInfo1) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
Int (*decodeInfo2) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
//Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
Int (*decodeStream) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
Int (*decodeEncode) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
+
//Int (*decodeFinalTest) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
+ Int (*decodeFinalTest) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, Int, Int);
+
Int (*decodeComplete) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *, ALG_Handle *, Int, Int);
Int (*selectDevices) (const struct PAF_ASOT_Params *, const struct PAF_ASOT_Patchs *, struct PAF_ASOT_Config *);
//Int (*sourceDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
// Audio Stream Input Task (ASOT) configuration
typedef struct PAF_ASOT_Config {
- Task_Handle taskHandle; // ASOT handle
- ACP_Handle acp; // ASOT local ACP handle
- PAF_ASPM_Config *pAspmCfg; // ASIT/ASOT shared configuration
- PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Task_Handle taskHandle; // ASOT handle
+ ACP_Handle acp; // ASOT local ACP handle
+ Int8 cbDrainedFlag[DECODEN_MAX]; // CB drained flags
+ PAF_ASPM_Config *pAspmCfg; // ASIT/ASOT shared configuration
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
} PAF_ASOT_Config;
PAF_ASOT_decodeProcessing(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
- PAF_ASOT_Config *pAsotCfg,
- Int sourceSelect
+ PAF_ASOT_Config *pAsotCfg
);
// Purpose: Decoding Function for processing Encode Commands.
PAF_ASOT_decodeInit(
const PAF_ASOT_Params *pP,
const PAF_ASOT_Patchs *pQ,
- PAF_ASOT_Config *pAsotCfg,
- Int sourceSelect
+ PAF_ASOT_Config *pAsotCfg
);
// Purpose: Decoding Function for processing information in a manner that
Int logArg
);
-#endif /* _ASOP_H_ */
+// Purpose: Decoding Function for determining whether processing of the
+// current stream is complete.
+Int
+PAF_ASOT_decodeFinalTest(
+ const struct PAF_ASOT_Params *pP,
+ const struct PAF_ASOT_Patchs *pQ,
+ struct PAF_ASOT_Config *pAsotCfg,
+ Int frame,
+ Int block
+);
+#endif /* _ASOP_H_ */
diff --git a/pasdk/test_dsp/framework/audioStreamOutProc_paramsFxns.c b/pasdk/test_dsp/framework/audioStreamOutProc_paramsFxns.c
index 0fdb01cdaba22923d7fa70f70622063790afed04..32a9dbfa487b5df3b887132e147fd8818bd48ec9 100644 (file)
PAF_ASOT_decodeInfo2, // decodeInfo2
PAF_ASOT_decodeStream, // decodeStream
PAF_ASOT_decodeEncode, // decodeEncode
+ PAF_ASOT_decodeFinalTest, // decodeFinalTest
PAF_ASOT_decodeComplete, // decodeComplete
PAF_ASOT_selectDevices, // selectDevices
PAF_ASOT_startOutput, // startOutput
diff --git a/pasdk/test_dsp/framework/audioStreamProc_master.c b/pasdk/test_dsp/framework/audioStreamProc_master.c
index 18562cbe80e6367fdc87ac814142534a187c6ca3..ad453a8aff0de288a9cbce9be29bf111dc38d6b6 100644 (file)
// ASPM configuration-- ASIT/ASOT shared
#pragma DATA_SECTION(gPAF_ASPM_config, ".globalSectionPafAspmConfig")
PAF_ASPM_Config gPAF_ASPM_config = {
- { NULL, NULL } // gateHandle, xDecOpCb
+ { NULL, 0, NULL }, // gateHandle, numCb, xDecOpCb
+ { NULL, NULL }, // gateHandle, xOutIsi
};
diff --git a/pasdk/test_dsp/framework/audioStreamProc_master.h b/pasdk/test_dsp/framework/audioStreamProc_master.h
index 3a458a5645f36de1e6dd94d56e0fc3483b879540..c5a3c0b968e2eb39e081514d1bbb97de5b00457c 100644 (file)
#include <xdc/std.h>
#include "aspDecOpCircBuf_common.h"
+#include "aspOutInitSync_common.h"
// Audio Stream Processing Master configuration--
// Audio Stream Input/Output Task shared
typedef struct PAF_ASPM_Config
{
- PAF_AST_DecOpCircBufCtl decOpCircBufCtl; // decoder output circular buffer control
+ PAF_AST_DecOpCircBufCtl decOpCircBufCtl; // decoder output circular buffer control
+ PAF_AST_OutInitSyncCtl outIsCtl; // output init-sync control
} PAF_ASPM_Config;
extern PAF_ASPM_Config gPAF_ASPM_config;
index f2d15f03bb9faefb1561665f34af71b88673a1e0..74dc45ea67cb78e8e5920d7cb65a68c55468ccbb 100644 (file)
PAF_SAMPLERATE_UNKNOWN, // sampleRate
0, // audio
PAF_OB_CLOCK_INTERNAL, // clock
- PAF_OB_FLUSH_ENABLE, // flush
+ PAF_OB_FLUSH_DISABLE, // flush !!! FLUSH_ENABLE not supported, yet !!!
0, // rateTrackMode // unused
PAF_OB_MARKER_DISABLED, // markerMode
0, // maxNumBufOverride
const IALG_MemRec outMemTabPrimary[] =
{
// SDRAM buffer
- // 4 buffers * 256 samples * 32 ch * 4 bytes
+ // 4 buffers * PAF_ASOT_MAX_FRAMELENGTH samples * 16 ch (assumed MAX) * 4 bytes
{
- 4 * 256 * 32 * 4, // size: note:
+ 4 * PAF_ASOT_MAX_FRAMELENGTH * 16 * 4, // size: note:
//6 * 256 * 32 * 4, // size: note:
//16 * 256 * 32 * 4, // size: note:
128, // alignment
- IALG_EXTERNAL, // space
+ IALG_SARAM, // space
IALG_PERSIST, // attrs
NULL, // base
}
//IALG_EXTERNAL // 31
};
+const PAF_AST_DecOpCircBufStatus PAF_AST_params_decOpCircBufStatus_primary =
+{
+ sizeof(PAF_AST_DecOpCircBufStatus),
+ PAF_ASOT_FRAMELENGTH
+};
+
+const PAF_AST_DecOpCircBufStatus *const PAF_AST_params_decOpCircBufStatus[] =
+{
+ &PAF_AST_params_decOpCircBufStatus_primary,
+};
+
+
//(***) FL: re-visit, clean this up (remove unused members)
// .............................................................................
//
inpLinkInit, // i_inpLinkInit
outLinkInit, // i_outLinkInit
outNumBufMap, // outNumBufMap // FL: poutNumBufMap
- PAF_AST_params_MetadataBufStatus, //metadata buffer status
- PAF_AST_params_AudioFrameBufStatus //Audio frame buffer status
+ PAF_AST_params_MetadataBufStatus, // metadata buffer status
+ PAF_AST_params_AudioFrameBufStatus, // Audio frame buffer status
+ PAF_AST_params_decOpCircBufStatus // z_pDecOpCircBufStatus
};
extern const PAF_ASOT_Fxns PAF_ASOT_params_fxns;
NULL, // z_rx_bufsiz
NULL, // z_tx_bufsiz
PAF_AST_params_numchan, // z_numchan
- PAF_SYS_FRAMELENGTH, // framelength
+ PAF_ASOT_FRAMELENGTH, // framelength
&PAF_AST_params_audioFrameFunctions, // pAudioFrameFunctions
&PAF_ASP_chainFxns, // pChainFxns
&PAF_AST_params_inpBufStatus, // pInpBufStatus
&PAF_ASP_params_decSioMap, // pDecSioMap
PAF_AST_streamsFromDecodes_std, // streamsFromDecodes
PAF_AST_streamsFromEncodes_std, // streamsFromEncodes
- PAF_MAX_SYS_FRAMELENGTH, // maxFramelength
+ PAF_ASOT_MAX_FRAMELENGTH, // maxFramelength
PAF_AST_streamOrder, // streamOrder
inpLinkInit, // i_inpLinkInit
outLinkInit, // i_outLinkInit
outNumBufMap, // outNumBufMap // FL: poutNumBufMap
- PAF_AST_params_MetadataBufStatus, //metadata buffer status
- PAF_AST_params_AudioFrameBufStatus //Audio frame buffer status
+ PAF_AST_params_MetadataBufStatus, // metadata buffer status
+ PAF_AST_params_AudioFrameBufStatus // Audio frame buffer status
};
diff --git a/pasdk/test_dsp/framework/itopo/params.h b/pasdk/test_dsp/framework/itopo/params.h
--- /dev/null
@@ -0,0 +1,51 @@
+
+/*
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
+All rights reserved.
+
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of Texas Instruments Incorporated nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+#ifndef _PARAMS_H_
+#define _PARAMS_H_
+
+#include "audioStreamInpProc.h"
+#include "audioStreamOutProc.h"
+
+#define asip_params asip_params_PAi
+#define asop_params asop_params_PAi
+
+// ASIT parameters
+extern const PAF_ASIT_Params asip_params_PAi;
+
+// ASOT parameters
+extern const PAF_ASOT_Params asop_params_PAi;
+
+#endif // _PARAMS_H_
index d540eb21a035f6d5bdd6b2d3af0e95e3189027a3..c0bc563839d0cc8376210f5094cceeb1dcb6fa23 100644 (file)
//
//#define _AE0_
-//#define _SRC4_
+#define _SRC4_
#define _CAR_
#define _OAR_
//#define _DAP_
index 3e2f79824959ed33d0e92d038cd41bf4c3db3503..bc1c4a9f34d9133eaadc5209597ecbca724250a5 100644 (file)
#include <ti/ipc/Ipc.h>
#include <ti/sysbios/family/c66/Cache.h>
+#include "params.h"
#include "pafhjt.h"
#include "paf_heapMgr.h"
#include "aspMsg_common.h"
// Create Shared DDR region as non-Cacheable, Before IPC attach
// TODO: remove hardcoded address and get correct values from .bld
{ // base: 0x81000000, len: 0x01000000,
- UInt Common2_DDR3_MAR_base = 0x01848204;
+ //UInt Common2_DDR3_MAR_base = 0x01848204;
UInt Common2_DDR3_base = 0x81000000;
UInt Common2_DDR3_len = 0x01000000;
// disable cache for common2 DDR3
- Cache_setMar(Common2_DDR3_base, Common2_DDR3_len, Cache_Mar_DISABLE);
+ Cache_setMar((xdc_Ptr)Common2_DDR3_base, Common2_DDR3_len, Cache_Mar_DISABLE);
}
//taskPriAfp = Task_setPri(TaskAfp, -1);
/* Initialize decoder output circular buffer control */
Log_info0("taskSysInitFxn:cbCtlInit()");
- status = cbCtlInit(&gPAF_ASPM_config.decOpCircBufCtl, &gPAF_AST_config.xDecOpCb);
+ status = cbCtlInit(&gPAF_ASPM_config.decOpCircBufCtl, asip_params.zone.decodeN, &gPAF_AST_config.xDecOpCb);
if (status < 0)
{
Log_info0("TaskSysInit: unable to initialize Decoder Output Circular Buffer Control. Exiting.");
return;
}
+ /* Initialize Output Processing Init-Sync control */
+ Log_info0("taskSysInitFxn:outIsCtlInit()");
+ status = outIsCtlInit(&gPAF_ASPM_config.outIsCtl, &gPAF_AST_config.xOutIsi);
+ if (status < 0)
+ {
+ Log_info1("%s: unable to initialize Output Init-Sync Control. Exiting.", (IArg)__TASK_NAME__);
+ return;
+ }
/* Initialize PAF heap manager */
Log_info0("taskSysInitFxn:pafHeapMgr_init()");
// FL: debug
// Any of these can be used on ARM, but DSP must configure the GPIO since pinMuxSetMode() is only available on DSP
- pinMuxSetMode(101,PADCONFIG_MUX_MODE_QUATERNARY); // PAD101 to QUATERNARY, GPIO (B5 on AudioDaughterCard J12)
+ audk2g_pinMuxSetMode(101,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD101 to QUATERNARY, GPIO (B5 on AudioDaughterCard J12)
GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_99, GPIO_OUT); // GPIO0,pin99 output
GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_99);
GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_99);
- pinMuxSetMode(117,PADCONFIG_MUX_MODE_QUATERNARY); // PAD117 to QUATERNARY, GPIO (B8 on AudioDaughterCard J12)
- GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_106, GPIO_OUT); // GPIO0,pin99 output
+ audk2g_pinMuxSetMode(117,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD117 to QUATERNARY, GPIO (B8 on AudioDaughterCard J12)
+ GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_106, GPIO_OUT); // GPIO0,pin106 output
GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106);
GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
- pinMuxSetMode(118,PADCONFIG_MUX_MODE_QUATERNARY); // PAD118 to QUATERNARY, GPIO (B9 on AudioDaughterCard J12)
+ audk2g_pinMuxSetMode(118,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD118 to QUATERNARY, GPIO (B9 on AudioDaughterCard J12)
GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_107, GPIO_OUT); // GPIO0,pin107 output
GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_107);
GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_107);
index 173b1d14bd30ea7847b26323869262c4b0307c7e..7eac297a288dba5f215aea8a1e66faf53df6c973 100644 (file)
--- a/pasdk/test_dsp/mob/mob.c
+++ b/pasdk/test_dsp/mob/mob.c
// GJ Debug Counters
Uint32 gMobStart_Idle=0;
-Uint32 gMobIdle_ClocksElse=0;
-Uint32 gMobIdle_ClocksIf=0;
+Uint32 gMobIdle_Ctrl=0;
+Uint32 gMobIdle_API=0;
Uint32 gMobOutRateX_Cnt=0;
Uint32 gMobStart_Open=0;
Uint32 gMobStart_Clocks=0;
if (status)
return status;
+ Log_info0("MOB: Inside PAF_SIO_CONTROL_OUTPUT_START_CLOCKS, starting output clocks ");
status = DOB_FTABLE_startClocks (device);
gMobStart_Idle++;
}
if (pDevExt->state == DOB_STATE_IDLE)
return SYS_OK;
+ gMobIdle_Ctrl++;
+
if (arg) {
// flush data (and keep clocks)
DOB_FTABLE_shutdown (device);
- gMobIdle_ClocksIf++;
+ //gMobIdle_ClocksIf++;
status = DEV2_ctrl (pChild, PAF_SIO_CONTROL_IDLE_WITH_CLOCKS, arg);
if (!status)
pDevExt->state = DOB_STATE_CLOCKING;
// truncate data (stops clocks)
DEV2_idle (device, 0);
status = DEV2_ctrl (pChild, code, arg);
- gMobIdle_ClocksElse++;
+ //gMobIdle_ClocksElse++;
}
break;
DEV2_Handle pChild = (DEV2_Handle)&pDevExt->child;
Int status;
+ gMobIdle_API++;
status = DEV2_idle (pChild, flush);
if (status != SYS_OK)
// specify minimal transfer size while still maintaining channel alignment
//xferSize = numChan * wordSize * 1;
- xferSize = numChan * wordSize * 4; // GJ: Experiment with longer startup transfers
+ xferSize = numChan * wordSize * 1; // GJ: Experiment with longer startup transfers
pChildFrame = Queue_get (Queue_handle(&((SIO2_Handle)pChild)->framelist));
if (pChildFrame == (DEV2_Frame *)&((SIO2_Handle)pChild)->framelist)
index 98f10e866b6bc39f3933d3072d9d7e9e852e54c4..51d5ec71cdf1b492adf937c46fccf322e3153cd2 100644 (file)
#include <stdarg.h>
#include "string.h"
#include <xdc/runtime/Log.h>
+#include "audk2g_audio.h"
-Platform_STATUS audioHDMIConfig(void);
+Audk2g_STATUS audioHDMIConfig(void);
#define HSR4_I2C_ADDR 0x5D
#define HSR4_I2C_PORT_NUM I2C_PORT_1
*
* \return Platform_EOK on Success or error code
*/
-Platform_STATUS audioAdcConfig(AdcDevId devId, AdcConfig *config)
+Audk2g_STATUS audioAdcConfig(Audk2gAdcDevId devId, AdcConfig *config)
{
- Platform_STATUS status;
+ Audk2g_STATUS status;
if(config == NULL)
{
- IFPRINT(platform_write("Invalid Inputs\n"));
- return (Platform_EINVALID);
+ IFPRINT(audk2g_write("Invalid Inputs\n"));
+ return (Audk2g_EINVALID);
}
/* Initialize all the HW instances of ADC */
- status = platformAudioAdcInit(devId);
- if(status != Platform_EOK)
+ status = audk2g_AudioAdcInit(devId);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioAdcConfig : platformaudioAdcConfig Failed\n"));
+ IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcInit Failed\n"));
return (status);
}
/* Set ADC channel gain */
- status = platformAudioAdcSetGain(devId, ADC_CH_ALL, config->gain);
- if(status != Platform_EOK)
+ status = audk2g_AudioAdcSetGain(devId, AUDK2G_ADC_CH_ALL, config->gain);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetGain Failed\n"));
+ IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetGain Failed\n"));
return (status);
}
/* Configure Left input mux for ADC1L */
- status = platformAudioAdcSetLeftInputMux(devId, ADC_CH1_LEFT,
+ status = audk2g_AudioAdcSetLeftInputMux(devId, AUDK2G_ADC_CH1_LEFT,
config->adc1LMux);
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetLeftInputMux Failed\n"));
+ IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetLeftInputMux Failed\n"));
return (status);
}
/* Configure Left input mux for ADC2L*/
- status = platformAudioAdcSetLeftInputMux(devId, ADC_CH2_LEFT,
+ status = audk2g_AudioAdcSetLeftInputMux(devId, AUDK2G_ADC_CH2_LEFT,
config->adc2LMux);
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetLeftInputMux Failed\n"));
+ IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetLeftInputMux Failed\n"));
return (status);
}
/* Configure Right input mux for ADC1R */
- status = platformAudioAdcSetRightInputMux(devId, ADC_CH1_RIGHT,
+ status = audk2g_AudioAdcSetRightInputMux(devId, AUDK2G_ADC_CH1_RIGHT,
config->adc1RMux);
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetRightInputMux Failed\n"));
+ IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetRightInputMux Failed\n"));
return (status);
}
/* Configure Right input mux for ADC2R */
- status = platformAudioAdcSetRightInputMux(devId, ADC_CH2_RIGHT,
+ status = audk2g_AudioAdcSetRightInputMux(devId, AUDK2G_ADC_CH2_RIGHT,
config->adc2RMux);
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioAdcConfig : platformAudioAdcSetRightInputMux Failed\n"));
+ IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcSetRightInputMux Failed\n"));
return (status);
}
/* Configure audio data format */
- status = platformAudioAdcDataConfig(devId, config->wlen, config->format);
- if(status != Platform_EOK)
+ status = audk2g_AudioAdcDataConfig(devId, config->wlen, config->format);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioAdcConfig : platformAudioAdcDataConfig Failed\n"));
+ IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcDataConfig Failed\n"));
return (status);
}
/* Configure all the interrupts */
- status = platformAudioAdcConfigIntr(devId, ADC_INTR_ALL,
+ status = audk2g_AudioAdcConfigIntr(devId, AUDK2G_ADC_INTR_ALL,
config->intEnable);
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioAdcConfig : platformAudioAdcConfigIntr Failed\n"));
+ IFPRINT(audk2g_write("audioAdcConfig : audk2g_AudioAdcConfigIntr Failed\n"));
return (status);
}
*
* \return Platform_EOK on Success or error code
*/
-Platform_STATUS audioDacConfig(DacDevId devId, DacConfig *config)
+Audk2g_STATUS audioDacConfig(Audk2gDacDevId devId, DacConfig *config)
{
- Platform_STATUS status;
+ Audk2g_STATUS status;
if(config == NULL)
{
- IFPRINT(platform_write("Invalid Inputs\n"));
- return (Platform_EINVALID);
+ IFPRINT(audk2g_write("Invalid Inputs\n"));
+ return (Audk2g_EINVALID);
}
/* Initialize Audio DAC */
- status = platformAudioDacInit(devId);
- if(status != Platform_EOK)
+ status = audk2g_AudioDacInit(devId);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDacConfig : platformaudioDacConfig Failed\n"));
+ IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacInit Failed\n"));
return (status);
}
/* Configure AMUTE control event */
- status = platformAudioDacAmuteCtrl(devId, config->amuteCtrl,
+ status = audk2g_AudioDacAmuteCtrl(devId, config->amuteCtrl,
config->amuteEnable);
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDacConfig : platformAudioDacAmuteCtrl Failed\n"));
+ IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacAmuteCtrl Failed\n"));
return (status);
}
/* Set sampling mode */
- status = platformAudioDacSetSamplingMode(devId, config->samplingMode);
- if(status != Platform_EOK)
+ status = audk2g_AudioDacSetSamplingMode(devId, config->samplingMode);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDacConfig : platformAudioDacSetSamplingMode Failed\n"));
+ IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSetSamplingMode Failed\n"));
return (status);
}
/* Set data format */
- status = platformAudioDacSetDataFormat(devId, config->dataFormat);
- if(status != Platform_EOK)
+ status = audk2g_AudioDacSetDataFormat(devId, config->dataFormat);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDacConfig : platformAudioDacSetDataFormat Failed\n"));
+ IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSetDataFormat Failed\n"));
return (status);
}
/* Enable soft mute control */
- status = platformAudioDacSoftMuteCtrl(devId, DAC_CHAN_ALL,
+ status = audk2g_AudioDacSoftMuteCtrl(devId, AUDK2G_DAC_CHAN_ALL,
config->softMuteEnable);
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDacConfig : platformAudioDacSoftMuteCtrl Failed\n"));
+ IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSoftMuteCtrl Failed\n"));
return (status);
}
/* Set attenuation mode */
- status = platformAudioDacSetAttnMode(devId, config->attnMode);
- if(status != Platform_EOK)
+ status = audk2g_AudioDacSetAttnMode(devId, config->attnMode);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDacConfig : platformAudioDacSetAttnMode Failed\n"));
+ IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSetAttnMode Failed\n"));
return (status);
}
/* Set De-emphasis control */
- status = platformAudioDacDeempCtrl(devId, config->deempCtrl);
- if(status != Platform_EOK)
+ status = audk2g_AudioDacDeempCtrl(devId, config->deempCtrl);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDacConfig : platformAudioDacDeempCtrl Failed\n"));
+ IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacDeempCtrl Failed\n"));
return (status);
}
/* Set DAC volume */
- status = platformAudioDacSetVolume(devId, DAC_CHAN_ALL, config->volume);
- if(status != Platform_EOK)
+ status = audk2g_AudioDacSetVolume(devId, AUDK2G_DAC_CHAN_ALL, config->volume);
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDacConfig : platformAudioDacSetVolume Failed\n"));
+ IFPRINT(audk2g_write("audioDacConfig : audk2g_AudioDacSetVolume Failed\n"));
return (status);
}
*
* \return Platform_EOK on Success or error code
*/
-Platform_STATUS audioDirConfig(void)
+Audk2g_STATUS audioDirConfig(void)
{
- Platform_STATUS status;
+ Audk2g_STATUS status;
int8_t fsout;
#ifdef CHECK_ERROR_STATUS
uint32_t timeout;
#endif
- status = platformAudioDirInit();
- if(status != Platform_EOK)
+ status = audk2g_AudioDirInit();
+ if(status != Audk2g_EOK)
{
- IFPRINT(platform_write("audioDirConfig : Audio DIR Configuration Failed!\n"));
+ IFPRINT(audk2g_write("audioDirConfig : Audio DIR Configuration Failed!\n"));
return (status);
}
timeout = ERROR_STATUS_WAIT_TIMEOUT;
while (timeout)
{
- if(!platformAudioDirGetErrStatus())
+ if(!audk2g_AudioDirGetErrStatus())
{
- IFPRINT(platform_write("audioDirConfig : DIR in PLL Mode\n"));
+ IFPRINT(audk2g_write("audioDirConfig : DIR in PLL Mode\n"));
break;
}
- IFPRINT(platform_write("audioDirConfig : Waiting for DIR to Enter PLL Mode...\n"));
- platform_delay(10);
+ IFPRINT(audk2g_write("audioDirConfig : Waiting for DIR to Enter PLL Mode...\n"));
+ audk2g_delay(10);
timeout--;
}
if(!timeout)
{
- IFPRINT(platform_write("audioDirConfig : DIR is not in PLL Mode!!\n"));
+ IFPRINT(audk2g_write("audioDirConfig : DIR is not in PLL Mode!!\n"));
return (Platform_EFAIL);
}
#endif
- fsout = platformAudioDirGetFsOut();
+ fsout = audk2g_AudioDirGetFsOut();
if(fsout == 2)
{
- IFPRINT(platform_write("audioDirConfig : Out of Range Sampling Frequency\n"));
+ IFPRINT(audk2g_write("audioDirConfig : Out of Range Sampling Frequency\n"));
}
else if(fsout == 0)
{
- IFPRINT(platform_write("audioDirConfig : Calculated Sampling Frequency Output is 43 kHz\9645.2 kHz\n"));
+ IFPRINT(audk2g_write("audioDirConfig : Calculated Sampling Frequency Output is 43 kHz\9645.2 kHz\n"));
}
else if(fsout == 1)
{
- IFPRINT(platform_write("audioDirConfig : Calculated Sampling Frequency Output is 46.8 kHz\9649.2 kHz\n"));
+ IFPRINT(audk2g_write("audioDirConfig : Calculated Sampling Frequency Output is 46.8 kHz\9649.2 kHz\n"));
}
else if(fsout == 3)
{
- IFPRINT(platform_write("audioDirConfig : Calculated Sampling Frequency Output is 31.2 kHz\9632.8 kHz\n"));
+ IFPRINT(audk2g_write("audioDirConfig : Calculated Sampling Frequency Output is 31.2 kHz\9632.8 kHz\n"));
}
else
{
- IFPRINT(platform_write("audioDirConfig : Error in Reading FSOUT status \n"));
- status = Platform_EFAIL;
+ IFPRINT(audk2g_write("audioDirConfig : Error in Reading FSOUT status \n"));
+ status = Audk2g_EFAIL;
}
return (status);
@@ -418,10 +419,10 @@ void set_audio_desc(unsigned char var1,unsigned char var2,unsigned char var3,uns
{
int ret_val=I2C_RET_OK;
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_FORMAT(var1, var2));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_NUM_CHANNELS(var1, var3));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_SAMPLE_RATES(var1, var4));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_MISC(var1, var5));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_FORMAT(var1, var2));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_NUM_CHANNELS(var1, var3));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_SAMPLE_RATES(var1, var4));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_EDID_AUDIO_DESC_MISC(var1, var5));}while (ret_val !=I2C_RET_OK);
}
int gI2Ccnt=0;
}while (ret_val !=I2C_RET_OK); */
do{ret_val=alpha_i2c_write(HSDIO_EDID_SPEAKER_ALLOCATION_BLOCK(0xFF));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);
+ audk2g_delay(10);
do{ret_val=alpha_i2c_write(HSDIO_EDID_SPEAKER_ALLOCATION_BLOCK_2(0x7));}while (ret_val !=I2C_RET_OK);
set_audio_desc(0,1,2,0x7f,7); // PCM 2 channel, 32kHz, 44.1kHz, 48kHz, 88.2kHz, 96kHz, 176.4 KHz, 192 KHz, 16bit, 20bit, 24bit
set_audio_desc(17,0,0,0,0);
set_audio_desc(18,0,0,0,0);
set_audio_desc(19,0,0,0,0);
- platform_delay(10);
+ audk2g_delay(10);
do{ret_val=alpha_i2c_write(HSDIO_EDID_GO);}while (ret_val !=I2C_RET_OK);
}
{
int ret_val=I2C_RET_OK;
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_CHANGE_msk));}while (ret_val !=I2C_RET_OK);
- //platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_MUTE_msk));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_MCLK_TO_HOST(HSDIO_AudioMClk_128X));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_UNMUTE_DELAY_TO_HOST(HSDIO_AudioUnMuteDelay_NO_DELAY));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_FORMAT_TO_HOST(HSDIO_AudioFmt_I2S));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_IMPLEMENT_AUDIO_TO_HOST_CMDS);}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_ROUTING(HSDIO_AudioRouting_HSDIOIN_NOOUT));}while (ret_val !=I2C_RET_OK);
- platform_delay(10);do{ret_val=alpha_i2c_write(HSDIO_SYS_CFG_GO);}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_CHANGE_msk));}while (ret_val !=I2C_RET_OK);
+ //audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_ALERT(HSDIO_ALERT_INPUT_AUDIO_MUTE_msk));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_MCLK_TO_HOST(HSDIO_AudioMClk_128X));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_UNMUTE_DELAY_TO_HOST(HSDIO_AudioUnMuteDelay_NO_DELAY));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_FORMAT_TO_HOST(HSDIO_AudioFmt_I2S));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_IMPLEMENT_AUDIO_TO_HOST_CMDS);}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_AUDIO_ROUTING(HSDIO_AudioRouting_HSDIOIN_NOOUT));}while (ret_val !=I2C_RET_OK);
+ audk2g_delay(10);do{ret_val=alpha_i2c_write(HSDIO_SYS_CFG_GO);}while (ret_val !=I2C_RET_OK);
}
//
}
-Platform_STATUS audioHDMIConfig(void)
+Audk2g_STATUS audioHDMIConfig(void)
{
- Platform_STATUS status = Platform_EOK;
+ Audk2g_STATUS status = Audk2g_EOK;
DA10x_I2C_init();
hrptredid();
Int16 DA10x_I2C_write( Uint16 i2c_addr, Uint8* data, Uint16 len )
{
Int32 timeout, i;
- Int32 oldMask;
-
I2C_ICCNT = len; // Set length
I2C_ICSAR = i2c_addr; // Set I2C slave address
index d920083f61a46825c9ce1226ed35a45c766a0c7a..c2fbb8cc3f38f920102263469d7f6c94306563a4 100644 (file)
#ifndef _AUDIO_DC_CFG_H_
#define _AUDIO_DC_CFG_H_
-#include "platform_internal.h"
-#include "platform.h"
+#include "audk2g.h"
+#include "audk2g_audio.h"
/**
* \brief ADC configuration parameter structure
*
typedef struct _AdcConfig
{
uint8_t gain;
- AdcLeftInputMux adc1LMux;
- AdcLeftInputMux adc2LMux;
- AdcRightInputMux adc1RMux;
- AdcRightInputMux adc2RMux;
- AdcRxWordLen wlen;
- AdcDataFormat format;
+ Audk2gAdcLeftInputMux adc1LMux;
+ Audk2gAdcLeftInputMux adc2LMux;
+ Audk2gAdcRightInputMux adc1RMux;
+ Audk2gAdcRightInputMux adc2RMux;
+ Audk2gAdcRxWordLen wlen;
+ Audk2gAdcDataFormat format;
uint8_t intEnable;
} AdcConfig;
*/
typedef struct _DacConfig
{
- DacAmuteCtrl amuteCtrl;
+ Audk2gDacAmuteCtrl amuteCtrl;
uint8_t amuteEnable;
- DacSamplingMode samplingMode;
- DacDataFormat dataFormat;
+ Audk2gDacSamplingMode samplingMode;
+ Audk2gDacDataFormat dataFormat;
uint8_t softMuteEnable;
- DacAttnMode attnMode;
- DacDeempCtrl deempCtrl;
+ Audk2gDacAttnMode attnMode;
+ Audk2gDacDeempCtrl deempCtrl;
uint8_t volume;
} DacConfig;
*
* \return Platform_EOK on Success or error code
*/
-Platform_STATUS audioAdcConfig(AdcDevId devId, AdcConfig *config);
+Audk2g_STATUS audioAdcConfig(Audk2gAdcDevId devId, AdcConfig *config);
/**
* \brief Initializes DAC module
*
* \return Platform_EOK on Success or error code
*/
-Platform_STATUS audioDacConfig(DacDevId devId, DacConfig *config);
+Audk2g_STATUS audioDacConfig(Audk2gDacDevId devId, DacConfig *config);
/**
* \brief Initializes DIR module
*
* \return Platform_EOK on Success or error code
*/
-Platform_STATUS audioDirConfig(void);
+Audk2g_STATUS audioDirConfig(void);
/**
* \brief Initializes HSR41 module
*
* \return Platform_EOK on Success or error code
*/
+Audk2g_STATUS audioHDMIConfig(void);
+
+/**
+ * \brief Read HDMI sampling rate
+ *
+ */
+unsigned int read_hdmi_samprate();
+
+/**
+ * \brief Clear HDMI interrupt on ~HMINT
+ *
+ */
+void clear_hdmi_hmint();
-Platform_STATUS audioHDMIConfig(void);
/* ------------------------------------------------------------------------ *
* *
* Variable types *
index 6ae1244f7b4d7fc8481820f63d3ec75c118c1637..29340d25029e8015bb91f5cfbfc216ba897f04d1 100644 (file)
*/
#include "edma_cfg.h"
+
#ifdef DCS7_UART_EDMA_ENABLE
-#include <ti/drv/uart/src/v0/UART_dma_v0.h>
+#if 0 // FL: PDK 1.0.1.2_eng
+#include <ti/drv/uart/src/v0/UART_dma_v0.h>
+#else // FL: PDK 1.0.6
+#include <ti/drv/uart/src/v0/UART_v0.h>
+#endif
#endif
+
/** @brief EDMA3 Driver Instance specific Semaphore handle */
extern EDMA3_OS_Sem_Handle semHandle[];
EDMA3_DRV_Handle hEdma1;
#ifdef DCS7_UART_EDMA_ENABLE
+#if 0 // FL: PDK 1.0.1.2_eng
extern UARTDMA_HwAttrs uartInitCfg[];
+#else // FL: PDK 1.0.6
+extern UART_HwAttrs uartInitCfg[];
+#endif
#endif
/**
*
* \return Platform_EOK on Success or error code
*/
-Platform_STATUS eDmaConfig(void)
+Audk2g_STATUS eDmaConfig(void)
{
EDMA3_DRV_Result edmaResult = 0;
hEdma0 = edma3init(CSL_EDMACC_0, &edmaResult);
if((hEdma0 == NULL) || (edmaResult != 0))
{
- IFPRINT(platform_write("eDMA instance 0 Initialization Failed\n"));
- return (Platform_EFAIL);
+ IFPRINT(audk2g_write("eDMA instance 0 Initialization Failed\n"));
+ return (Audk2g_EFAIL);
}
#ifdef DCS7_UART_EDMA_ENABLE
uartInitCfg[0].edmaHandle = hEdma0;
hEdma1 = edma3init(CSL_EDMACC_1, &edmaResult);
if((hEdma1 == NULL) || (edmaResult != 0))
{
- IFPRINT(platform_write("eDMA instance 1 Initialization Failed\n"));
- return (Platform_EFAIL);
+ IFPRINT(audk2g_write("eDMA instance 1 Initialization Failed\n"));
+ return (Audk2g_EFAIL);
}
- return (Platform_EOK);
+ return (Audk2g_EOK);
}
/**
index 3941823fd551cbdb9a40468051a30128d3b9ade0..14d1d44ae1ec3b854d7b7d585ecba38c749a1b39 100644 (file)
*
* \return Platform_EOK on Success or error code
*/
-Platform_STATUS eDmaConfig(void);
+Audk2g_STATUS eDmaConfig(void);
#endif /* _EDMA_CFG_H_ */
index 0cd2ab067cc09f4340561b19d3313ed4d80ef6c9..d22d42878eb5010f8823793cf95e17c4f609ab17 100644 (file)
* project
*
******************************************************************************/
+#if 0 // Functions defined below are not used in PASDK
#include <cerrno>
#include <stdio.h>
return;
}
+#endif
index 23eae4b8090f41e3e7ab32af9f393f91cae0eb17..899fb976ecf538897d86909ab6ef003c66c7c081 100644 (file)
--- a/pasdk/test_dsp/sap/sap.c
+++ b/pasdk/test_dsp/sap/sap.c
#include <ti/csl/cslr_device.h>
#define EDMA_HINV NULL
+#define EDMA_NUM_PARAMS 6
#include "sap_mcasp.h"
#include <pafsio.h>
#define SAP_UNDER_LEN 8
+#pragma DATA_SECTION(sap_UNDER, ".sap_UNDER");
int sap_UNDER[SAP_UNDER_LEN]; // used for underrun
int sap_OVER_1LANE = 0; // used for overrun
int sap_OVER_4LANE[4] = {0,0,0,0}; // used for overrun
#ifdef DEBUG
-void DJDBG_SAP_EDMA_dumpParams(int tag_place)
+void SAP_EDMA_dumpParams(int tag_place)
{
//unsigned int *ptrPARAM_BASE = (unsigned int *)0x02704000;
- //unsigned int *ptrPARAM0x18 = (unsigned int *)0x02704300; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
- unsigned int *ptrPARAM0x19 = (unsigned int *)0x02704320; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
- unsigned int *ptrPARAM0x41 = (unsigned int *)0x027048A0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
- unsigned int *ptrPARAM0x42 = (unsigned int *)0x027048C0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
- unsigned int *ptrPARAM0x43 = (unsigned int *)0x027048E0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
- unsigned int *ptrPARAM0x44 = (unsigned int *)0x02704910; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+ unsigned int *ptrPARAM0x18 = (unsigned int *)0x02704300; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+ //unsigned int *ptrPARAM0x19 = (unsigned int *)0x02704320; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+ //unsigned int *ptrPARAM0x41 = (unsigned int *)0x027048A0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+ //unsigned int *ptrPARAM0x42 = (unsigned int *)0x027048C0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+ //unsigned int *ptrPARAM0x43 = (unsigned int *)0x027048E0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+ //unsigned int *ptrPARAM0x48 = (unsigned int *)0x02704910; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[24]
+ unsigned int *ptrPARAM0x45 = (unsigned int *)0x027048A0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[69]
+ unsigned int *ptrPARAM0x46 = (unsigned int *)0x027048C0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[70]
+ unsigned int *ptrPARAM0x47 = (unsigned int *)0x027048E0; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[71]
+ unsigned int *ptrPARAM0x48 = (unsigned int *)0x02704900; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[72]
+ unsigned int *ptrPARAM0x49 = (unsigned int *)0x02704920; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[73]
+ unsigned int *ptrPARAM0x4A = (unsigned int *)0x02704940; // ((*((EDMA3_CCRL_Regs *) 0x02700000)).PARAMENTRY)[74]
//Log_info5("PARAM0x18a(%d): 0x%x 0x%x 0x%x 0x%x", tag_place, ptrPARAM0x18[0], ptrPARAM0x18[1], ptrPARAM0x18[2], ptrPARAM0x18[3]);
//Log_info5("PARAM0x18b(%d): 0x%x 0x%x 0x%x 0x%x", tag_place, ptrPARAM0x18[4], ptrPARAM0x18[5], ptrPARAM0x18[6], ptrPARAM0x18[7]);
- Log_info5("PARAM0x19a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x19[0] & 0x200000) >> 21), ((ptrPARAM0x19[0] & 0x100000) >> 20), ((ptrPARAM0x19[0] & 0x3F000) >> 12), ((ptrPARAM0x19[0] & 0x800) >> 11));
+ /*Log_info5("PARAM0x19a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x19[0] & 0x200000) >> 21), ((ptrPARAM0x19[0] & 0x100000) >> 20), ((ptrPARAM0x19[0] & 0x3F000) >> 12), ((ptrPARAM0x19[0] & 0x800) >> 11));
Log_info5("PARAM0x19b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x19[1], ptrPARAM0x19[2], ptrPARAM0x19[3], ptrPARAM0x19[4]);
Log_info4("PARAM0x19b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x19[5], ptrPARAM0x19[6], ptrPARAM0x19[7]);
Log_info5("PARAM0x43b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x43[1], ptrPARAM0x43[2], ptrPARAM0x43[3], ptrPARAM0x43[4]);
Log_info4("PARAM0x43b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x43[5], ptrPARAM0x43[6], ptrPARAM0x43[7]);
- Log_info5("PARAM0x44a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x44[0] & 0x200000) >> 21), ((ptrPARAM0x44[0] & 0x100000) >> 20), ((ptrPARAM0x44[0] & 0x3F000) >> 12), ((ptrPARAM0x44[0] & 0x800) >> 11));
- Log_info5("PARAM0x44b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x44[1], ptrPARAM0x44[2], ptrPARAM0x44[3], ptrPARAM0x44[4]);
- Log_info4("PARAM0x44b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x44[5], ptrPARAM0x44[6], ptrPARAM0x44[7]);
- //Log_info1("TCC0: ERR reg %x", *((unsigned int *)0x02760120)); //DJDBG
+ Log_info5("PARAM0x48a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x48[0] & 0x200000) >> 21), ((ptrPARAM0x48[0] & 0x100000) >> 20), ((ptrPARAM0x48[0] & 0x3F000) >> 12), ((ptrPARAM0x48[0] & 0x800) >> 11));
+ Log_info5("PARAM0x48b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x48[1], ptrPARAM0x48[2], ptrPARAM0x48[3], ptrPARAM0x48[4]);
+ Log_info4("PARAM0x48b(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x48[5], ptrPARAM0x48[6], ptrPARAM0x48[7]);*/
+
+ Log_info5("PARAM0x18a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x18[0] & 0x200000) >> 21), ((ptrPARAM0x18[0] & 0x100000) >> 20), ((ptrPARAM0x18[0] & 0x3F000) >> 12), ((ptrPARAM0x18[0] & 0x800) >> 11));
+ Log_info5("PARAM0x18b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x18[1], ptrPARAM0x18[2], ptrPARAM0x18[3], ptrPARAM0x18[4]);
+ Log_info4("PARAM0x18c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x18[5], ptrPARAM0x18[6], ptrPARAM0x18[7]);
+
+ Log_info5("PARAM0x45a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x45[0] & 0x200000) >> 21), ((ptrPARAM0x45[0] & 0x100000) >> 20), ((ptrPARAM0x45[0] & 0x3F000) >> 12), ((ptrPARAM0x45[0] & 0x800) >> 11));
+ Log_info5("PARAM0x45b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x45[1], ptrPARAM0x45[2], ptrPARAM0x45[3], ptrPARAM0x45[4]);
+ Log_info4("PARAM0x45c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x45[5], ptrPARAM0x45[6], ptrPARAM0x45[7]);
+
+ Log_info5("PARAM0x46a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x46[0] & 0x200000) >> 21), ((ptrPARAM0x46[0] & 0x100000) >> 20), ((ptrPARAM0x46[0] & 0x3F000) >> 12), ((ptrPARAM0x46[0] & 0x800) >> 11));
+ Log_info5("PARAM0x46b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x46[1], ptrPARAM0x46[2], ptrPARAM0x46[3], ptrPARAM0x46[4]);
+ Log_info4("PARAM0x46c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x46[5], ptrPARAM0x46[6], ptrPARAM0x46[7]);
+
+ Log_info5("PARAM0x47a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x47[0] & 0x200000) >> 21), ((ptrPARAM0x47[0] & 0x100000) >> 20), ((ptrPARAM0x47[0] & 0x3F000) >> 12), ((ptrPARAM0x47[0] & 0x800) >> 11));
+ Log_info5("PARAM0x47b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x47[1], ptrPARAM0x47[2], ptrPARAM0x47[3], ptrPARAM0x47[4]);
+ Log_info4("PARAM0x47c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x47[5], ptrPARAM0x47[6], ptrPARAM0x47[7]);
+
+ Log_info5("PARAM0x48a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x48[0] & 0x200000) >> 21), ((ptrPARAM0x48[0] & 0x100000) >> 20), ((ptrPARAM0x48[0] & 0x3F000) >> 12), ((ptrPARAM0x48[0] & 0x800) >> 11));
+ Log_info5("PARAM0x48b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x48[1], ptrPARAM0x48[2], ptrPARAM0x48[3], ptrPARAM0x48[4]);
+ Log_info4("PARAM0x48c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x48[5], ptrPARAM0x48[6], ptrPARAM0x48[7]);
+
+ Log_info5("PARAM0x49a(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x49[0] & 0x200000) >> 21), ((ptrPARAM0x49[0] & 0x100000) >> 20), ((ptrPARAM0x49[0] & 0x3F000) >> 12), ((ptrPARAM0x49[0] & 0x800) >> 11));
+ Log_info5("PARAM0x49b(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x49[1], ptrPARAM0x49[2], ptrPARAM0x49[3], ptrPARAM0x49[4]);
+ Log_info4("PARAM0x49c(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x49[5], ptrPARAM0x49[6], ptrPARAM0x49[7]);
+
+ Log_info5("PARAM0x4Aa(%d): ITCINTEN: 0x%02x, TCINTEN: 0x%02x, TCC: 0x%02x, TCCMODE: %d", tag_place, ((ptrPARAM0x4A[0] & 0x200000) >> 21), ((ptrPARAM0x4A[0] & 0x100000) >> 20), ((ptrPARAM0x4A[0] & 0x3F000) >> 12), ((ptrPARAM0x4A[0] & 0x800) >> 11));
+ Log_info5("PARAM0x4Ab(%d): SRC: 0x%08x, A_B_CNT: 0x%08x, DST: 0x%08x, SRC_DST_BIDX: 0x%08x", tag_place, ptrPARAM0x4A[1], ptrPARAM0x4A[2], ptrPARAM0x4A[3], ptrPARAM0x4A[4]);
+ Log_info4("PARAM0x4Ac(%d): LINK_BCNTRLD: 0x%08x, SRC_DST_CIDX: 0x%08x, CCNT: 0x%08x", tag_place, ptrPARAM0x4A[5], ptrPARAM0x4A[6], ptrPARAM0x4A[7]);
+
+ Log_info1("TCC0: ERR reg %x", *((unsigned int *)0x02760120)); //DJDBG
}
#endif
// .............................................................................
// -----------------------------------------------------------------------------
+int gSapInput_ControlOpen = 0;
+int gSapOutput_ControlOpen = 0;
+
+int gSapInput_ControlClose = 0;
+int gSapOutput_ControlClose = 0;
+
Int SAP_ctrl (DEV2_Handle device, Uns code, Arg arg)
{
SAP_DeviceExtension *pDevExt = (SAP_DeviceExtension *)device->object;
if (!( pParams = (const SAP_Params *) arg ))
return SIO2_OK;
+ if(device->mode == DEV2_OUTPUT)
+ gSapOutput_ControlOpen++;
+ else
+ gSapInput_ControlOpen++;
+
if (result = SAP_FTABLE_config (device, pParams))
return result;
pDevExt->activeEdma = EDMA_HINV;
}
+ if(device->mode == DEV2_INPUT)
+ gSapInput_ControlClose++;
+ else
+ gSapOutput_ControlClose++;
+
for (i=0; i < pDevExt->numEdmaParams; i++) {
if (pDevExt->edmaParams[i].hEdmaParam != EDMA_HINV)
{
if (pDevExt->activeEdma != EDMA_HINV)
EDMA3_DRV_disableTransfer (hEdma, pDevExt->activeEdma, EDMA3_DRV_TRIG_MODE_EVENT);
- pDevExt->numQueued = 0;
+ Log_info0("SAP_idle:Before pDevExt->numQueued = 0");
+ pDevExt->numQueued = 0;
// signal stopped
pDevExt->runState = 0;
+ Log_info0("SAP_idle: runState = 0");
// reset errorState
pDevExt->errorState = PAF_SIO_ERROR_NONE;
int result;
EDMA3_DRV_Handle hEdma;
- //TRACE_GEN((&TR_MOD, "SAP_start.%d (0x%x)", __LINE__, device));
+ Log_info2("SAP_start.%d (0x%x)", __LINE__, device);
- // signal we have started
- // we change the state here since we have already moved a frame from the
- // todevice queue to the xferQue. If an error occurs during one of the
- // following resets/enables then we need to have runState !=0 in order
- // for SAP_idle to properly cleanup. Moreover, the following resets/enables
- // do not (and are now required not to) depend on runState being 0.
- //pDevExt->runState = 1;
// Assume todevice queue is not empty -- how else could we be here?
pFrame = (DEV2_Frame *) Queue_get (device->todevice);
}
// enable DMA processing
-
+ if (device->mode == DEV2_OUTPUT)
+ Log_info3("SAP_start.%d, pDevExt->activeEdma 0x%x (pDevExt->errorEdma = 0x%x)",
+ __LINE__, pDevExt->activeEdma, pDevExt->errorEdma);
// config active xfer for this buffer
result = SAP_EDMA_setupXfer(device, pDevExt->activeEdma, EDMA_HINV, pDevExt->errorEdma, pFrame);
- //Log_info3("SAP_start.%d, pDevExt->activeEdma 0x%x (pDevExt->errorEdma = 0x%x)",
- // __LINE__, pDevExt->activeEdma, pDevExt->errorEdma);
+
// signal we have started -- this must come before last enable to prevent a race
// condition where the initial EDMA transfer is very small (e.g. due to startClocks)
// and completes before any further instructions in this thread are executed.
// This comes before the EDMA enable since, if the # of samples is 1, then the EDMA
// will be serviced and generate an interrupt even before the McASP is enabled.
- pDevExt->runState = 1;
- pDevExt->shutDown = 0;
- Log_info1 ("SAP: %d, SAP_start runState=1 & ENABLE TRANSFERS", __LINE__);
+ pDevExt->runState = 1;
+ pDevExt->shutDown = 0;
+ if (device->mode == DEV2_OUTPUT)
+ Log_info2 ("SAP: %d, SAP_start runState=1 & ENABLE TRANSFERS for activeEdma = 0x%x", __LINE__, pDevExt->activeEdma);
// enable interrupts and event servicing for this channel
EDMA3_DRV_enableTransfer (hEdma, pDevExt->activeEdma, EDMA3_DRV_TRIG_MODE_EVENT);
SAP_EDMA_Param *pParam;
XDAS_UInt32 parentEdma;
- //TRACE_GEN((&TR_MOD, "SAP_issue.%d (0x%x)", __LINE__, device));
+ if (device->mode == DEV2_OUTPUT)
+ Log_info3("SAP_issue for output device with pDevExt->errorState = 0x%x, pDevExt->runState = 0x%x, pDevExt->numQueued = 0x%x", pDevExt->errorState, pDevExt->runState, pDevExt->numQueued);
if ((device->mode == DEV2_OUTPUT) && (pDevExt->errorState >= PAF_SIO_ERROR_ERRBUF_XFER))
{
parentEdma = ((SAP_EDMA_Param *) tail->misc)->hEdmaParam;
}
+ //if (device->mode == DEV2_OUTPUT)
+ Log_info2("SAP_issue: Determined Parent = 0x%x for device = 0x%x", parentEdma, device->mode );
+
// get frame and parameter table to use; ints off => non-atomic OK
// dont need to check for empty queues since were here then todevice
// must have a frame placed there by the SIO_issue layer.
pParam = (SAP_EDMA_Param *) Queue_dequeue (Queue_handle(&pDevExt->paramQue));
if (pParam->hEdmaParam == NULL)
- Log_info0("SAP_issue: hEdma value is NULL");
+ Log_info1("SAP_issue: hEdma value is NULL for device = 0x%x", device->mode);
// set misc argument to pParam so get enqueue later
pFrame->misc = (Arg) pParam;
pDevExt->numQueued += 1;
result = SAP_EDMA_setupXfer (device, pParam->hEdmaParam, parentEdma, pDevExt->errorEdma, pFrame);
- Log_info4("SAP_issue.%d, EDMA_setupXfer: Target EDMA: 0x%x, Parent Edma: 0x%x Error Edma: 0x%x",
- __LINE__, pParam->hEdmaParam, parentEdma, pDevExt->errorEdma);
+ if (device->mode == DEV2_OUTPUT)
+ {
+ Log_info4("SAP_issue.%d, EDMA_setupXfer: Target EDMA: 0x%x, Parent Edma: 0x%x Error Edma: 0x%x",
+ __LINE__, pParam->hEdmaParam, parentEdma, pDevExt->errorEdma);
+ }
+
/*if ((device->mode != DEV2_INPUT) && (gDmaParamsidx <=16))
{
pDevExt->shutDown = 0;
+ //if (device->mode == DEV2_OUTPUT)
+ //SAP_EDMA_dumpParams(5);
+
// special case enables when not yet started
if (pDevExt->runState == 0) {
gSAPSpecialCase++;
#endif
//TRACE_GEN((&TR_MOD, "SAP_reclaim.%d (0x%x)", __LINE__, device));
-
+ if (device->mode == DEV2_OUTPUT)
+ Log_info3("SAP_reclaim for output device with pDevExt->errorState = 0x%x, runState: 0x%x & pDevExt->numQueued = 0x%x", pDevExt->errorState, pDevExt->runState, pDevExt->numQueued);
// must be running and error free
if ((!pDevExt->runState) || (pDevExt->errorState))
{
- //TRACE_GEN((&TR_MOD, "SAP_reclaim.%d, not runState: 0x%x", __LINE__, pDevExt->errorState));
+ Log_info3("SAP_reclaim.%d, error-state: 0x%x, mode = 0x%x", __LINE__, pDevExt->errorState, device->mode);
return SIO2_EBADIO;
}
return SIO2_EBADIO;
}
- // Log_info0("SAP_reclaim: Before SEM Pend");
+ Log_info1("SAP_reclaim: Before SEM Pend for mode: 0x%x", device->mode);
// wait for ISR to signal block completion
//TRACE_VERBOSE((&TR_MOD, "SAP_reclaim.%d wait for ISR to signal block completion", __LINE__));
Log_info0("SAP_reclaim, SYS_ETIMEOUT");
return SIO2_ETIMEOUT;
}
- //Log_info1("SAP_reclaim: After SEM Pend for mode: 0x%x", device->mode);
+ Log_info1("SAP_reclaim: After SEM Pend for mode: 0x%x", device->mode);
#if 1
// return error (owner must idle)
if (pDevExt->errorState == PAF_SIO_ERROR_FATAL)
{
DEV2_idle (device, 1);
- //TRACE_TERSE((&TR_MOD, "SAP_reclaim.%d, PAF_SIO_ERROR_FATAL: 0x%x", __LINE__, pDevExt->errorState));
+ Log_info2("SAP_reclaim.%d, PAF_SIO_ERROR_FATAL: 0x%x", __LINE__, pDevExt->errorState);
return PAF_SIO_ERROR_FATAL;
}
#endif
pDevExt->firstTCC = 0;
pDevExt->optLevel = 0;
pDevExt->numParamSetup = 0;
- pDevExt->numEdmaParams = 4;
+ pDevExt->numEdmaParams = EDMA_NUM_PARAMS; // We need more than 4 spare params to handle the immediate transition from Unknown
+ // to a Known program. Cheap resource to spend.
// use dev match to fetch function table pointer for SAP
DEV2_match(SAP_NAME, &entry);
}
else
{
- Que_num = 1;
+ Que_num = 0;
pDevExt->activeEdma = CSL_EDMACC_0_McASP_0_XEVT;
}
}
}
else
{
- Que_num = 1;
+ Que_num = 0;
pDevExt->activeEdma = CSL_EDMACC_1_McASP_1_XEVT;
}
}
}
else
{
- Que_num = 1;
+ Que_num = 0;
pDevExt->activeEdma = CSL_EDMACC_1_McASP_2_XEVT;
}
}
// reset counter
pDevExt->numQueued = 0;
- //DJDBG_SAP_EDMA_dumpParams(1);
+ Log_info0("SAP_shutdown: After pDevExt->numQueued = 0 ");
+
+ //SAP_EDMA_dumpParams(8);
// make sure active is linked to error
- EDMA3_DRV_linkChannel (hEdma, pDevExt->activeEdma, pDevExt->errorEdma);
+ EDMA3_DRV_linkChannel (hEdma, pDevExt->activeEdma, pDevExt->errorEdma);
// think this is better (from SIO_idle for standard model )
// refill frame list -- so user needn't call reclaim, which may cause Rx underrun.
//oldMask = Hwi_disable ();
- //TRACE_VERBOSE((&TR_MOD, "%s.%d: devices loop, numDevices = %d", __FUNCTION__, __LINE__, dapDrv.numDevices));
+ //Log_info3("%s.%d: devices loop, numDevices = %d", __FUNCTION__, __LINE__, sapDrv.numDevices);
for (i=0; i < sapDrv.numDevices; i++) {
device = sapDrv.device[i];
- //TRACE_VERBOSE((&TR_MOD, "%s.%d, devices loop start, device = 0x%x", __FUNCTION__, __LINE__, device));
+ //Log_info3("%s.%d, devices loop start, device = 0x%x", __FUNCTION__, __LINE__, device);
pDevExt = (SAP_DeviceExtension *) device->object;
if(device->mode == DEV2_INPUT)
gSapWatchDogIn++;
else
- gSapWatchDogOut++;
+ {
+ //if (gSapWatchDogOut == 0)
+ //SAP_EDMA_dumpParams(1);
+ gSapWatchDogOut++;
+ }
//TRACE_TERSE((&TR_MOD, "SAP_watchDog.%d, PAF_SIO_ERROR_FATAL: 0x%x", __LINE__, pDevExt->errorState));
/* if(gSapWatchDogThrottle == 0) //DJDBG
pDevExt->numQueued -= 1;
//gIsrCnt++;
if (device->mode == 1)
+ {
gIsrOutputCnt++;
+ //Log_info1("SAP isrCallback for 0x%x", pDevExt->activeEdma);
+ }
else
gIsrInputCnt++;
// place frame onto user queue and signal user thread
@@ -1380,9 +1452,14 @@ Int SAP_EDMA_setupXfer (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
}
SAP_DMA_FTABLE_setupParam (device, targetEdma, childEdma, (XDAS_UInt32) pFrame->addr, pFrame->size);
+ if (device->mode == DEV2_OUTPUT)
+ Log_info4("SAP: Inside SAP_EDMA_setupXfer with childEdma=0x%x & targetEdma = 0x%x; pFrame->addr = 0x%x, pFrame->size=0x%x", childEdma, targetEdma, pFrame->addr, pFrame->size);
+
if (parentEdma != EDMA_HINV)
EDMA3_DRV_linkChannel (hEdma, parentEdma, targetEdma);
+ if (device->mode == DEV2_OUTPUT)
+ Log_info3("SAP: Inside SAP_EDMA_setupXfer linked targetEdma = 0x%x with parentEdma=0x%x on Edma=0x%x", targetEdma, parentEdma, hEdma);
Hwi_restore (key); //DJDBG
@@ -1478,7 +1555,7 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
else {
edmaConfig.srcBIdx = 0;
edmaConfig.srcAddr = (unsigned int) &sap_UNDER[0];
-#if 1
+#if 0
//edmaConfig.cCnt = (SAP_UNDER_LEN * sizeof(int))/(edmaConfig.aCnt * edmaConfig.bCnt); //DJDBG
edmaConfig.cCnt = SAP_UNDER_LEN; //DJDBG, if underrun have frame of silence
#endif
@@ -1487,14 +1564,16 @@ Int SAP_EDMA_setupParam (DEV2_Handle device, XDAS_UInt32 targetEdma, XDAS_UInt32
edmaConfig.srcAddr = (unsigned int) getGlobalAddr(edmaConfig.srcAddr);
edmaConfig.destAddr = (unsigned int) getGlobalAddr(edmaConfig.destAddr);
- Log_info5("SAP: Inside SAP_EDMA_setupParam with size=0x%x, targetEdma = 0x%x, CCNT = %d with dest-addr: 0x%x and OPT=0x%x", size, targetEdma, edmaConfig.cCnt, edmaConfig.destAddr, edmaConfig.opt);
- Log_info5("SAP: Inside SAP_EDMA_setupParam with aCnt=0x%x, bCnt = 0x%x, destBIdx = 0x%x destCIdx: 0x%x and bCntReload=0x%x", edmaConfig.aCnt, edmaConfig.bCnt, edmaConfig.destBIdx, edmaConfig.destCIdx, edmaConfig.bCntReload);
-
EDMA3_DRV_setPaRAM (hEdma, targetEdma, &edmaConfig);
// link child xfer
if (childEdma != EDMA_HINV)
EDMA3_DRV_linkChannel (hEdma, targetEdma, childEdma);
+ if (device->mode == DEV2_OUTPUT) {
+ Log_info5("SAP: Inside SAP_EDMA_setupParam: size=0x%x, targetEdma = 0x%x, CCNT = %d with dest-addr: 0x%x and OPT=0x%x", size, targetEdma, edmaConfig.cCnt, edmaConfig.destAddr, edmaConfig.opt);
+ Log_info5("SAP: Inside SAP_EDMA_setupParam: aCnt=0x%x, bCnt = 0x%x; linked targetEdma = 0x%x with childEdma=0x%x on Edma=0x%x", edmaConfig.aCnt, edmaConfig.bCnt, targetEdma, childEdma, hEdma );
+ }
+
return SIO2_OK;
} //SAP_setupParam
index 5438f2e089b5be028c349029f2ac6c28d67e44b7..65c51e66bd9295f80c944b8cc208aae5ba4dfcdc 100644 (file)
--- a/pasdk/test_dsp/sap/sap.h
+++ b/pasdk/test_dsp/sap/sap.h
XDAS_UInt32 firstTCC;
Queue_Struct paramQue;
- Semaphore_Handle ready;
+ Semaphore_Handle ready; //unused - remove me
XDAS_Int8 numEdmaParams;
XDAS_Int32 edmaWordSize;
- XDAS_UInt32 shortTCC;
- XDAS_UInt32 shortEdma;
+ XDAS_UInt32 shortTCC; //unused - remove me
+ XDAS_UInt32 shortEdma; //unused - remove me
XDAS_Int8 shutDown;
XDAS_UInt32 activeEdma;
Uint16 numSers;
Uint16 numSlots;
- Void *pPortExt; // unused for now
- Void *pDmaExt;
+ Void *pPortExt; //unused - remove me
+ Void *pDmaExt; //unused - remove me
SAP_EDMA_Param edmaParams[MAX_EDMA_PARAM_ENTRIES];
- Int optLevel;
- Int numParamSetup;
+ Int optLevel; //unused - remove me
+ Int numParamSetup; //unused - remove me
} SAP_DeviceExtension;
index 22c68e1b35fb5a078d33daed8f3462e92214cbda..66cb7cc82035b3d673cd2791c6df70a877b58049 100644 (file)
#include <sap_d10.h>
#include <audio_dc_cfg.h>
#include "vproccmds_a.h"
+#include "evmc66x_gpio.h" // in "${PDK_INSTALL_PATH}/ti/addon/audk2g/include"
#include "dbgBenchmark.h" // PCM high-sampling rate + SRC + CAR benchmarking
void HSR4_readStatus (PAF_SIO_InputStatus *pStatus);
unsigned int HDMIGpioGetState (void);
+
+/** GPIO number for I2S Header HSR4's ~HMINT pin - GPIO port 0 */
+#define AUDK2G_AUDIO_HSR_HMINTz_GPIO (105) // missing from audio addon
+
+/** GPIO number for I2S Header HSR4's ~RESET pin - GPIO port 0 */
+#define AUDK2G_AUDIO_HSR_RESETz_GPIO (104) // missing from audio addon
+
// -----------------------------------------------------------------------------
// State machine variables and defines
0x8, //PAF_SAMPLERATE_32000HZ
0x2, //PAF_SAMPLERATE_44100HZ
0x2, //PAF_SAMPLERATE_48000HZ
- 0x4, //PAF_SAMPLERATE_88200HZ
- 0x1, //PAF_SAMPLERATE_96000HZ
+ 0x2, //PAF_SAMPLERATE_88200HZ
+ 0x2, //PAF_SAMPLERATE_96000HZ
0x2, //PAF_SAMPLERATE_192000HZ
0x4, //PAF_SAMPLERATE_64000HZ
0x2, //PAF_SAMPLERATE_128000HZ
4, // wordSize (unused)
-1, // precision (unused)
D10_sapControl, // control
- 0xE000F000, // pinMask
+ 0x0000F000, // pinMask
(D10_MODE_HDMI << D10_MODE_SHIFT) |
(D10_MCLK_HDMI << D10_MCLK_SHIFT), // mode
0,0 // unused[2]
/* DAC default configuration parameters */
DacConfig dacCfg =
{
- DAC_AMUTE_CTRL_SCKI_LOST, /* Amute event */
+ AUDK2G_DAC_AMUTE_CTRL_SCKI_LOST, /* Amute event */
0, /* Amute control */
- DAC_SAMPLING_MODE_SINGLE_RATE, /* Sampling mode */
- DAC_DATA_FORMAT_I2S, /* Data format */
+ AUDK2G_DAC_SAMPLING_MODE_SINGLE_RATE, /* Sampling mode */
+ AUDK2G_DAC_DATA_FORMAT_I2S, /* Data format */
0, /* Soft mute control */
- DAC_ATTENUATION_WIDE_RANGE, /* Attenuation mode */
- DAC_DEEMP_44KHZ, /* De-emph control */
+ AUDK2G_DAC_ATTENUATION_WIDE_RANGE, /* Attenuation mode */
+ AUDK2G_DAC_DEEMP_44KHZ, /* De-emph control */
100 /* Volume */
};
/* ADC default configuration parameters */
AdcConfig adcCfg =
{
90, /* ADC gain */
- ADC_INL_SE_VINL1, /* Left input mux for ADC1L */
- ADC_INL_SE_VINL2, /* Left input mux for ADC2L */
- ADC_INR_SE_VINR1, /* Right input mux for ADC1R */
- ADC_INR_SE_VINR2, /* Right input mux for ADC2R */
- ADC_RX_WLEN_24BIT, /* ADC word length */
- ADC_DATA_FORMAT_I2S, /* ADC data format */
+ AUDK2G_ADC_INL_SE_VINL1, /* Left input mux for ADC1L */
+ AUDK2G_ADC_INL_SE_VINL2, /* Left input mux for ADC2L */
+ AUDK2G_ADC_INR_SE_VINR1, /* Right input mux for ADC1R */
+ AUDK2G_ADC_INR_SE_VINR2, /* Right input mux for ADC2R */
+ AUDK2G_ADC_RX_WLEN_24BIT, /* ADC word length */
+ AUDK2G_ADC_DATA_FORMAT_I2S, /* ADC data format */
0
};
-Platform_STATUS setAudioDacConfig(void)
+Audk2g_STATUS setAudioDacConfig(void)
{
- Platform_STATUS status;
+ Audk2g_STATUS status;
/* Initialize Audio DAC module */
- status = audioDacConfig(DAC_DEVICE_ALL, &dacCfg);
+ status = audioDacConfig(AUDK2G_DAC_DEVICE_ALL, &dacCfg); // defined in sap\audio_dc_cfg.c
if (status)
Log_info0("SAP_D10: Audio DAC Configuration Failed!!!\n");
return status;
}
+// Configure GPIO for HSR HDMI signaling. This needs to be added to audk2g_AudioInit()
+// in ti\addon\audk2g\src\audk2g.c.
+Audk2g_STATUS audk2g_AudioInit_Extra()
+{
+ /* Configure GPIO for HSR HDMI Signaling - GPIO0 104 (~RESET) & 105 (~HMINT) */
+ audk2g_pinMuxSetMode(114, AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY);
+ audk2g_gpioSetDirection(AUDK2G_GPIO_PORT_0, AUDK2G_AUDIO_HSR_HMINTz_GPIO, AUDK2G_GPIO_IN);
+
+ audk2g_pinMuxSetMode(113, AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY);
+ audk2g_gpioSetDirection(AUDK2G_GPIO_PORT_0, AUDK2G_AUDIO_HSR_RESETz_GPIO, AUDK2G_GPIO_OUT);
+ audk2g_gpioSetOutput(AUDK2G_GPIO_PORT_0, AUDK2G_AUDIO_HSR_RESETz_GPIO);
+
+ return Audk2g_EOK;
+}
+
static inline XDAS_Int32 initD10 (DEV2_Handle device)
{
- Platform_STATUS status = Platform_EOK;
+ Audk2g_STATUS status = Audk2g_EOK;
/* Initialize common audio configurations */
- status = platformAudioInit();
- if(status != Platform_EOK)
+ status = audk2g_AudioInit(); // defined in in ti\addon\audk2g\src\audk2g.c
+ if(status != Audk2g_EOK)
{
Log_info0("Audio Init Failed!\n");
return status;
}
+ status = (Audk2g_STATUS)audk2g_AudioInit_Extra();
+ if(status != Audk2g_EOK)
+ {
+ Log_info0("Audio Init Failed!\n");
+ return status;
+ }
+
/* Initialize Audio ADC module */
- status = audioAdcConfig(ADC_DEVICE_ALL, &adcCfg);
- if(status != Platform_EOK)
+ status = audioAdcConfig(AUDK2G_ADC_DEVICE_ALL, &adcCfg);
+ if(status != Audk2g_EOK)
{
Log_info0("Audio ADC Configuration Failed!\n");
return status;
/* Setup DIR 9001 for SPDIF input operation */
//status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_DIR);
status = audioDirConfig();
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
Log_info0("Audio DIR Init Failed!\n");
return status;
}
- status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_I2S);
- platform_delay(5000); // Without delay between these 2 calls system aborts.
+ status = audk2g_AudioSelectClkSrc(AUDK2G_AUDIO_CLK_SRC_I2S);
+ audk2g_delay(5000); // Without delay between these 2 calls system aborts.
status = setAudioDacConfig();
#if 1
/* Initialize the HDMI Card */
while(HDMIGpioGetState());
status = audioHDMIConfig();
- if(status != Platform_EOK)
+ if(status != Audk2g_EOK)
{
Log_info0("Audio HDMI Init Failed!\n");
return status;
// speed clocks (DIR/HDMI) or the internal AUXCLK (Audio_OSC). This is divided down
// output via ACLKX0 which is connected to the high speed input
// of TX0 (DAC) and TX2 (DIT).
+#define AUDK2G_AUDIO_CLK_SRC_OSC (AUDK2G_AUDIO_CLK_SRC_I2S+1) //temporary, to add AUDK2G_AUDIO_CLK_SRC_OSC to audk2g_audio.h
static XDAS_Int32 clockMuxTx (int sel, int force)
{
- Platform_STATUS status = 0;
+ Audk2g_STATUS status = 0;
// select clkxDiv table
if (sel == D10_MCLK_DIR)
{
- status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_DIR);
+ status = audk2g_AudioSelectClkSrc(AUDK2G_AUDIO_CLK_SRC_DIR);
pClkxDiv = (unsigned char *) clkxDivDIR;
}
else if (sel == D10_MCLK_HDMI)
{
- status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_I2S);
+ status = audk2g_AudioSelectClkSrc(AUDK2G_AUDIO_CLK_SRC_I2S);
pClkxDiv = (unsigned char *) clkxDivHDMI;
}
else if (sel == D10_MCLK_OSC)
{
- status = platformAudioSelectClkSrc(AUDIO_CLK_SRC_OSC);
+ status = audk2g_AudioSelectClkSrc((Audk2gAudioClkSrc)AUDK2G_AUDIO_CLK_SRC_OSC);
pClkxDiv = (unsigned char *) clkxDivADC;
}
Log_info1("SAP_D10: Inside clockMuxTx with sel = %d", sel);
- platform_delay(20000);
+ audk2g_delay(20000);
return status;
} //clockMuxTx
@@ -816,10 +847,10 @@ static int manageInput (DEV2_Handle device, const SAP_D10_Rx_Params *pParams, PA
if ((((pParams->d10rx.mode & D10_MCLK_MASK) >> D10_MCLK_SHIFT) == D10_MCLK_DIR) &
(((pParams->d10rx.mode & D10_MODE_MASK) >> D10_MODE_SHIFT) == D10_MODE_STD))
{
- pStatusIn->lock = !(platformAudioDirGetClkStatus());
- pStatusIn->nonaudio = !(platformAudioDirGetAudioStatus());
- pStatusIn->emphasis = platformAudioDirGetEmphStatus();
- pStatusIn->sampleRateMeasured = RateTable_spdif[platformAudioDirGetFsOut()];
+ pStatusIn->lock = !(audk2g_AudioDirGetClkStatus());
+ pStatusIn->nonaudio = !(audk2g_AudioDirGetAudioStatus());
+ pStatusIn->emphasis = audk2g_AudioDirGetEmphStatus();
+ pStatusIn->sampleRateMeasured = RateTable_spdif[audk2g_AudioDirGetFsOut()];
pStatusIn->sampleRateData = pStatusIn->sampleRateMeasured;
PrevSampRate = pStatusIn->sampleRateMeasured;
@@ -1074,7 +1105,7 @@ XDAS_Int32 D10_sapControl (DEV2_Handle device, const PAF_SIO_Params *pParams, XD
// the periodic manage_output calls.
int sel = (pDapD10TxParams->d10tx.mode & D10_MCLK_MASK) >> D10_MCLK_SHIFT;
clockMuxTx (sel, -1);
- platform_delay(50000); // GJ REVISIT: Without delay between Tx McASP & DAC configs, system aborts.
+ audk2g_delay(50000); // GJ REVISIT: Without delay between Tx McASP & DAC configs, system aborts.
setAudioDacConfig();
dacHardUnMute ();
@@ -1172,7 +1203,7 @@ XDAS_Int32 D10_sapControl (DEV2_Handle device, const PAF_SIO_Params *pParams, XD
unsigned int HDMIGpioGetState (void) {
- return(gpioReadInput(GPIO_PORT_0, PLATFORM_AUDIO_HSR_HMINTz_GPIO));
+ return(audk2g_gpioReadInput(AUDK2G_GPIO_PORT_0, AUDK2G_AUDIO_HSR_HMINTz_GPIO));
}
// EOF
index c31e78dbdf832d7284d1c186021694d2213e17c2..355e987d43c597b181e3eae600b6d9ba08f5bae2 100644 (file)
#include <sap.h>
#include <pafsio.h>
-#include "platform_internal.h"
-#include "platform.h"
-
// mode is a bitfield
// bit 0: SYNC 0 = synchronous, 1 = asynchronous (Tx)
// bit 1: Reserved
index 2adffe09b954e3e36b7862235ebe2f1de7f250ca..747e7666cf98b7f4f354d17dfde56d890f203b6b 100644 (file)
base[_MCASP_PDIR_OFFSET] = 0; // all input by default
}
-
-
} // SAP_MCASP_init
// -----------------------------------------------------------------------------
pSers =&base[_MCASP_SRCTL0_OFFSET];
for (i=0; i < _MCASP_CHANNEL_CNT; i++)
{
- timeout = 0;
if (pDevExt->pParams->sap.pinMask & (1 << i))
{
//Log_info3(( "SAP_MCASP_enable(): wait for serializer %d. pSers: 0x%x, *pSers: 0x%x", i, pSers, *pSers));
- while ((*pSers & _MCASP_SRCTL_XRDY_MASK) != 0)
- {
- timeout++;
- if (timeout > 10000)
- {
- Log_info1("SAP_MCASP_enable(): McASP serializer %d timed out.\n", i);
- result = SIO2_ETIMEOUT;
- break;
- }
-
- }
+ while ((*pSers & _MCASP_SRCTL_XRDY_MASK) != 0);
}
*pSers++;
}
{
//TRACE_TERSE1(( "SAP_MCASP_reset(0x%x) input device.", device));
// disable FIFO if present
- Log_info1("SAP_MCASP_reset(0x%x) input device.", device); //DJDBG
+ Log_info1("SAP_MCASP_reset(0x%x) input device.", device);
if (sapMcaspDrv.fifoPresent[mcaspNum])
fifoBase[_MCASP_RFIFOCTL_OFFSET] &=
~(MCASP_RFIFOCTL_RENA_ENABLE << _MCASP_RFIFOCTL_RENA_SHIFT);
else
{
//TRACE_TERSE1(("SAP_MCASP_reset(0x%x) output device.", device));
- Log_info1("SAP_MCASP_reset(0x%x) output device.", device); //DJDBG
+ Log_info1("SAP_MCASP_reset(0x%x) output device.", device);
// disable FIFO if present
if (sapMcaspDrv.fifoPresent[mcaspNum])
fifoBase[_MCASP_WFIFOCTL_OFFSET] &=
// the settings will never take affect which would lead to a lockup condition.
#define INT_MAX 0xFFFFFFFF // maximum value returned by Clock_getTicks
-#define USEC_PER_MSEC ( 1000 ) // microseconds per millisecond
Int SAP_MCASP_waitSet (MCASP_Handle hMcasp, Uint32 wrReg, Uint32 rdReg, Uint32 mask, Uint32 timeout)
{
@@ -729,27 +715,6 @@ Int SAP_MCASP_waitSet (MCASP_Handle hMcasp, Uint32 wrReg, Uint32 rdReg, Uint32 m
// set register with mask value
base[wrReg] = (base[rdReg] | mask) & resMask;
-#if 0
- // convert timeout from milliseconds to nTicks
- timeout = CLK_countspms () * timeout;
-
- timeStart = CLK_gethtime ();
- while (1) {
- // return success if register has latched value
- if ((base[rdReg] & mask) == mask)
- break;
- timeNow = CLK_gethtime ();
- elapsed = timeNow - timeStart;
- // check for wrap aound
- if (timeNow <= timeStart)
- elapsed = INT_MAX - timeStart + timeNow;
-
- // return error if timeout reached
- if (elapsed > timeout)
- return SYS_ETIMEOUT;
- }
-#endif
-
timeStart = Clock_getTicks();
while (1) {
if ((base[rdReg] & mask) == mask)
index 1a91cc1277e062710652fcc2bcd70f204e744e86..169a0c62e90b81e37cf2bd6b59eb3ccefcbb506c 100644 (file)
set PSDK_CUST_LROOT_DIR=%PASDK_ROOT_DIR%psdk_cust
:: Set custom PDK install directory
-set PDK_VERSION=1_0_1_2_eng
-set PDK_INSTALL_DIR=%PSDK_CUST_LROOT_DIR%\pdk_k2g_%PDK_VERSION%
+::set PDK_VERSION=1_0_1_2_eng
+::set PDK_INSTALL_DIR=%PSDK_CUST_LROOT_DIR%\pdk_k2g_%PDK_VERSION%
:: Set workspace directory
set CCS_WRKSP_DIR=workspace_v6_1
if "%1"=="Release" goto SetBuildProfilesRelease
:: Set build profiles for SDF
-set PDK_PLATFORM_LIB_BUILD_PROFILE=Debug
+::set PDK_PLATFORM_LIB_BUILD_PROFILE=Debug
set ARM_APP_BUILD_PROFILE=Debug_pkgs
set DSP_APP_BUILD_PROFILE=Debug_pkgs
goto build_ccs_projects
:SetBuildProfilesDebug
:: Set build profiles for debug
-set PDK_PLATFORM_LIB_BUILD_PROFILE=Debug
+::set PDK_PLATFORM_LIB_BUILD_PROFILE=Debug
set ARM_APP_BUILD_PROFILE=Debug
set DSP_APP_BUILD_PROFILE=Debug
goto build_ccs_projects
:SetBuildProfilesRelease
:: Set build profiles for release
:: FL: currently we only have a "Release" profile for the DSP
-set PDK_PLATFORM_LIB_BUILD_PROFILE=Debug
+::set PDK_PLATFORM_LIB_BUILD_PROFILE=Debug
set ARM_APP_BUILD_PROFILE=Debug
set DSP_APP_BUILD_PROFILE=Release
::
:: Import PDK platform library project into workspace
-eclipsec -noSplash -data %PASDK_LROOT_DIR%\%CCS_WRKSP_DIR% -application com.ti.ccstudio.apps.projectImport -ccs.location "%PDK_INSTALL_DIR%\packages\ti\platform\evmk2g\platform_lib"
+::eclipsec -noSplash -data %PASDK_LROOT_DIR%\%CCS_WRKSP_DIR% -application com.ti.ccstudio.apps.projectImport -ccs.location "%PDK_INSTALL_DIR%\packages\ti\platform\evmk2g\platform_lib"
:: Import ARM and DSP application projects to workspace
eclipsec -noSplash -data %PASDK_LROOT_DIR%\%CCS_WRKSP_DIR% -application com.ti.ccstudio.apps.projectImport -ccs.location "%PASDK_LROOT_DIR%\test_arm"
::
:: Build PDK platform library project
-eclipsec -noSplash -data %PASDK_LROOT_DIR%\%CCS_WRKSP_DIR% -application com.ti.ccstudio.apps.projectBuild -ccs.projects platform_lib_evmk2g -ccs.configuration %PDK_PLATFORM_LIB_BUILD_PROFILE%
+::eclipsec -noSplash -data %PASDK_LROOT_DIR%\%CCS_WRKSP_DIR% -application com.ti.ccstudio.apps.projectBuild -ccs.projects platform_lib_evmk2g -ccs.configuration %PDK_PLATFORM_LIB_BUILD_PROFILE%
:: Build ARM application project
eclipsec -noSplash -data %PASDK_LROOT_DIR%\%CCS_WRKSP_DIR% -application com.ti.ccstudio.apps.projectBuild -ccs.projects test_arm -ccs.configuration %ARM_APP_BUILD_PROFILE%
@@ -90,12 +90,12 @@ eclipsec -noSplash -data %PASDK_LROOT_DIR%\%CCS_WRKSP_DIR% -application com.ti.c
:cleanupenv
set PASDK_LROOT_DIR=
set PSDK_CUST_LROOT_DIR=
-set PDK_VERSION=
-set PDK_INSTALL_DIR=
+::set PDK_VERSION=
+::set PDK_INSTALL_DIR=
set CCS_WRKSP_DIR=
set SAVE_CYGWIN=
set CYGWIN=
-set PDK_PLATFORM_LIB_BUILD_PROFILE=
+::set PDK_PLATFORM_LIB_BUILD_PROFILE=
set ARM_APP_BUILD_PROFILE=
set DSP_APP_BUILD_PROFILE=
index 589445727db7dea6e4722134f07efbff7906453b..bfe768db7e63ec6656b6b49a86b6acf9f4af3fcd 100644 (file)
--- a/scripts/build_os_pkg.bat
+++ b/scripts/build_os_pkg.bat
@mkdir Temp
@xcopy /E /H /I /Q %PASDK_ROOT_DIR%.git Temp\.git
+
+:: pasdk
@xcopy /E /H /I /Q %PASDK_ROOT_DIR%pasdk Temp\pasdk
-@xcopy /E /H /I /Q %PASDK_ROOT_DIR%psdk_cust Temp\psdk_cust
+:: psdk_cust
+@xcopy /E /H /I /Q %PASDK_ROOT_DIR%psdk_cust\ipc_3_43_00_00_eng Temp\psdk_cust\ipc_3_43_00_00_eng
+@xcopy /E /H /I /Q %PASDK_ROOT_DIR%psdk_cust\libarch_k2g_1_0_1_0 Temp\psdk_cust\libarch_k2g_1_0_1_0
+:: PDK 1.0.1.2_eng removed from BR1, replaced w/ PrSDK 4.0, PDK 1.0.6
+::@xcopy /E /H /I /Q %PASDK_ROOT_DIR%psdk_cust\pdk_k2g_1_0_1_2_eng Temp\psdk_cust\pdk_k2g_1_0_1_2_eng
+
+:: tools
@mkdir Temp\tools
:: tools/alpha
@xcopy /E /H /I /Q %PASDK_ROOT_DIR%tools\alpha Temp\tools\alpha
@copy /Y %PASDK_ROOT_DIR%tools\config_cust.ini Temp\tools\config_cust.ini
@copy /Y %PASDK_ROOT_DIR%tools\setup.bat Temp\tools\setup.bat
+:: docs
@mkdir Temp\docs
@copy /Y %PASDK_ROOT_DIR%docs\PASDK_release_notes.pdf Temp\PASDK_release_notes.pdf
@copy /Y %PASDK_ROOT_DIR%docs\DA10x_UG_AspExample.pdf Temp\docs\DA10x_UG_AspExample.pdf
@copy /Y %PASDK_ROOT_DIR%docs\pa-fil-fe.pdf Temp\docs\pa-fil-fe.pdf
@copy /Y %PASDK_ROOT_DIR%docs\PASDK_setup_guide.pdf Temp\docs\PASDK_setup_guide.pdf
+:: scripts
@mkdir Temp\scripts
@copy /Y %PASDK_ROOT_DIR%scripts\build_paf_libs.bat Temp\scripts
-@copy /Y %PASDK_ROOT_DIR%scripts\build_pdk_libs.bat Temp\scripts
+:: PDK 1.0.1.2_eng removed from BR1, replaced w/ PrSDK 4.0, PDK 1.0.6
+::@copy /Y %PASDK_ROOT_DIR%scripts\build_pdk_libs.bat Temp\scripts
@copy /Y %PASDK_ROOT_DIR%scripts\setup_env.bat Temp\scripts
@pushd Temp