]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/commitdiff
Cache coherence for Decoder status structure.
authorChitresh Gupta <chitresh.g@pathpartnertech.com>
Mon, 24 Oct 2016 13:34:56 +0000 (19:04 +0530)
committerChitresh Gupta <chitresh.g@pathpartnertech.com>
Mon, 24 Oct 2016 13:34:56 +0000 (19:04 +0530)
pasdk/test_arm/framework/audioStreamDecodeProc.c
pasdk/test_dsp/framework/alphaFuncProc.c

index 234d351ad2951fcfea276ff9a1a18f2a729a36d1..c73ae2a9fef4070a19937e38dda99c953ab75814 100644 (file)
@@ -116,6 +116,41 @@ UInt32 gSlaveDecDecodeCnt       =0;
 UInt32 gSlaveDecDeactivateCnt   =0;
 
 
+// TODO: upadate with Decoder beta number
+const UInt32 pafBetaMap[] =
+{
+    -1,                // PAF_SOURCE_UNKNOWN,
+    -1,                // PAF_SOURCE_NONE,
+    -1,                // PAF_SOURCE_PASS,
+    -1,                // PAF_SOURCE_SNG,
+    -1,                // PAF_SOURCE_AUTO,
+    -1,                // PAF_SOURCE_BITSTREAM,
+    -1,                // PAF_SOURCE_DTSALL,
+    -1,                // PAF_SOURCE_PCMAUTO,
+    STD_BETA_PCM,      // PAF_SOURCE_PCM,
+    -1,                // PAF_SOURCE_PC8,
+    -1,                // PAF_SOURCE_AC3,
+    -1,                // PAF_SOURCE_DTS,
+    -1,                // PAF_SOURCE_AAC,
+    -1,                // PAF_SOURCE_MPEG,
+    -1,                // PAF_SOURCE_DTS12,
+    -1,                // PAF_SOURCE_DTS13,
+    -1,                // PAF_SOURCE_DTS14,
+    -1,                // PAF_SOURCE_DTS16,
+    -1,                // PAF_SOURCE_WMA9PRO,
+    -1,                // PAF_SOURCE_MP3,
+    -1,                // PAF_SOURCE_DSD1,
+    -1,                // PAF_SOURCE_DSD2,
+    -1,                // PAF_SOURCE_DSD3,
+    STD_BETA_DDP,      // PAF_SOURCE_DDP,
+    -1,                // PAF_SOURCE_DTSHD,
+    STD_BETA_THD,      // PAF_SOURCE_THD,
+    -1,                // PAF_SOURCE_DXP,
+    -1,                // PAF_SOURCE_WMA,
+    -1                 // PAF_SOURCE_N
+};
+
+
 /*
  *  ======== taskAsdpFxn ========
  *  Audio Stream Decode Processing task function
@@ -541,6 +576,11 @@ Void taskAsdpFxn(
                     // Get input associated w/ decoder
                     zI = pP->inputsFromDecodes[z];
                     
+                    // invalidate Status structures for Beta Units initialized on Slave
+                    size = IACP_STD_BETA_TABLE.pStatus[pafBetaMap[sourceSelect]]->size;
+                    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[pafBetaMap[sourceSelect]]), size, Cache_Type_ALLD, 0);
+                    Cache_wait();
+
                     // (***) FL: revisit
                     // invalidate Inp configuration
                     Cache_inv(&pAstCfg->xInp[zI], sizeof(PAF_AST_InpBuf), Cache_Type_ALLD, 0);
@@ -654,6 +694,11 @@ Void taskAsdpFxn(
                         }
                         TRACE_TERSE0("Dec:decode done");
                         
+                        // write back Status structures for Beta Units initialized on Slave
+                        size = IACP_STD_BETA_TABLE.pStatus[pafBetaMap[sourceSelect]]->size;
+                        Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[pafBetaMap[sourceSelect]]), size, Cache_Type_ALLD, 0);
+                        Cache_wait();
+
                         // copy decoder output to decoder output circular buffers
                         //pCb = &pAstCfg->xDecOpCb[z];
                         //TRACE_TERSE1("Dec:pCb=0x%04x", (IArg)pCb);
index 133012e0bc0ec8a5d0131ca90e0ce13591f824a9..8e985b0c3d3ff18a3c36852532f2be107c6510d3 100644 (file)
@@ -66,6 +66,12 @@ All rights reserved.
     #define AE_TRACE4(a,b,c,d,e)
 #endif
 
+extern struct {
+    Int size;
+    IALG_Status *pStatus[512];
+} IACP_STD_BETA_TABLE;
+
+
 // Global debug counters */
 Uint32 gTaskAfpCnt=0;
 
