From d993e9c80c0168c9a4948ce77a873058e52f2de7 Mon Sep 17 00:00:00 2001 From: Frank Livingston Date: Tue, 15 May 2018 14:07:24 -0500 Subject: [PATCH] PASDK-577:Add JX updates for autodet restart, plug into ASIT FSM --- pasdk/test_dsp/application/main.c | 7 ++--- pasdk/test_dsp/framework/audioStreamInpProc.h | 3 ++- .../framework/audioStreamInpProcNewIO.c | 27 +++++++++++++++---- pasdk/test_dsp/io/ioData.c | 6 +++++ pasdk/test_dsp/io/ioData.h | 1 + 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/pasdk/test_dsp/application/main.c b/pasdk/test_dsp/application/main.c index 01a35510..0c8ab2d8 100644 --- a/pasdk/test_dsp/application/main.c +++ b/pasdk/test_dsp/application/main.c @@ -82,7 +82,7 @@ Int main() Int status; Aud_STATUS AudStatus; Int k; - Board_initCfg cfg; + //Board_initCfg cfg; Log_info0("Enter main()"); @@ -112,8 +112,9 @@ Int main() #endif /* initialize board */ - cfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK; - Board_init(cfg); + // board init is handled by GEL files or SBL + //cfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_MODULE_CLOCK; + //Board_init(cfg); evmI2CInit(I2C_PORT_0); evmI2CInit(I2C_PORT_1); evmI2CInit(I2C_PORT_2); diff --git a/pasdk/test_dsp/framework/audioStreamInpProc.h b/pasdk/test_dsp/framework/audioStreamInpProc.h index 4f9ca0de..3bfd7b3c 100644 --- a/pasdk/test_dsp/framework/audioStreamInpProc.h +++ b/pasdk/test_dsp/framework/audioStreamInpProc.h @@ -202,9 +202,10 @@ enum { enum { ASIT_NO_ERR, + ASIT_AUTODET_TIME_OUT, ASIT_ERR_IOBUFF_INIT, ASIT_ERR_IODATA_INIT, - ASIT_ERR_IOPYH_INIT, + ASIT_ERR_IOPHY_INIT, ASIT_ERR_INPDATA_PROC, ASIT_ERR_INPBUF_UNDERFLOW, ASIT_ERR_AUTO_DETECION, diff --git a/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c b/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c index e07c9f1a..fa15ce52 100644 --- a/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c +++ b/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c @@ -305,6 +305,11 @@ Int inputReadyForProcessing; // Input data is ready - perform source detection. // New state will be decided inside the function asitErr = asitSourceDetection(pP, pQ, pAsitCfg); + + if(asitErr == ASIT_AUTODET_TIME_OUT) { + // Should restart if new interface is selected. + TRACE_VERBOSE0("TaskAsip: auto-detection time out."); + } } else { //Error checking & debug @@ -515,8 +520,11 @@ Int asitSourceDetection(const PAF_ASIT_Params *pP, // Mark input data read complete ioDataReadComplete(pInp->hIoData); + if(autoDetStatus.syncTimeOut) { + return ASIT_AUTODET_TIME_OUT; + } // Check if bitstream or PCM is detected - if( autoDetStatus.syncState == IODATA_SYNC_BITSTREAM + else if( autoDetStatus.syncState == IODATA_SYNC_BITSTREAM || autoDetStatus.syncState == IODATA_SYNC_PCM) { // Decide input source and inform decoder asitErr = asitDecideSource(pAstCfg, pInp, &autoDetStatus); @@ -557,6 +565,9 @@ Int asitSourceDetection(const PAF_ASIT_Params *pP, } } } + else { + // SYNC search ongoing, no action is needed + } // Start next transfer asitPhyTransferStart(pInp); @@ -915,7 +926,7 @@ int asitIoCompsInit(PAF_AST_InpBuf * pInpBuf, PAF_AST_IoInp * pInpIo) ioPhyParams.mcaspChanHandle = pInpIo->hMcaspChan; ioPhyParams.ioBuffOp = IOPHY_IOBUFFOP_WRITE; if (ioPhyInit(pInpIo->hIoPhy, &ioPhyParams) != IOPHY_NOERR) { - return (ASIT_ERR_IOPYH_INIT); // to remove magic number + return (ASIT_ERR_IOPHY_INIT); // to remove magic number } pInpIo->numPrimeXfers = NUM_PRIME_XFERS; @@ -1274,7 +1285,7 @@ Int asitSelectDevices( } } - return ASIT_NO_ERR; + return ASIP_NO_ERR; } /* asitSelectDevices */ /*====================================================================================== @@ -1699,6 +1710,12 @@ void asitErrorHandling(PAF_ASIT_Config *pAsitCfg, Int asitErr) TRACE_VERBOSE0("ASIT error handling: input buffer underflows. No actions needed."); } + if(asitErr == ASIT_AUTODET_TIME_OUT) { + pAsitCfg->pIoInp[0].asipState = ASIT_RESET; + pAsitCfg->pIoInp[0].numAsitRestart++; + TRACE_VERBOSE1("ASIT error %d handling finished. Go to state ASIT_RESET.", asitErr); + } + if(asitErr == ASIT_ERR_DECODE_QUIT) { TRACE_VERBOSE0("ASIT error handling: DECODE_QUIT - clear INPDATA event."); #if 0 @@ -1714,13 +1731,13 @@ void asitErrorHandling(PAF_ASIT_Config *pAsitCfg, Int asitErr) #endif pAsitCfg->pIoInp[0].asipState = ASIT_RESET; pAsitCfg->pIoInp[0].numAsitRestart++; - TRACE_VERBOSE0("ASIT error handling finished. Go to state ASIT_RESET."); + TRACE_VERBOSE1("ASIT error %d handling finished. Go to state ASIT_RESET.", asitErr); } if(asitErr == ASIT_ERR_EVENTS) { pAsitCfg->pIoInp[0].asipState = ASIT_RESET; pAsitCfg->pIoInp[0].numAsitRestart++; - TRACE_VERBOSE0("ASIT error handling: events error. Go to state ASIT_RESET."); + TRACE_VERBOSE1("ASIT error %d handling: events error. Go to state ASIT_RESET.", asitErr); } return; diff --git a/pasdk/test_dsp/io/ioData.c b/pasdk/test_dsp/io/ioData.c index 1db06be8..4c5c673c 100644 --- a/pasdk/test_dsp/io/ioData.c +++ b/pasdk/test_dsp/io/ioData.c @@ -143,6 +143,7 @@ typedef struct ioDataInst_s { size_t frameDataSize; uint8_t deliverZeros; uint8_t ioBuffUnderFlow; + uint8_t syncTimeOut; void *buff1; void *buff2; size_t size1; @@ -228,6 +229,7 @@ int ioDataInit(ioDataHandle_t handle, ioDataParam_t *cfgParams) pIoDataInst->autoDetState = AUTODET_SYNC_SEARCH_INITIAL; pIoDataInst->dbgStats.numSyncLost = 0; pIoDataInst->ioBuffUnderFlow = FALSE; + pIoDataInst->syncTimeOut = FALSE; autoDetReset(pIoDataInst); @@ -328,6 +330,7 @@ int ioDataControl(ioDataHandle_t ioDataHandle, ioDataCtl_t *ioDataCtl) ioDataCtl->param.autoDetStats.syncState = pIoDataInst->autoDet.syncState; ioDataCtl->param.autoDetStats.deliverZeros = pIoDataInst->deliverZeros; ioDataCtl->param.autoDetStats.bitStreamInfo = pIoDataInst->autoDet.bitStreamInfo; + ioDataCtl->param.autoDetStats.syncTimeOut = pIoDataInst->syncTimeOut; break; /* case IODATA_CTL_GET_STEAM_INFO: @@ -359,6 +362,8 @@ void autoDetection(ioDataInst_t * pIoDataInst) /* Search for SYNC the first time */ autoDetSyncScan(pIoDataInst); + pIoDataInst->syncTimeOut = FALSE; + if(pIoDataInst->autoDet.syncDetected) { syncCheckInit(pIoDataInst); // prepare for SYNC checking in subsequent frames @@ -378,6 +383,7 @@ void autoDetection(ioDataInst_t * pIoDataInst) /* Reset if zero-run is long enough */ autoDetReset(pIoDataInst); pIoDataInst->autoDetState = AUTODET_SYNC_SEARCH_INITIAL; + pIoDataInst->syncTimeOut = TRUE; } else { // inform decoder where to read PCM data diff --git a/pasdk/test_dsp/io/ioData.h b/pasdk/test_dsp/io/ioData.h index bed31c5a..08799023 100644 --- a/pasdk/test_dsp/io/ioData.h +++ b/pasdk/test_dsp/io/ioData.h @@ -69,6 +69,7 @@ typedef struct ioDataAutoDetStat_s { uint_least16_t syncState; // SYNC state uint_least16_t bitStreamInfo; // bit stream information - value of IEC_PC uint8_t deliverZeros; // flag to indicate whether zeros should be sent to output + uint8_t syncTimeOut; } ioDataAutoDetStat_t; // I/O DATA control structure -- 2.39.2