Add support for DDR shared heap. Note:algs use IALG_EXTERNAL_SHM, which is IALG_ESDATA.
authorFrank Livingston <frank-livingston@ti.com>
Mon, 19 Sep 2016 21:03:59 +0000 (16:03 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Mon, 19 Sep 2016 21:03:59 +0000 (16:03 -0500)
processor_audio_sdk_1_00_00_00/pasdk/common/audioStreamProc_common.h
processor_audio_sdk_1_00_00_00/pasdk/common/paf_alg_malloc.c
processor_audio_sdk_1_00_00_00/pasdk/common/paf_alg_print.c
processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/audioStreamDecodeProc.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/audioStreamOutProc.c
processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/itopo/params.c

index a31d507d1dc966ad1efd59575030474062681f74..56501ccc796e761da7526f5b5205cdf8465eb965 100644 (file)
@@ -157,10 +157,12 @@ All rights reserved.
 #define HEAP_ID_INTERNAL1       *pP->heap.pHeapIdIntern1    //*pP->heap.pIntern1
 #define HEAP_ID_EXTERNAL        *pP->heap.pHeapIdExtern     //*pP->heap.pExtern
 #define HEAP_ID_INTERNAL1_SHM   gPafHeapIdInt1Shm
+#define HEAP_ID_EXTERNAL_SHM    gPafHeapIdExtShm
 #define HEAP_INTERNAL           (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_INTERNAL)
 #define HEAP_INTERNAL1          (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_INTERNAL1)
 #define HEAP_EXTERNAL           (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_EXTERNAL)
 #define HEAP_INTERNAL1_SHM      (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_INTERNAL1_SHM)
+#define HEAP_EXTERNAL_SHM       (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_EXTERNAL_SHM)
 #define HEAP_CLEAR              pP->heap.clear
 
 #define HEAP_ID_INPBUF      *pP->heap.pHeapIdInpbuf     //*pP->heap.pInpbuf
index 463cd9d2477224640870f4630c8e9d195e956b4c..b613bf75109e38f285acc8e6ca1dc0037e409392 100644 (file)
@@ -207,6 +207,7 @@ PAF_ALG_allocMemory_ (
                             gPafHeapIdInt1,     (HeapMem_Handle)pafHeapMgr_readHeapHandle(gPafHeapIdInt1),
                             gPafHeapIdExt,      (HeapMem_Handle)pafHeapMgr_readHeapHandle(gPafHeapIdExt),
                             gPafHeapIdInt1Shm,  (HeapMem_Handle)pafHeapMgr_readHeapHandle(gPafHeapIdInt1Shm),
+                            gPafHeapIdExtShm,   (HeapMem_Handle)pafHeapMgr_readHeapHandle(gPafHeapIdExtShm),
                             0);
                     TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_.%d: alloc %d bytes from space %d", __LINE__, memTab[i].size, memTab[i].space));
                     //if(!(memTab[i].base=(void *)MEM_alloc(
@@ -401,20 +402,20 @@ PAF_ALG_memSpaceToHeapId_ (
 {
     switch(space)
     {
-        case IALG_SARAM:    /* IALG_SARAM0 = IALG_SARAM :  Normally used for IRAM.  */
+        case IALG_SARAM:    /* IALG_SARAM0 = IALG_SARAM :  Normally used for IRAM */ // FL: K2G: used for L2 on DSP
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_SARAM (0x%x) 0x%x", __LINE__, space, p->iHeapId));
             return p->iHeapId;
 
-        case IALG_EXTERNAL: // normally external SDRAM
+        case IALG_EXTERNAL: // normally external SDRAM // FL: K2G: used for DDR local memory
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_EXTERNAL (0x%x) 0x%x", __LINE__, space, p->eHeapId));
             return p->eHeapId;
 
-        case IALG_SARAM1:
+        case IALG_SARAM1: // FL: K2G: used for MSMC local memory
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_SARAM1 (0x%x) 0x%x", __LINE__, space, p->lHeapId));
             return p->lHeapId;
 
-        case IALG_SARAM2:
-            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_SARAM2 (0x%x) 0x%x", __LINE__, space, p->lHeapIdShm));
+        case IALG_SARAM2:  // FL: K2G: used for MSMC shared memory
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_SARAM2 (IALG_SARAM_SHM) (0x%x) 0x%x", __LINE__, space, p->lHeapIdShm));
             return p->lHeapIdShm;
 
         case IALG_DARAM0:   // Can't use this because it is zero and overridden
@@ -429,9 +430,9 @@ PAF_ALG_memSpaceToHeapId_ (
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_DARAM2 (0x%x) 0x%x", __LINE__, space, p->iHeapId));
             return p->iHeapId;    // not normally used.
 
-        case IALG_ESDATA:   // not normally used.
-            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_ESDATA (0x%x) 0x%x", __LINE__, space, p->eHeapId));
-            return p->eHeapId;
+        case IALG_ESDATA:   // FL: K2G: used for DDR shared memory
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_ESDATA (IALG_EXTERNAL_SHM) (0x%x) 0x%x", __LINE__, space, p->eHeapIdShm));
+            return p->eHeapIdShm;
 
         default:
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: default (0x%x) 0x%x", __LINE__, space, p->eHeapId));
@@ -447,20 +448,20 @@ PAF_ALG_memSpaceToHeap_ (
 {
     switch(space)
     {
-        case IALG_SARAM:    /* IALG_SARAM0 = IALG_SARAM :  Normally used for IRAM.  */
+        case IALG_SARAM:    /* IALG_SARAM0 = IALG_SARAM :  Normally used for IRAM. */ // FL: K2G: used for L2 on DSP
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_SARAM (0x%x) 0x%x", __LINE__, space, p->iHeapId));
             return p->hIHeap;
 
-        case IALG_EXTERNAL: // normally external SDRAM
+        case IALG_EXTERNAL: // normally external SDRAM // FL: K2G: used for DDR local memory
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_EXTERNAL (0x%x) 0x%x", __LINE__, space, p->eHeapId));
             return p->hEHeap;
 
-        case IALG_SARAM1:   // Used by Dolby Digital
+        case IALG_SARAM1:   // FL: K2G: used for MSMC local memory
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_SARAM1 (0x%x) 0x%x", __LINE__, space, p->lHeapId));
             return p->hLHeap;
 
         case IALG_SARAM2:
-            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_SARAM2 (0x%x) 0x%x", __LINE__, space, p->iHeapId));
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_SARAM2 (IALG_SARAM_SHM) (0x%x) 0x%x", __LINE__, space, p->lHeapIdShm));
             return p->hLHeapShm;
 
         case IALG_DARAM0:   // Can't use this because it is zero and overridden
@@ -475,9 +476,9 @@ PAF_ALG_memSpaceToHeap_ (
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_DARAM2 (0x%x) 0x%x", __LINE__, space, p->iHeapId));
             return p->hIHeap;    // not normally used.
 
-        case IALG_ESDATA:   // not normally used.
-            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_ESDATA (0x%x) 0x%x", __LINE__, space, p->eHeapId));
-            return p->hEHeap;
+        case IALG_ESDATA:   // FL: K2G: used for DDR shared memory
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_ESDATA (0x%x) 0x%x", __LINE__, space, p->eHeapIdShm));
+            return p->hEHeapShm;
 
         default:
             TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: default (0x%x) 0x%x", __LINE__, space, p->eHeapId));
@@ -504,6 +505,8 @@ PAF_ALG_setup_ (
     HeapMem_Handle hEHeap,
     Int lHeapIdShm,
     HeapMem_Handle hLHeapShm,
+    Int eHeapIdShm,
+    HeapMem_Handle hEHeapShm,
     Int clr
 )
 { 
@@ -516,12 +519,14 @@ PAF_ALG_setup_ (
     p->lHeapId      = lHeapId;
     p->eHeapId      = eHeapId;
     p->lHeapIdShm   = lHeapIdShm;
+    p->eHeapIdShm   = eHeapIdShm;
     
     /* initialize heap handles */
     p->hIHeap       = hIHeap;
     p->hLHeap       = hLHeap;
     p->hEHeap       = hEHeap;
     p->hLHeapShm    = hLHeapShm;
+    p->hEHeapShm    = hEHeapShm;
     
     /* initialize clear flag */
     p->clr=clr;
index 9d500a268c611a3f29fae16bf68501e4f83f43d1..9385b44440e9eb530b8740ff5b3159c20b64c705 100644 (file)
@@ -194,7 +194,7 @@ PAF_ALG_headerPrint()
     printf("\n\nAlgorithm Memory requirement:\n");
     printf("  Key:  \n");
     printf("    Beta ID can be decoded from stdbeta.h, oembeta.h or cusbeta.h in pa\\sio\\acp1.\n");
-    printf("    The number in parentheses is the heap.  (0) is L2.  (1) is MSMC.  (2) is DDR3.  (3) is MSMC SHM.\n");
+    printf("    The number in parentheses is the heap.  (0) is L2.  (1) is MSMC.  (2) is DDR3.  (3) is MSMC SHM.  (4) is DDR SHM.\n");
     printf("%8s\t","BetaId");
     for(i=PAF_IALG_COMMON_MEM0;i<=PAF_IALG_COMMON_MEMN;++i){
         if(i==0) printf("%8s\t","SCRATCH");
index 4b869a2ff5e1a967ff04f53749364c497652e44c..7a7c0c8c874496a02d756d89e11bdaf96c2a5035 100644 (file)
@@ -962,6 +962,7 @@ PAF_ASDT_initPhaseCommon(
         HEAP_ID_INTERNAL1,      HEAP_INTERNAL1, 
         HEAP_ID_EXTERNAL,       HEAP_EXTERNAL, 
         HEAP_ID_INTERNAL1_SHM,  HEAP_INTERNAL1_SHM, 
+        HEAP_ID_EXTERNAL_SHM,   HEAP_EXTERNAL_SHM, 
         HEAP_CLEAR);
 
     if (pP->fxns->headerPrint)
index 58950f00c335a131af8237540f5f1dfc139318f5..9e06ee9d85e84deebd4353d75564bab8db3bb225 100644 (file)
@@ -1077,6 +1077,7 @@ PAF_ASIT_initPhaseCommon(
         HEAP_ID_INTERNAL1,      HEAP_INTERNAL1, 
         HEAP_ID_EXTERNAL,       HEAP_EXTERNAL, 
         HEAP_ID_INTERNAL1_SHM,  HEAP_INTERNAL1_SHM, 
+        HEAP_ID_EXTERNAL_SHM,   HEAP_EXTERNAL_SHM, 
         HEAP_CLEAR);
 
     if (pP->fxns->headerPrint)
@@ -1279,6 +1280,7 @@ PAF_ASIT_initPhaseDevice(
             HEAP_ID_INTERNAL1,      HEAP_INTERNAL1,
             HEAP_ID_EXTERNAL,       HEAP_EXTERNAL,
             HEAP_ID_INTERNAL1_SHM,  HEAP_INTERNAL1_SHM,
+            HEAP_ID_EXTERNAL_SHM,   HEAP_EXTERNAL_SHM,
             HEAP_CLEAR);
         TRACE_TERSE2("PAF_ASIT_initPhaseDevice: AS%d: calling PAF_ALG_setup with clear at %d.", as, HEAP_CLEAR);
     }
index 4381a4625de5bc5cd8386f79882828154e6414d1..c9194211868041352ead8ca1ae21aaac51f88da0 100644 (file)
@@ -601,6 +601,7 @@ PAF_ASOT_initPhaseCommon(
         HEAP_ID_INTERNAL1,      HEAP_INTERNAL1, 
         HEAP_ID_EXTERNAL,       HEAP_EXTERNAL, 
         HEAP_ID_INTERNAL1_SHM,  HEAP_INTERNAL1_SHM, 
+        HEAP_ID_EXTERNAL_SHM,   HEAP_EXTERNAL_SHM, 
         HEAP_CLEAR);
 
     if (pP->fxns->headerPrint)
@@ -889,6 +890,7 @@ PAF_ASOT_initPhaseDevice(
             HEAP_ID_INTERNAL1,      HEAP_INTERNAL1,
             HEAP_ID_EXTERNAL,       HEAP_EXTERNAL,
             HEAP_ID_INTERNAL1_SHM,  HEAP_INTERNAL1_SHM,
+            HEAP_ID_EXTERNAL_SHM,   HEAP_EXTERNAL_SHM,
             HEAP_CLEAR);
         TRACE_TERSE2("PAF_ASOT_initPhaseDevice: AS%d: calling PAF_ALG_setup with clear at %d.", as, HEAP_CLEAR);
     }
index 37e7d46d20456df37472caeedbd00fb80cc49438..0173dfb7d72d6b478367b4a3eeed632e26128fe7 100644 (file)
@@ -44,6 +44,7 @@ All rights reserved.
 #include <procsdk_audio_typ.h>
 
 #include "paftyp.h"
+#include "paf_ialg.h"
 #include <stdasp.h>
 #include <pafsio_ialg.h>
 
@@ -588,6 +589,8 @@ static const IALG_MemSpace params_memspace_PAi[] = {
 // DIB memory requirements
 
 // primary input
+// IALG_SARAM_SHM: MSMC shared memory heap
+// IALG_EXTERNAL_SHM: DDR shared memory heap
 const IALG_MemRec inpMemTabPrimary[] =
 {
     // SDRAM circular buffer
@@ -597,7 +600,7 @@ const IALG_MemRec inpMemTabPrimary[] =
         //180 * 1024,                                           // size
         //6 * 60 * 1024,                                        // size
         128,                                                    // alignment
-        IALG_SARAM2, //IALG_SARAM1, //IALG_EXTERNAL,                           // space
+        IALG_SARAM_SHM, //IALG_EXTERNAL_SHM, //IALG_SARAM2, //IALG_SARAM1, //IALG_EXTERNAL,                           // space
         IALG_PERSIST,                                           // attrs
         NULL,                                                   // base
      },