]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - pasdk/test_dsp/framework/audioStreamInpProc.c
PASDK183: maxFramelength updated to 8192
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / audioStreamInpProc.c
index ab3bf34466c3998dd6e2c5aa71bc3731ce044e2c..318a5feb73b80179fdaa898c90fb4e4047b04fdf 100644 (file)
@@ -73,8 +73,6 @@ All rights reserved.
 
 #include "statusOp_common.h"
 
-#define CACHE_COHERENCE
-
 
 // -----------------------------------------------------------------------------
 // Debugging Trace Control, local to this file.
@@ -338,7 +336,7 @@ Void taskAsipFxn(
     // Messaging
     ASP_Msg *pAspMsg;              
     Int status;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     Int8 tempVar8;
 #endif
 
@@ -501,12 +499,16 @@ Void taskAsipFxn(
     Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
     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_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");
     
     // (***) FL: revisit
     // invalidate Status structures for Beta Units initialized on Slave
@@ -525,8 +527,36 @@ Void taskAsipFxn(
     Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(Int), Cache_Type_ALLD, 0);
     size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
     Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), sizeof(Int), Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_THD]), size, Cache_Type_ALLD, 0);
+    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_wait();
     
+#ifdef NON_CACHE_STATUS
+    // Get the shared status structure GateMP handles. Initialized at slave.
+    if (statusOp_Init(GATEMP_INDEX_DEC) == STATUSOP_INIT_FAIL)
+    {
+        Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_DEC);
+    }
+    if (statusOp_Init(GATEMP_INDEX_DDP) == STATUSOP_INIT_FAIL)
+    {
+        Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_DDP);
+    }
+    if (statusOp_Init(GATEMP_INDEX_PCM) == STATUSOP_INIT_FAIL)
+    {
+        Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_PCM);
+    }
+    if (statusOp_Init(GATEMP_INDEX_THD) == STATUSOP_INIT_FAIL)
+    {
+        Log_info1("TaskAfp: Gate Index %d:Open status GateMP Fail.", GATEMP_INDEX_THD);
+    }
+#endif
+
     // (***) FL: revisit
     // invalidate Dec configuration
     Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
@@ -604,11 +634,12 @@ Void taskAsipFxn(
         // so set to unknown and skip any remaining processing
         if (!pAstCfg->xInp[zMI].hRxSio)
         {
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
             tempVar8 = PAF_SOURCE_UNKNOWN;
             statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
                            &tempVar8,
-                           sizeof(tempVar8));
+                           sizeof(tempVar8),
+                           GATEMP_INDEX_DEC);
 #else
             pAstCfg->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_UNKNOWN;
 #endif
@@ -623,10 +654,11 @@ Void taskAsipFxn(
             continue;
         }
         
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[zMD].decodeStatus.mode),
-                      sizeof(tempVar8));
+                      sizeof(tempVar8),
+                      GATEMP_INDEX_DEC);
         // If master decoder is not enabled, or the input is unlocked, then do nothing
         if (!tempVar8 || !pAstCfg->xInp[zMI].inpBufStatus.lock)
         {
@@ -642,17 +674,19 @@ Void taskAsipFxn(
         }
 #endif
         
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                      sizeof(tempVar8));
+                      sizeof(tempVar8),
+                      GATEMP_INDEX_DEC);
         // If no source selected then do nothing
         if (tempVar8 == PAF_SOURCE_NONE)
         {
             tempVar8 = PAF_SOURCE_NONE;
             statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
                            &tempVar8,
-                           sizeof(tempVar8));
+                           sizeof(tempVar8),
+                           GATEMP_INDEX_DEC);
             TRACE_VERBOSE1("TaskAsip: AS%d: no source selected, continue", as+zMS);
             continue;
         }
@@ -666,10 +700,11 @@ Void taskAsipFxn(
         }
 #endif
 
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                      sizeof(tempVar8));
+                      sizeof(tempVar8),
+                      GATEMP_INDEX_DEC);
         // If we want pass processing then proceed directly
         if (tempVar8 == PAF_SOURCE_PASS)
         {
@@ -678,7 +713,8 @@ Void taskAsipFxn(
             tempVar8 = PAF_SOURCE_PASS;
             statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
                            &tempVar8,
-                           sizeof(tempVar8));
+                           sizeof(tempVar8),
+                           GATEMP_INDEX_DEC);
 #else
         // If we want pass processing then proceed directly
         if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_PASS) 
