diff --git a/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c b/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c
index 84d525c83631c5869794344ccac9edb3121db9df..7aec882afcf7ddb68b12db930d0c509e88dc515c 100644 (file)
#include "ioPhy.h"
#include "ioData.h"
+#include <pa_i13_evmk2g_io_a.h>
#define STRIDE_WORST_CASE 32 // 4-byte (32-bit) word, 2 slots, 4 serializers
@@ -113,6 +114,7 @@ extern Void taskAsipFxnInit(const PAF_ASIT_Params *pP,const PAF_ASIT_Patchs *pQ)
extern XDAS_Int32 D10_initClkMux(void *pD10Params);
extern XDAS_Int32 D10_RxControl(const void *pD10RxParams,
XDAS_Int32 code, XDAS_Int32 arg);
+extern Aud_STATUS D10_initHDMI(void);
/*
* Functions only used in this file
asitErr = asitInputDataProcess(pInp, &autoDetStatus);
if(asitErr != ASIT_NO_ERR) {
// Even though there is error, still need to start next transfer to
- // maintain McASP transfer.
+ // maintain McASP transfer, before returning error.
asitPhyTransferStart(pInp);
return asitErr;
if(autoDetStatus.syncState == IODATA_SYNC_BITSTREAM) {
// Input is bit stream: go to decoding
pInp->asipState = ASIT_DECODE_PROCESSING;
+ TRACE_VERBOSE0("Bit stream detected. Go to decoding. ");
}
else {
// Input is PCM: stop swapping data
// always point to PCM data from 1st I2S (out of 4 for HDMI 4xI2S)
ioBuffAdjustDelay(pInp->hIoBuff, pInp->phyXferSize);
+ // Mute decoder output during PCM transition
+ pAstCfg->xInp[zMD].inpBufConfig.deliverZeros = TRUE;
+
// Go to transition state to switch to PCM
pInp->asipState = ASIT_PCM_TRANSITION;
+ TRACE_VERBOSE0("PCM stream detected. Go to PCM transition. ");
}
}
}
pInp->pcmSwitchHangOver--;
if(pInp->pcmSwitchHangOver == 0) {
pInp->asipState = ASIT_DECODE_PROCESSING;
+
+ // Unmute decoder output after PCM transition
+ pAsitCfg->pAstCfg->xInp[zMD].inpBufConfig.deliverZeros = FALSE;
}
else {
; // stay in this state
// Inform decoder to complete the decoding of previous frame - is this good?
pInp->sourceSelect = PAF_SOURCE_NONE;
- pInp->numFrameReceived = 0; // for debugging
+ pInp->numFrameReceived = 0; // for debugging
+ pInp->numPcmFrameReceived = 0; // for debugging
TRACE_TERSE0("asitDecodeProcessing: SYNC lost.");
#ifdef DEBUG_SKIP_DECODING
#endif
}
else {
- pInp->numFrameReceived += 1; // for debugging
+ if(autoDetStatus.syncState == IODATA_SYNC_PCM) {
+ pInp->numPcmFrameReceived += 1; // for debugging
+ }
+ else {
+ pInp->numFrameReceived += 1; // for debugging
+ }
// Communicate input stream information to decoder through input
// buffer configuration -- this was moved inside decDecodeFsm
else {
// Inform decoder to complete the decoding of previous frame - is this good?
pInp->sourceSelect = PAF_SOURCE_NONE;
- pInp->numFrameReceived = 0; // for debugging
+ pInp->numFrameReceived = 0; // for debugging
+ pInp->numPcmFrameReceived = 0; // for debugging
TRACE_TERSE1("asitDecodeProcessing: asitInputDataProcess error: %d", asitErr);
#ifdef DEBUG_SKIP_DECODING
ioBuffParams.size = pInpBuf->inpBufConfig.allocation / STRIDE_WORST_CASE
* STRIDE_WORST_CASE;
ioBuffParams.sync = IOBUFF_WRITE_SYNC;
- ioBuffParams.nominalDelay = INPUT_FRAME_SIZE_DEF;
+ ioBuffParams.nominalDelay = pInpIo->phyXferSize;
if (ioBuffInit(pInpIo->hIoBuff, &ioBuffParams) != IOBUFF_NOERR) {
return (ASIT_ERR_IOBUFF_INIT); // to remove magic number
}
// pInp->swapData = TRUE;
pInp->pcmSwitchHangOver = INPUT_SWITCH_HANGOVER;
pDec->initDone = FALSE;
- pInp->numFrameReceived = 0;
+ pInp->numFrameReceived = 0; // for debugging
+ pInp->numPcmFrameReceived = 0; // for debugging
}
/*======================================================================================
if(mcasp_packet->arg == IOPHY_XFER_FINAL) {
//Semaphore_post(asipSemRx);
Event_post(gAsitEvtHandle, ASIT_EVTMSK_INPDATA);
+ //Log_info0("asipMcaspCallback: final packet - event posted.\n");
} else {
+ //Log_info0("asipMcaspCallback: intermediate packet.\n");
; // intermediate packet due to buffer wrapping around
}
}
System_abort("\nMcASP for input overruns! %d!\n");
}
else {
+ //TRACE_VERBOSE0("asitPhyTransferStart: submit a transfer");
ioPhyErr = ioPhyXferSubmit(pInpIo->hIoPhy);
//if(ioPhyXferSubmit(pInpIo->hIoPhy)==IOPHY_ERR_BUFF_OVERFLOW) {
if(ioPhyErr!=IOPHY_NOERR){
PAF_AST_IoInp *pInp
)
{
- Aud_STATUS status;
+ Int32 status;
+ Aud_STATUS audStatus;
const PAF_SIO_Params *pInPrms;
mcaspLLDconfig *pLldCfg;
mcaspLLDconfig *pReqLldCfg;
{
d10Initialized = 0; // indicate no Input selected
- // check McASP LLD control API
- mcaspControlChan(pInp->hMcaspChan, MCASP_CHAN_RESET, NULL); // Rx reset channel
- //mcaspControlChan(pInp->hMcaspChan, MCASP_DEVICE_RESET, NULL); // Reset Tx/Rx channel
+ // Reset channel
+ status = mcaspControlChan(pInp->hMcaspChan, MCASP_CHAN_RESET, NULL); // Rx reset channel
+ //status = mcaspControlChan(pInp->hMcaspChan, MCASP_DEVICE_RESET, NULL); // Reset Tx/Rx channel
+ if (status != MCASP_COMPLETED)
+ {
+ Log_info0("asitSelectDevices(): McASP channel reset failed!\n");
+ return ASIP_ERR_MCASP_CFG;
+ }
// Delete McASP LLD channel
status = mcaspDeleteChan(pInp->hMcaspChan);
- if (status != Aud_EOK)
+ if (status != MCASP_COMPLETED)
{
Log_info0("asitSelectDevices(): McASP channel deletion failed!\n");
return ASIP_ERR_MCASP_CFG;
//
// Requested device is other than InNone
//
+ if((interface == DEVINP_HDMI) || (interface == DEVINP_HDMI_STEREO))
+ {
+ D10_initHDMI();
+ }
// Initialize Tx clock mux
D10_initClkMux((void *)pD10Params);
{
// Create McASP LLD channel
mcaspChanHandle = NULL;
- status = mcasplldChanCreate(pReqLldCfg, &mcaspChanHandle);
- if (status != Aud_EOK)
+ audStatus = mcasplldChanCreate(pReqLldCfg, &mcaspChanHandle);
+ if (audStatus != Aud_EOK)
{
Log_info0("asitSelectDevices(): McASP channel creation failed!\n");
return ASIP_ERR_MCASP_CFG;
}
if(autoDetStatus->syncState == IODATA_SYNC_BITSTREAM) {
- uint_least16_t pc = autoDetStatus->bitStreamInfo & SYNC_PC_MASK; //0x001F
+ uint_least16_t pc = autoDetStatus->streamInfo.IEC_PC;
sourceProgram = IECpafSource[pc];
}
}
else {
// For bitstream, I/O frame length is the frame length of the bitstream
- uint_least16_t pc = autoDetStatus->bitStreamInfo & SYNC_PC_MASK; //0x001F
- ioFrameLength = iecFrameLength[pc];
-
-/*
- if( (pc == 0x11) && (DTSHDSubType == 3)
- && (PAF_ASP_sampleRateHzTable[pBufConfig->pBufStatus->sampleRateStatus][PAF_SAMPLERATEHZ_STD] <=48000.0))
- pDevExt->sourceProgram = PAF_SOURCE_DXP; // LBR is 23
-
- if (pc == 1)
- pDevExt->elementSize = 4288;
- else if (pc == 0x11) {
- pDevExt->frameLength = (pDevExt->pIECFrameLength[pc] << DTSHDSubType);
- pDevExt->lengthofData = pDevExt->frameLength;
- }
-*/
-
pBufConfig->sizeofElement = WORD_SIZE_BITSTREAM;
- pBufConfig->frameLength = ioFrameLength;
- pBufConfig->lengthofData = ioFrameLength - IEC_HEADER_LENGTH;
+ pBufConfig->frameLength = autoDetStatus->streamInfo.frameLength;
+ pBufConfig->lengthofData = autoDetStatus->streamInfo.dataLength;
+ ioFrameLength = autoDetStatus->streamInfo.frameLength;
// Change I/O PHY transfer size to bitstream frame size
- pInp->phyXferSize = ioFrameLength*WORD_SIZE_BITSTREAM;
+ pInp->phyXferSize = ioFrameLength*(WORD_SIZE_BITSTREAM);
}
pBufConfig->stride = pInp->stride; // common for PCM and bitstream
sourceConfig = (Int)sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
GATEMP_INDEX_DEC);
- if(autoDetStatus->syncState == IODATA_SYNC_PCM) {
- // Bitstream preamble is not found and it times out -> assume this is PCM
- deliverZeros = autoDetStatus->deliverZeros;
- if (sourceConfig == PAF_SOURCE_PCM || sourceConfig == PAF_SOURCE_DSD1 ||
- sourceConfig == PAF_SOURCE_DSD2 || sourceConfig == PAF_SOURCE_DSD3) {
- // set to one -- ensures that PCM decode calls made before data is
- // available will result in zero output.
- // (mostly needed for PA15 since, currently, all other frameworks
- // require a frame of data before the first decode call.
- deliverZeros = TRUE; // override deliverZeros returned by ioDataControl
- }
-
- // update input buffer config structure
- pBufConfig->deliverZeros = deliverZeros;
- }
-
- //JXTODO: decide what to do with hRxSio
- //temporary - does ARM use hRxSio or just check if it is not NULL?
+ // temporary - does ARM use hRxSio or just check if it is not NULL?
pAstCfg->xInp[zMD].hRxSio = pInp->hIoData;
pAstCfg->xInp[zMD].pInpBuf = &(pAstCfg->xInp[zMD].inpBufConfig);