diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.h b/pasdk/test_dsp/framework/audioStreamInpProc.h
index e2bc5fdcd1772a83265c9a7ead3d875724ce5ec6..a9b791c0a7d075aa293241a4f81588cd9c092123 100644 (file)
/*
-Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
+Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
All rights reserved.
* Redistribution and use in source and binary forms, with or without
#include "audioStreamProc_patchs.h"
#include "audioStreamProc_config.h"
#include "audioStreamProc_master.h"
+#include "statusOp_common.h"
+#include "ioPhy.h"
+#include "ioBuff.h"
+#include "ioData.h"
// Global debug counter */
extern Uint32 gTaskAsipCnt; // debug counter for ASP task
Int (*autoProcessing) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, ALG_Handle);
Int (*decodeProcessing) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int);
Int (*decodeCommand) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *);
- //Int (*encodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
Int (*decodeInit) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int);
Int (*decodeInfo) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int);
Int (*decodeInfo1) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int);
Int (*decodeInfo2) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int);
//Int (*decodeCont) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
Int (*decodeDecode) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int, Int);
- //Int (*decodeStream) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
- //Int (*decodeEncode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
Int (*decodeFinalTest) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int);
Int (*decodeComplete) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, ALG_Handle *, Int, Int);
Int (*selectDevices) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *);
Int (*sourceDecode) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int);
- //Int (*startOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
- //Int (*stopOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
- //Int (*setCheckRateX) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
- //Int (*streamChainFunction) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
Int (*deviceAllocate) (SIO_Handle *, int, int, int, Ptr);
Int (*deviceSelect) (SIO_Handle *, int, int, Ptr);
Int (*computeFrameLength) (Int, Int, Int);
Int (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
- Void (*memStatusPrint)(HeapMem_Handle
- hInternalHeap,
+ Void (*memStatusPrint)(
+ CString header,
+ HeapMem_Handle hInternalHeap,
HeapMem_Handle hInternal1Heap,
HeapMem_Handle hExternalHeap,
HeapMem_Handle hInternal1HeapShm,
const SmInt *inputsFromDecodes;
const SmInt *outputsFromEncodes;
struct {
- int *pHeapIdIntern; //int *pIntern;
- int *pHeapIdExtern; //int *pExtern;
- int *pHeapIdInpbuf; //int *pInpbuf;
- int *pHeapIdOutbuf; //int *pOutbuf;
- int *pHeapIdFrmbuf; //int *pFrmbuf;
- int *pHeapIdIntern1; //int *pIntern1;
+ int *pHeapIdIntern; // INT memory heap ID
+ int *pHeapIdExtern; // EXT memory heap ID
+ int *pHeapIdInpbuf; // IB buffer heap ID
+ int *pHeapIdOutbuf; // OB buffer heap ID
+ int *pHeapIdFrmbuf; // Frame buffer heap ID
+ int *pHeapIdIntern1; // INT1 memory heap ID
+ int *pHeapIdInt1Shm; // INT1 SHared Memory heap ID
+ int *pHeapIdExtShm; // EXT SHared Memory heap ID
+ int *pHeapIdExtNonCachedShm; // EXT Non-Cached SHared Memory heap ID
int clear;
} heap;
struct {
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
//const PAF_ASP_LinkInit * const (*i_encLinkInit);
} PAF_ASIT_Patchs;
+enum {
+ ASIP_NO_ERR,
+ ASIP_ERR_AUTO_DETECION,
+ ASIP_ERR_NO_MATCHING_SOURCE,
+ ASIP_ERR_SWITCH_TO_PCM,
+ ASIP_ERR_D10_CFG,
+ ASIP_ERR_MCASP_CFG,
+ ASIP_ERR_INPUT_CFG,
+ ASIP_ERR_DECODE_INIT,
+ ASIP_ERR_DECODE_COMMAND,
+ ASIP_ERR_DECODE_INFO1,
+ ASIP_ERR_DECODE_INFO2,
+ ASIP_ERR_DECODE_DATA,
+ ASIP_ERR_DECODE_FINAL,
+ ASIP_ERR_DECODE_COMPLETE,
+ ASIP_ERR_DECODE_MSG,
+ ASIP_ERR_DECODE_QUIT,
+ ASIP_ERR_ABORT
+};
+
+enum {
+ ASIT_NO_ERR,
+ ASIT_ERR_IOBUFF_INIT,
+ ASIT_ERR_IODATA_INIT,
+ ASIT_ERR_IOPYH_INIT,
+ ASIT_ERR_INPDATA_PROC,
+ ASIT_ERR_INPBUF_UNDERFLOW,
+ ASIT_ERR_AUTO_DETECION,
+ ASIT_ERR_NO_MATCHING_SOURCE,
+ ASIT_ERR_SWITCH_TO_PCM,
+ ASIT_ERR_D10_CFG,
+ ASIT_ERR_MCASP_CFG,
+ ASIT_ERR_INPUT_CFG,
+ ASIT_ERR_DECODE_INIT,
+ ASIT_ERR_DECODE,
+ ASIT_ERR_DECODE_COMMAND,
+ ASIT_ERR_DECODE_INFO1,
+ ASIT_ERR_DECODE_INFO2,
+ ASIT_ERR_DECODE_DATA,
+ ASIT_ERR_DECODE_FINAL,
+ ASIT_ERR_DECODE_COMPLETE,
+ ASIT_ERR_DECODE_MSG,
+ ASIT_ERR_DECODE_QUIT,
+ ASIP_ERR_DECODE_ABORT,
+ ASIT_ERR_EVENTS,
+ ASIT_ERR_ABORT
+};
+
+enum {
+ DEC_NO_ERR,
+ DEC_ERR_SOURCE_NONE,
+ DEC_ERR_ASPERR_ABORT,
+ DEC_ERR_ASPERR_QUIT,
+ DEC_ERR_WRONG_MSG,
+ DEC_ERR_INFO_SNDMSG,
+ DEC_ERR_INFO_ACKMSG,
+ DEC_ERR_DECODE_SNDMSG,
+ DEC_ERR_DECODE_ACKMSG,
+ DEC_ERR_DECODE_FINAL,
+ DEC_ERR_COMPLETE_MSG
+};
+
+
+#define DEC_MSGMSK_INPDATA 0x1
+#define DEC_MSGMSK_INFOACK 0x2
+#define DEC_MSGMSK_DECACK 0x4
+
+
+// Input I/O structure
+typedef struct PAF_AST_InpIO {
+ ioPhyHandle_t hIoPhy; /* handle to I/O physical layer */
+ ioBuffHandle_t hIoBuff; /* handle to I/O buffer management */
+ ioDataHandle_t hIoData; /* handle to I/O data processing */
+ Ptr hMcaspChan;
+ const void *pRxParams; /* pointer to D10 Rx Params */
+
+ Int sourceSelect;
+ Int sourceProgram;
+
+ Int preSyncState;
+ Int numPrimeXfers;
+ Int mcaspXferErr;
+/*
+ void *mcaspRxBuf1;
+ void *mcaspRxBuf2;
+ uint32_t mcaspRxSize1;
+ uint32_t mcaspRxSize2;
+ Int mcaspRxtwoXfers;
+*/
+ // debugging counters
+ //uint32_t numXferStart;
+ //uint32_t numXferFinish;
+ //uint32_t numXferInterm;
+ uint32_t numInputOverrun;
+ uint32_t numUnderflow;
+ uint32_t numAsitRestart;
+ uint32_t numAsitDecodeQuit;
+ uint32_t numFrameReceived;
+ uint32_t numPcmFrameReceived;
+
+ size_t phyXferSize;
+ int_fast32_t pcmSwitchHangOver;
+ uint_least16_t asipState;
+ //uint_least16_t asipProcState;
+ bool buffReadComplete;
+ bool swapData;
+ bool firstTimeInit;
+} PAF_AST_IoInp;
+
+// Decoder structure
+typedef struct asipDecProc_s {
+ Int state;
+ Int frame;
+ Int block;
+
+ Int majorAuFound;
+ Int initDone;
+ Int decodeAckDelayed;
+} asipDecProc_t;
+
// Audio Stream Input Task (ASIT) configuration
typedef struct PAF_ASIT_Config {
- Task_Handle taskHandle; // ASIT handle
- ACP_Handle acp; // ASIT local ACP handle
- PAF_ASPM_Config *pAspmCfg; // ASIT/ASOT shared configuration
- PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ Task_Handle taskHandle; // ASIT handle
+ ACP_Handle acp; // ASIT local ACP handle
+ PAF_ASPM_Config *pAspmCfg; // ASIT/ASOT shared configuration
+ PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
+ PAF_AST_IoInp *pIoInp;
+ asipDecProc_t inpDec;
} PAF_ASIT_Config;
PAF_ASIT_initPhaseMalloc(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// Purpose: Audio Stream Input Task Function for initialization of data values
PAF_ASIT_initPhaseConfig(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// Purpose: Audio Stream Input Task Function for initialization of ACP by
PAF_ASIT_initPhaseAcpAlg(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// (***) FL: re-visit this, ASIT/ASOT currently consider common memory independently.
PAF_ASIT_initPhaseCommon(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// Purpose: Audio Stream Input Task Function for initialization of ASP algorithms.
PAF_ASIT_initPhaseAspAlg(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// Purpose: Audio Stream Input Task Function for initialization of data values
PAF_ASIT_initPhaseAlgKey(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// Purpose: Audio Stream Input Task Function for initialization of Decoder Output Circular Buffer.
PAF_ASIT_initPhaseDecOpCircBuf(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// Purpose: Audio Stream Input Task Function for initialization of Input Devices.
PAF_ASIT_initPhaseDevice(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ 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
PAF_AST_initFrame1(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_AST_Config *pC,
+ PAF_AST_Config *pAsitCfg,
Int z,
Int apply
);
PAF_ASIT_autoProcessing(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int inputTypeSelect,
ALG_Handle pcmAlgMaster);
PAF_ASIT_decodeProcessing(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int sourceSelect
);
PAF_ASIT_decodeCommand(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// Purpose: Decoding Function for reinitializing the decoding process.
PAF_ASIT_decodeInit(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int sourceSelect
);
PAF_ASIT_decodeInfo(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int frame,
Int block
);
PAF_ASIT_decodeInfo1(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int frame,
Int block
);
PAF_ASIT_decodeInfo2(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int frame,
Int block
);
+#if 0
// Purpose: Decoding Function for processing that occurs subsequent to
// information processing but antecedent to timing processing
// for frames of input data other than the initial one.
PAF_AST_decodeCont(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
ALG_Handle decAlg[],
Int frame,
Int block
);
+#endif
// Purpose: Decoding Function for processing of input data by the
// Decode Algorithm.
PAF_ASIT_decodeDecode(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int sourceSelect,
Int frame,
Int block
PAF_ASIT_decodeFinalTest(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int frame,
Int block
);
PAF_ASIT_decodeComplete(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
ALG_Handle decAlg[],
Int frame,
Int block
PAF_ASIT_selectDevices(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
+ PAF_ASIT_Config *pAsitCfg
);
// Purpose: Audio Stream Input Task Function for selecting the sources used
PAF_ASIT_sourceDecode(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int x
);
-// Purpose: Decoding Function for terminating output.
-Int
-PAF_AST_stopOutput(
- const PAF_ASIT_Params *pP,
- const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC
-);
-
// Purpose: Common Function for processing algorithm chains.
Int
PAF_AST_streamChainFunction(
const PAF_ASIT_Params *pP,
const PAF_ASIT_Patchs *pQ,
- PAF_ASIT_Config *pC,
+ PAF_ASIT_Config *pAsitCfg,
Int iChainFrameFxns,
Int abortOnError,
Int logArg
);
+// Purpose: writing 8-bit integer to shared memeory
+static inline
+sharedMemWriteInt8(
+ volatile XDAS_Int8 *address, /* address to write to */
+ Int8 value, /* value to write to the adddress */
+ Int gateIdx) /* GateMP Index, defined in statusOp_common.h */
+{
+#ifdef NON_CACHE_STATUS
+ statusOp_write((void *)address, (void *)&value, sizeof(Int8), gateIdx);
+#else
+ *address = value;
+#endif
+}
+
+// Purpose: read 8-bit integer from shared memeory
+static inline Int8 /* return the value read in the shared memory */
+sharedMemReadInt8(
+ volatile XDAS_Int8 *address, /* address to read from */
+ Int gateIdx) /* GateMP Index, defined in statusOp_common.h */
+{
+#ifdef NON_CACHE_STATUS
+ Int8 tempVar;
+ statusOp_read((void *)&tempVar, (void *)address, sizeof(Int8), gateIdx);
+
+ return tempVar;
+#else
+ return(*address);
+#endif
+}
+
+// Purpose: writing 32-bit integer to shared memeory
+static inline sharedMemWriteInt(volatile XDAS_Int32 *address, Int value, Int gateIdx)
+{
+#ifdef NON_CACHE_STATUS
+ statusOp_write((void *)address, (void *)&value, sizeof(Int), gateIdx);
+#else
+ *address = value;
+#endif
+}
+
+// Purpose: read 32-bit integer from shared memeory
+static inline Int sharedMemReadInt(volatile XDAS_Int32 *address, Int gateIdx)
+{
+#ifdef NON_CACHE_STATUS
+ Int tempVar;
+ statusOp_read((void *)&tempVar, (void *)address, sizeof(Int), gateIdx);
+
+ return tempVar;
+#else
+ return(*address);
+#endif
+}
+
+Int asitUpdateInputStatus(const void *pRxParams, PAF_InpBufStatus *pStatus,
+ PAF_InpBufConfig *pInpBuf);
+/*
+Int asipDecodeInit(
+ const PAF_ASIT_Params *pP,
+ PAF_ASIT_Config *pAsitCfg,
+ Int sourceSelect);
+*/
+/*Int asipDecodeProcessing(
+ const PAF_ASIT_Params *pP,
+ const PAF_ASIT_Patchs *pQ,
+ PAF_ASIT_Config *pAsitCfg,
+ Int sourceSelect);*/
+Int asitDecodeProcessing(const PAF_ASIT_Params *pP,
+ const PAF_ASIT_Patchs *pQ,
+ PAF_ASIT_Config *pAsitCfg,
+ UInt asitEvents);
+
+Int decDecodeInit(
+ const PAF_ASIT_Params *pP,
+ PAF_ASIT_Config *pAsitCfg,
+ Int sourceSelect);
+
+Int decDecodeFsm(
+ const PAF_ASIT_Params *pP,
+ const PAF_ASIT_Patchs *pQ,
+ PAF_ASIT_Config *pAsitCfg,
+ Int sourceSelect,
+ UInt decMsg);
+
+Int getFrameLengthSourceSel(
+ const PAF_ASIT_Params *pP,
+ Int8 sourceSelect);
+
+Int rxDecodePcm(PAF_AST_IoInp *pInp);
+
+Int rxDecodeBitStream(PAF_AST_IoInp *pInp);
+
+Int rxDecodePlayZero(PAF_AST_IoInp *pInp);
#endif /* _ASIP_H_ */