]> 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-401:Add No-IP builds
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / audioStreamInpProc.c
index 1bfeaa706a061f9a35c5bdabcc23a6c2eb9b7701..ace2a1dc98405a10cddb490c22ea6adf663454ad 100644 (file)
@@ -317,7 +317,9 @@ extern UInt32 gAspProfileEnable;
 // FL: (***) hard-coded
 #define ASIP_FRAMELEN_SS_DDP_AC3    ( 1536 )
 // FL: (***) hard-coded
-#define ASIP_FRAMELEN_SS_THD        ( 1536 )        //QIN FIX ME
+#define ASIP_FRAMELEN_SS_THD        ( 1536 )        
+
+#define ASIP_FRAMELEN_SS_DTS        ( 512 )         
 
 // Compute decoder frame length based on selected source
 static Int getFrameLengthSourceSel(
@@ -350,11 +352,14 @@ UInt32 gAsipInfo1_PrimaryErrCnt =0;
 UInt32 gAsipInfo1_ErrCnt        =0;
 UInt32 gAsipInfo2_PrimaryErrCnt =0;
 UInt32 gAsipInfo2_ErrCnt        =0;
+// debug
 UInt32 gCapIbReset_cnt          =0;
 UInt32 gCapIb_cnt               =0;
-// debug
 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
 
@@ -459,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++)
@@ -549,14 +554,20 @@ Void taskAsipFxn(
     Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_wait();
-    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]) Log_info0("ERROR: beta unit for Dec==NULL");
-    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]) Log_info0("ERROR: beta unit for Dec==NULL");
-    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]) Log_info0("ERROR: beta unit for Dec==NULL");
-    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]) Log_info0("ERROR: beta unit for Dec==NULL");
-    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]) Log_info0("ERROR: beta unit for Dec==NULL");
-    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]) Log_info0("ERROR: beta unit for Dec==NULL");
-    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]) Log_info0("ERROR: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]) Log_info0("WARNING: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]) Log_info0("WARNING: beta unit for Dec==NULL");
     
     // (***) FL: revisit
     // invalidate Status structures for Beta Units initialized on Slave
@@ -581,6 +592,14 @@ Void taskAsipFxn(
     Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), sizeof(Int), Cache_Type_ALLD, 0);
     size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]->size;
     Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD2]), size, Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), size, Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), sizeof(Int), Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC]), size, Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), sizeof(Int), Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_AAC2]), size, Cache_Type_ALLD, 0);
     Cache_wait();
     
 #ifdef NON_CACHE_STATUS
@@ -601,8 +620,11 @@ Void taskAsipFxn(
     {
         Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_THD);
     }
+    if (statusOp_Init(GATEMP_INDEX_DTS) == STATUSOP_INIT_FAIL)
+    {
+        Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_DTS);
+    }
 #endif
-
     // (***) FL: revisit
     // invalidate Dec configuration
     Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
@@ -649,6 +671,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)
@@ -849,12 +883,13 @@ Void taskAsipFxn(
             continue;
         }
 
-        // FL: debug, reset IB capture buffer
+#if 0 // debug, reset IB capture buffer
         capIbReset();
         gCapIbReset_cnt++;
         Log_info0("capIbReset()");
+#endif
 
-        // FL: send source select message to slave
+        // send source select message to slave
         *(Int32 *)&asipMsgBuf[0] = sourceSelect;
         if(AspMsgSend(ASP_SLAVE_DEC_SOURCE_SELECT, ASP_MASTER_DEC_SOURCE_SELECT_DONE,
                       asipMsgBuf, NULL) != ASP_MSG_NO_ERR)
@@ -2386,6 +2421,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;
@@ -2709,9 +2748,10 @@ PAF_ASIT_decodeInfo(
             return ASPERR_RECLAIM;
         }
         
-        //// FL: debug, capture input buffer
-        //capIb(pAstCfg->xInp[zMI].pInpBuf);
-        //gCapIb_cnt++;
+#if 0 // debug, capture input buffer
+        capIb(pAstCfg->xInp[zMI].pInpBuf);
+        gCapIb_cnt++;
+#endif
         
 #if 0 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
         // (***) debug // B5
@@ -3056,8 +3096,9 @@ PAF_ASIT_decodeDecode(
                     (IArg)pAstCfg->xInp[z].pInpBuf->base.pVoid,
                     (IArg)pAstCfg->xInp[z].pInpBuf->head.pVoid);
 
-            // FL: debug, capture input buffer
-            //capIbPcm(pAstCfg->xInp[z].pInpBuf);
+#if 0 // debug, capture input buffer
+            capIbPcm(pAstCfg->xInp[z].pInpBuf);
+#endif
             
             // (***) FL: revisit
             // write back Dec configuration
@@ -3572,6 +3613,9 @@ static Int getFrameLengthSourceSel(
         case PAF_SOURCE_PCM:
             frameLength = FRAMELENGTH;
             break;
+        case PAF_SOURCE_AAC:
+            frameLength = 1024;
+            break;
         case PAF_SOURCE_AC3: 
         case PAF_SOURCE_DDP: 
             frameLength = ASIP_FRAMELEN_SS_DDP_AC3;
@@ -3579,6 +3623,15 @@ static Int getFrameLengthSourceSel(
         case PAF_SOURCE_THD:
             frameLength = ASIP_FRAMELEN_SS_THD;
             break;
+        case PAF_SOURCE_DTS:
+        case PAF_SOURCE_DTSHD:
+        case PAF_SOURCE_DTS12:
+        case PAF_SOURCE_DTS13:
+        case PAF_SOURCE_DTS14:
+        case PAF_SOURCE_DTS16:
+        case PAF_SOURCE_DTSALL:
+            frameLength = ASIP_FRAMELEN_SS_DTS;
+            break;
         default:
             frameLength = ASIP_FRAMELEN_SS_DEFAULT;
             break;