]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - pasdk/test_dsp/framework/audioStreamInpProcNewIO.c
PASDK-577:Add JX updates for autodet restart, plug into ASIT FSM
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / audioStreamInpProcNewIO.c
index e07c9f1a725a1098216562a7e8b3c383d409ff64..fa15ce522d8e9965e2eb65be1e6f8fe6362b3348 100644 (file)
@@ -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;