@@ -700,10 +736,11 @@ Void taskAsipFxn(
             continue;
         }
 
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                      sizeof(tempVar8));
+                      sizeof(tempVar8),
+                      GATEMP_INDEX_DEC);
         // .....................................................................
         // At this point we have an enabled input and want to decode something.
         // If no decoder selected then do nothing. Need to reset the sourceProgram, since
@@ -734,10 +771,11 @@ Void taskAsipFxn(
             errno = ASPERR_AUTO_PROGRAM;
             continue;
         }
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
                       &(sourceProgram),
-                      sizeof(sourceProgram));
+                      sizeof(sourceProgram),
+                      GATEMP_INDEX_DEC);
 #else
         pAstCfg->xDec[zMD].decodeStatus.sourceProgram = sourceProgram;
 #endif
@@ -753,10 +791,11 @@ Void taskAsipFxn(
         // input frame, we determine whether or not to call decodeProcessing and with
         // what decAlg.
         sourceSelect = PAF_SOURCE_NONE;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                      sizeof(tempVar8));
+                      sizeof(tempVar8),
+                      GATEMP_INDEX_DEC);
         switch (tempVar8)
         {
 #else
@@ -807,11 +846,12 @@ Void taskAsipFxn(
             // If user made specific selection then program must match select.
             // (NB: this compare relies on ordering of PAF_SOURCE)
             default:
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
                 sourceSelect = 0; // due to size difference
                 statusOp_read(&sourceSelect,
                               &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                              sizeof(Int8));
+                              sizeof(Int8),
+                              GATEMP_INDEX_DEC);
 #else
                 sourceSelect = pAstCfg->xDec[zMD].decodeStatus.sourceSelect;
 #endif
@@ -984,6 +1024,16 @@ PAF_ASIT_initPhaseMalloc(
         INPUTN * sizeof (*pAstCfg->xInp),
         HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xInp);
 
+#ifdef NON_CACHE_STATUS
+    /* Decode memory */
+    if (!(pAstCfg->xDec = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM,
+        DECODEN * sizeof (*pAstCfg->xDec), 4, &eb)))
+    {
+        TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+        SW_BREAKPOINT;
+        return __LINE__;
+    }
+#else
     /* Decode memory */
     if (!(pAstCfg->xDec = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, 
         DECODEN * sizeof (*pAstCfg->xDec), 4, &eb)))
@@ -992,6 +1042,7 @@ PAF_ASIT_initPhaseMalloc(
         SW_BREAKPOINT;
         return __LINE__;
     }
+#endif
     TRACE_TERSE3("PAF_ASIT_initPhaseMalloc. (pC->xDec) %d bytes from space %d at 0x%x.",
         DECODEN * sizeof (*pAstCfg->xDec),
         HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xDec);
@@ -1452,6 +1503,7 @@ PAF_ASIT_initPhaseDecOpCircBuf(
         SW_BREAKPOINT;
         return __LINE__;
     }
+
     TRACE_TERSE3("PAF_ASIT_initPhaseDecOpCircBuf. (pC->xDecOpCb) %d bytes from space %d at 0x%x.",
         DECODEN * sizeof (*pAstCfg->xDecOpCb),
         HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xDecOpCb);
@@ -1469,30 +1521,31 @@ PAF_ASIT_initPhaseDecOpCircBuf(
         // allocate audio frame PCM sample pointer array
         for (i = 0; i<ASP_DECOP_CB_MAX_NUM_AF; i++)
         {
-            if (!(pCb->afCb[i].data.sample = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_PCM_CH * sizeof(PAF_AudioData *), 4, &eb)))
+            if (!(pCb->afCb[i].data.sample = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT * sizeof(PAF_AudioData *), 4, &eb)))
             {
                 TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
                 SW_BREAKPOINT;
             }
-            if (!(pCb->afCb[i].data.samsiz = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_PCM_CH * sizeof(PAF_AudioSize), 4, &eb)))
+            if (!(pCb->afCb[i].data.samsiz = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_PCM_CH_MAT * sizeof(PAF_AudioSize), 4, &eb)))
             {
                 TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
                 SW_BREAKPOINT;
             }                
         }
         // allocate PCM sample buffer
-        if (!(pCb->pcmBuf = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_PCM_BUF_SZ * sizeof(PAF_AudioData), 4, &eb)))
+        if (!(pCb->pcmBuf = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_SHM, ASP_DECOP_CB_PCM_BUF_SZ * sizeof(PAF_AudioData), 4, &eb)))
         {
             TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
             SW_BREAKPOINT;
         }
