From: Frank Livingston Date: Thu, 10 May 2018 21:50:42 +0000 (-0500) Subject: PASDK-577:Split D10 audio hardware init & add OutNone check to asitIoCompsInit() X-Git-Url: https://git.ti.com/gitweb?p=processor-sdk%2Fperformance-audio-sr.git;a=commitdiff_plain;h=59dc31b9a561e95723f4a0b612d515a203865946 PASDK-577:Split D10 audio hardware init & add OutNone check to asitIoCompsInit() D10_init() split: - Run-once code, called from main - Interface specific code, called from asitSelectedDevices() --- diff --git a/pasdk/test_dsp/application/itopo/evmk2g/sap_d10.c b/pasdk/test_dsp/application/itopo/evmk2g/sap_d10.c index 7d96e6b6..d4f1564a 100644 --- a/pasdk/test_dsp/application/itopo/evmk2g/sap_d10.c +++ b/pasdk/test_dsp/application/itopo/evmk2g/sap_d10.c @@ -1244,10 +1244,9 @@ void setD10ClkMux(UInt16 mode) clockMuxTx (sel, 0); } -XDAS_Int32 D10_init(void *pD10Params) +XDAS_Int32 D10_init(void) { XDAS_Int32 result = 0; - SAP_D10_Rx_Params *pD10RxParams; // perform one time hardware initialization if (!initDone) { @@ -1258,10 +1257,17 @@ XDAS_Int32 D10_init(void *pD10Params) initDone = 1; } + return result; +} + +XDAS_Int32 D10_initClkMux(void *pD10Params) +{ + SAP_D10_Rx_Params *pD10RxParams; + pD10RxParams = (SAP_D10_Rx_Params *)pD10Params; setD10ClkMux(pD10RxParams->d10rx.mode); - return result; + return 0; } XDAS_Int32 D10_RxControl(const void *pD10RxParams, diff --git a/pasdk/test_dsp/application/main.c b/pasdk/test_dsp/application/main.c index c9ab1c38..01a35510 100644 --- a/pasdk/test_dsp/application/main.c +++ b/pasdk/test_dsp/application/main.c @@ -44,6 +44,7 @@ All rights reserved. #include #include #include +#include #include #include "evmc66x_i2c.h" @@ -51,6 +52,7 @@ All rights reserved. #include #include "audio_dc_cfg.h" #include "edma_cfg.h" +#include #include "components/clk.h" /* PFP testing */ #include "pfp/pfp.h" @@ -68,6 +70,10 @@ extern void audioIoCreate(void); extern void ioSemaphoreCreate(void); #endif +// avoid including sap_d10.h, which would cause symbol redefinition +// warning (MCASP_PFUNC_XXX) +extern XDAS_Int32 D10_init(void); + /* * ======== main ======== */ @@ -170,6 +176,10 @@ Int main() /* Initialize McASP SOC level configuration */ McaspDevice_init(); + Log_info0("D10 init"); + /* Initialize audio hardware */ + D10_init(); + Log_info0("IPC start"); /* Initialize IPC */ status = Ipc_start(); diff --git a/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c b/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c index c60d5b05..bd9adc28 100644 --- a/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c +++ b/pasdk/test_dsp/framework/audioStreamInpProcNewIO.c @@ -109,8 +109,8 @@ extern Void taskAsipFxnInit(const PAF_ASIT_Params *pP,const PAF_ASIT_Patchs *pQ) // avoid including sap_d10.h, which would cause symbol redefinition // warning (MCASP_PFUNC_XXX) -extern XDAS_Int32 D10_init(void * pD10Params); - +//extern XDAS_Int32 D10_init(void * pD10Params); +extern XDAS_Int32 D10_initClkMux(void *pD10Params); extern XDAS_Int32 D10_RxControl(const void *pD10RxParams, XDAS_Int32 code, XDAS_Int32 arg); @@ -894,77 +894,80 @@ int asitIoCompsInit(PAF_AST_InpBuf * pInpBuf, PAF_AST_IoInp * pInpIo) ioDataParam_t ioDataCfg; ioPhyCtl_t ioPhyCtl; - //pInpIo->phyXferSize = INPUT_FRAME_SIZE_DEF; - pInpIo->phyXferSize = pInpIo->stride * NUM_CYCLE_PER_FRAME_DEF * WORD_SIZE_BITSTREAM; - - if(pInpIo->firstTimeInit) { - TRACE_VERBOSE0("Initialize I/O BUFF and I/O PHY."); - ioBuffParams.base = pInpBuf->inpBufConfig.base.pVoid; - ioBuffParams.size = pInpBuf->inpBufConfig.allocation / STRIDE_WORST_CASE - * STRIDE_WORST_CASE; - ioBuffParams.sync = IOBUFF_WRITE_SYNC; - ioBuffParams.nominalDelay = INPUT_FRAME_SIZE_DEF; - if(ioBuffInit(pInpIo->hIoBuff, &ioBuffParams) != IOBUFF_NOERR) { - return (ASIT_ERR_IOBUFF_INIT); // to remove magic number - } + if (pInpIo->hMcaspChan != NULL) + { + //pInpIo->phyXferSize = INPUT_FRAME_SIZE_DEF; + pInpIo->phyXferSize = pInpIo->stride * NUM_CYCLE_PER_FRAME_DEF * WORD_SIZE_BITSTREAM; + + if (pInpIo->firstTimeInit) { + TRACE_VERBOSE0("Initialize I/O BUFF and I/O PHY."); + ioBuffParams.base = pInpBuf->inpBufConfig.base.pVoid; + ioBuffParams.size = pInpBuf->inpBufConfig.allocation / STRIDE_WORST_CASE + * STRIDE_WORST_CASE; + ioBuffParams.sync = IOBUFF_WRITE_SYNC; + ioBuffParams.nominalDelay = INPUT_FRAME_SIZE_DEF; + if (ioBuffInit(pInpIo->hIoBuff, &ioBuffParams) != IOBUFF_NOERR) { + return (ASIT_ERR_IOBUFF_INIT); // to remove magic number + } + + ioPhyParams.ioBuffHandle = pInpIo->hIoBuff; + ioPhyParams.xferFrameSize = pInpIo->phyXferSize; + 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 + } - ioPhyParams.ioBuffHandle = pInpIo->hIoBuff; - ioPhyParams.xferFrameSize = pInpIo->phyXferSize; - 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 + pInpIo->numPrimeXfers = NUM_PRIME_XFERS; } - pInpIo->numPrimeXfers = NUM_PRIME_XFERS; - } + /* Reinitialize I/O DATA every time when ASIT restarts */ + TRACE_VERBOSE0("Initialize I/O DATA."); + ioDataCfg.ioBuffHandle = pInpIo->hIoBuff; + ioDataCfg.unknownSourceTimeOut = pInpBuf->inpBufConfig.pBufStatus->unknownTimeout; + ioDataCfg.frameLengthsIEC = (uint_least16_t *)&iecFrameLength[0]; + ioDataCfg.frameLengthPCM = pInpIo->stride * NUM_CYCLE_PER_FRAME_DEF; + ioDataCfg.frameLengthDef = pInpIo->stride * NUM_CYCLE_PER_FRAME_DEF; + ioDataCfg.ibMode = pInpBuf->inpBufConfig.pBufStatus->mode; + ioDataCfg.zeroRunRestart = pInpBuf->inpBufConfig.pBufStatus->zeroRunRestart; + ioDataCfg.zeroRunTrigger = pInpBuf->inpBufConfig.pBufStatus->zeroRunTrigger; + + if (ioDataInit(pInpIo->hIoData, &ioDataCfg) != IODATA_NO_ERR) { + return (ASIT_ERR_IODATA_INIT); // to remove magic number + } - /* Reinitialize I/O DATA every time when ASIT restarts */ - TRACE_VERBOSE0("Initialize I/O DATA."); - ioDataCfg.ioBuffHandle = pInpIo->hIoBuff; - ioDataCfg.unknownSourceTimeOut = pInpBuf->inpBufConfig.pBufStatus->unknownTimeout; - ioDataCfg.frameLengthsIEC = (uint_least16_t *)&iecFrameLength[0]; - ioDataCfg.frameLengthPCM = pInpIo->stride * NUM_CYCLE_PER_FRAME_DEF; - ioDataCfg.frameLengthDef = pInpIo->stride * NUM_CYCLE_PER_FRAME_DEF; - ioDataCfg.ibMode = pInpBuf->inpBufConfig.pBufStatus->mode; - ioDataCfg.zeroRunRestart = pInpBuf->inpBufConfig.pBufStatus->zeroRunRestart; - ioDataCfg.zeroRunTrigger = pInpBuf->inpBufConfig.pBufStatus->zeroRunTrigger; - - if(ioDataInit(pInpIo->hIoData, &ioDataCfg) != IODATA_NO_ERR) { - return (ASIT_ERR_IODATA_INIT); // to remove magic number - } + if (pInpIo->firstTimeInit) { + /* Initialize I/O BUFF and I/O PHY only when input interface changes. */ + TRACE_VERBOSE0("Prime I/O PHY."); - if(pInpIo->firstTimeInit) { - /* Initialize I/O BUFF and I/O PHY only when input interface changes. */ - TRACE_VERBOSE0("Prime I/O PHY."); + // Start I/O physical layer by priming McASP LLD for input + asitIoPhyPrime(pInpIo); - // Start I/O physical layer by priming McASP LLD for input - asitIoPhyPrime(pInpIo); + pInpIo->firstTimeInit = FALSE; + } + else { + // Reconfigure I/O PHY transfer size + ioPhyCtl.code = IOPHY_CTL_FRAME_SIZE; + ioPhyCtl.params.xferFrameSize = pInpIo->phyXferSize; + ioPhyControl(pInpIo->hIoPhy, &ioPhyCtl); + #if 0 + // If previous stream before reset was PCM, reconfigure McASP LLD to receive 16-bit packed bits + if (!pInpIo->swapData) { + Int mcaspErr; + mcaspErr = mcaspRecfgWordWidth(pInpIo->hMcaspChan, Mcasp_WordLength_16); + if(mcaspErr != Aud_EOK) { + return ASIT_ERR_MCASP_CFG; + } - pInpIo->firstTimeInit = FALSE; - } - else { - // Reconfigure I/O PHY transfer size - ioPhyCtl.code = IOPHY_CTL_FRAME_SIZE; - ioPhyCtl.params.xferFrameSize = pInpIo->phyXferSize; - ioPhyControl(pInpIo->hIoPhy, &ioPhyCtl); -#if 0 - // If previous stream before reset was PCM, reconfigure McASP LLD to receive 16-bit packed bits - if(!pInpIo->swapData) { - Int mcaspErr; - mcaspErr = mcaspRecfgWordWidth(pInpIo->hMcaspChan, Mcasp_WordLength_16); - if(mcaspErr != Aud_EOK) { - return ASIT_ERR_MCASP_CFG; + // Start swapping data + pInpIo->swapData = TRUE; + TRACE_VERBOSE0("Reconfigure McASP word length and start swapping data."); } - - // Start swapping data - pInpIo->swapData = TRUE; - TRACE_VERBOSE0("Reconfigure McASP word length and start swapping data."); + #endif + // Start PHY transfer + TRACE_VERBOSE0("Start I/O PHY transfer."); + asitPhyTransferStart(pInpIo); } -#endif - // Start PHY transfer - TRACE_VERBOSE0("Start I/O PHY transfer."); - asitPhyTransferStart(pInpIo); } return 0; @@ -1188,8 +1191,9 @@ Int asitSelectDevices( // Initialize McASP HW details //McaspDevice_init(); - // Initialize Rx hardware - D10_init((void *)pD10Params); + // Initialize Tx clock mux + //D10_init((void *)pD10Params); + D10_initClkMux((void *)pD10Params); d10Initialized=1; }