@@ -84,11 +90,90 @@ Void *AFP_memAlloc(
     return (void *)Memory_alloc((IHeap_Handle)hHeap, size, align, NULL);
 }
 
+
+// Get the beta number from Alpha command
+Int32 AFP_getBeta(AFP_Handle handle, const ACP_Unit *from)
+{
+    ACP_MDS_Obj *acp = (Void *)handle->acp;
+
+    ACP_Union *x = (ACP_Union *)from;
+
+    Uns write, series, type;
+    Int subtype;
+
+    Int beta;
+
+    if ((x[0].byte.hi & 0xc0) != 0xc0)
+        return -1;  // legacy
+    else if (x[0].word == 0xffff)
+        return -1;  // non-zero fill
+
+    write = x[0].byte.hi & 0x08;
+    series = (x[0].byte.hi >> 4) & 0x03;
+    type = x[0].byte.hi & 0x07;
+    subtype = -1;
+
+    if (series >= 4 || ! acp->config.betaTable[series])
+    {
+        return -1;  // No such series
+    }
+
+    beta = -1;
+    switch (type)
+    {
+        case 0:
+            if (!write)
+            {
+                beta = x[0].byte.lo;
+            }
+            break;
+        case 2:
+        case 6:
+            beta = x[0].byte.lo;
+            break;
+        case 3:
+        case 4:
+            beta = x[0].byte.lo;
+            break;
+        case 5:
+            subtype = x[0].byte.lo;
+            switch (subtype)
+            {
+                case 0:
+                    type = subtype;
+                    if (!write)
+                    {
+                        beta = x[1].word;
+                    }
+                    break;
+                case 6:
+                case 10:
+                    beta = x[1].word;
+                    break;
+                case 8:
+                    if (write)
+                    {
+                        return -1;  // NO SUBTYPE error
+                    }
+                    else
+                    {
+                        beta = x[1].word;
+                    }
+                    break;
+                default:
+                    return -1;
+            }
+            default:
+                return -1;
+    }
+    return beta;
+}
+
 Void AFP_process(
     AFP_Handle handle
 )
 {
-    Int rxIdx, txIdx;
+    Int rxIdx, txIdx, beta, statusSize;
     Int encap, len, res_len, error, cnt, txStrip, i, rxOffset, txOffset;
 
     /* Process Alpha commands */
@@ -99,6 +184,8 @@ Void AFP_process(
         txIdx = 3;
         txOffset = 0;
         encap = 0;
+        beta = -1;
+        statusSize = 0;
         
         /* Read the payload */
         if (handle->dcs7->fxns->read(handle->dcs7, 
@@ -193,10 +280,43 @@ Void AFP_process(
                 rxOffset = 2;
             }
 
+            // Get beta number
+            beta = AFP_getBeta(handle->acp,
+                    &handle->rxBuf[rxIdx]);
+
+            // TODO: Add beta of all decoders on Slave
+            // Invalidate Status structures for Beta Units initialized on Slave
+            if ((beta == STD_BETA_PCM)  ||
+                (beta == STD_BETA_PCM2) ||
+                (beta == STD_BETA_DDP) ||
+                (beta == STD_BETA_DDP2) ||
+                (beta == STD_BETA_THD) ||
+                (beta == STD_BETA_THD2)
+               )
+            {
+                statusSize = IACP_STD_BETA_TABLE.pStatus[beta]->size;
+                Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[beta]), statusSize, Cache_Type_ALLD, 0);
+            }
+            
             /* Process alpha command */
             error = handle->acp->fxns->sequence(handle->acp,
                 &handle->rxBuf[rxIdx],
                 &handle->txBuf[txIdx]);
+
+            // TODO: Add beta of all decoders on Slave
+            // write back Status structures for Beta Units initialized on Slave
+            if ((beta == STD_BETA_PCM)  ||
+                (beta == STD_BETA_PCM2) ||
+                (beta == STD_BETA_DDP) ||
+                (beta == STD_BETA_DDP2) ||
+                (beta == STD_BETA_THD) ||
+                (beta == STD_BETA_THD2)
+               )
+            {
+                statusSize = IACP_STD_BETA_TABLE.pStatus[beta]->size;
+                Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[beta]), statusSize, Cache_Type_ALLD, 0);
+            }
+            
             if (error)
             {
                 //handle->fxns->log(handle,handle->logObj,