]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/commitdiff
PASDK-577:Split D10 audio hardware init & add OutNone check to asitIoCompsInit()
authorFrank Livingston <frank-livingston@ti.com>
Thu, 10 May 2018 21:50:42 +0000 (16:50 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Thu, 10 May 2018 21:50:42 +0000 (16:50 -0500)
D10_init() split:
- Run-once code, called from main
- Interface specific code, called from asitSelectedDevices()

pasdk/test_dsp/application/itopo/evmk2g/sap_d10.c
pasdk/test_dsp/application/main.c
pasdk/test_dsp/framework/audioStreamInpProcNewIO.c

index 7d96e6b6b88fe491d631c56de44f341f85d10ac2..d4f1564a42394ce24c2028823c1b3d7b7f8cebab 100644 (file)
@@ -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,
index c9ab1c385eadcd9bbe12a2fb7fa97880a066aca6..01a35510dca9d63974f9ac7b7b90d8e94d53e377 100644 (file)
@@ -44,6 +44,7 @@ All rights reserved.
 #include <ti/sysbios/BIOS.h>
 #include <ti/ipc/Ipc.h>
 #include <ti/sysbios/hal/Cache.h>
+#include <ti/xdais/xdas.h>
 
 #include <board.h>
 #include "evmc66x_i2c.h"
@@ -51,6 +52,7 @@ All rights reserved.
 #include <aud_audio.h>
 #include "audio_dc_cfg.h"
 #include "edma_cfg.h"
+#include <soc/mcasp_soc.h>
 
 #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();
index c60d5b059fdb302fc0a6227743bb40c12960452d..bd9adc2868a6f8b9c22c32054d8371eda55b3c8d 100644 (file)
@@ -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;
             }