Add GateMP for Decoder Output Circular Buffer
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / common / aspDecOpCircBuf_common.c
index 41669a9873491bd18fde420c2935ddb4630dc355..edf3b7c16c228d1c569accc0ed4ff89ff5772022 100644 (file)
@@ -34,18 +34,32 @@ All rights reserved.
 */
 
 #include <xdc/std.h>
-#include <ti/sysbios/hal/Cache.h>
 #include <xdc/runtime/Log.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/ipc/GateMP.h>
 
 #include "aspDecOpCircBuf_common.h"
 
 // Output log of circular buffer control variables (debug)
 Int cbLog(
-    PAF_AST_DecOpCircBuf *pCb,
+    PAF_AST_DecOpCircBufCtl *pCbCtl,
+    Int8 cbIdx, 
     Int8 fullLog, 
     char *locInfo
 )
 {
+    IArg key;
+    GateMP_Handle gateHandle;
+    PAF_AST_DecOpCircBuf *pCb;
+    
+    // Get gate handle
+    gateHandle = pCbCtl->gateHandle;
+    // Enter gate
+    key = GateMP_enter(gateHandle);
+    
+    // Get circular buffer base pointer
+    pCb = &pCbCtl->xDecOpCb[cbIdx];
+    
     // Invalidate circular buffer configuration.
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
@@ -61,6 +75,9 @@ Int cbLog(
         Log_info2("CB: decOpFrameLen=%d, strFrameLen=%d", pCb->decOpFrameLen, pCb->strFrameLen);
         //Log_info1("cbWriteInit=%d", pCb->cbWriteAfInit);
     }
+
+    // Leave the gate
+    GateMP_leave(gateHandle, key);
     
-    return 0;
+    return ASP_DECOP_CB_SOK;
 }