]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - pasdk/test_arm/framework/audioStreamDecodeProc.c
Manual merge from dev_pasdk_pp_work1, commitId=cf72f3b
[processor-sdk/performance-audio-sr.git] / pasdk / test_arm / framework / audioStreamDecodeProc.c
index 8b695a53ea61411e3df5473068f15856faf6d484..8f628d00cc209140d78af5491115ce1a0a0fd649 100644 (file)
@@ -154,6 +154,7 @@ Void taskAsdpFxn(
     MessageQ_QueueId queId;
     Int status;
     Int zI;
+    Int bufEnd, wrapSize, currentBufSize, chunkSize;
 
     
     Log_info0("Enter taskAsdpFxn()");
@@ -551,12 +552,38 @@ Void taskAsdpFxn(
                     {
                         size *= pIpBufConfig->stride;
                     }
-                    Cache_inv((Ptr)pIpBufConfig->pntr.pSmInt, size, Cache_Type_ALLD, 0);
+
+                    bufEnd = (Int) pIpBufConfig->base.pVoid + pIpBufConfig->sizeofBuffer;
+                    currentBufSize = (bufEnd - (Int)pIpBufConfig->pntr.pSmInt);
+                    if (currentBufSize >= size)
+                    {
+                        chunkSize = size;
+                    }
+                    else
+                    {
+                        chunkSize = currentBufSize;
+                    }
+                    wrapSize = size - chunkSize;
+                    // invalidate input data
+                    Cache_inv((Ptr)pIpBufConfig->pntr.pSmInt, chunkSize, Cache_Type_ALLD, 0);
+                    TRACE_MSG2("IBUF : pIpBufConfig->pntr.pSmInt: 0x%x and chunkSize: %d", pIpBufConfig->pntr.pSmInt, chunkSize);
                     // invalidate Dec configuration
                     Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
                     // status for selected decoder should be invalidated
                     Cache_wait();
-            
+
+                    /* Circular buffer wrap condition*/
+                    //if(((Int) pIpBufConfig->head.pVoid + size)  > bufEnd)
+                    if(wrapSize > 0)
+                    {
+                        // invalidate input data
+                        Cache_inv((Ptr)pIpBufConfig->base.pSmInt, wrapSize, Cache_Type_ALLD, 0);
+                        TRACE_MSG2("IBUF : pIpBufConfig->base.pSmInt: 0x%x and wrapSize: %d",pIpBufConfig->base.pSmInt, wrapSize);
+                        // status for selected decoder should be invalidated
+                        Cache_wait();
+                    }
+                    /* Circular buffer wrap condition */
+
                     dec = (DEC_Handle)alg[z];
                     errno = 0;
                     if (dec->fxns->info)