]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - pasdk/test_dsp/framework/audioStreamInpProc.c
PASDK-402:Add writeDECCommandRestart updates
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / audioStreamInpProc.c
index 7a2d35ca3180bc30199142e4e813968a69cfa0ae..990a758abf82a4eae85f414c1eb6874476a14650 100644 (file)
@@ -357,6 +357,9 @@ UInt32 gCapIbReset_cnt          =0;
 UInt32 gCapIb_cnt               =0;
 UInt32 gCbWrtAfErrCnt           =0; // decoder output circular buffer write error count (returned from ARM to DSP)
                                    
+// For writeDECCommandRestart
+volatile UInt32 gCommandOutputTask_SYNC   =0;
+volatile UInt32 gCommandOutputTask_ACK    =0;
 
 #include "dbgDib.h" // debug
 
@@ -461,7 +464,7 @@ Void taskAsipFxn(
     //      - AlgKey: Dec/Enc chain to Array Initialization
     //      - Device: I/O Device Initialization
     //      - DecOpCircBuf: Decoder Output Circular Buffer
-    //      - Unused: (available)
+    //      - OutIS: Output Init-Sync
     //
     LINNO_RPRT(TaskAsip, -2);
     for (i=0; i < lengthof(pP->fxns->initPhase); i++)
@@ -658,6 +661,18 @@ Void taskAsipFxn(
         // any error forces idling of input
         if (errno) 
         {
+            // If gCommandOutputTask_SYNC invoked by writeDECCommandRestart, wait for output task in sync ...
+            if (gCommandOutputTask_SYNC) {
+                TRACE_VERBOSE1("TaskAsip: writeDECCommandRestart issued ... Wait for ack from output task side (errno=%d)", errno);
+                // Wait for ack
+                while (gCommandOutputTask_ACK == 0) {
+                    Task_sleep(1);
+                }
+                TRACE_VERBOSE0("TaskAsip: writeDECCommandRestart issued ... Sync-ed! Startover the process");
+                gCommandOutputTask_ACK = 0;
+                gCommandOutputTask_SYNC = 0;
+            }
+            
             for (z=INPUT1; z < INPUTN; z++)
             {
                 if (pAstCfg->xInp[z].hRxSio)
@@ -2396,6 +2411,10 @@ PAF_ASIT_decodeCommand(
                     tempVar8 |= 0x80;
                     sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
                                        tempVar8, GATEMP_INDEX_DEC);
+                                       
+                    // Invoke command to output task to break the loop
+                    gCommandOutputTask_SYNC = 1;
+                    
                     return (ASPERR_QUIT);
                 default: // command unknown - ignore
                     break;