+        pCb->pcmBufEnd = pCb->pcmBuf + ASP_DECOP_CB_PCM_BUF_SZ;
         // allocate Metadata buffers //QIN
-        if (!(pCb->metaBuf = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, ASP_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD * sizeof(Int8), 4, &eb)))
+        if (!(pCb->metaBuf = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_SHM, ASP_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD * sizeof(Int8), 4, &eb)))
         {
             TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
             SW_BREAKPOINT;
         }
-        
+        pCb->metaBufEnd = pCb->metaBuf + (ASP_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD);
         // (***) FL: revisit, here PCM is hard-coded for 256 sample dec op frame length        
         // Initialize decoder output circular buffer for PCM
         errno = cbInit(pCb);
@@ -1959,8 +2012,8 @@ PAF_ASIT_decodeProcessing(
     //PAF_InpBufConfig *pIpBufConfig;
     Int frame; // decoder input frame count
     Int block; // (***) FL: formerly  -- decoder output block count / input frame
-#ifdef CACHE_COHERENCE
-    Int8 tempVar8;
+#ifdef NON_CACHE_STATUS
+    Int8 tempVar8, tempVar8_2;
 #endif
     
     pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
@@ -1980,10 +2033,11 @@ PAF_ASIT_decodeProcessing(
     state = INIT;
     errno = 0; /* error number */
 
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     statusOp_read(&tempVar8,
                   &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                  sizeof(tempVar8));
+                  sizeof(tempVar8),
+                  GATEMP_INDEX_DEC);
     TRACE_TERSE1("PAF_ASIT_decodeProcessing: sourceSelect is %d", tempVar8);
 
     for (;;) 
@@ -2045,6 +2099,9 @@ PAF_ASIT_decodeProcessing(
                 size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
                 Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
                 Cache_wait();*/
+                size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]->size;
+                Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DTSUHDA]), size, Cache_Type_ALLD, 0);
+                Cache_wait();
 #endif
 #if 0
                 ////size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
@@ -2072,6 +2129,9 @@ PAF_ASIT_decodeProcessing(
                 size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
                 Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
                 Cache_wait();*/
+                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_wait();
 #endif
                 
                 frame = 0;
@@ -2113,15 +2173,24 @@ PAF_ASIT_decodeProcessing(
 #endif                
 
 
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
                 statusOp_read(&tempVar8,
                               &(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
-                              sizeof(tempVar8));
+                              sizeof(tempVar8),
+                              GATEMP_INDEX_DEC);
+
+                statusOp_read(&tempVar8_2,
+                              &(pAstCfg->xDec[zMD].decodeStatus.sampleRate),
+                              sizeof(tempVar8),
+                              GATEMP_INDEX_DEC);
                 // Don't start decode until major access unit is found.
                 if (((tempVar8 == PAF_SOURCE_THD)    ||
                      (tempVar8 == PAF_SOURCE_DXP)    ||
-                     (tempVar8 == PAF_SOURCE_DTSHD)) &&
-                     (pAstCfg->xStr[zMS].pAudioFrame->sampleRate == PAF_SAMPLERATE_UNKNOWN)) 
+                     (tempVar8 == PAF_SOURCE_DTSHD))
+                        &&
+                     //(pAstCfg->xStr[zMS].pAudioFrame->sampleRate == PAF_SAMPLERATE_UNKNOWN)
+                     (tempVar8_2 == PAF_SAMPLERATE_UNKNOWN)  // debug chitresh as per govind
+                        )
 #else
                 // Don't start decode until major access unit is found.
                 if (((pAstCfg->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_THD)    ||
@@ -2134,10 +2203,11 @@ PAF_ASIT_decodeProcessing(
                     for (z=DECODE1; z < DECODEN; z++) 
                     {
                         Int zI = pP->inputsFromDecodes[z];
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
                         statusOp_read(&tempVar8,
                                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                                      sizeof(tempVar8));
+                                      sizeof(tempVar8),
+                                      GATEMP_INDEX_DEC);
                         if (pAstCfg->xInp[zI].hRxSio && tempVar8)
                         {
 #else
@@ -2315,7 +2385,7 @@ PAF_ASIT_decodeCommand(
     Int as;                 /* Audio Stream Number (1, 2, etc.) */
     Int z;                  /* decode counter */
     Int zS;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     Int8 tempVar8;
 #endif
 
@@ -2325,10 +2395,11 @@ PAF_ASIT_decodeCommand(
     for (z=DECODE1; z < DECODEN; z++) 
     {
         zS = pP->streamsFromDecodes[z];
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[z].decodeStatus.command2),
-                      sizeof(tempVar8));
+                      sizeof(tempVar8),
+                      GATEMP_INDEX_DEC);
         if (!(tempVar8 & 0x80))
         {
             switch (tempVar8)
@@ -2337,21 +2408,24 @@ PAF_ASIT_decodeCommand(
                     tempVar8 |= 0x80;
                     statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
                                    &tempVar8,
-                                   sizeof(tempVar8));
+                                   sizeof(tempVar8),
+                                   GATEMP_INDEX_DEC);
                     break;
                 case 1: // command abort - leave now
                     TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command abort (0x%02x)", as+zS, 1);
                     tempVar8 |= 0x80;
                     statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
                                    &tempVar8,
-                                   sizeof(tempVar8));
+                                   sizeof(tempVar8),
+                                   GATEMP_INDEX_DEC);
                     return (ASPERR_ABORT);
                 case 2: // command restart - leave later
                     TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command quit (0x%02x)", as+zS, 2);
                     tempVar8 |= 0x80;
                     statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
                                    &tempVar8,
-                                   sizeof(tempVar8));
+                                   sizeof(tempVar8),
+                                   GATEMP_INDEX_DEC);
                     return (ASPERR_QUIT);
                 default: // command unknown - ignore
                     break;
