Add 1 16-bit word for EDMA padding for Input Driver
authorFrank Livingston <frank-livingston@ti.com>
Fri, 9 Sep 2016 23:05:44 +0000 (18:05 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Fri, 9 Sep 2016 23:05:44 +0000 (18:05 -0500)
processor_audio_sdk_1_00_00_00/pasdk/common/aspDecOpCircBuf_common.h
processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/aspDecOpCircBuf_slave.c
processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/audioStreamDecodeProc.c
processor_audio_sdk_1_00_00_00/pasdk/test_dsp/application/itopo/evmk2g/atboot.c
processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/aspDecOpCircBuf_master.c
processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/audioStreamInpProc.c
processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/itopo/params.c

index 8b9994de3f27d28dd9d9f9690ddb1268ffc095ae..d78cf5ce4570740dcf152571198bf52faf9aaa92 100644 (file)
@@ -51,7 +51,7 @@ All rights reserved.
 #define ASP_DECOP_CB_PCM_BUF_SZ             ( ASP_DECOP_CB_MAX_NUM_PCM_CH * ASP_DECOP_CB_MAX_NUM_PCM_FRAMES * ASP_DECOP_CB_MAX_PCM_FRAME_LEN )
 
 #define ASP_DECODE_CB_GATE_NAME             ( "AspDecOpCbGate" )
-#define ASP_DECODE_CB_GATE_REGION_ID        ( 0 )
+#define ASP_DECODE_CB_GATE_REGION_ID        ( 1 )
 
 
 // Decoder output circular buffer
index 750fe4df3eaaca4c0cc6072002462c4c04843483..ea6598d95a3d16ef933cb40a52b1c191090d2887 100644 (file)
@@ -45,6 +45,8 @@ All rights reserved.
 //#include "pafsp.h"
 #include "aspDecOpCircBuf_slave.h"
 
+extern UInt32 gSlaveDecDecodeCnt;
+
 // Initialize circular buffer control
 Int cbCtlInit(
     PAF_AST_DecOpCircBufCtl *pCbCtl,    // decoder output circular buffer control
@@ -100,6 +102,8 @@ Int cbWriteStart(
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
     
+    Log_info1("cbWriteStart:afCb=0x%04x", (IArg)pCb->afCb);
+    
     // Invalidate AF circular buffer
     Cache_inv(pCb->afCb, pCb->maxNumAfCb*sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
     for (n=0; n<pCb->maxNumAfCb; n++)
@@ -150,6 +154,8 @@ Int cbWriteStop(
     // Invalidate circular buffer configuration
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
+
+    Log_info1("cbWriteStop:afCb=0x%04x", (IArg)pCb->afCb);
     
     // update flags
     pCb->writerActiveFlag = 0;
@@ -186,8 +192,11 @@ Int cbWriteAf(
     // Enter gate
     key = GateMP_enter(gateHandle);
 
+    Log_info2("cbWriteAf:gate enter, gateHandle=0x%04x, key=%d", (IArg)gateHandle, (IArg)key);
+    
     // Get circular buffer base pointer
     pCb = &((*pCbCtl->pXDecOpCb)[cbIdx]);
+    Log_info1("cbWriteAf:pCb=0x%04x", (IArg)pCb);
 
     // (***) FL: revisit
     // Invalidate circular buffer configuration.
@@ -195,6 +204,10 @@ Int cbWriteAf(
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
     
+    Log_info1("cbWriteAf:afCb=0x%04x", (IArg)pCb->afCb);   
+
+    Log_info2("cbWriteAf:pCb->readerActiveFlag=%d, pCb->writerActiveFlag=%d", (IArg)pCb->readerActiveFlag, (IArg)pCb->writerActiveFlag);
+
     if (pCb->readerActiveFlag == 1)
     {
         //
@@ -217,6 +230,8 @@ Int cbWriteAf(
         }
 #endif        
 
+        Log_info2("cbWriteAf:pCb->numAfCb=%d, pCb->maxNumAfCb=%d", (IArg)pCb->readerActiveFlag, (IArg)pCb->maxNumAfCb);
+    
         // check overflow
         if (pCb->numAfCb >= pCb->maxNumAfCb)
         {
@@ -225,14 +240,21 @@ Int cbWriteAf(
             //SW_BREAKPOINT;
             Log_info1("cbWriteAf: ERROR: overflow, numAfCb=%d", pCb->numAfCb);
 
+            // Write back circular buffer configuration
+            Cache_wb(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
+
             // Leave the gate
             GateMP_leave(gateHandle, key);
 
+            Log_info2("cbWriteAf:gate leave, gateHandle=0x%04x, key=%d", (IArg)gateHandle, (IArg)key);
+            
             return ASP_DECOP_CB_WRITE_OVERFLOW;
         }
         
         // get pointer to current audio frame in circular buffer
+        Log_info2("cbWriteAf:afCb=0x%04x, pCb->afWrtIdx=%d", (IArg)pCb->afCb, (IArg)pCb->afWrtIdx);
         pAfCb = &pCb->afCb[pCb->afWrtIdx];
+        Log_info1("cbWriteAf:pAfCb=0x%04x", (IArg)pAfCb);
            
         // write audio frame information updated by decoder
         pAfCb->sampleDecode = pAfWrt->sampleDecode;
@@ -248,6 +270,14 @@ Int cbWriteAf(
         pAfCb->bsMetadata_offset   = pAfWrt->bsMetadata_offset;      /* offset into audio frame for change in bsMetadata_type field */
         // write PCM samples
         streamMask = pAfWrt->fxns->channelMask(pAfWrt, pAfCb->channelConfigurationStream);
+        Log_info1("cbWriteAf:streamMask=0x%04x", (IArg)streamMask);
+        Log_info1("cbWriteAf:pCb->decOpFrameLen=%d", (IArg)pCb->decOpFrameLen);
+        Log_info2("cbWriteAf:pAfCb->data.sample=0x%04x, pAfWrt->data.sample=0x%04x", (IArg)pAfCb->data.sample, (IArg)pAfWrt->data.sample);
+        Log_info2("cbWriteAf:pAfCb->data.samsiz=0x%04x, pAfWrt->data.samsiz=0x%04x", (IArg)pAfCb->data.samsiz, (IArg)pAfWrt->data.samsiz);
+        //if (gSlaveDecDecodeCnt == 7)
+        //{
+        //    Log_info1("gSlaveDecDecodeCnt=%d", (IArg)gSlaveDecDecodeCnt);
+        //}
         for (i = 0; i < ASP_DECOP_CB_MAX_NUM_PCM_CH; i++)
         {
             if ((streamMask >> i) & 0x1)
@@ -261,6 +291,7 @@ Int cbWriteAf(
             }
         }
         
+        Log_info1("cbWriteAf:pAfCb->numPrivateMetadata=%d", (IArg)pAfCb->numPrivateMetadata);
         // Write metadata to circular buffer
         for (i = 0; i < pAfCb->numPrivateMetadata; i++) // FL: only copy numPrivateMetadata
         {
@@ -270,14 +301,18 @@ Int cbWriteAf(
         }
         
         // update audio frame write index
+        Log_info2("cbWriteAf:pCb->afWrtIdx=%d, pCb->maxNumAfCb", (IArg)pCb->afWrtIdx, (IArg)pCb->maxNumAfCb);
         pCb->afWrtIdx++;
         if (pCb->afWrtIdx >= pCb->maxNumAfCb)
         {
             pCb->afWrtIdx = 0;
         }
+        Log_info2("cbWriteAf:pCb->afWrtIdx=%d, pCb->maxNumAfCb", (IArg)pCb->afWrtIdx, (IArg)pCb->maxNumAfCb);
         
         // update number of audio frames in circular buffer
+        Log_info1("cbWriteAf:pCb->numAfCb=%d", (IArg)pCb->numAfCb);
         pCb->numAfCb++;
+        Log_info1("cbWriteAf:pCb->numAfCb=%d", (IArg)pCb->numAfCb);
 
         // (***) FL: revisit
         // Write back circular buffer configuration
@@ -306,6 +341,8 @@ Int cbWriteAf(
     // Leave the gate
     GateMP_leave(gateHandle, key);
 
+    Log_info2("cbWriteAf:gate leave, gateHandle=0x%04x, key=%d", (IArg)gateHandle, (IArg)key);
+    
     return ASP_DECOP_CB_SOK;
 }
 
index 71e249394f446e2de90462b3eef191b00ff86ab9..6a3fee8704cf67153e0167ea63f07e5c92a6c3bc 100644 (file)
@@ -620,14 +620,14 @@ Void taskAsdpFxn(
                         {
                             SW_BREAKPOINT;
                         }
-                        //TRACE_TERSE0("Dec:decode done");
+                        TRACE_TERSE0("Dec:decode done");
                         
                         // copy decoder output to decoder output circular buffers
                         //pCb = &pAstCfg->xDecOpCb[z];
                         //TRACE_TERSE1("Dec:pCb=0x%04x", (IArg)pCb);
                         
                         pAfWrt = pAstCfg->xDec[z].decodeOutStruct.pAudioFrame;
-                        //TRACE_TERSE1("Dec:pAfWrt=0x%04x", (IArg)pAfWrt);
+                        TRACE_TERSE1("Dec:pAfWrt=0x%04x", (IArg)pAfWrt);
                         //TRACE_TERSE1("nSamples=%d",pAfWrt->data.nSamples);
                         
                         // FL: debug, capture audio frame
@@ -641,7 +641,7 @@ Void taskAsdpFxn(
                         {
                             SW_BREAKPOINT;
                         }
-                        //TRACE_TERSE0("Dec:cbWriteAf() complete");
+                        TRACE_TERSE0("Dec:cbWriteAf() complete");
                         
                         // FL: debug, log circular buffer control variables
                         cbLog(pCbCtl, z, 1, "cbWriteAf");
index 812ac0e306280ceba977a6f2744d217a5fb4f896..947e7b145d3afdcaaa30de6f82980899180829bc 100644 (file)
@@ -56,14 +56,14 @@ All rights reserved.
     writeVOLOffsetMasterN(0x7fff), \
     writeSYSRecreationModeDirect, \
     writeSYSChannelConfigurationRequestSurround4_1, \
-    execPAIOutAnalogSlave, \
-    execPAIInAnalog
-    //execPAIOutAnalog, \
-    //execPAIInDigital    
-    //execPAIOutAnalog, \
-    //execPAIInHDMIStereo   
+    execPAIOutAnalog, \
+    execPAIInHDMIStereo   
     //execPAIOutAnalog, \
     //execPAIInHDMI
+    //execPAIOutAnalogSlave, \
+    //execPAIInAnalog
+    //execPAIOutAnalog, \
+    //execPAIInDigital    
 #else
 
 #define CUS_ATBOOT_S \
index f970ec5666cc66ad373e7fd0571cdfda3910ea4b..f5c0ebcf1b1c795d6e1f76b484fa159a08a4d845 100644 (file)
@@ -231,6 +231,8 @@ Int cbInitSourceSel(
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
 
+    Log_info1("cbInitSourceSel:afCb=0x%04x", (IArg)pCb->afCb);
+
     // set source select
     pCb->sourceSel = sourceSelect;
 
@@ -388,6 +390,8 @@ Int cbReadStart(
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
     
+    Log_info1("cbReadStart:afCb=0x%04x", (IArg)pCb->afCb);
+
     // update flags
     pCb->readerActiveFlag = 1;
     
@@ -424,6 +428,8 @@ Int cbReadStop(
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
     
+    Log_info1("cbReadStop:afCb=0x%04x", (IArg)pCb->afCb);
+
     // update flags
     pCb->readerActiveFlag = 0;
     
@@ -466,6 +472,8 @@ Int cbReadAf(
     Cache_inv(pCb, sizeof(PAF_AST_DecOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
 
+    Log_info1("cbReadAf:afCb=0x%04x", (IArg)pCb->afCb);
+
     if ((pCb->writerActiveFlag == 1) && (pCb->emptyFlag == 1))
     {
         // This shouldn't occur:
index 983559702d88a2d2e9c681e50ad4c54989c8d560..f8085b8e909543cf23d99bedfd12d2dc44ad4348 100644 (file)
@@ -1333,7 +1333,6 @@ PAF_ASIT_initPhaseDecOpCircBuf(
 )
 {
     PAF_AST_Config *pAstCfg;
-    PAF_AST_DecOpCircBufCtl *pCbCtl;    /* Decoder output circular buffer control */
     PAF_AST_DecOpCircBuf *pCb;          /* Decoder output circular buffer */
     Int as;                             /* Audio Stream Number (1, 2, etc.) */
     Int zMS;
@@ -1347,8 +1346,6 @@ PAF_ASIT_initPhaseDecOpCircBuf(
     as = pAstCfg->as;
     zMS = pAstCfg->masterStr;
 
-    pCbCtl = &pC->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
-    
     /* Decode output circular buffer memory */
     if (!(pAstCfg->xDecOpCb = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, 
         DECODEN * sizeof (*pAstCfg->xDecOpCb), 4, &eb)))
@@ -2441,14 +2438,14 @@ PAF_ASIT_decodeInit(
             //pC->xDec[z].decodeControl.rdSampleCount = 0;
 
             // Initialize decoder output circular buffer for selected source
-            errno = cbInitSourceSel(pCbCtl, z, sourceSelect, frameLength, FRAMELENGTH);
+            errno = cbInitSourceSel(pCbCtl, z, sourceSelect, frameLength, FRAMELENGTH, 0);
             if (errno)
             {
                 SW_BREAKPOINT; // FL: debug
                 return errno;
             }
             // FL: debug
-            cbLog(pCbCtl, z, 1, "PAF_ASIT_decodeInit:cbInit");
+            cbLog(pCbCtl, z, 1, "PAF_ASIT_decodeInit:cbInitSourceSel");
             
             if (z != zMD) 
             {
index 628c82144ef45bf4297b48c1f5908386285022b4..2bbd9e5d213a01d28196d8cd55ab7dc3821d3bc3 100644 (file)
@@ -592,7 +592,7 @@ const IALG_MemRec inpMemTabPrimary[] =
     // SDRAM circular buffer
     // 2 buffers * 256 samples/buffer * 8 words/sample * 3 bytes/word
     {
-        3 * 60 * 1024,                                          // size
+        (3 * 60 * 1024) + 2,                                    // size 184320 + 1 16-bit word for EDMA padding
         //180 * 1024,                                           // size
         //6 * 60 * 1024,                                        // size
         128,                                                    // alignment