Modified input task decode processing to have both INFO and DECODE done for every
authorJianzhong Xu <a0869574@ti.com>
Tue, 30 Jan 2018 17:13:59 +0000 (12:13 -0500)
committerJianzhong Xu <a0869574@ti.com>
Tue, 30 Jan 2018 17:13:59 +0000 (12:13 -0500)
I/O PHY transfer completion.

pasdk/test_dsp/framework/audioStreamInpDec.c

index 6cf54662f1a3a9ba95038019800a1db420e6c1fb..b15f928e78aef531858bdbc3683fecc2491cece5 100644 (file)
@@ -109,7 +109,7 @@ Int asipDecodeProcessing(
     PAF_AST_Config *pAstCfg;
     asipDecProc_t  *pDec;
     Int decError, retVal, getVal;                          /* error number */
-    Int zMD;
+    Int zMD, decProcDone;
     Int8 tempVar8;
 
     pAstCfg = pAsitCfg->pAstCfg;     // get pointer to common (shared) configuration
@@ -161,88 +161,95 @@ Int asipDecodeProcessing(
         }
     }
 
-    switch(pAsitCfg->inpDec.state)
-    {
-        case INFO1:
-            decError = decDecodeInfo(pP, pQ, pAsitCfg);
-            if (decError) {
-                //gAsipInfo1_PrimaryErrCnt++;
-                TRACE_TERSE1("INFO1: decError 0x%x after decodeInfo, primary timing", decError);
-                retVal = ASIP_ERR_DECODE_INFO1;
-            }
-            else {
-                // Don't start decode until major access unit is found.
-                Int8 sourceDecode, sampleRate;
-
-                sourceDecode = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
-                                                 GATEMP_INDEX_DEC);
-                sampleRate   = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sampleRate),
-                                                 GATEMP_INDEX_DEC);
-                if ( ( (sourceDecode == PAF_SOURCE_THD)     ||
-                       (sourceDecode == PAF_SOURCE_DXP)     ||
-                       (sourceDecode == PAF_SOURCE_DTSHD) ) &&
-                     ( sampleRate == PAF_SAMPLERATE_UNKNOWN) ) {
-                    //gMajorAuMissed++; // debug
-                    pAsitCfg->inpDec.frame++;
-                    //pAsitCfg->inpDec.state = INFO1;    // stay in this state
+    do {
+        decProcDone = TRUE;
+
+        switch(pAsitCfg->inpDec.state)
+        {
+            case INFO1:
+                decError = decDecodeInfo(pP, pQ, pAsitCfg);
+                if (decError) {
+                    //gAsipInfo1_PrimaryErrCnt++;
+                    TRACE_TERSE1("INFO1: decError 0x%x after decodeInfo, primary timing", decError);
+                    retVal = ASIP_ERR_DECODE_INFO1;
                 }
                 else {
-                    decError = pP->fxns->decodeInfo1(pP, pQ, pAsitCfg, pAsitCfg->inpDec.frame, pAsitCfg->inpDec.block);
-                    if(decError) {
-                        retVal = ASIP_ERR_DECODE_INFO1;
+                    // Don't start decode until major access unit is found.
+                    Int8 sourceDecode, sampleRate;
+
+                    sourceDecode = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
+                                                     GATEMP_INDEX_DEC);
+                    sampleRate   = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sampleRate),
+                                                     GATEMP_INDEX_DEC);
+                    if ( ( (sourceDecode == PAF_SOURCE_THD)     ||
+                           (sourceDecode == PAF_SOURCE_DXP)     ||
+                           (sourceDecode == PAF_SOURCE_DTSHD) ) &&
+                         ( sampleRate == PAF_SAMPLERATE_UNKNOWN) ) {
+                        //gMajorAuMissed++; // debug
+                        pAsitCfg->inpDec.frame++;
+                        //pAsitCfg->inpDec.state = INFO1;    // stay in this state
                     }
                     else {
-                        pAsitCfg->inpDec.state = DECODE;
+                        decError = pP->fxns->decodeInfo1(pP, pQ, pAsitCfg, pAsitCfg->inpDec.frame, pAsitCfg->inpDec.block);
+                        if(decError) {
+                            retVal = ASIP_ERR_DECODE_INFO1;
+                        }
+                        else {
+                            pAsitCfg->inpDec.state = DECODE;
+                            decProcDone = FALSE;    // go to DECODE state before return
+                        }
                     }
                 }
-            }
-            break;
-
-        case INFO2:
-            decError = decDecodeInfo(pP, pQ, pAsitCfg);
-            if (decError) {
-                //gAsipInfo1_PrimaryErrCnt++;
-                TRACE_TERSE1("INFO2: decError 0x%x after decodeInfo, primary timing", decError);
-                retVal = ASIP_ERR_DECODE_INFO2;
-            }
-            else {
-                pAsitCfg->inpDec.state= DECODE;
-            }
-            break;
+                break;
 