@@ -2415,7 +2489,7 @@ PAF_ASIT_decodeInit(
     Int argIdx;
     Int decErrno;
     Int status;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     Int8 tempVar8;
 #endif
     
@@ -2427,19 +2501,21 @@ PAF_ASIT_decodeInit(
     
     pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
 
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     // reset frameCount
     for (z=DECODE1; z < DECODEN; z++)
     {
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                      sizeof(tempVar8));
+                      sizeof(tempVar8),
+                      GATEMP_INDEX_DEC);
         if (tempVar8)
         {
             tempVar8 = 0;
             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.frameCount),
                           &tempVar8,
-                          sizeof(tempVar8));
+                          sizeof(tempVar8),
+                          GATEMP_INDEX_DEC);
         }
     }
 
@@ -2450,7 +2526,8 @@ PAF_ASIT_decodeInit(
         (void)zS; // clear compiler warning in case not used with tracing disabled
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                      sizeof(tempVar8));
+                      sizeof(tempVar8),
+                      GATEMP_INDEX_DEC);
         if (pAstCfg->xInp[zI].hRxSio && tempVar8)
         {
 #else
@@ -2601,15 +2678,17 @@ PAF_ASIT_decodeInit(
                 return errno;
 #endif
             
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
             gear = 0;  // due to size difference
             statusOp_read(&gear,
                           &(pAstCfg->xDec[z].decodeStatus.aspGearControl),
-                          sizeof(Int8));
+                          sizeof(Int8),
+                          GATEMP_INDEX_DEC);
             tempVar8 = gear < GEARS ? gear : 0;
             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.aspGearStatus),
                            &tempVar8,
-                           sizeof(tempVar8));
+                           sizeof(tempVar8),
+                           GATEMP_INDEX_DEC);
 #else
             gear = pAstCfg->xDec[z].decodeStatus.aspGearControl;
             pAstCfg->xDec[z].decodeStatus.aspGearStatus = gear < GEARS ? gear : 0;
