summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e9ab6fa)
raw | patch | inline | side by side (parent: e9ab6fa)
author | Frank Livingston <frank-livingston@ti.com> | |
Tue, 6 Sep 2016 23:27:11 +0000 (18:27 -0500) | ||
committer | Frank Livingston <frank-livingston@ti.com> | |
Tue, 6 Sep 2016 23:27:11 +0000 (18:27 -0500) |
13 files changed:
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/common/aspDecOpCircBuf_common.c b/processor_audio_sdk_1_00_00_00/pasdk/common/aspDecOpCircBuf_common.c
index 41669a9873491bd18fde420c2935ddb4630dc355..edf3b7c16c228d1c569accc0ed4ff89ff5772022 100644 (file)
*/
#include <xdc/std.h>
-#include <ti/sysbios/hal/Cache.h>
#include <xdc/runtime/Log.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/ipc/GateMP.h>
#include "aspDecOpCircBuf_common.h"
// Output log of circular buffer control variables (debug)
Int cbLog(
- PAF_AST_DecOpCircBuf *pCb,
+ PAF_AST_DecOpCircBufCtl *pCbCtl,
+ Int8 cbIdx,
Int8 fullLog,
char *locInfo
)
{
+ 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->xDecOpCb[cbIdx];
+
// Invalidate circular buffer configuration.
Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
Cache_wait();
Log_info2("CB: decOpFrameLen=%d, strFrameLen=%d", pCb->decOpFrameLen, pCb->strFrameLen);
//Log_info1("cbWriteInit=%d", pCb->cbWriteAfInit);
}
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
- return 0;
+ return ASP_DECOP_CB_SOK;
}
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/common/aspDecOpCircBuf_common.h b/processor_audio_sdk_1_00_00_00/pasdk/common/aspDecOpCircBuf_common.h
index 7b74a725eec4b56a6c9f79acf046a347303a76f7..46d91f17dda6251ddc229e10ca51842d7dfa56d2 100644 (file)
#include <ti/ipc/GateMP.h>
#include "paftyp.h"
-#define ASP_DECOP_CB_SOK ( 0 ) // ok
+#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 )
#define ASP_DECOP_CB_MAX_NUM_AF ( 4 ) // decoder output circular buffer maximum number audio frames
#define ASP_DECOP_CB_MAX_NUM_PCM_CH ( 16 ) // decoder output circular buffer maximum number audio PCM channels
#define ASP_DECOP_CB_MAX_PCM_FRAME_LEN ( 6*256 ) // decoder output circular buffer maximum PCM frame length
#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_DECODE_CB_GATE_NAME ( "AspDecOpCbGate" )
+#define ASP_DECODE_CB_GATE_REGION_ID ( 0 )
+
// Decoder output circular buffer
typedef struct PAF_AST_DecOpCircBuf
} PAF_AST_DecOpCircBuf;
// Decoder output circular buffer control
-typedef struct PAF_AST_DecOpCircBufCtrl
+typedef struct PAF_AST_DecOpCircBufCtl
{
- GateMP_Handle *gateHandle; // circular buffer gate handle
+ GateMP_Handle gateHandle; // circular buffer gate handle
PAF_AST_DecOpCircBuf *xDecOpCb; // circular buffer base pointer
-} PAF_AST_DecOpCircBufCtrl;
+} PAF_AST_DecOpCircBufCtl;
+
+// Initialize circular buffer control
+Int cbCtlInit(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ PAF_AST_DecOpCircBuf *xDecOpCb // decoder output circular buffer base pointer
+);
// Output log of circular buffer control variables (debug)
Int cbLog(
- PAF_AST_DecOpCircBuf *pCb,
+ PAF_AST_DecOpCircBufCtl *pCbCtl,
+ Int8 cbIdx,
Int8 fullLog,
char *locInfo
);
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/aspDecOpCircBuf_slave.c b/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/aspDecOpCircBuf_slave.c
index 6fb390de61af00d545d4d937e6668ccaf7a1a398..16010b8eb3617b675205cf6fdea3f8eaf44d98cd 100644 (file)
//#include "pafsp.h"
#include "aspDecOpCircBuf_slave.h"
+// Initialize circular buffer control
+Int cbCtlInit(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ PAF_AST_DecOpCircBuf *xDecOpCb // decoder output circular buffer base pointer
+)
+{
+ GateMP_Handle gateHandle;
+ Int status;
+
+ status = GateMP_open(ASP_DECODE_CB_GATE_NAME, &gateHandle);
+ if (status < 0)
+ {
+ return ASP_DECOP_CB_CTL_INIT_INV_GATE;
+ }
+
+ pCbCtl->xDecOpCb = xDecOpCb;
+
+ return ASP_DECOP_CB_SOK;
+
+}
+
// Start writes to circular buffer
Int cbWriteStart(
- PAF_AST_DecOpCircBuf *pCb // decoder output circular buffer
+ 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;
PAF_AudioFrame *pAfCb;
Int8 n;
//Int8 i;
+ // Get gate handle
+ gateHandle = pCbCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ // Get circular buffer base pointer
+ pCb = &pCbCtl->xDecOpCb[cbIdx];
+
// (***) FL: revisit
// Invalidate circular buffer configuration.
// NOTE: Probably only a subset of this information needs to be updated.
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;
};
// Stop writes to circular buffer
Int cbWriteStop(
- PAF_AST_DecOpCircBuf *pCb // decoder output circular buffer
+ 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->xDecOpCb[cbIdx];
+
// Invalidate circular buffer configuration
Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
Cache_wait();
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;
}
// Write audio frame to circular buffer
Int cbWriteAf(
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- PAF_AudioFrame *pAfWrt // audio frame from which to write
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ PAF_AudioFrame *pAfWrt // audio frame from which to write
)
{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_DecOpCircBuf *pCb;
PAF_AudioFrame *pAfCb;
PAF_ChannelMask_HD streamMask;
Int8 i;
Int16 j;
+ // Get gate handle
+ gateHandle = pCbCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ // Get circular buffer base pointer
+ pCb = &pCbCtl->xDecOpCb[cbIdx];
+
// (***) FL: revisit
// Invalidate circular buffer configuration.
// NOTE: Probably only a subset of this information nexeds to be updated.
if (pCb->numAfCb >= pCb->maxNumAfCb)
{
pCb->errOvrCnt++;
+
//SW_BREAKPOINT;
Log_info1("cbWriteAf: ERROR: overflow, numAfCb=%d", pCb->numAfCb);
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
return ASP_DECOP_CB_WRITE_OVERFLOW;
}
Cache_wait();
}
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
return ASP_DECOP_CB_SOK;
}
// Get next audio frame to write in circular buffer
Int cbGetNextWriteAf(
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- PAF_AudioFrame **ppAfWrt // audio frame next to be written
+ 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
)
{
+ 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->xDecOpCb[cbIdx];
+
// get pointer to current audio frame in circular buffer
*ppAfWrt = &pCb->afCb[pCb->afWrtIdx];
pCb->afWrtIdx = 0;
}
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
return ASP_DECOP_CB_SOK;
}
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/aspDecOpCircBuf_slave.h b/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/aspDecOpCircBuf_slave.h
index 2759e378a5b0011878ad5db6c6b4f122a3c9a4db..4e4dbf1433e028f515b011e8a01623ff506b7918 100644 (file)
#include "paftyp.h"
#include "aspDecOpCircBuf_common.h"
-#define ASP_DECOP_CB_WRITE_OVERFLOW ( ASP_DECOP_CB_SOK-1 ) // error: write overflow
+#define ASP_DECOP_CB_WRITE_OVERFLOW ( ASP_DECOP_CB_ERR_START-1 ) // error: write overflow
// Start writes to circular buffer
Int cbWriteStart(
- PAF_AST_DecOpCircBuf *pCb // decoder output circular buffer
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx // decoder output circular buffer index
);
// Stop writes to circular buffer
Int cbWriteStop(
- PAF_AST_DecOpCircBuf *pCb // decoder output circular buffer
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx // decoder output circular buffer index
);
// Write audio frame to circular buffer
Int cbWriteAf(
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- PAF_AudioFrame *pAfWrt // audio frame from which to write
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ PAF_AudioFrame *pAfWrt // audio frame from which to write
);
// Get next audio frame to write in circular buffer
Int cbGetNextWriteAf(
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- PAF_AudioFrame **ppAfWrt // audio frame next to be written
+ 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 /* _ASP_DECOP_CB_SLAVE_H_ */
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/audioStreamDecodeProc.c b/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/audioStreamDecodeProc.c
index 6d0fec4b04c128022b639e7012127b84dc503d4b..e7ab2ca2a2fc7b9d819fa27323c1e98bd76dd170 100644 (file)
PAF_ASDT_Config gPAF_ASDT_config
__attribute__ ((section(".globalSectionPafAsdtConfig"))) = {
NULL, // acp
+ {NULL, NULL}, // decOpCircBufCtl
&gPAF_AST_config // ASIT/ASOT/ASDT shared configuration
};
Int size;
Int argIdx;
// Decoder output circular buffer
- PAF_AST_DecOpCircBuf *pCb;
+ PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
+ //PAF_AST_DecOpCircBuf *pCb;
PAF_AudioFrame *pAfWrt;
Int cbErrno;
// Messaging
// Audio Framework Configuration (*pC):
//
pC = &gPAF_ASDT_config;
- pAstCfg = pC->pAstCfg;
+ pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+ pCbCtl = &pC->decOpCircBufCtl; // get pointer to circular buffer control
// wait for initialization message from master
do {
}
// Start writes to circular buffer
- pCb = &pAstCfg->xDecOpCb[z];
- cbErrno = cbWriteStart(pCb);
+ //pCb = &pAstCfg->xDecOpCb[z];
+ cbErrno = cbWriteStart(pCbCtl, z);
if (cbErrno < 0)
{
SW_BREAKPOINT;
}
// FL: debug, log circular buffer control variables
- cbLog(pCb, 1, "cbWriteStart");
+ cbLog(pCbCtl, z, 1, "cbWriteStart");
// Reset audio frame
resetAf(pP, z, sourceSelect);
//TRACE_TERSE0("Dec:decode done");
// copy decoder output to decoder output circular buffers
- pCb = &pAstCfg->xDecOpCb[z];
+ //pCb = &pAstCfg->xDecOpCb[z];
//TRACE_TERSE1("Dec:pCb=0x%04x", (IArg)pCb);
pAfWrt = pAstCfg->xDec[z].decodeOutStruct.pAudioFrame;
// Log_info0("capAfWrite() error");
//}
- cbErrno = cbWriteAf(pCb, pAfWrt);
+ cbErrno = cbWriteAf(pCbCtl, z, pAfWrt);
if (cbErrno < 0)
{
SW_BREAKPOINT;
//TRACE_TERSE0("Dec:cbWriteAf() complete");
// FL: debug, log circular buffer control variables
- cbLog(pCb, 1, "cbWriteAf");
+ cbLog(pCbCtl, z, 1, "cbWriteAf");
}
// write back Dec configuration
}
// Stop writes to circular buffer
- pCb = &pAstCfg->xDecOpCb[z];
- cbErrno = cbWriteStop(pCb);
+ //pCb = &pAstCfg->xDecOpCb[z];
+ cbErrno = cbWriteStop(pCbCtl, z);
if (cbErrno < 0)
{
SW_BREAKPOINT;
}
// FL: debug, log circular buffer control variables
- cbLog(pCb, 1, "cbWriteStop");
+ cbLog(pCbCtl, z, 1, "cbWriteStop");
// send dec deactivate complete message to master
queId = MessageQ_getReplyQueue(pAspMsg);
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/audioStreamDecodeProc.h b/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/audioStreamDecodeProc.h
index da0aacef8a973d9dfe8ca009ef762fd39c9d7c5e..3fa0fca5d665429c3dfb960bd4c412416191bcb7 100644 (file)
#include "audioStreamProc_params.h"
#include "audioStreamProc_patchs.h"
#include "audioStreamProc_config.h"
+#include "aspDecOpCircBuf_common.h"
struct PAF_ASDT_Params;
struct PAF_ASDT_Patchs;
typedef struct PAF_ASDT_Config
{
ACP_Handle acp;
+ PAF_AST_DecOpCircBufCtl decOpCircBufCtl; // decoder output circular buffer control
PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
} PAF_ASDT_Config;
Int z
);
+extern PAF_ASDT_Config gPAF_ASDT_config;
#endif /* _ASDP_H_ */
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/systemInit.c b/processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/systemInit.c
index ad9831761b888a2032172ec30272c3b35aabdab6..dd6b2a10b13ceb0ec17fffd6bbb65ce2430b496a 100644 (file)
#include "pafhjt.h"
#include "paf_heapMgr.h"
+#include "aspDecOpCircBuf_slave.h"
+#include "audioStreamProc_common.h"
+#include "audioStreamDecodeProc.h"
const PAFHJT_t *pafhjt;
return;
}
+ /* Initialize decoder output circular buffer control */
+ status = cbCtlInit(&gPAF_ASDT_config.decOpCircBufCtl, gPAF_AST_config.xDecOpCb);
+ if (status < 0)
+ {
+ Log_info1("%s: unable to initialize Decoder Output Circular Buffer Control. Exiting.", (IArg)__TASK_NAME__);
+ return;
+ }
+
/* Initialize PAF heap manager */
Log_info0("taskSysInitFxn:pafHeapMgr_init()");
pafHeapMgr_init((IHeap_Handle)heapMemL2Sram,
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c
index 948c1fb9b4716d0092a1f8f27a07b1421a1dff51..e8c86a38635ff25401a670e58a04ff6f57cc7c75 100644 (file)
#include <xdc/std.h>
#include <ti/sysbios/hal/Cache.h>
#include <xdc/runtime/Log.h>
+#include <ti/ipc/GateMP.h>
#include "common.h"
#include "paftyp.h"
Int16 strFrameLen // stream frame length (output transaction size)
);
+
+// Initialize circular buffer control
+Int cbCtlInit(
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ PAF_AST_DecOpCircBuf *xDecOpCb // decoder output circular buffer base pointer
+)
+{
+ 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->xDecOpCb = xDecOpCb;
+
+ return ASP_DECOP_CB_SOK;
+
+}
+
// Initialize circular buffer
Int cbInit(
- Int8 sourceSelect, // source select (PCM, DDP, etc.)
- Int16 decOpFrameLen, // decoder output frame length (PCM samples)
- Int16 strFrameLen, // stream frame length (PCM samples)
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- Int8 resetRwFlags // whether to reset reader, writer, and empty flags
+ 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)
+ Int16 strFrameLen, // stream frame length (PCM samples)
+ Int8 resetRwFlags // whether to reset reader, writer, and empty flags
)
{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_DecOpCircBuf *pCb;
PAF_AudioFrame *pAfCb;
PAF_AudioData *pPcmBuf;
UInt8 *pMetaBuf; //QIN
Int8 n;
Int8 i;
+ // Get gate handle
+ gateHandle = pCbCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ // Get circular buffer base pointer
+ pCb = &pCbCtl->xDecOpCb[cbIdx];
+
// set input frame length
pCb->decOpFrameLen = decOpFrameLen;
}
else
{
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
return ASP_DECOP_CB_INIT_INV_SOURCE_SEL;
}
}
Cache_wait();
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
return ASP_DECOP_CB_SOK;
}
// Start reads from circular buffer
Int cbReadStart(
- PAF_AST_DecOpCircBuf *pCb // decoder output circular buffer
+ 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->xDecOpCb[cbIdx];
+
// Invalidate circular buffer configuration
Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
Cache_wait();
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;
}
// Stop reads from circular buffer
Int cbReadStop(
- PAF_AST_DecOpCircBuf *pCb // decoder output circular buffer
+ 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->xDecOpCb[cbIdx];
+
// Invalidate circular buffer configuration
Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
Cache_wait();
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;
}
// Read audio frame from circular buffer
Int cbReadAf(
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- PAF_AudioFrame *pAfRd // audio frame into which to read
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ PAF_AudioFrame *pAfRd // audio frame into which to read
)
{
+ IArg key;
+ GateMP_Handle gateHandle;
+ PAF_AST_DecOpCircBuf *pCb;
PAF_AudioFrame *pAfCb;
PAF_ChannelMask_HD streamMask;
Int8 i;
Int16 j;
+ // Get gate handle
+ gateHandle = pCbCtl->gateHandle;
+ // Enter gate
+ key = GateMP_enter(gateHandle);
+
+ // Get circular buffer base pointer
+ pCb = &pCbCtl->xDecOpCb[cbIdx];
+
// (***) FL: revisit
// Invalidate circular buffer configuration.
Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
// writer is active AND draining circular buffer
Log_info2("cbReadAf: ERROR: writerActiveFlag=%d, emptyFlag=%d", pCb->writerActiveFlag, pCb->emptyFlag);
SW_BREAKPOINT; // FL: debug
+
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
return ASP_DECOP_CB_READ_INVSTATE;
}
//
cbReadAfMute(pAfRd, pCb->strFrameLen);
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
return ASP_DECOP_CB_SOK;
}
Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
Cache_wait();
+ // Leave the gate
+ GateMP_leave(gateHandle, key);
+
return ASP_DECOP_CB_READ_UNDERFLOW;
}
}
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;
}
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/aspDecOpCircBuf_master.h b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/aspDecOpCircBuf_master.h
index fd297784fa941dd9f65e468be5afb60faf6e5d67..eb4e89b86d065cfaca9e28d58c7b89ac1291c184 100644 (file)
#include "paftyp.h"
#include "aspDecOpCircBuf_common.h"
-#define ASP_DECOP_CB_INIT_INV_SOURCE_SEL ( ASP_DECOP_CB_SOK-1 ) // error: invalid source selection on init
-#define ASP_DECOP_CB_READ_UNDERFLOW ( ASP_DECOP_CB_SOK-2 ) // error: read underflow
-#define ASP_DECOP_CB_READ_INVSTATE ( ASP_DECOP_CB_SOK-3 ) // error: circular buffer invalid state on read
+#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
// Initialize circular buffer
Int cbInit(
- Int8 sourceSelect, // source select (PCM, DDP, etc.)
- Int16 decOpFrameLen, // decoder output frame length (PCM samples)
- Int16 strFrameLen, // stream frame length (PCM samples)
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- Int8 resetRwFlags // whether to reset reader, writer, and empty flags
+ 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)
+ Int16 strFrameLen, // stream frame length (PCM samples)
+ Int8 resetRwFlags // whether to reset reader, writer, and empty flags
);
// Start reads from circular buffer
Int cbReadStart(
- PAF_AST_DecOpCircBuf *pCb // decoder output circular buffer
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx // decoder output circular buffer index
);
// Stop reads from circular buffer
Int cbReadStop(
- PAF_AST_DecOpCircBuf *pCb // decoder output circular buffer
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx // decoder output circular buffer index
);
// Read audio frame from circular buffer
Int cbReadAf(
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- PAF_AudioFrame *pAfRd // audio frame into which to read
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ PAF_AudioFrame *pAfRd // audio frame into which to read
);
// Write audio frame to circular buffer
Int cbWriteAf(
- PAF_AST_DecOpCircBuf *pCb, // decoder output circular buffer
- PAF_AudioFrame *pAfWrt // audio frame from which to write
+ PAF_AST_DecOpCircBufCtl *pCbCtl, // decoder output circular buffer control
+ Int8 cbIdx, // decoder output circular buffer index
+ PAF_AudioFrame *pAfWrt // audio frame from which to write
);
#endif /* _ASP_DECOP_CB_MASTER_H_ */
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamInpProc.c b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamInpProc.c
index 6fe77021fc1ad1480c67e75bc94a079f34004ba2..5209f7048bce82af4c6159d546eb3c8c0f6b2873 100644 (file)
)
{
PAF_AST_Config *pAstCfg;
- Int as; /* Audio Stream Number (1, 2, etc.) */
+ PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
+ PAF_AST_DecOpCircBuf *pCb; /* Decoder output circular buffer */
+ Int as; /* Audio Stream Number (1, 2, etc.) */
Int zMS;
- Int z; /* decode counter */
- PAF_AST_DecOpCircBuf *pCb; /* Decoder output circular buffer */
- Int errno; /* error number */
+ Int z; /* decode counter */
+ Int errno; /* error number */
Error_Block eb;
Int i;
// FL: (***)revisit
-
pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
as = pAstCfg->as;
zMS = pAstCfg->masterStr;
+
+ pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
/* Decode output circular buffer memory */
if (!(pAstCfg->xDecOpCb = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM,
// (***) FL: revisit, here PCM is hard-coded for 256 sample dec op frame length
// Initialize decoder output circular buffer for PCM
- errno = cbInit(PAF_SOURCE_PCM, 256, FRAMELENGTH, pCb, 1);
+ errno = cbInit(pCbCtl, z, PAF_SOURCE_PCM, 256, FRAMELENGTH, 1);
if (errno)
{
SW_BREAKPOINT; // FL: debug
return errno;
}
// FL: debug
- cbLog(pCb, 1, "PAF_ASIT_initPhaseDecOpCircBuf:cbInit");
+ cbLog(pCbCtl, z, 1, "PAF_ASIT_initPhaseDecOpCircBuf:cbInit");
}
return 0;
)
{
PAF_AST_Config *pAstCfg;
- Int as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* decode/encode counter */
- Int errno; /* error number */
+ 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 */
Int zI, zS;
Int zMD;
Int zMI;
- ASP_Msg* pAspMsg; /* Messaging */
+ ASP_Msg* pAspMsg; /* Messaging */
Int argIdx;
Int decErrno;
Int status;
- PAF_AST_DecOpCircBuf *pCb; /* Decoder output circular buffer */
pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
as = pAstCfg->as;
zMI = pP->zone.master;
(void)as; // clear compiler warning in case not used with tracing disabled
+ pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
+
// reset frameCount
for (z=DECODE1; z < DECODEN; z++)
{
//pC->xDec[z].decodeControl.rdSampleCount = 0;
// Initialize decoder output circular buffer for selected source
- pCb = &pAstCfg->xDecOpCb[z];
- errno = cbInit(sourceSelect, frameLength, FRAMELENGTH, pCb, 0);
+ errno = cbInit(pCbCtl, z, sourceSelect, frameLength, FRAMELENGTH, 0);
if (errno)
{
SW_BREAKPOINT; // FL: debug
return errno;
}
// FL: debug
- cbLog(pCb, 1, "PAF_ASIT_decodeInit:cbInit");
+ cbLog(pCbCtl, z, 1, "PAF_ASIT_decodeInit:cbInit");
if (z != zMD)
{
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamOutProc.c b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamOutProc.c
index 9ff831a028aac8008d8abdabe96bc0035c7f7260..7d0b61271fe644663849a3fb7098e0d4b459cafa 100644 (file)
)
{
PAF_AST_Config *pAstCfg;
- Int as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* decode/encode counter */
- Int errno; /* error number */
+ 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 */
Int zO, zS;
- PAF_AST_DecOpCircBuf *pCb; /* decoder output circular buffer */
pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
as = pAstCfg->as;
+ pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
+
for (z=DECODE1; z < DECODEN; z++)
{
// Start decoder output circular buffer reads
- pCb = &pAstCfg->xDecOpCb[z];
- errno = cbReadStart(pCb);
+ errno = cbReadStart(pCbCtl, z);
if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeInit:cbReadStart() error=%d", errno);
return errno;
}
// FL: debug
- cbLog(pCb, 1, "PAF_ASOT_decodeInit:cbReadStart");
+ cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeInit:cbReadStart");
}
// TODO: move this to start of this function so that it doesn't affect IO timing
)
{
PAF_AST_Config *pAstCfg;
+ PAF_AST_DecOpCircBufCtl *pCbCtl; /* Decoder output circular buffer control */
Int z; /* decode/stream counter */
- PAF_AST_DecOpCircBuf *pCb; /* decoder output circular buffer */
PAF_AudioFrame *pAfRd;
Int cbErrno;
Int errno;
pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
+
+ pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
for (z=DECODE1; z < DECODEN; z++)
{
//
// (***) FL: read circular buffer
//
- pCb = &pAstCfg->xDecOpCb[z];
pAfRd = pAstCfg->xStr[zS].pAudioFrame;
- cbErrno = cbReadAf(pCb, pAfRd);
+ cbErrno = cbReadAf(pCbCtl, z, pAfRd);
if (cbErrno != 0)
{
TRACE_TERSE1("PAF_ASOT_decodeStream:cbReadAf() error=%d", cbErrno);
//Log_info0("PAF_ASOT_decodeStream:cbReadAf() complete.");
// FL: debug
- cbLog(pCb, 1, "PAF_ASOT_decodeStream:cbReadAf");
+ cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeStream:cbReadAf");
//if (capAfWrite(pAfRd, 0) != CAP_AF_SOK)
//{
// Log_info0("capAfWrite() error");
)
{
PAF_AST_Config *pAstCfg;
- Int as; /* Audio Stream Number (1, 2, etc.) */
- Int z; /* decode/encode counter */
- Int errno; /* error number */
- PAF_AST_DecOpCircBuf *pCb; /* decoder output circular buffer */
+ 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 */
pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
as = pAstCfg->as;
(void)as; // clear compiler warning in case not used with tracing disabled
+ pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
+
for (z=DECODE1; z < DECODEN; z++)
{
// Stop decoder output circular buffer reads
- pCb = &pAstCfg->xDecOpCb[z];
- errno = cbReadStop(pCb);
+ errno = cbReadStop(pCbCtl, z);
if (errno)
{
TRACE_TERSE1("PAF_ASOT_decodeComplete:cbReadStop() error=%d", errno);
return errno;
}
// FL: debug
- cbLog(pCb, 1, "PAF_ASOT_decodeComplete:cbReadStop");
+ cbLog(pCbCtl, z, 1, "PAF_ASOT_decodeComplete:cbReadStop");
}
pP->fxns->streamChainFunction(pP, pQ, pC, PAF_ASP_CHAINFRAMEFXNS_FINAL, 0, frame);
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamProc_master.h b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamProc_master.h
index 3d1526dbcecd9342c976d18b13880dd77a231353..3a458a5645f36de1e6dd94d56e0fc3483b879540 100644 (file)
// Audio Stream Input/Output Task shared
typedef struct PAF_ASPM_Config
{
- PAF_AST_DecOpCircBufCtrl decOpCircBufCtrl;
+ PAF_AST_DecOpCircBufCtl decOpCircBufCtl; // decoder output circular buffer control
} PAF_ASPM_Config;
extern PAF_ASPM_Config gPAF_ASPM_config;
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/systemInit.c b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/systemInit.c
index d85d0a28433001e690c440cd47f500d16738089f..f5e1a7448403c1f9d5438a7210d3a2758fcd4bfe 100644 (file)
#include "paf_heapMgr.h"
#include "aspMsg_common.h"
#include "aspMsg_master.h"
+#include "aspDecOpCircBuf_master.h"
+#include "audioStreamProc_master.h" // ASIT/ASOT config
+#include "audioStreamProc_common.h" // ASIT/ASOT/ASDT config
#include "fwkSim.h"
extern Void ACP_main_cus(Void); // (*** ?) FL: revisit -- check method of patching alpha codes
return;
}
+ /* Initialize decoder output circular buffer control */
+ status = cbCtlInit(&gPAF_ASPM_config.decOpCircBufCtl, gPAF_AST_config.xDecOpCb);
+ if (status < 0)
+ {
+ Log_info0("TaskSysInit: unable to initialize Decoder Output Circular Buffer Control. Exiting.");
+ return;
+ }
+
/* Initialize PAF heap manager */
Log_info0("taskSysInitFxn:pafHeapMgr_init()");
regionId = SharedRegion_getIdByName("SR_MSMC");