-        case DECODE:
-            decError = decDecodeData(pP, pQ, pAsitCfg, sourceSelect);
-            if (decError) {
-                //gAsipDecodeErrCnt++;
-                TRACE_TERSE1("PAF_ASIT_decodeProcessing: state: DECODE.  decodeDecode err 0x%04x", decError);
-                retVal = ASIP_ERR_DECODE_DATA;
-            }
-            else {
-                decError = pP->fxns->decodeFinalTest(pP, pQ, pAsitCfg, pAsitCfg->inpDec.frame, pAsitCfg->inpDec.block);
+            case INFO2:
+                decError = decDecodeInfo(pP, pQ, pAsitCfg);
                 if (decError) {
-                    retVal = ASIP_ERR_DECODE_FINAL;
+                    //gAsipInfo1_PrimaryErrCnt++;
+                    TRACE_TERSE1("INFO2: decError 0x%x after decodeInfo, primary timing", decError);
+                    retVal = ASIP_ERR_DECODE_INFO2;
                 }
                 else {
-                    pAsitCfg->inpDec.frame++;
-                    pAsitCfg->inpDec.state = INFO2;
+                    pAsitCfg->inpDec.state = DECODE;
+                    decProcDone = FALSE;     // go to DECODE state before return
                 }
-            }
-            break;
+                break;
 
-        case QUIT:
-            //gAsipQuitCnt++;
-            Log_info0("TaskAsip: state=QUIT");
+            case DECODE:
+                decError = decDecodeData(pP, pQ, pAsitCfg, sourceSelect);
+                if (decError) {
+                    //gAsipDecodeErrCnt++;
+                    TRACE_TERSE1("PAF_ASIT_decodeProcessing: state: DECODE.  decodeDecode err 0x%04x", decError);
+                    retVal = ASIP_ERR_DECODE_DATA;
+                }
+                else {
+                    decError = pP->fxns->decodeFinalTest(pP, pQ, pAsitCfg, pAsitCfg->inpDec.frame, pAsitCfg->inpDec.block);
+                    if (decError) {
+                        retVal = ASIP_ERR_DECODE_FINAL;
+                    }
+                    else {
+                        pAsitCfg->inpDec.frame++;
+                        pAsitCfg->inpDec.state = INFO2;
+                    }
+                }
+                break;
+
+            case QUIT:
+                //gAsipQuitCnt++;
+                Log_info0("TaskAsip: state=QUIT");
 
-            // Quit:
-            // - Set error number registers.
-            // - Exit state machine to "decode complete" processing.
-            TRACE_VERBOSE0("PAF_ASIT_decodeProcessing: state: QUIT");
-            break;
+                // Quit:
+                // - Set error number registers.
+                // - Exit state machine to "decode complete" processing.
+                TRACE_VERBOSE0("PAF_ASIT_decodeProcessing: state: QUIT");
+                break;
+
+            default:
+                break;
 
-        default:
-            break;
+        }  /* switch */
 
-    }
+    } while (!decProcDone);
 
     if(retVal != ASIP_NO_ERR) {
         decDecodeComplete(pP, pAsitCfg);