@@ -2633,6 +2712,21 @@ PAF_ASIT_decodeInit(
             {
                 frameLength = 1536;
             }
+            else if (sourceSelect == PAF_SOURCE_THD)
+            {
+                frameLength = 1536; //QIN FIX ME
+            }
+            else if ((sourceSelect == PAF_SOURCE_DTS)   ||
+                     (sourceSelect == PAF_SOURCE_DTSHD) ||
+                     (sourceSelect == PAF_SOURCE_DTS12) ||
+                     (sourceSelect == PAF_SOURCE_DTS13) ||
+                     (sourceSelect == PAF_SOURCE_DTS14) ||
+                     (sourceSelect == PAF_SOURCE_DTS16) ||
+                     (sourceSelect == PAF_SOURCE_DTSALL)
+                    )
+            {
+                frameLength = 8192; // TODO: Chitresh FIX ME
+            }
             else
             {
                 frameLength = 256;
@@ -2666,10 +2760,11 @@ PAF_ASIT_decodeInit(
                 }
             }
 
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
             statusOp_read(&tempVar8,
                           &(pAstCfg->xDec[z].decodeStatus.sourceSelect),
-                          sizeof(Int8));
+                          sizeof(Int8),
+                          GATEMP_INDEX_DEC);
             if (errno = SIO_ctrl(pAstCfg->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_SOURCESELECT,
                 DECSIOMAP(tempVar8)))
             {
@@ -2743,7 +2838,7 @@ PAF_ASIT_decodeInfo(
     ASP_Msg *pAspMsg;          /* Messaging */
     Int argIdx;
     Int status;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     Int8 tempVar8;
     Int tempVar;
 #endif
@@ -2791,10 +2886,11 @@ PAF_ASIT_decodeInfo(
                     // return (ASPERR_INFO_RATECHANGE);
                 }
             }
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
             statusOp_read(&tempVar8,
                           &(pAstCfg->xDec[zD].decodeStatus.sourceDecode),
-                          sizeof(Int8));
+                          sizeof(Int8),
+                          GATEMP_INDEX_DEC);
             pAstCfg->xDec[zD].decodeControl.emphasis = 
                 tempVar8 != PAF_SOURCE_PCM
                 ? PAF_IEC_PREEMPHASIS_NO // fix for Mantis ID #119
@@ -2845,10 +2941,11 @@ PAF_ASIT_decodeInfo(
         zI = pP->inputsFromDecodes[z];
         zS = pP->streamsFromDecodes[z];
         (void)zS; // clear compiler warning in case not used with tracing disabled
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                      sizeof(Int8));
+                      sizeof(Int8),
+                      GATEMP_INDEX_DEC);
         if (pAstCfg->xInp[zI].hRxSio && tempVar8)
         {
 #else
@@ -2940,15 +3037,17 @@ PAF_ASIT_decodeInfo(
                 TRACE_TERSE1("return error errno 0x%x.", errno);
                 return errno;
             }
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
             statusOp_read(&tempVar,
                           &(pAstCfg->xDec[z].decodeStatus.frameCount),
-                          sizeof(Int));
+                          sizeof(Int),
+                          GATEMP_INDEX_DEC);
             // increment decoded frame count
             tempVar += 1;
             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.frameCount),
                            &tempVar,
-                           sizeof(Int));
+                           sizeof(Int),
+                           GATEMP_INDEX_DEC);
 #else
             // increment decoded frame count
             pAstCfg->xDec[z].decodeStatus.frameCount += 1;
@@ -2956,10 +3055,11 @@ PAF_ASIT_decodeInfo(
         }
     } // z=DECODE1 to DECODEN
 
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     statusOp_read(&tempVar8,
                   &(pAstCfg->xDec[zMD].decodeStatus.mode),
-                  sizeof(Int8));
+                  sizeof(Int8),
+                  GATEMP_INDEX_DEC);
     // query IB for latest sourceProgram (needed if we started decoding due to a force mode)
     if (tempVar8)
     {
@@ -2972,7 +3072,8 @@ PAF_ASIT_decodeInfo(
         }
         statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
                        &(sourceProgram),
-                       sizeof(Int8));
+                       sizeof(Int8),
+                       GATEMP_INDEX_DEC);
     }
 
     // since now decoding update decode status for all enabled decoders
@@ -2980,24 +3081,29 @@ PAF_ASIT_decodeInfo(
     {
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                      sizeof(Int8));
+                      sizeof(Int8),
+                      GATEMP_INDEX_DEC);
         if (tempVar8)
         {
             statusOp_read(&tempVar8,
                           &(pAstCfg->xDec[z].decodeStatus.sourceProgram),
-                          sizeof(Int8));
+                          sizeof(Int8),
+                          GATEMP_INDEX_DEC);
             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
                            &tempVar8,
-                           sizeof(Int8));
+                           sizeof(Int8),
+                           GATEMP_INDEX_DEC);
             statusOp_read(&tempVar8,
                           &(pAstCfg->xDec[z].decodeStatus.sourceSelect),
-                          sizeof(Int8));
+                          sizeof(Int8),
+                          GATEMP_INDEX_DEC);
             if (tempVar8 == PAF_SOURCE_SNG)
             {
                 tempVar8 = PAF_SOURCE_SNG;
                 statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
                                &tempVar8,
-                               sizeof(Int8));
+                               sizeof(Int8),
+                               GATEMP_INDEX_DEC);
             }
         }
     }
@@ -3142,7 +3248,7 @@ PAF_AST_decodeCont(
     Int z;                      /* decode counter */
     Int zI, zS;
     Int zMD;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     Int8 tempVar8;
 #endif
 
@@ -3158,10 +3264,11 @@ PAF_AST_decodeCont(
         zI = pP->inputsFromDecodes[z];
         zS = pP->streamsFromDecodes[z];
         (void)zS;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                      sizeof(Int8));
+                      sizeof(Int8),
+                      GATEMP_INDEX_DEC);
         if (z == zMD
             || ! pAstCfg->xInp[zI].hRxSio
             || ! tempVar8)
@@ -3350,6 +3457,21 @@ PAF_ASIT_decodeDecode(
             {
                 frameLength = 1536;
             }
+            else if (sourceSelect == PAF_SOURCE_THD)
+            {
+                frameLength = 1536; //QIN FIX ME
+            }
+            else if ((sourceSelect == PAF_SOURCE_DTS)   ||
+                     (sourceSelect == PAF_SOURCE_DTSHD) ||
+                     (sourceSelect == PAF_SOURCE_DTS12) ||
+                     (sourceSelect == PAF_SOURCE_DTS13) ||
+                     (sourceSelect == PAF_SOURCE_DTS14) ||
+                     (sourceSelect == PAF_SOURCE_DTS16) ||
+                     (sourceSelect == PAF_SOURCE_DTSALL)
+                    )
+            {
+                frameLength = 8192; // TODO: Chitresh FIX ME
+            }
             else
             {
                 frameLength = 256;
@@ -3438,21 +3560,23 @@ PAF_ASIT_decodeFinalTest(
     Int zMD;
     Int sourceSelect;
     Int sourceProgram;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     Int8 tempVar8, temp2Var8;
 #endif
 
     pAstCfg = pC->pAstCfg; // get pointer to common (shared) configuration
     zMD = pAstCfg->masterDec;
 
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     statusOp_read(&tempVar8,
                   &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                  sizeof(Int8));
+                  sizeof(Int8),
+                  GATEMP_INDEX_DEC);
     sourceSelect = tempVar8;
     statusOp_read(&tempVar8,
                   &(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
-                  sizeof(Int8));
+                  sizeof(Int8),
+                  GATEMP_INDEX_DEC);
     sourceProgram = tempVar8;
 #else
     sourceSelect  = pAstCfg->xDec[zMD].decodeStatus.sourceSelect;
@@ -3489,13 +3613,15 @@ PAF_ASIT_decodeFinalTest(
         }
         else 
         {
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
             statusOp_read(&tempVar8,
                           &(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
-                          sizeof(Int8));
+                          sizeof(Int8),
+                          GATEMP_INDEX_DEC);
             statusOp_read(&temp2Var8,
                           &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                          sizeof(Int8));
+                          sizeof(Int8),
+                          GATEMP_INDEX_DEC);
             if (temp2Var8 != tempVar8)
             {
                 return 1;
@@ -3541,7 +3667,7 @@ PAF_ASIT_decodeComplete(
     Int argIdx;
     Int errno;                  /* error number */
     Int status;
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     Int8 tempVar8;
 #endif
 
@@ -3559,10 +3685,11 @@ PAF_ASIT_decodeComplete(
         DEC_Handle dec = (DEC_Handle )decAlg[z];
 #endif /* PAF_ASP_FINAL */
         Int zI = pP->inputsFromDecodes[z];
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                      sizeof(Int8));
+                      sizeof(Int8),
+                      GATEMP_INDEX_DEC);
         if (pAstCfg->xInp[zI].hRxSio && tempVar8)
         {
 #else
@@ -3734,7 +3861,7 @@ PAF_ASIT_sourceDecode(
 {
     PAF_AST_Config *pAstCfg;
     Int z;                              /* decode counter */
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
     Int8 tempVar8;
 #endif
 
@@ -3742,16 +3869,18 @@ PAF_ASIT_sourceDecode(
 
     for (z=DECODE1; z < DECODEN; z++)
     {
-#ifdef CACHE_COHERENCE
+#ifdef NON_CACHE_STATUS
         statusOp_read(&tempVar8,
                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                      sizeof(Int8));
+                      sizeof(Int8),
+                      GATEMP_INDEX_DEC);
         if (tempVar8)
         {
             tempVar8 = x;
             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
                            &tempVar8,
-                           sizeof(Int8));
+                           sizeof(Int8),
+                           GATEMP_INDEX_DEC);
         }
 #else
         if (pAstCfg->xDec[z].decodeStatus.mode)