Add demo source code
authorFrank Livingston <frank-livingston@ti.com>
Mon, 20 Jun 2016 20:40:07 +0000 (15:40 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Mon, 20 Jun 2016 20:40:07 +0000 (15:40 -0500)
108 files changed:
procsdk_audio_x_xx_xx_xx/common/asp0.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/audioStreamProc_common.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/audioStreamProc_common.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/common.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/dbgCapAf.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/dbgCapAf.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/dbgDib.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/dbgDib.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/drvPort.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/fwkPort.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/fwkPort.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/paf_alg_create.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/paf_alg_malloc.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/paf_alg_print.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/paf_heapMgr.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/paf_heapMgr.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/shared/aspMsg_common.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/shared/config.bld [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/shared/ipc.cfg.xs [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/.ccsproject [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/.cproject [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/.project [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/application/app.cfg [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/application/app.cmd [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/application/main.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/aspMsg_slave.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/aspMsg_slave.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_paramsFxns_slave.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/itopo/params_slave.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/itopo/patchs_slave.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/systemInit.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/macros.ini_initial [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/.ccsproject [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/.cproject [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/.project [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/acp_main_cus.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/app.cfg [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/app.cmd [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/itopo/evmk2g/alpha/i13_a.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/itopo/evmk2g/alpha/pa_i13_evmk2g_io_a.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/itopo/evmk2g/atboot.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/itopo/evmk2g/io.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/itopo/ipce_nodelay.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/application/main.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/boards/k2g/drivers/dap_e17.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/boards/k2g/drivers/dap_e17.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/alphaFuncProc.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/alphaFuncProc.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/alphaIntervalProc.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/alphaIntervalProc.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/as0.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/aspMsg_master.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/aspMsg_master.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamProc.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamProc.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamProc_paramsFxns.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/fwkSim.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/fwkSim.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/itopo/identify.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/itopo/params.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/itopo/patchs.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/itopo/system.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/notifyInfoChangeGpio.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/systemInit.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/systemStream.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/systemStream.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/macros.ini_initial [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/mib/mib.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/mib/mib.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/mib/miberr.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/mob/mob.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/mob/mob.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/mob/moberr.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/Makefile [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/audio_dc_cfg.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/dap_dmax.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/edma_cfg.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/platform_osal.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sample_cs.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sample_k2g_cfg.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sample_k2g_int_reg.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap_csl_mcasp.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap_csl_mcasp.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap_csl_mcasphal.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap_csl_stdinchal.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap_d10.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap_mcasp.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sap/sap_mcasp.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio/dap/dap.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio/dbgDob.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio/dbgDob.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio/dev2utils.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio/sio.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio/sio.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio_dev2/dev2.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio_dev2/dev2.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio_dev2/dgn2.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio_dev2/dgn2.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio_dev2/sio2.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/sio_dev2/sio2.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/targetConfigs/K2GEVM.ccxml [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/targetConfigs/readme.txt [new file with mode: 0644]

diff --git a/procsdk_audio_x_xx_xx_xx/common/asp0.c b/procsdk_audio_x_xx_xx_xx/common/asp0.c
new file mode 100644 (file)
index 0000000..0825e37
--- /dev/null
@@ -0,0 +1,502 @@
+
+/*
+* Copyright (C) 2004-2014 Texas Instruments Incorporated - http://www.ti.com/
+* All rights reserved. 
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+//
+//
+// Performance Audio Framework Series 3 -- Audio Stream Processing Definitions
+//
+//
+//
+
+#include "fwkPort.h"
+
+#include <xdc/std.h>
+
+//#include <mem.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/IHeap.h>
+#include <ti/sysbios/heaps/HeapMem.h>
+
+//
+#include "asp0.h"
+//#include <paf_alg.h>
+//#include <pafhjt.h>
+
+#include <acp.h>
+
+#include "logp.h"
+
+//
+// Audio Stream Processing Chain Function - Initialization
+//
+//   Name:      PAF_ASP_chainInit_
+//   Purpose:   Initialize an ASP Chain by linking all elements of an
+//              initialization array onto it. If this is the first audio
+//              stream, perform base initialization of the ASP Chain, but 
+//              otherwise do not.
+//   From:      AST Parameter Chain Function -> chainInit
+//   Uses:      AST Parameter Chain Function -> chainLink
+//   States:    None.
+//   Return:    ASP Chain.
+//   Trace:     None.
+//
+
+PAF_ASP_Chain *
+PAF_ASP_chainInit_ (
+    PAF_ASP_Chain *this,
+    const struct PAF_ASP_ChainFxns *fxns,
+    HeapMem_Handle heap, //int heap,
+    Uns stream,
+    ACP_Handle acp,
+    LOG_Obj *log,
+    const PAF_ASP_LinkInit *pInit,
+    PAF_ASP_Chain *from,
+    IALG_MemRec *common,
+    PAF_IALG_Config *pafConfig)
+{
+    if (stream) {
+        this->fxns = fxns;
+        this->head = NULL;
+        this->stream = stream;
+        this->acp = acp;
+        this->log = log;
+    }
+
+    for ( ; pInit && pInit->thisCode.full; pInit++)
+        if (! this->fxns->chainLink (this, heap, pInit, from, common, pafConfig))
+            return NULL;
+
+    return this;
+}
+
+//
+// Audio Stream Processing Chain Function - Link
+//
+//   Name:      PAF_ASP_chainLink_
+//   Purpose:   Link an element onto an ASP Chain:
+//              (1) Allocate memory for the link, and
+//              (2) For the first gear, create the data for the link, but
+//              (3) For other than the first gear, simply link the data already
+//                  created in the previous gear.
+//   From:      AST Parameter Chain Function -> chainInit
+//   Uses:      See code.
+//   States:    None.
+//   Return:    Success: ASP Chain.
+//              Failure: Null.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * Memory allocation errors.
+//              * Data creation errors.
+//              * Data linking errors.
+//
+
+
+PAF_ASP_Chain *
+PAF_ASP_chainLink_ (
+    PAF_ASP_Chain *this,
+    HeapMem_Handle heap, //int heap,
+    const PAF_ASP_LinkInit *pInit,
+    PAF_ASP_Chain *from,
+    IALG_MemRec *common,
+    PAF_IALG_Config *pafConfig)
+{
+    PAF_ASP_Link *pLink;
+    Error_Block    eb;
+
+    if (! this || ! pInit)
+        return this;
+
+    // Initialize error block
+    Error_init(&eb); 
+
+    //if (! (pLink = MEM_alloc (heap, sizeof(PAF_ASP_Link), 4))) {
+    if (!(pLink = Memory_alloc((IHeap_Handle)heap, sizeof(PAF_ASP_Link), 4, &eb))) {
+        if (this->log)
+            LOG_printf(this->log, "AS%d: ASP code 0x%08x alloc failure", 
+                this->stream, pInit->thisCode.full);
+        return NULL;
+    }
+
+    if (! from) {
+        if (! this->fxns->linkData(pLink, pInit, this->stream, this->acp, 
+            this->log,common, pafConfig)) {
+            if (this->log)
+                LOG_printf(this->log, "AS%d: ASP code 0x%08x link-init failure",
+                    this->stream, pInit->thisCode.full);
+            return NULL;
+        }
+    }
+    else {
+        if (! this->fxns->linkCopy(pLink, pInit, from->head)) {
+            if (this->log)
+                LOG_printf(this->log, "AS%d: ASP code 0x%08x link-copy failure",
+                    this->stream, pInit->thisCode.full);
+            return NULL;
+        }
+    }
+
+    {
+        PAF_ASP_Link **ppLink;
+        for (ppLink=&this->head; *ppLink; ppLink=&(*ppLink)->next)
+            if ((*ppLink)->code.full == pInit->linkCode.full)
+                break;
+        pLink->next = *ppLink;
+        *ppLink = pLink;
+    }
+
+    return this;
+}
+
+//
+// Audio Stream Processing Chain Function - Find
+//
+//   Name:      PAF_ASP_chainFind_
+//   Purpose:   Find an element in an ASP Chain.
+//   From:      AST Parameter Chain Function -> chainFind
+//   Uses:      None.
+//   States:    None.
+//   Return:    Success (found): Pointer to element.
+//              Failure (not found): Null.
+//   Trace:     None.
+//
+
+PAF_ASP_Link *
+PAF_ASP_chainFind_ (
+    PAF_ASP_Chain *this,
+    PAF_ASP_AlphaCode code)
+{
+    PAF_ASP_Link *that = this->head;
+
+    for ( ; that; that = that->next) {
+        if (that->code.full == code.full)
+            break;
+    }
+
+    return that;
+}
+
+//
+// Audio Stream Processing Chain Function - Reset
+//
+//   Name:      PAF_ASP_chainReset_
+//   Purpose:   Reset an ASP Chain by invoking for each element:
+//              (1) The algorithm activation function (NOT PERFORMED), and
+//              (2) The algorithm reset function.
+//   From:      AST Parameter Chain Function -> chainReset
+//   Uses:      See code.
+//   States:    None.
+//   Return:    0 on success.
+//              Error number reported by ASP Reset Function on failure.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * ASP Reset Function errors.
+//
+
+Int
+PAF_ASP_chainReset_ (PAF_ASP_Chain *this, PAF_AudioFrame *pAudioFrame)
+{
+    Int errno;
+
+    PAF_ASP_Link *pLink;
+
+    for (pLink=this->head; pLink; pLink=pLink->next) {
+        ASP_Handle alg = pLink->alg;
+#if 0
+        /* ASP Algorithms are self-activating and not framework-activated */
+        if (((ALG_Handle )alg)->fxns->algActivate)
+            ((ALG_Handle )alg)->fxns->algActivate (((ALG_Handle )alg));
+#endif
+        if (alg->fxns->reset && (errno = alg->fxns->reset(alg, pAudioFrame))) {
+            if (this->log) {
+                LOG_printf(this->log, "AS%d: ASP code 0x%08x reset error",
+                    this->stream, pLink->code.full);
+                LOG_printf(this->log, "AS%d: errno = 0x%08x", 
+                    this->stream, errno);
+            }
+            return errno;
+        }
+    }
+
+    return 0;
+}
+
+//
+// Audio Stream Processing Chain Function - Apply
+//
+//   Name:      PAF_ASP_chainApply_
+//   Purpose:   Apply an ASP Chain by invoking for each:
+//              (1) The algorithm apply function.
+//   From:      AST Parameter Chain Function -> chainApply
+//   Uses:      See code.
+//   States:    None.
+//   Return:    0 on success.
+//              Error number reported by ASP Apply Function on failure.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * ASP Apply Function errors.
+//
+
+Int
+PAF_ASP_chainApply_ (PAF_ASP_Chain *this, PAF_AudioFrame *pAudioFrame)
+{
+    Int errno;
+    int i = 0;
+
+    PAF_ASP_Link *pLink;
+
+    for (pLink=this->head; pLink; pLink=pLink->next)
+    {
+        ASP_Handle alg = pLink->alg;
+
+        i++;
+        if (this->log)
+        {
+            LOG_printf(&trace, "PAF_ASP_chainApply_: AS_%d. link %d.  alg: 0x%x.",
+                       this->stream, i, alg);
+        }
+        Log_info3("PAF_ASP_chainApply_: AS_%d. link %d.  alg: 0x%x.", this->stream, i, (IArg)alg);
+
+        if (alg->fxns->apply && (errno = alg->fxns->apply(alg, pAudioFrame)))
+        {
+            if (this->log)
+            {
+                LOG_printf(this->log, "AS%d: ASP code 0x%08x apply error 0x%x.",
+                    this->stream, pLink->code.full, errno);
+                LOG_printf(&trace, "AS%d: ASP code 0x%08x apply error 0x%x.",
+                    this->stream, pLink->code.full, errno);
+            }
+            return errno;
+        }
+    }
+
+    return 0;
+}
+
+//
+// Audio Stream Processing Chain Function - Final
+//
+//   Name:      PAF_ASP_chainFinal_
+//   Purpose:   Finalize an ASP Chain by invoking for each:
+//              (1) The algorithm final function (NOT PERFORMED), and
+//              (2) The algorithm deactivation function.
+//   From:      AST Parameter Chain Function -> chainFinal
+//   Uses:      See code.
+//   States:    None.
+//   Return:    0 on success.
+//              Error number reported by ASP Final Function on failure.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * ASP Final Function errors.
+//
+//   Note:      In Audio Framework #2, PAF_ASP_FINAL is not defined and there
+//              are no Final Functions supplied with ASP Algorithms.
+
+Int
+PAF_ASP_chainFinal_ (PAF_ASP_Chain *this, PAF_AudioFrame *pAudioFrame)
+{
+#ifdef PAF_ASP_FINAL
+    Int errno;
+#endif /* PAF_ASP_FINAL */
+
+    PAF_ASP_Link *pLink;
+
+    for (pLink=this->head; pLink; pLink=pLink->next) {
+        ASP_Handle alg = pLink->alg;
+#ifdef PAF_ASP_FINAL
+        if (alg->fxns->final && (errno = alg->fxns->final(alg, pAudioFrame))) {
+            if (this->log) {
+                LOG_printf(this->log, "AS%d: ASP code 0x%08x final error",
+                    this->stream, pLink->code.full);
+                LOG_printf(this->log, "AS%d: errno = 0x%08x", 
+                    this->stream, errno);
+            }
+            return errno;
+        }
+#endif /* PAF_ASP_FINAL */
+#if 1
+        /* ASP Algorithms are self-deactivating and framework-deactivated */
+        if (((ALG_Handle )alg)->fxns->algDeactivate)
+            ((ALG_Handle )alg)->fxns->algDeactivate (((ALG_Handle )alg));
+#endif
+    }
+
+    return 0;
+}
+
+//
+// Audio Stream Processing Chain Function - Link Data
+//
+//   Name:      PAF_ASP_linkData
+//   Purpose:   Create the data for a chain link:
+//              (1) Perform beta unit relocation,
+//              (2) Instantiate an algorithm, and
+//              (3) Attach the beta unit(s) of an algorithm to an ACP Algorithm
+//                  instance.
+//   From:      AST Parameter Chain Function -> linkData
+//   Uses:      See code.
+//   States:    None.
+//   Return:    Null pointer on failure.
+//              Pointer to the chain link on success.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * Algorithm instance creation failure message.
+//              * Beta Unit initialization success message.
+//
+
+PAF_ASP_Link *
+PAF_ASP_linkData (
+    PAF_ASP_Link *this,
+    const PAF_ASP_LinkInit *pInit,
+    Uns stream,
+    ACP_Handle acp,
+    LOG_Obj *log,
+    IALG_MemRec *common,
+    PAF_IALG_Config *pafConfig) 
+{
+    IALG_Status *pStatus;
+    
+    ALG_Handle alg;
+    
+    Int beta = pInit->thisCode.part.beta;
+        
+    if (log)
+        LOG_printf(log, "AS%d: beta 0x%x initialization begins.", stream, beta);
+    {
+        ALG_Handle acpAlg = (ALG_Handle) acp;
+        Int betaPrimeBase;
+        Int betaPrimeOffset;
+        acpAlg->fxns->algControl (acpAlg, ACP_GETBETAPRIMEBASE, 
+            (IALG_Status *) &betaPrimeBase);
+        acpAlg->fxns->algControl (acpAlg, ACP_GETBETAPRIMEOFFSET, 
+            (IALG_Status *) &betaPrimeOffset);
+        if (beta >= betaPrimeBase)
+            beta += (stream - 1) * betaPrimeOffset;
+    }
+    
+    this->next = NULL;
+    this->code = pInit->thisCode;
+
+    if (pInit->ialg_fxns) {
+
+        if (pInit->init_func)
+            (*pInit->init_func)();
+
+        if (! (alg = PAF_ALG_create(pInit->ialg_fxns,NULL,(IALG_Params *)pInit->ialg_prms,
+                     common, pafConfig))) {
+            if (log) {
+                LOG_printf(log,
+                    "AS%d: beta 0x%x algorithm instance creation failed",
+                    stream, beta);
+            }
+            return NULL;
+        }
+    }
+    else
+        return NULL;
+
+    this->alg = (ASP_Handle )alg;
+
+    if (alg->fxns->algControl) {
+        if (! alg->fxns->algControl (alg, ACP_GETSTATUSADDRESS1, (IALG_Status *)&pStatus))
+            acp->fxns->attach (acp, pInit->thisCode.part.series, beta, pStatus);
+        if (! alg->fxns->algControl (alg, ACP_GETSTATUSADDRESS2, (IALG_Status *)&pStatus))
+            acp->fxns->attach (acp, pInit->thisCode.part.series, beta+1, pStatus);
+    }
+
+    if (log)
+        LOG_printf(log, "AS%d: beta 0x%x processing initialized", stream, beta);
+
+    return this;
+}
+
+//
+// Audio Stream Processing Chain Function - Link Copy
+//
+//   Name:      PAF_ASP_linkCopy
+//   Purpose:   Copy the data for a chain link:
+//              (1) Find an element on a chain, and
+//              (2) Copy the reference to the data of the link.
+//   From:      AST Parameter Chain Function -> linkCopy
+//   Uses:      See code.
+//   States:    None.
+//   Return:    Null pointer on failure.
+//              Pointer to the chain link on success.
+//   Trace:     None.
+//
+
+PAF_ASP_Link *
+PAF_ASP_linkCopy (
+    PAF_ASP_Link *this,
+    const PAF_ASP_LinkInit *pInit,
+    PAF_ASP_Link *from)
+{
+    for ( ; from; from = from->next) {
+        if (from->code.full == pInit->thisCode.full)
+            break;
+    }
+
+    if (! from)
+        return NULL;
+
+    this->next = NULL;
+    this->code = pInit->thisCode;
+    this->alg = from->alg;
+
+    return this;
+}
+
+//
+// Audio Stream Processing Chain Functions
+//
+//   Name:      PAF_ASP_chainFxns
+//   Purpose:   Collect the chain functions that embody the implementation 
+//              of Audio Framework Number 2 for use as a jump table.
+//   From:      PAF_AST_Params
+//   Uses:      See contents.
+//   States:    N.A.
+//   Return:    N.A.
+//   Trace:     None.
+//
+
+const struct PAF_ASP_ChainFxns PAF_ASP_chainFxns =
+{
+    PAF_ASP_chainInit_,
+    PAF_ASP_chainLink_,
+    PAF_ASP_chainFind_,
+    {
+        PAF_ASP_chainReset_,
+        PAF_ASP_chainApply_,
+        PAF_ASP_chainFinal_,
+    },
+    PAF_ASP_linkData,
+    PAF_ASP_linkCopy,
+};
diff --git a/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_common.c b/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_common.c
new file mode 100644 (file)
index 0000000..fc4b2f8
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ *  ======== audioStreamProc_common.c ========
+ */
+
+#include <xdc/std.h>
+
+#include "as1-f2-config.h"
+
+// Task data
+#ifndef _TMS320C6X
+PAF_AST_Config gPAF_AST_config      __attribute__ ((section(".globalSectionPafAstConfig"))); /* Global configuration */
+PAF_AST_Config *pC                  __attribute__ ((section(".globalSectionPafAstConfig"))); /* Global configuration pointer */
+
+#else
+
+#pragma DATA_SECTION(gPAF_AST_config, ".globalSectionPafAstConfig")
+#pragma DATA_SECTION(pC, ".globalSectionPafAstConfig")
+PAF_AST_Config gPAF_AST_config; /* Global configuration */
+far PAF_AST_Config *pC;         /* Global configuration pointer */
+
+#endif
diff --git a/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_common.h b/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_common.h
new file mode 100644 (file)
index 0000000..cf86776
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ *  ======== audioStreamProc_common.h ========
+ */
+
+#ifndef _ASP_COMMON_H_
+#define _ASP_COMMON_H_
+#include <xdc/std.h>
+#include "as1-f2-config.h"
+#include "paf_heapMgr.h"
+
+// .............................................................................
+
+/* ---------------------------------------------------------------- */
+/* For historical reasons, macro definitions (#define ...) are used */
+/* to hide parameter references (pP->...) throughout this file, but */
+/* only for select quantities and not for all parameter elements.   */
+/*                                                                  */
+/*             Parameter macro definitions start here.              */
+/* ---------------------------------------------------------------- */
+
+//
+// Audio Topology (Zone) Definitions
+//
+//   The ZONE, a historical term here, is a letter identifying the Audio
+//   Topology with a single letter or "*" for a variable quantization of
+//   same.
+//
+//   The Zone Elements listed here indicate the cardinality of the corre-
+//   sponding element:
+//
+//     INPUTS   Number of inputs.
+//     DECODES  Number of decodes.
+//     STREAMS  Number of streams.
+//     ENCODES  Number of encodes.
+//     OUTPUTS  Number of outputs.
+//
+//   The Zone Element Counts listed here indicate the first (1) and after-
+//   last (N) values suitable for use in a loop:
+//
+//     INPUTS[1N]  for inputs.
+//     DECODES[1N] for decodes.
+//     STREAMS[1N] for streams.
+//     ENCODES[1N] for encodes.
+//     OUTPUTS[1N] for outputs.
+//
+//   The Zone Element Count Limits listed here establish array sizes:
+//
+//     DECODEN_MAX for decodes.
+//     STREAMN_MAX for streams.
+//     ENCODEN_MAX for encodes.
+//
+//   The Zone Master is important in multi-input frameworks:
+//
+//     MASTER   In a uni-input zone, the count of the input.
+//              In a multi-input zone, the count of the primary which controls
+//              the secondary or secondaries.
+//
+
+#ifndef ZONE
+
+#define ZONE "*" /* 19.53 kB of 38.80 kB FW */
+//
+//#define MASTER  pP->zone.master
+//#define INPUTS  pP->zone.inputs
+//#define DECODES pP->zone.decodes
+#define STREAMS pP->zone.streams
+//#define ENCODES pP->zone.encodes
+//#define OUTPUTS pP->zone.outputs
+
+#endif /* ZONE */
+
+#ifndef ZONE
+
+#define ZONE "I" /* ~2.5 kB less than above */
+
+#define MASTER  0
+#define INPUTS  1
+#define DECODES 1
+#define STREAMS 1
+#define ENCODES 1
+#define OUTPUTS 1
+
+#endif /* ZONE */
+
+#define INPUT1  pP->zone.input1
+#define INPUTN  pP->zone.inputN
+//
+#define DECODE1 pP->zone.decode1
+#define DECODEN pP->zone.decodeN
+//#define DECODEN_MAX 3
+//
+#define STREAM1 0
+#define STREAMN STREAMS
+//#define STREAMN_MAX 5
+//
+#define ENCODE1 pP->zone.encode1
+#define ENCODEN pP->zone.encodeN
+//#define ENCODEN_MAX 3
+//
+#define OUTPUT1 pP->zone.output1
+#define OUTPUTN pP->zone.outputN
+
+//
+// Audio Data Representation Definitions
+//
+
+/* audio frame "width" in channels */
+#define numchan pP->z_numchan
+
+/* audio frame "length" in samples */
+#define FRAMELENGTH pP->framelength
+
+#define PA_MODULO       8   // also defined independently in ARC2 code, and may be hard coded other places.
+
+
+// .............................................................................
+
+//
+// Heap & Memory Allocation Definitions
+//
+#define HEAP_ID_INTERNAL        *pP->heap.pHeapIdIntern     //*pP->heap.pIntern
+#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_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_CLEAR              pP->heap.clear
+
+#define HEAP_ID_INPBUF      *pP->heap.pHeapIdInpbuf     //*pP->heap.pInpbuf
+#define HEAP_ID_OUTBUF      *pP->heap.pHeapIdOutbuf     //*pP->heap.pOutbuf
+#define HEAP_ID_FRMBUF      *pP->heap.pHeapIdFrmbuf     //*pP->heap.pFrmbuf
+#define HEAP_INPBUF         (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_INPBUF)
+#define HEAP_OUTBUF         (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_OUTBUF)
+#define HEAP_FRMBUF         (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_FRMBUF)
+
+#define HEAP_ID_MDBUF       *pP->pMetadataBufStatus->pHeadIdSpace
+#define HEAP_MDBUF          (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_MDBUF)
+
+#define COMMONSPACE         pP->common.space
+
+// .............................................................................
+
+// -----------------------------------------------------------------------------
+// Debugging Trace Control
+//#define TRACE_TERSE(a)              LOG_printf a
+#define TRACE_TERSE0(a)             Log_info0(a)
+#define TRACE_TERSE1(a,b)           Log_info1(a,b)
+#define TRACE_TERSE2(a,b,c)         Log_info2(a,b,c)
+#define TRACE_TERSE3(a,b,c,d)       Log_info3(a,b,c,d)
+#define TRACE_TERSE4(a,b,c,d,e)     Log_info4(a,b,c,d,e)
+
+//#define TRACE_GEN(a)                LOG_printf a
+#define TRACE_GEN0(a)               Log_info0(a)
+#define TRACE_GEN1(a,b)             Log_info1(a,b)
+#define TRACE_GEN2(a,b,c)           Log_info2(a,b,c)
+#define TRACE_GEN3(a,b,c,d)         Log_info3(a,b,c,d)
+#define TRACE_GEN4(a,b,c,d,e)       Log_info4(a,b,c,d,e)
+
+//#define TRACE_VERBOSE(a)            LOG_printf a
+#define TRACE_VERBOSE0(a)           Log_info0(a)
+#define TRACE_VERBOSE1(a,b)         Log_info1(a,b)
+#define TRACE_VERBOSE2(a,b,c)       Log_info2(a,b,c)
+#define TRACE_VERBOSE3(a,b,c,d)     Log_info3(a,b,c,d)
+#define TRACE_VERBOSE4(a,b,c,d,e)   Log_info4(a,b,c,d,e)
+
+#define TRACE_MSG0(a)               Log_info0(a)
+#define TRACE_MSG1(a,b)             Log_info1(a,b)
+#define TRACE_MSG2(a,b,c)           Log_info2(a,b,c)
+#define TRACE_MSG3(a,b,c,d)         Log_info3(a,b,c,d)
+#define TRACE_MSG4(a,b,c,d,e)       Log_info4(a,b,c,d,e)
+
+
+#define DEC_Handle PCM_Handle /* works for all: SNG, PCM, AC3, DTS, AAC */
+
+
+/* Global configuration */
+extern PAF_AST_Config gPAF_AST_config;
+extern far PAF_AST_Config *pC;
+
+// Temporary
+//extern Bool gAspInitDone;
+
+
+#endif /* _ASP_COMMON_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/common/common.h b/procsdk_audio_x_xx_xx_xx/common/common.h
new file mode 100644 (file)
index 0000000..5027c2f
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef _COMMON_H_
+#define _COMMON_H_
+
+#ifdef _TMS320C6X
+// This works to set a breakpoint
+#define SW_BREAKPOINT       asm( " SWBP 0" );
+/* Software Breakpoint to Code Composer */
+// SW_BREAKPOINT;
+#else
+#include <ti/sysbios/hal/Hwi.h> // full halt
+#include <ti/sysbios/knl/Swi.h> // full halt
+#define SW_BREAKPOINT \
+    Hwi_disable();  \
+    Swi_disable();  \
+    while(1);
+#endif
+
+#endif /* _COMMON_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/common/dbgCapAf.c b/procsdk_audio_x_xx_xx_xx/common/dbgCapAf.c
new file mode 100644 (file)
index 0000000..52beb04
--- /dev/null
@@ -0,0 +1,57 @@
+#include <xdc/std.h>
+
+#include "dbgCapAf.h"
+
+#ifdef _TMS320C6X
+#pragma DATA_SECTION(gCapAfBuf, ".gCapAfBuf");
+PAF_AudioData gCapAfBuf[CAP_AF_MAX_NUM_SAMP];
+#else
+PAF_AudioData gCapAfBuf[CAP_AF_MAX_NUM_SAMP] __attribute__ ((section(".gCapAfBuf")));
+//PAF_AudioData gCapAfBuf[CAP_AF_MAX_NUM_SAMP] __attribute__ ((section(".noinit")));
+#endif
+Int32 gCapAfBufIdx=0;
+Int32 gCapAfBufWrapCnt=0;
+
+// Reset audio frame capture buffer
+Int capAfReset(Void)
+{
+    gCapAfBufIdx = 0;
+    gCapAfBufWrapCnt = 0;
+
+    return 0;
+}
+
+// Write audio frame to capture buffer
+Int capAfWrite(
+    PAF_AudioFrame *pAf,    // audio frame
+    Int8 chNum              // channel number to capture
+)
+{
+    Int16 nSamp;
+    PAF_AudioData *pSamp;
+    Int16 i;
+    
+    if (chNum > (pAf->data.nChannels-1))
+    {
+        return CAP_AF_INV_CHNUM;
+    }
+    
+    nSamp = pAf->data.nSamples;
+    pSamp = pAf->data.sample[chNum];
+
+    if ((CAP_AF_MAX_NUM_SAMP - gCapAfBufIdx) < nSamp)
+    {
+        //return;
+        gCapAfBufIdx = 0;
+        gCapAfBufWrapCnt++;
+    }
+    
+    for (i=0; i<nSamp; i++)
+    {
+        gCapAfBuf[gCapAfBufIdx] = *pSamp;
+        pSamp++;
+        gCapAfBufIdx++;
+    }
+    
+    return CAP_AF_SOK;
+}
diff --git a/procsdk_audio_x_xx_xx_xx/common/dbgCapAf.h b/procsdk_audio_x_xx_xx_xx/common/dbgCapAf.h
new file mode 100644 (file)
index 0000000..8d2bdbe
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef _DBG_CAP_AFB_H_
+#define _DBG_CAP_AFB_H_
+
+#include <xdc/std.h>
+
+#include "paftyp.h"
+
+#define CAP_AF_SOK         ( 0 )
+#define CAP_AF_INV_CHNUM   ( -1 )
+
+// buffer capture parameters
+#define CAP_AF_MAX_NUM_FRAME       ( 5625 ) //( 100 )
+#define CAP_AF_MAX_SAMP_PER_FRAME  ( 256 )
+#define CAP_AF_MAX_NUM_SAMP        ( CAP_AF_MAX_NUM_FRAME * CAP_AF_MAX_SAMP_PER_FRAME )
+
+extern PAF_AudioData gCapAfBuf[CAP_AF_MAX_NUM_SAMP];
+extern Int32 gCapAfBufIdx;
+
+// Reset audio frame capture buffer
+Int capAfReset(Void);
+
+// Write audio frame to capture buffer
+Int capAfWrite(
+    PAF_AudioFrame *pAf,    // audio frame
+    Int8 chNum              // channel number to capture
+);
+
+#endif /* _DBG_CAP_AFB_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/common/dbgDib.c b/procsdk_audio_x_xx_xx_xx/common/dbgDib.c
new file mode 100644 (file)
index 0000000..d0f3b6d
--- /dev/null
@@ -0,0 +1,204 @@
+#include <string.h> // for memcpy
+#include <xdc/std.h>
+#include <xdc/runtime/Log.h>
+
+
+#include "common.h"
+
+#ifndef _TMS320C6X
+#include "c67x_cintrins.h"
+#endif
+
+#include "inpbuf.h"
+#include "dbgDib.h"
+
+// sinusoid generator parameters
+/* Performs floating-point to 24-bit fixed point conversion.
+Resulting fixed-point value is left-justified in 32-bit word. */
+#define F2INT_SCALE     (float)0x7FFFFF
+#define F2INT_ROUND(x)  _spint(x)
+#define F2INT(x)        (((Int32)F2INT_ROUND(F2INT_SCALE * x) << 0x8) & 0xFFFFFF00)
+
+#define TWO_PI          (6.283185307179586476925286766559L)
+#define FS_48KHZ        (48000.0)
+#define TWOPIOVERSRATE  ( TWO_PI / FS_48KHZ )
+
+#define SINP_MAX_CHS    ( 8 )       // sin probe maximum number of channels
+Int8 gSinPNumChs = SINP_MAX_CHS;    // sin probe number of channels 
+Int8 gSinPChIdx = 0;                // sin probe channel index
+// sinusoid data generated on these DIB channels
+Int8 gSinPCh[SINP_MAX_CHS] = {0,1,2,3,4,5,6,7};
+
+#define SINP_MAX_GEN ( 2 )      // sin probe maximum number of generators
+// Configurable from CCS
+Int8 gSinPNumGen = SINP_MAX_GEN;
+float gSineProbeAmp[SINP_MAX_GEN]   = {0.0625, 0.125};  // sinusoid amplitudes
+float gSineProbeFreq[SINP_MAX_GEN]  = {440.0, 1004.0};  // sinusoid frequencies (Hz)
+
+static double gSineProbeArg[SINP_MAX_GEN] = {0.0, 0.0};  // sinusoid function arguments
+
+#ifdef CAP_IB_PCM
+// IB capture (PCM) buffer
+#ifdef _TMS320C6X
+#pragma DATA_SECTION(gCapIbPcmBuf, ".gCapIbPcmBuf");
+Int32 gCapIbPcmBuf[CAP_IB_PCM_MAX_NUM_CH][CAP_IB_PCM_MAX_NUM_SAMP];
+#else
+Int32 gCapIbPcmBuf[CAP_IB_PCM_MAX_NUM_CH][CAP_IB_PCM_MAX_NUM_SAMP] __attribute__ ((section(".gCapIbPcmBuf")));
+#endif
+Int32 gCapIbPcmBufIdx=0;
+Int32 gCapIbPcmBufWrapCnt=0;
+static UInt32 capIbPcmStopCnt=5000;
+#endif // CAP_IB_PCM
+
+#ifdef CAP_IP
+// IB capture buffer
+#ifdef _TMS320C6X
+#pragma DATA_SECTION(gCapIbBuf, ".gCapIbBuf");
+Int8 gCapIbBuf[2][CAP_IB_BUF_SZ];
+#else
+Int8 gCapIbBuf[2][CAP_IB_BUF_SZ] __attribute__ ((section(".gCapIbBuf")));
+//Int32 gCapIbBuf[CAP_IB_BUF_SZ] __attribute__ ((section(".noinit")));
+#endif
+Int32 gCapIbBufIdx[2]={0,0};
+Int32 gCapIbBufWrapCnt[2]={0,0};
+Int8 gCapIbBufPingPongSel=1;
+Int32 gNumDiffFrame[2]={0,0};
+
+#endif // CAP_IP
+
+// Generate sinusoids in IB buffer
+Void genSinIb(
+    PAF_InpBufConfig *pInpBufConfig
+)
+{
+    Int8 numCh;
+    Int16 numSamp;
+    Int8 genIdx;
+    double phaseInc, arg, amp;
+    Int32 *pCh;
+    Int16 i;
+    
+    numCh = pInpBufConfig->stride; // get number of channels
+    numSamp = pInpBufConfig->frameLength / numCh; // get number of samples to generate
+
+    for (genIdx=0; genIdx<gSinPNumGen; genIdx++)
+    {
+        // compute generator phase increment
+        phaseInc = (double)gSineProbeFreq[genIdx] * TWOPIOVERSRATE;
+        
+        arg = gSineProbeArg[genIdx]; // get generator arg
+        amp = gSineProbeAmp[genIdx]; // get generator amplitude
+        
+        // generate sinusoid on selected channel
+        pCh = &pInpBufConfig->pntr.pLgInt[gSinPCh[gSinPChIdx]];
+        for (i=0; i<numSamp; i++)
+        {
+            *pCh = F2INT(amp * sin(arg));
+            arg += phaseInc;
+            pCh += numCh; // skipped interleaved channels
+        }
+        
+        gSineProbeArg[genIdx] = arg; // save generator arg
+        
+        // update sin probe channel index
+        gSinPChIdx++;
+        if (gSinPChIdx >= gSinPNumChs)
+        {
+            gSinPChIdx = 0;
+        }
+    }
+}
+
+#ifdef CAP_IB_PCM
+// Capture data in IB buffer to memory
+Void capIbPcm(
+    PAF_InpBufConfig *pInpBufConfig
+)
+{
+    Int8 numCh;
+    Int16 numSamp;
+    Int8 sampSz;
+    Int32 samp;
+    Int8 *pCh;
+    Int16 i, j, k;
+    Int32 *pCapBuf;
+
+    if (--capIbPcmStopCnt == 0)
+    {
+        SW_BREAKPOINT;
+    }
+
+    numCh = pInpBufConfig->stride; // get number of channels
+    numSamp = pInpBufConfig->frameLength / numCh; // get number of samples to capture
+    sampSz = pInpBufConfig->sizeofElement; // get sample size (bytes)
+    
+    if ((CAP_IB_PCM_MAX_NUM_SAMP - gCapIbPcmBufIdx) < numSamp)
+    {
+        //return;
+        gCapIbPcmBufIdx = 0;
+        gCapIbPcmBufWrapCnt++;
+    }
+        
+    for (i=0; i<numCh; i++)
+    {
+        pCapBuf = &gCapIbPcmBuf[i][gCapIbPcmBufIdx];
+        pCh = &pInpBufConfig->pntr.pSmInt[i*sampSz];
+        for (j=0; j<numSamp; j++)
+        {
+            samp = (Int32)(*(pCh+sampSz-1));
+            for (k=sampSz-2; k>=0; k--)
+            {
+                samp <<= 8;
+                samp |= (UInt8)(*(pCh+k));
+            }
+            samp <<= 32-8*sampSz;
+            
+            *pCapBuf = samp;
+            pCapBuf++;
+            pCh += numCh * sampSz;
+        }
+    }
+    gCapIbPcmBufIdx += numSamp;
+}
+#endif // CAP_IB_PCM
+
+#ifdef CAP_IP
+// Reset IB capture buffer
+Int capIbReset(Void)
+{
+    gCapIbBufPingPongSel ^= 0x1;
+    gCapIbBufIdx[gCapIbBufPingPongSel] = 0;
+    gCapIbBufWrapCnt[gCapIbBufPingPongSel] = 0;
+    gNumDiffFrame[gCapIbBufPingPongSel] = 0;
+
+    return 0;
+}
+
+// Capture data in IB buffer to memory
+Void capIb(
+    PAF_InpBufConfig *pInpBufConfig
+)
+{
+    UInt32 nBytes;
+    
+    nBytes = pInpBufConfig->frameLength * pInpBufConfig->sizeofElement;
+    
+    // FL: DDP debug
+    if (nBytes != 24576)
+    {
+        Log_info1("capIb(): nBytes=%d", nBytes);
+        gNumDiffFrame[gCapIbBufPingPongSel]++;
+    }
+    
+    if ((CAP_IB_BUF_SZ - gCapIbBufIdx[gCapIbBufPingPongSel]) < nBytes)
+    {
+        //return; // fixed buffer
+        gCapIbBufIdx[gCapIbBufPingPongSel] = 0;
+        gCapIbBufWrapCnt[gCapIbBufPingPongSel]++;
+    }
+
+    memcpy(&gCapIbBuf[gCapIbBufPingPongSel][gCapIbBufIdx[gCapIbBufPingPongSel]], pInpBufConfig->pntr.pSmInt, nBytes);
+    gCapIbBufIdx[gCapIbBufPingPongSel] += nBytes;
+}
+
+#endif // CAP_IP
diff --git a/procsdk_audio_x_xx_xx_xx/common/dbgDib.h b/procsdk_audio_x_xx_xx_xx/common/dbgDib.h
new file mode 100644 (file)
index 0000000..ae21137
--- /dev/null
@@ -0,0 +1,50 @@
+#include <math.h> // sin
+#include <xdc/std.h>
+
+#include "inpbuf.h"
+
+//#define CAP_IB_PCM
+#ifdef CAP_IB_PCM
+// IB capture (PCM) buffer parameters
+#define CAP_IB_PCM_MAX_NUM_CH           ( 8 )
+#define CAP_IB_PCM_MAX_NUM_FRAME        ( 100 )
+#define CAP_IB_PCM_MAX_SAMP_PER_FRAME   ( 256 )
+#define CAP_IB_PCM_MAX_NUM_SAMP         ( CAP_IB_PCM_MAX_NUM_FRAME * CAP_IB_PCM_MAX_SAMP_PER_FRAME )
+
+// IB capture (PCM) buffer
+extern Int32 gCapIpPcmBuf[CAP_IB_PCM_MAX_NUM_CH][CAP_IB_PCM_MAX_NUM_SAMP];
+extern Int32 gCapIbPcmBufIdx;
+extern Int32 gCapIbPcmBufWrapCnt;
+#endif // CAP_IB_PCM
+
+#define CAP_IP
+#ifdef CAP_IP
+// IB capture buffer parameters
+#define CAP_IB_MAX_NUM_FRAME        ( 938 )
+#define CAP_IB_MAX_BYTES_PER_FRAME  ( 24576 )
+#define CAP_IB_BUF_SZ               ( CAP_IB_MAX_NUM_FRAME * CAP_IB_MAX_BYTES_PER_FRAME )
+
+// IB capture buffer
+extern Int8 gCapIpBuf[2][CAP_IB_BUF_SZ];
+extern Int32 gCapIbBufIdx[2];
+extern Int32 gCapIbBufWrapCnt[2];
+extern Int8 gCapIbBufPingPongSel;
+#endif // CAP_IP
+
+// Generate sinusoids in IB buffer
+Void genSinIb(
+    PAF_InpBufConfig *pInpBufConfig
+);
+
+// Capture data in IB buffer (PCM) to memory
+Void capIbPcm(
+    PAF_InpBufConfig *pInpBufConfig
+);
+
+// Reset IB capture buffer
+Int capIbReset(Void);
+
+// Capture data in IB buffer to memory
+Void capIb(
+    PAF_InpBufConfig *pInpBufConfig
+);
diff --git a/procsdk_audio_x_xx_xx_xx/common/drvPort.h b/procsdk_audio_x_xx_xx_xx/common/drvPort.h
new file mode 100644 (file)
index 0000000..5fbbb34
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ *  ======== drvPort.h ========
+ */
+
+
+#ifndef _DRV_PORT_H_
+#define _DRV_PORT_H_
+
+#include <xdc/std.h>
+#include <xdc/runtime/LoggerBuf.h>
+#include <ti/xdais/xdas.h>
+
+// ------------------------------------- //
+// Below is temporary for driver port    //
+// ------------------------------------- //
+// dap.h -- extracted defs
+struct DAP_Params_
+{
+    XDAS_Int32  pinMask;
+};
+// dap_csl_mcasp.h -- extracted defs
+#define MCASP_DEV1 ( 1 )
+
+#endif /* _DRV_PORT_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/common/fwkPort.c b/procsdk_audio_x_xx_xx_xx/common/fwkPort.c
new file mode 100644 (file)
index 0000000..55b1d71
--- /dev/null
@@ -0,0 +1,9 @@
+#include <xdc/std.h>
+
+#include "fwkPort.h"
+
+// FL: Temporary, 1st parameter for audioStream1Task().
+// FL: Need to remove this since SYS/BIOS 6.21 doesn't allow more than 2 parameters for a task.
+Int gBetaPrimeValue=0;
+
+far LoggerBuf_Struct trace;
diff --git a/procsdk_audio_x_xx_xx_xx/common/fwkPort.h b/procsdk_audio_x_xx_xx_xx/common/fwkPort.h
new file mode 100644 (file)
index 0000000..466a730
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ *  ======== fwkPort.h ========
+ */
+
+
+#ifndef _FWK_PORT_H_
+#define _FWK_PORT_H_
+
+#include <xdc/std.h>
+#include <xdc/runtime/LoggerBuf.h>
+#include <ti/xdais/xdas.h>
+
+// ------------------------------------- //
+// Below is temporary for framework port //
+// ------------------------------------- //
+// SYS/BIOS 6.45 LOG APIs are different than BIOS 6.21
+// log.h -- replacements
+#define LOG_Obj LoggerBuf_Struct
+#define LOG_disable(a)
+#define LOG_printf(...)
+
+// Not defined in SYS/BIOS 6.45
+// sys.h -- extracted defs
+#define SYS_OK              0   /* no error */ // packages/ti/bios/include/sys.h
+#define SYS_EALLOC          1   /* memory allocation error */ // packages/ti/bios/include/sys.h
+
+// 1st parameter for audioStream1Task().
+// SYS/BIOS 6.45 doesn't allow more than 2 parameters for a task.
+extern Int gBetaPrimeValue;
+
+//extern LOG_Obj trace;
+
+#endif /* _FWK_PORT_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/common/paf_alg_create.c b/procsdk_audio_x_xx_xx_xx/common/paf_alg_create.c
new file mode 100644 (file)
index 0000000..01bbde0
--- /dev/null
@@ -0,0 +1,250 @@
+
+/*
+* Copyright (C) 2004-2014 Texas Instruments Incorporated - http://www.ti.com/
+* All rights reserved. 
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+//
+//
+// Performance Audio Algorithm Creation.
+//
+//
+//
+
+#include <stdlib.h>
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Memory.h>
+#include "alg.h"
+
+//#include "pafhjt.h" // FL: ??
+#include "paf_alg.h"
+#include "paf_alg_priv.h"
+
+//extern far int SDRAM;
+//far int *mem_mallocseg_ptr=&SDRAM;
+//#define MALLOC(size) MEM_alloc(*mem_mallocseg_ptr,(size), 8)
+//#define FREE(addr,size) MEM_free(*mem_mallocseg_ptr,(addr),(size))
+extern HeapMem_Handle heapMemDdr3;
+#define HEAPMALLOC (IHeap_Handle)heapMemDdr3
+
+/*
+ * The PAF_ALG_alloc_ function collects the Common Memory Data Requirements
+ * from all the Algorithms. The function returns 0 on success. If the 
+ * call to malloc() fails then it returns PAF_ALGERR_MEMTAB_MALLOC. If a 
+ * particular Algorithm requests 0 or less memTabs then the function returns 
+ * an error value of PAF_ALGERR_MEMTAB_COUNT. 
+ */
+
+Int 
+PAF_ALG_alloc_ (
+    const PAF_ALG_AllocInit *pInit, 
+    Int sizeofInit, 
+    IALG_MemRec common[])
+{
+    IALG_MemRec *memTab;
+    Int commonSize[PAF_IALG_COMMON_MEMN+1];
+    Int commonCount[PAF_IALG_COMMON_MEMN+1];
+    Int i,n;
+    Error_Block eb;
+
+    // Initialize error block
+    Error_init(&eb); 
+
+    for ( ; pInit && pInit->ialg_fxns; 
+        pInit=(const PAF_ALG_AllocInit *)((char *)pInit+sizeofInit)) {
+#ifdef _TMS320C6X
+#pragma UNROLL(1)
+#endif
+        for(i=PAF_IALG_COMMON_MEM0;i<=PAF_IALG_COMMON_MEMN;++i) {
+            commonSize[i]=0;
+            commonCount[i]=0;
+        }
+        n = pInit->ialg_fxns->algNumAlloc != NULL ? pInit->ialg_fxns->algNumAlloc() 
+                                                  : IALG_DEFMEMRECS;
+        //if((memTab = (IALG_MemRec *)MALLOC(n * sizeof(IALG_MemRec)))) {
+        if ((memTab = (IALG_MemRec *)Memory_alloc(HEAPMALLOC, n*sizeof(IALG_MemRec), 8, &eb)))
+        {
+            n=pInit->ialg_fxns->algAlloc(pInit->ialg_prms,
+                                         (IALG_Fxns ** )&(pInit->ialg_fxns),memTab);
+            if(n<=0)
+                return PAF_ALGERR_MEMTAB_COUNT;
+
+            for(i=0;i<n;++i){
+                if((memTab[i].attrs == PAF_IALG_COMMON_MEM0) || 
+                   (memTab[i].attrs >= PAF_IALG_COMMON_MEM1 && 
+                    memTab[i].attrs <= PAF_IALG_COMMON_MEMN)) {
+                    commonSize[memTab[i].attrs] += memTab[i].size + 
+                       (commonCount[memTab[i].attrs] ? memTab[i].alignment : 0);
+                    if(!commonCount[memTab[i].attrs] && 
+                        memTab[i].alignment > common[memTab[i].attrs].alignment)
+                       common[memTab[i].attrs].alignment = memTab[i].alignment;
+                    commonCount[memTab[i].attrs]++;
+                    if (common[memTab[i].attrs].space == PAF_IALG_NONE)
+                        /* creating common memory section */
+                        common[memTab[i].attrs].space = memTab[i].space;
+                    else if (common[memTab[i].attrs].space == memTab[i].space)
+                        /* existing common memory section: space okay */
+                        ;
+                    else {
+                        /* existing common memory section: space conflict */
+                        /* Greater Memory Space Rule (tends to external)  */
+                        if (common[memTab[i].attrs].space < memTab[i].space)
+                            common[memTab[i].attrs].space = memTab[i].space;
+                        else 
+                            ;
+                    }
+                }
+            }
+            //FREE(memTab,(n * sizeof(IALG_MemRec)));
+            Memory_free(HEAPMALLOC,memTab,(n*sizeof(IALG_MemRec)));
+            if(common){
+                for(i=PAF_IALG_COMMON_MEM0;i<=PAF_IALG_COMMON_MEMN;++i) {
+                    if(commonSize[i] > common[i].size) {
+                        common[i].size = commonSize[i];
+                        common[i].attrs = (IALG_MemAttrs )i;
+                    }
+                }
+            }
+        }
+        else
+            return PAF_ALGERR_MEMTAB_MALLOC;
+    }
+    return 0;
+}
+
+/*
+ * The PAF_ALG_create_ is derived from standard XDAIS ALG_create function defined in the 
+ * file alg_create.c version "XDAS 2.2.1 12-07-01". 
+ * The PAF_ALG_create_ is designed to handle the Performance Audio Specific "Common"
+ * memory and also to share the scratch memory accross the Performance Audio
+ * System.
+ * The PAF_ALG_create_ function returns the Handle to the Algorithm if the Algorithm is 
+ * created successfully otherwise it returns NULL.
+ */
+
+ALG_Handle PAF_ALG_create_ (
+    const IALG_Fxns *fxns,
+    IALG_Handle p,
+    const IALG_Params *params,
+    const IALG_MemRec common[],
+    PAF_IALG_Config *pafConfig)
+{
+    IALG_MemRec *memTab;
+    Int n;
+    ALG_Handle alg;
+    IALG_Fxns *fxnsPtr;
+    Error_Block eb;
+
+    // Initialize error block
+    Error_init(&eb); 
+
+    if(fxns != NULL){
+        n = fxns->algNumAlloc != NULL ? fxns->algNumAlloc() : IALG_DEFMEMRECS;
+        //if((memTab = (IALG_MemRec *)MALLOC(n * sizeof (IALG_MemRec)))) 
+        if((memTab = (IALG_MemRec *)Memory_alloc(HEAPMALLOC, n*sizeof (IALG_MemRec), 8, &eb)))
+        {
+            n = fxns->algAlloc(params, &fxnsPtr, memTab);
+            if(n<=0)
+                return NULL;
+            if(!PAF_ALG_allocMemory(memTab,n,common,pafConfig)){
+                alg = (IALG_Handle)memTab[0].base;
+                alg->fxns = (IALG_Fxns * )fxns;
+                if(fxns->algInit(alg, memTab, p, params) == IALG_EOK){
+                    //FREE(memTab,(n * sizeof(IALG_MemRec)));
+                    Memory_free(HEAPMALLOC,memTab,(n * sizeof(IALG_MemRec)));
+                    return alg;
+                }
+                fxns->algFree(alg, memTab);
+                PAF_ALG_freeMemory(memTab, n);
+            }
+            //FREE(memTab,(n * sizeof(IALG_MemRec)));
+            Memory_free(HEAPMALLOC,memTab,(n * sizeof(IALG_MemRec)));
+        }
+    }
+    return (NULL);
+}
+
+/*
+ * The PAF_ALG_delete is derived from standard XDAIS ALG_delete function defined in the 
+ * file alg_create.c version "XDAS 2.2.1 12-07-01". 
+ * The PAF_ALG_create is designed to handle the Performance Audio Specific "Common"
+ * memory and also scratch memory.
+ */
+
+/* DO NOT REMOVE THIS CODE_SECTION. --Kurt */
+#ifdef _TMS320C6X
+#pragma CODE_SECTION(PAF_ALG_delete,".text:_PAF_ALG_delete")
+#endif
+
+Void PAF_ALG_delete(ALG_Handle alg)
+{
+    IALG_MemRec *memTab;
+    Int n;
+    IALG_Fxns *fxns;
+    Error_Block eb;
+
+#if defined(_TMS320C6X) && !defined(__TI_EABI__)
+    asm (" .clink");
+#endif    
+
+    // Initialize error block
+    Error_init(&eb); 
+
+    if (alg != NULL && alg->fxns != NULL) {
+        fxns = alg->fxns;
+        n = fxns->algNumAlloc != NULL ? fxns->algNumAlloc() : IALG_DEFMEMRECS;
+
+        //if ((memTab = (IALG_MemRec *)MALLOC(n * sizeof (IALG_MemRec)))) 
+        if ((memTab = (IALG_MemRec *)Memory_alloc(HEAPMALLOC, n*sizeof (IALG_MemRec), 8, &eb)))
+        {
+            memTab[0].base = alg;
+            n = fxns->algFree(alg, memTab);
+            PAF_ALG_freeMemory(memTab, n);
+            //FREE(memTab,(n * sizeof(IALG_MemRec)));
+            Memory_free(HEAPMALLOC,memTab,(n * sizeof(IALG_MemRec)));
+        }
+    }
+}
+
+struct PAF_ALG_Fxns PAF_ALG_fxns =
+{
+    PAF_ALG_alloc_,
+    PAF_ALG_create_,
+    PAF_ALG_init_,
+    PAF_ALG_allocMemory_,
+    PAF_ALG_mallocMemory_,
+    PAF_ALG_memSpaceToHeapId_,    
+    PAF_ALG_memSpaceToHeap_,
+    PAF_ALG_setup_
+};
diff --git a/procsdk_audio_x_xx_xx_xx/common/paf_alg_malloc.c b/procsdk_audio_x_xx_xx_xx/common/paf_alg_malloc.c
new file mode 100644 (file)
index 0000000..7114b07
--- /dev/null
@@ -0,0 +1,533 @@
+
+/*
+* Copyright (C) 2004-2014 Texas Instruments Incorporated - http://www.ti.com/
+* All rights reserved. 
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+//
+//
+// Performance Audio Algorithm Memory Allocation.
+//
+//
+//
+
+/*
+ * File Inclusions 
+ */
+
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+
+//#include <mem.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/IHeap.h>
+#include <ti/sysbios/heaps/HeapMem.h>
+
+//#include <stdlib.h>
+//#include <string.h>
+
+#include "alg.h"
+
+//#include "pafhjt.h"
+#include "paf_alg.h"
+#include "paf_alg_priv.h"
+
+#include "common.h"
+#include "paf_heapMgr.h"
+
+//extern int IRAM;
+//extern int SDRAM;
+//extern int L3RAM;
+
+
+// -----------------------------------------------------------------------------
+// Debugging Trace Control, local to this file.
+//
+
+#define PAF_DEVICE_VERSION (PAF_DEVICE & 0xffff)
+#if PAF_DEVICE_VERSION == 0xE000
+#define _DEBUG // This is to enable log_printfs
+#endif /* PAF_DEVICE_VERSION */
+
+#include <logp.h>
+
+// allows you to set a different trace module in pa.cfg
+#define TR_MOD  trace
+
+// Allow a developer to selectively enable tracing.
+// For release, set mask to 1 to make it easier to catch any errors.
+#define CURRENT_TRACE_MASK  0   // terse only
+
+#define TRACE_MASK_TERSE    1   // only flag errors
+#define TRACE_MASK_GENERAL  2   // log a half dozen lines per loop
+#define TRACE_MASK_VERBOSE  4   // trace full operation
+
+#if (CURRENT_TRACE_MASK & TRACE_MASK_TERSE)
+ #define TRACE_TERSE(a) LOG_printf a
+#else
+ #define TRACE_TERSE(a)
+#endif
+
+#if (CURRENT_TRACE_MASK & TRACE_MASK_GENERAL)
+ #define TRACE_GEN(a) LOG_printf a
+#else
+ #define TRACE_GEN(a)
+#endif
+
+#if (CURRENT_TRACE_MASK & TRACE_MASK_VERBOSE)
+ #define TRACE_VERBOSE(a) LOG_printf a
+#else
+ #define TRACE_VERBOSE(a)
+#endif
+
+// Note:  memory spaces are defined in ialg.h from the xdais package.
+// 17 is external.  2 and 5 are internal.
+
+/*
+ * The PAF_ALG_allocMemory is derived from _ALG_allocMemory function defined 
+ * in the TI Standard XDAIS file alg_malloc.c version "XDAS 2.2.1 12-07-01"
+ * It is extended to check for the Performance Audio specific "Common"
+ * memory. This function assumes that memory is already
+ * allocated for the common memory and shared scratch memory.
+ */
+
+Int 
+PAF_ALG_allocMemory_ (
+    IALG_MemRec memTab[], 
+    Int n, 
+    const IALG_MemRec common[],
+    PAF_IALG_Config *p)
+{
+    char * commonBase[PAF_IALG_COMMON_MEMN+1];
+    Int commonCount[PAF_IALG_COMMON_MEMN+1];
+    Int i;
+    Error_Block eb;
+
+    // Initialize error block
+    Error_init(&eb); 
+
+    if(common) {
+#ifdef _TMS320C6X
+//#warn This pragma saves ~125 bytes! --Kurt
+#pragma UNROLL(1)
+#endif
+        for(i=PAF_IALG_COMMON_MEM0;i<=PAF_IALG_COMMON_MEMN;++i) {
+            commonBase[i]=common[i].base;
+            commonCount[i]=0;
+        }
+    }
+    
+    for(i=0;i<n;++i) {
+        if( common && 
+           (memTab[i].attrs == PAF_IALG_COMMON_MEM0 ||
+            (memTab[i].attrs >= PAF_IALG_COMMON_MEM1 &&
+            memTab[i].attrs <= PAF_IALG_COMMON_MEMN))) {
+            memTab[i].base = commonBase[memTab[i].attrs] + 
+                             (commonCount[memTab[i].attrs] ? memTab[i].alignment : 0);
+            memTab[i].base = (void *)((unsigned int )memTab[i].base & 
+                             (~(memTab[i].alignment ? memTab[i].alignment - 1 : 0)));
+            commonBase[memTab[i].attrs] = (char *)memTab[i].base + memTab[i].size;
+            commonCount[memTab[i].attrs]++;
+            TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_.%d: memTab alloc %d bytes at 0x%x.", __LINE__, memTab[i].size, memTab[i].base));
+            TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_ (cont'd) memTab %d. i: %d", memTab[i].attrs, i));
+        }
+        else {
+            if(memTab[i].size){
+                if(p) {
+                    if(p->clr){
+                        TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_.%d: calloc %d bytes from space %d", __LINE__, memTab[i].size, memTab[i].space));
+                        //if(!(memTab[i].base = (void *)MEM_calloc(
+                        //    PAF_ALG_memSpace(p,memTab[i].space),
+                        //    memTab[i].size,memTab[i].alignment)))
+                        if (!(memTab[i].base = (void *)Memory_calloc(
+                            (IHeap_Handle)PAF_ALG_memSpaceToHeap(p,memTab[i].space),
+                            memTab[i].size,
+                            memTab[i].alignment,
+                            &eb)))
+                        {
+                            TRACE_TERSE((&TR_MOD, "PAF_ALG_allocMemory_.%d: calloc %d bytes failed.", __LINE__, memTab[i].size));
+                            SW_BREAKPOINT;
+                            return PAF_ALGERR_PERSIST;
+                        }
+                        TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_ (cont'd) %d at 0x%x, %d",
+                                       memTab[i].size, memTab[i].base, PAF_ALG_memSpace(p,memTab[i].space)));
+                    }
+                    else{
+                        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(
+                        //    PAF_ALG_memSpace(p,memTab[i].space),
+                        //    memTab[i].size,memTab[i].alignment)))
+                        if (!(memTab[i].base = (void *)Memory_alloc(
+                            (IHeap_Handle)PAF_ALG_memSpaceToHeap(p, memTab[i].space),
+                            memTab[i].size, 
+                            memTab[i].alignment, 
+                            &eb)))
+                        {
+                            TRACE_TERSE((&TR_MOD, "PAF_ALG_allocMemory_.%d: alloc %d bytes failed.", __LINE__, memTab[i].size));
+                            SW_BREAKPOINT;
+                            return PAF_ALGERR_PERSIST;
+                        }
+                        TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_ (cont'd) %d at 0x%x, %d",
+                                       memTab[i].size, memTab[i].base, PAF_ALG_memSpace(p,memTab[i].space)));
+                    }
+                }
+                else {
+                    PAF_IALG_Config pafConfig;
+                    TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_.%d: Setup memory regions.", __LINE__));
+                    //PAF_ALG_setup(&pafConfig,IRAM,SDRAM,IRAM,0); // option: use L3RAM
+                    PAF_ALG_setup(&pafConfig,
+                            gPafHeapIdInt,      (HeapMem_Handle)pafHeapMgr_readHeapHandle(gPafHeapIdInt),
+                            gPafHeapIdInt1,     (HeapMem_Handle)pafHeapMgr_readHeapHandle(gPafHeapIdInt1),
+                            gPafHeapIdExt,      (HeapMem_Handle)pafHeapMgr_readHeapHandle(gPafHeapIdExt),
+                            gPafHeapIdInt1Shm,  (HeapMem_Handle)pafHeapMgr_readHeapHandle(gPafHeapIdInt1Shm),
+                            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(
+                    //    PAF_ALG_memSpace(&pafConfig,memTab[i].space),
+                    //    memTab[i].size,memTab[i].alignment)))
+                    if (!(memTab[i].base = (void *)Memory_alloc(
+                        (IHeap_Handle)PAF_ALG_memSpaceToHeap(&pafConfig, memTab[i].space),
+                        memTab[i].size,
+                        memTab[i].alignment, 
+                        &eb)))
+                    {
+                        TRACE_TERSE((&TR_MOD, "PAF_ALG_allocMemory_.%d: alloc %d bytes failed.",__LINE__, memTab[i].size));
+                        SW_BREAKPOINT;
+                        return PAF_ALGERR_PERSIST;
+                    }
+                    TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_ (cont'd) %d at 0x%x",
+                                   memTab[i].size, memTab[i].base, PAF_ALG_memSpace(&pafConfig,memTab[i].space)));
+                }
+            }
+            else
+            {
+                memTab[i].base=NULL;
+                TRACE_TERSE((&TR_MOD, "PAF_ALG_allocMemory_.%d: alloc %d bytes failed.", __LINE__, memTab[i].size));
+                SW_BREAKPOINT;
+            }
+        }
+    }
+    return 0;
+}
+
+/*
+ * The PAF_ALG_mallocMemory function allocates the memory requested by the 
+ * memTab's.
+ */
+
+Int
+PAF_ALG_mallocMemory_ (
+    IALG_MemRec common[], 
+    PAF_IALG_Config *p)
+{
+    Int i;
+    Error_Block eb;
+    
+    // Initialize error block
+    Error_init(&eb);
+    
+    for(i=PAF_IALG_COMMON_MEM0;i<=PAF_IALG_COMMON_MEMN;++i)
+    {
+        if(0 == common[i].size)
+            continue;
+
+        if(p->clr)
+        {
+            TRACE_GEN((&TR_MOD, "PAF_ALG_mallocMemory_.%d: calloc %d bytes from space %d", __LINE__, common[i].size, common[i].space));
+            //common[i].base = (void *)MEM_calloc( PAF_ALG_memSpace(p,common[i].space), common[i].size, common[i].alignment);
+            common[i].base = (void *)Memory_calloc((IHeap_Handle)PAF_ALG_memSpaceToHeap(p,common[i].space), common[i].size, common[i].alignment, &eb);
+            TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_ (cont'd) %d at 0x%x", common[i].size, common[i].base));
+        }
+        else
+        {
+            TRACE_GEN((&TR_MOD, "PAF_ALG_mallocMemory_.%d: alloc %d bytes from space %d", __LINE__, common[i].size, common[i].space));
+            //common[i].base = (void *)MEM_alloc(PAF_ALG_memSpace(p, common[i].space),common[i].size, common[i].alignment);
+            common[i].base = (void *)Memory_alloc((IHeap_Handle)PAF_ALG_memSpaceToHeap(p, common[i].space), common[i].size, common[i].alignment, &eb);
+            TRACE_GEN((&TR_MOD, "PAF_ALG_allocMemory_ (cont'd) %d at 0x%x", common[i].size, common[i].base));
+        }
+
+        if(!(common[i].base))
+        {
+            TRACE_TERSE((&TR_MOD, "PAF_ALG_mallocMemory_.%d: (c)alloc %d bytes failed", __LINE__, common[i].size));
+            SW_BREAKPOINT;
+            return PAF_ALGERR_COMMON;
+        }
+    }
+
+    return 0;
+}
+
+/*
+ * The PAF_ALG_freeMemory is derived from _ALG_freeMemory function defined 
+ * in the TI Standard XDAIS file alg_malloc.c version "XDAS 2.2.1 12-07-01"
+ * It is extended to check for the Performance Audio specific "Common"
+ * memory and scratch memory.
+ */
+
+Void 
+PAF_ALG_freeMemory(
+    IALG_MemRec memTab[], 
+    Int n)
+{
+
+#ifdef _TMS320C6X
+//#warn Cannot free memory here because segids are not known
+#endif
+
+    // Cannot free memory here bacause there is no way to determine
+    // the segid needed by MEM_free.
+    // Not an issuue as of now, in PA, because, if alg creation fails
+    // system does not do any thing further.
+    // 
+#if 0
+    Int i;
+    Int segid;
+
+    for(i=0;i<n;i++){
+        if(memTab[i].base != NULL && !(memTab[i].attrs == PAF_IALG_COMMON_MEM0 ||
+           memTab[i].attrs >= PAF_IALG_COMMON_MEM1 && memTab[i].attrs <= PAF_IALG_COMMON_MEMN))
+        {
+#warn MEM_free might be 
+            segid = (memTab[i].space == IALG_SARAM)?IRAM:SDRAM;
+            MEM_free(segid,memTab[i].base,memTab[i].size);
+        }
+    }
+#endif
+}
+
+/* 
+ * The PAF_ALG_init function initializes the memTab's to default values.
+ */
+
+Void 
+PAF_ALG_init_ (
+    IALG_MemRec memTab[], 
+    Int n, 
+    const IALG_MemSpace memSpace[])
+{
+    Int i;
+
+    for (i=0; i<n; i++) {
+        memTab[i].size = 0;
+        memTab[i].alignment = 0;
+        memTab[i].base = NULL;
+        memTab[i].space = memSpace ? memSpace[i] : PAF_IALG_NONE;
+        // TRACE_GEN((&TR_MOD, "PAF_ALG_init_[%d]:space %d", i, memTab[i].space));
+    }
+}
+
+/*
+ *  PAF_ALG_activate is derived from standard XDAIS ALG_activate function defined in the
+ *  file alg_malloc.c version "XDAS 2.2.1 12-07-01".
+ */
+
+#ifdef _TMS320C6X
+/* DO NOT REMOVE THIS CODE_SECTION. --Kurt */
+#pragma CODE_SECTION(PAF_ALG_activate,".text:_PAF_ALG_activate")
+#endif
+
+Void
+PAF_ALG_activate (
+    ALG_Handle alg)
+{
+#if defined(_TMS320C6X) && !defined(__TI_EABI__)
+    asm (" .clink");
+#endif    
+
+    if (alg->fxns->algActivate != NULL) {
+        alg->fxns->algActivate (alg);
+    }
+}
+
+/*
+ *  PAF_ALG_deactivate is derived from standard XDAIS ALG_deactivate function defined in the
+ *  file alg_malloc.c version "XDAS 2.2.1 12-07-01".
+ */
+
+#ifdef _TMS320C6X
+/* DO NOT REMOVE THIS CODE_SECTION. --Kurt */
+#pragma CODE_SECTION(PAF_ALG_deactivate,".text:_PAF_ALG_deactivate")
+#endif
+
+Void 
+PAF_ALG_deactivate (
+    ALG_Handle alg)
+{
+#if defined(_TMS320C6X) && !defined(__TI_EABI__)
+    asm (" .clink");
+#endif
+
+    if (alg->fxns->algDeactivate != NULL) {
+        alg->fxns->algDeactivate(alg);
+    }   
+}
+
+/* 
+ * The PAF_ALG_memSpaceToHeapId function is derived from ALGRF_memSpace function 
+ * defined in the TI released algrf.h file ver "ALGRF 0.02.06 11-21-01".
+ */
+
+Int
+PAF_ALG_memSpaceToHeapId_ (
+    const PAF_IALG_Config *p, 
+    IALG_MemSpace space)
+{
+    switch(space)
+    {
+        case IALG_SARAM:    /* IALG_SARAM0 = IALG_SARAM :  Normally used for IRAM.  */
+            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
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_EXTERNAL (0x%x) 0x%x", __LINE__, space, p->eHeapId));
+            return p->eHeapId;
+
+        case IALG_SARAM1:
+            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));
+            return p->lHeapIdShm;
+
+        case IALG_DARAM0:   // Can't use this because it is zero and overridden
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_DARAM0 (0x%x) 0x%x", __LINE__, space, p->iHeapId));
+            return p->iHeapId;
+
+        case IALG_DARAM1:   // not normally used.
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: IALG_DARAM1 (0x%x) 0x%x", __LINE__, space, p->iHeapId));
+            return p->iHeapId;
+
+        case IALG_DARAM2:   // not normally used.
+            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;
+
+        default:
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeapId_.%d: default (0x%x) 0x%x", __LINE__, space, p->eHeapId));
+            return p->eHeapId;
+    }
+}
+
+HeapMem_Handle
+PAF_ALG_memSpaceToHeap_ (
+    const PAF_IALG_Config *p, 
+    IALG_MemSpace space)
+{
+    switch(space)
+    {
+        case IALG_SARAM:    /* IALG_SARAM0 = IALG_SARAM :  Normally used for IRAM.  */
+            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
+            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
+            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));
+            return p->hLHeapShm;
+
+        case IALG_DARAM0:   // Can't use this because it is zero and overridden
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_DARAM0 (0x%x) 0x%x", __LINE__, space, p->iHeapId));
+            return p->hIHeap;
+
+        case IALG_DARAM1:   // not normally used.
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: IALG_DARAM1 (0x%x) 0x%x", __LINE__, space, p->iHeapId));
+            return p->hIHeap;
+
+        case IALG_DARAM2:   // not normally used.
+            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;
+
+        default:
+            TRACE_GEN((&TR_MOD, "PAF_ALG_memSpaceToHeap_.%d: default (0x%x) 0x%x", __LINE__, space, p->eHeapId));
+            return p->hEHeap;
+    } 
+}
+
+/* 
+ * The PAF_ALG_setup function is derived from ALGRF_setup function defined in
+ * the TI released algrf_setup.c file ver "ALGRF 0.02.06 11-21-01" .
+ */
+    
+#ifdef _TMS320C6X
+#pragma CODE_SECTION(PAF_ALG_setup_,".text:_PAF_ALG_setup_")
+#endif
+Void
+PAF_ALG_setup_ (
+    PAF_IALG_Config *p, 
+    Int iHeapId, 
+    HeapMem_Handle hIHeap,
+    Int lHeapId,
+    HeapMem_Handle hLHeap,
+    Int eHeapId,
+    HeapMem_Handle hEHeap,
+    Int lHeapIdShm,
+    HeapMem_Handle hLHeapShm,
+    Int clr
+)
+{ 
+#if defined(_TMS320C6X) && !defined(__TI_EABI__)
+    asm (" .clink");
+#endif    
+    
+    /* initialize heap Ids */
+    p->iHeapId      = iHeapId; 
+    p->lHeapId      = lHeapId;
+    p->eHeapId      = eHeapId;
+    p->lHeapIdShm   = lHeapIdShm;
+    
+    /* initialize heap handles */
+    p->hIHeap       = hIHeap;
+    p->hLHeap       = hLHeap;
+    p->hEHeap       = hEHeap;
+    p->hLHeapShm    = hLHeapShm;
+    
+    /* initialize clear flag */
+    p->clr=clr;
+    
+    // TRACE_GEN((&TR_MOD, "PAF_ALG_memSpace_.%d: IPAF_ALG_setup_", __LINE__));
+}
diff --git a/procsdk_audio_x_xx_xx_xx/common/paf_alg_print.c b/procsdk_audio_x_xx_xx_xx/common/paf_alg_print.c
new file mode 100644 (file)
index 0000000..79cd635
--- /dev/null
@@ -0,0 +1,210 @@
+
+/*
+* Copyright (C) 2004-2014 Texas Instruments Incorporated - http://www.ti.com/
+* All rights reserved. 
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+//
+//
+// Performance Audio Algorithm RAM_REPORT definitions.
+//
+//
+#include <stdlib.h> // malloc
+#include <stdio.h>  // printf
+#include <paf_alg_print.h>
+
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/IHeap.h>
+#include <ti/sysbios/heaps/HeapMem.h>
+
+Int
+PAF_ALG_allocPrint (const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p)
+{
+    IALG_MemRec *memTab;
+    Int commonSize[PAF_IALG_COMMON_MEMN+1];
+    Int commonCount[PAF_IALG_COMMON_MEMN+1];
+    Int commonSpace[PAF_IALG_COMMON_MEMN+1];
+    Int i,n;
+
+    for ( ; pInit && pInit->ialg_fxns; 
+        pInit=(const PAF_ALG_AllocInit *)((char *)pInit+sizeofInit)) {
+#ifdef _TMS320C6X
+#pragma UNROLL(1)
+#endif
+        for (i=PAF_IALG_COMMON_MEM0;i<=PAF_IALG_COMMON_MEMN;++i) {
+            commonSize[i]=0;
+            commonCount[i]=0;
+            commonSpace[i]=-1;
+        }
+        n = pInit->ialg_fxns->algNumAlloc != NULL ? pInit->ialg_fxns->algNumAlloc() 
+                                                  : IALG_DEFMEMRECS;
+        if((memTab = (IALG_MemRec *)malloc(n * sizeof(IALG_MemRec)))){
+            n=pInit->ialg_fxns->algAlloc(pInit->ialg_prms,(IALG_Fxns ** )&(pInit->ialg_fxns),memTab);
+            if(n<=0)
+                return PAF_ALGERR_MEMTAB_COUNT;
+
+            for(i=0;i<n;++i){
+                if((((Int)memTab[i].attrs >= PAF_IALG_COMMON_MEM0) && ((Int)memTab[i].attrs <= PAF_IALG_COMMON_MEMN))) {
+                    commonSize[memTab[i].attrs] += memTab[i].size + 
+                (commonCount[memTab[i].attrs] ? memTab[i].alignment : 0);
+                    commonCount[memTab[i].attrs]++;
+                }
+                // (***) FL: this is broken for printout of persistent memory
+                // The code was broken before addition of persist memory in MSMC SHM.
+                // commonSize[] and commonCount[] are correct, but here persist is treated like common memory, i.e.
+                //     persistent memory is treated as through it's combined into a single memory space.
+                //     For example, printout can only show persist memory as belonging to one space.
+                //     This isn't true for persistent memory since it can be in multiple spaces.
+                if (commonSpace[memTab[i].attrs] < (Int)memTab[i].space) {
+                    commonSpace[memTab[i].attrs] = (Int)memTab[i].space;
+                }
+            }
+            free(memTab);
+
+            printf("\n0x%-3x\t",((PAF_ASP_LinkInit*)pInit)->thisCode.part.beta);
+            for(i=PAF_IALG_COMMON_MEM0;i<=PAF_IALG_COMMON_MEMN;++i){
+                if (commonSize[i] == 0)
+                    printf("%9d\t",0);
+                else 
+                    printf("%6d(%1d)\t", 
+                        commonSize[i], PAF_ALG_memSpaceToHeapId(p, (IALG_MemSpace)commonSpace[i]));
+            }
+            commonSize[IALG_SCRATCH] = commonSize[IALG_PERSIST] = commonSize[IALG_WRITEONCE] = 0;
+        }
+        else
+            return 1;
+    }
+    return 0;
+}
+
+Void
+PAF_ALG_commonPrint (IALG_MemRec common[], PAF_IALG_Config *p)
+{
+
+    Int i;
+
+    printf("\n\n");
+    for(i=0;i<130;i++)
+        printf ("--");
+
+    printf ("\nCOMMON                         \t\t\t\t");
+    for (i=PAF_IALG_COMMON_MEM0; i <= PAF_IALG_COMMON_MEMN; i++) {
+        if (i <= IALG_WRITEONCE)
+            ; //printf(""); // print empty string??
+        else if (common[i].size == 0)
+            printf("%9d\t",0);
+        else 
+            printf("%6d(%1d)\t",
+                common[i].size, PAF_ALG_memSpaceToHeapId(p, common[i].space));
+    }
+}
+
+
+//PAF_ALG_memStatusPrint(Int internal, Int external, Int internal1)
+Void
+PAF_ALG_memStatusPrint(
+    HeapMem_Handle hInternalHeap, 
+    HeapMem_Handle hInternal1Heap,
+    HeapMem_Handle hExternalHeap, 
+    HeapMem_Handle hInternal1HeapShm
+)
+{
+    //MEM_Stat statbuf;
+    Memory_Stats stats;
+
+    printf("\n\nSegment\tSize\tUsed\tAvailable");
+    
+    //MEM_stat(internal,&statbuf);
+    //printf("\nIRAM\t%d\t%d\t%d",statbuf.size,statbuf.used,statbuf.length);
+    //MEM_stat(external,&statbuf);
+    //printf("\nSDRAM\t%d\t%d\t%d",statbuf.size,statbuf.used,statbuf.length);
+    //MEM_stat(internal1,&statbuf);
+    //printf("\nL3RAM\t%d\t%d\t%d\n",statbuf.size,statbuf.used,statbuf.length);
+
+    if (hInternalHeap != NULL)
+    {
+        Memory_getStats((IHeap_Handle)hInternalHeap, &stats);
+        printf("\nL2\t%d\t%d\t%d", stats.totalSize, stats.totalSize-stats.totalFreeSize, stats.largestFreeSize);
+    }
+    if (hInternal1Heap != NULL)
+    {
+        Memory_getStats((IHeap_Handle)hInternal1Heap, &stats);
+        printf("\nMSMC\t%d\t%d\t%d", stats.totalSize, stats.totalSize-stats.totalFreeSize, stats.largestFreeSize);    
+    }
+    if (hExternalHeap != NULL)
+    {
+        Memory_getStats((IHeap_Handle)hExternalHeap, &stats);
+        printf("\nDDR3\t%d\t%d\t%d", stats.totalSize, stats.totalSize-stats.totalFreeSize, stats.largestFreeSize);
+    }
+    if (hInternal1HeapShm != NULL)
+    {
+        Memory_getStats((IHeap_Handle)hInternal1HeapShm, &stats);
+        printf("\nMSMC SHM\t%d\t%d\t%d\n", stats.totalSize, stats.totalSize-stats.totalFreeSize, stats.largestFreeSize);
+    }
+}
+
+//PAF_ALG_bufMemPrint(Int z,Int size, Int heap,Int bufType)
+Void
+PAF_ALG_bufMemPrint(
+    Int z,
+    Int size, 
+    Int heapId,
+    Int bufType
+)
+{
+      printf("\n\n%s Device Buffer (Zone %d) = %d (%d)", 
+              (bufType==0 ? "Input" : bufType==1 ? "Output" : "Audio Frame"), 
+              z, size, heapId);
+      printf("\n");
+}
+
+Void
+PAF_ALG_headerPrint()
+{
+    Int i;
+
+    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("%8s\t","BetaId");
+    for(i=PAF_IALG_COMMON_MEM0;i<=PAF_IALG_COMMON_MEMN;++i){
+        if(i==0) printf("%8s\t","SCRATCH");
+        else if(i==1) printf("%8s\t","PERSIST");
+        else if(i==2) printf("%8s \t","WRITEONCE");
+        else if(i<10)
+            printf("%-7s%d  \t","COMMON",(i==0 ? i : i-IALG_WRITEONCE));
+        else
+            printf("%6s%2d \t","COMMON",(i==0 ? i : i-IALG_WRITEONCE));
+    }
+}
+
diff --git a/procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.c b/procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.c
new file mode 100644 (file)
index 0000000..19622fc
--- /dev/null
@@ -0,0 +1,351 @@
+#include <string.h> // for memset()
+#include <xdc/std.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <xdc/runtime/Log.h>
+
+#include "pafdec.h"
+#include "pafsp.h"
+#include "paf_decOpCircBuf.h"
+
+#define MAX_NUM_AF_PCM      ( 4 )
+#define MAX_NUM_AF_DDP      ( 2 )
+
+#define CB_INIT_RD_LAG      ( 2 )
+
+// PCM audio frame data
+
+// DDP audio frame data
+
+// Initialize circular buffer
+Int cbInit(
+    Int8 sourceSelect,          // source select (PCM, DDP, etc.)
+    Int decOpFrameLen,          // decoder output frame length
+    Int pafFrameLen,            // PAF frame length
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
+)
+{
+    PAF_AudioFrame *pAfCb;
+    PAF_AudioData *pPcmBuf;
+    Int n;
+    Int i;
+
+    // set input frame length
+    pCb->decOpFrameLen = decOpFrameLen;
+    
+    // set output frame length
+    pCb->pafFrameLen = pafFrameLen;
+    
+    // initialize circular buffer maximum number of audio frames
+    if (sourceSelect == PAF_SOURCE_PCM)
+    {
+        pCb->maxNumAfCb = MAX_NUM_AF_PCM;
+        pCb->afWrtIdx = CB_INIT_RD_LAG;
+        pCb->afRdIdx = 0;
+        pCb->pcmRdIdx = 0; // 2*256 in behind
+        
+        // initialize audio frames
+        for (n=0; n<pCb->maxNumAfCb; n++)
+        {
+            pAfCb = &pCb->afCb[n];
+            pAfCb->sampleDecode = PAF_SOURCE_PCM;
+            PAF_PROCESS_ZERO(pAfCb->sampleProcess);
+            pAfCb->sampleRate = PAF_SAMPLERATE_48000HZ;
+            pAfCb->sampleCount = decOpFrameLen;
+            pAfCb->channelConfigurationRequest.full = 0;
+            pAfCb->channelConfigurationRequest.part.sat = PAF_CC_SAT_SURROUND4;
+            pAfCb->channelConfigurationRequest.part.sub = PAF_CC_SUB_ONE;
+            pAfCb->channelConfigurationStream.full = 0;
+            pAfCb->channelConfigurationStream.part.sat = PAF_CC_SAT_SURROUND4;
+            pAfCb->channelConfigurationStream.part.sub = PAF_CC_SUB_ONE;
+        }
+    }
+    else if (sourceSelect == PAF_SOURCE_DDP)
+    {
+        pCb->maxNumAfCb = MAX_NUM_AF_DDP;
+        pCb->afRdIdx = 0;
+        pCb->afWrtIdx = 1;
+        pCb->pcmRdIdx = decOpFrameLen - CB_INIT_RD_LAG*pafFrameLen; // 2*256 behind
+        
+        // initialize audio frames
+        for (n=0; n<pCb->maxNumAfCb; n++)
+        {
+            pAfCb = &pCb->afCb[n];
+            pAfCb->sampleDecode = PAF_SOURCE_DDP;
+            PAF_PROCESS_ZERO(pAfCb->sampleProcess);
+            pAfCb->sampleRate = PAF_SAMPLERATE_48000HZ;
+            pAfCb->sampleCount = decOpFrameLen;
+            pAfCb->channelConfigurationRequest.full = 0;
+            pAfCb->channelConfigurationRequest.part.sat = PAF_CC_SAT_SURROUND4;
+            pAfCb->channelConfigurationRequest.part.sub = PAF_CC_SUB_ONE;
+            pAfCb->channelConfigurationStream.full = 0;
+            pAfCb->channelConfigurationStream.part.sat = PAF_CC_SAT_SURROUND4;
+            pAfCb->channelConfigurationStream.part.sub = PAF_CC_SUB_ONE;
+        }
+    }
+    else
+    {
+        return PAF_DECOP_CB_INIT_INV_SOURCE_SEL;
+    }
+
+    // initialize circular buffer current number of frames
+    pCb->numAfCb = pCb->afWrtIdx - pCb->afRdIdx;
+    
+    // initialize audio frame PCM buffers
+    pPcmBuf = pCb->pcmBuf;
+    for (n=0; n<pCb->maxNumAfCb; n++)
+    {
+        pAfCb = &pCb->afCb[n];
+        pAfCb->data.nChannels = PAF_DECOP_CB_MAX_NUM_PCM_CH;
+        pAfCb->data.nSamples = decOpFrameLen;
+        for (i=0; i<PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        {
+            pAfCb->data.sample[i] = pPcmBuf;
+            memset(pAfCb->data.sample[i], decOpFrameLen, 0);
+            pPcmBuf += decOpFrameLen;
+            
+            pAfCb->data.samsiz[i] = 0;
+        }
+    }
+    
+    pCb->cbWriteInit = FALSE;
+    
+    // (***) FL: hackin'
+    // Write back circular buffer configuration
+    Cache_wb(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+    // Write back AF circular buffer
+    Cache_wb(pCb->afCb, pCb->maxNumAfCb*sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
+    // Write back PCM data
+    for (n=0; n<pCb->maxNumAfCb; n++)
+    {
+        pAfCb = &pCb->afCb[n];
+        Cache_wb(pAfCb->data.samsiz, PAF_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+        Cache_wb(pAfCb->data.sample, PAF_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
+        for (i=0; i<PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        {
+            Cache_wb(pAfCb->data.sample[i], decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+        }
+    }
+    Cache_wait();
+
+    return PAF_DECOP_CB_SOK;
+}
+
+// Read audio frame from circular buffer
+Int cbReadAf(
+    PAF_DecodeOpCircBuf *pCb,   // decoder output circular buffer
+    PAF_AudioFrame *pAfRd       // audio frame into which to read
+)
+{
+    PAF_AudioFrame *pAfCb;
+    PAF_ChannelMask_HD streamMask;
+    Int i, j;
+
+    // (***) FL: hackin'
+    // Invalidate circular buffer configuration.
+    Cache_inv(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+    Cache_wait();
+    
+    // check underflow
+    if (pCb->numAfCb <= 0)
+    {
+        return PAF_DECOP_CB_READ_UNDERFLOW;
+    }
+    
+    // get pointer to current audio frame in circular buffer
+    pAfCb = &pCb->afCb[pCb->afRdIdx];
+
+    // (***) FL: hackin'
+    // Invalidate audio frame
+    Cache_inv(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
+    Cache_inv(pAfCb->data.samsiz, PAF_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+    Cache_wait();
+
+    // compute stream mask
+    streamMask = pAfRd->fxns->channelMask(pAfRd, pAfCb->channelConfigurationStream);
+
+    // Invalidate PCM data
+    for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+    {
+        if ((streamMask >> i) & 0x1)
+        {
+            Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], pCb->pafFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+        }
+    }
+    Cache_wait();        
+    
+    // read audio frame information updated by decoder
+    pAfRd->sampleDecode = pAfCb->sampleDecode;
+    PAF_PROCESS_COPY(pAfRd->sampleProcess, pAfCb->sampleProcess);
+    pAfRd->sampleRate = pAfCb->sampleRate;
+    pAfRd->sampleCount = pCb->pafFrameLen;
+    pAfRd->channelConfigurationRequest = pAfCb->channelConfigurationRequest;
+    pAfRd->channelConfigurationStream = pAfCb->channelConfigurationStream;
+
+    // read PCM samples
+    for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+    {
+        if ((streamMask >> i) & 0x1)
+        {
+            for (j = 0; j < pCb->pafFrameLen; j++)
+            {
+                pAfRd->data.sample[i][j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
+            }
+
+            pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
+        }
+    }
+    
+    pCb->pcmRdIdx += pCb->pafFrameLen; // update PCM read index
+    if (pCb->pcmRdIdx == pCb->decOpFrameLen)
+    {
+        // update audio frame read index
+        pCb->afRdIdx++;
+        if (pCb->afRdIdx >= pCb->maxNumAfCb)
+        {
+            pCb->afRdIdx = 0;
+        }
+        
+        // update PCM read index
+        pCb->pcmRdIdx = 0;
+        
+        // update number of audio frames in circular buffer
+        pCb->numAfCb--;
+    }
+
+    // (***) FL: hackin'
+    // Write back circular buffer configuration.
+    // NOTE: Probably only a subset of this information needs to be updated.
+    Cache_wb(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+    Cache_wait();    
+    
+    return PAF_DECOP_CB_SOK;
+}
+
+// Write audio frame to circular buffer
+Int cbWriteAf(
+    PAF_DecodeOpCircBuf *pCb,   // decoder output circular buffer
+    PAF_AudioFrame *pAfWrt      // audio frame from which to write
+)
+{
+    PAF_AudioFrame *pAfCb;
+    PAF_ChannelMask_HD streamMask;
+    Int n;
+    Int i, j;
+
+    // (***) FL: hackin'
+    // Invalidate circular buffer configuration.
+    // NOTE: Probably only a subset of this information needs to be updated.
+    Cache_inv(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+    Cache_wait();
+    
+    if (pCb->cbWriteInit == FALSE)
+    {
+        // Invalidate AF circular buffer
+        Cache_inv(pCb->afCb, pCb->maxNumAfCb*sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
+        for (n=0; n<pCb->maxNumAfCb; n++)
+        {
+            pAfCb = &pCb->afCb[n];
+            Cache_inv(pAfCb->data.sample, PAF_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioData *), Cache_Type_ALLD, 0);
+        }
+        Cache_wait();
+
+        pCb->cbWriteInit = TRUE;
+    }
+
+    // check overflow
+    if (pCb->numAfCb >= pCb->maxNumAfCb)
+    {
+        return PAF_DECOP_CB_WRITE_OVERFLOW;
+    }
+
+    // get pointer to current audio frame in circular buffer
+    pAfCb = &pCb->afCb[pCb->afWrtIdx];
+       
+    // write audio frame information updated by decoder
+    pAfCb->sampleDecode = pAfWrt->sampleDecode;
+    PAF_PROCESS_COPY(pAfCb->sampleProcess, pAfWrt->sampleProcess);
+    pAfCb->sampleRate = pAfWrt->sampleRate;
+    pAfCb->sampleCount = pAfWrt->sampleCount;
+    pAfCb->channelConfigurationRequest = pAfWrt->channelConfigurationRequest;
+    pAfCb->channelConfigurationStream = pAfWrt->channelConfigurationStream;
+    
+    // write PCM samples
+    streamMask = pAfWrt->fxns->channelMask(pAfWrt, pAfCb->channelConfigurationStream);
+    for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+    {
+        if ((streamMask >> i) & 0x1)
+        {
+            for (j = 0; j < pCb->decOpFrameLen; j++)
+            {
+                pAfCb->data.sample[i][j] = pAfWrt->data.sample[i][j];
+            }            
+            
+            pAfCb->data.samsiz[i] = pAfWrt->data.samsiz[i];
+        }
+    }
+    
+    // update audio frame write index
+    pCb->afWrtIdx++;
+    if (pCb->afWrtIdx >= pCb->maxNumAfCb)
+    {
+        pCb->afWrtIdx = 0;
+    }
+    
+    // update number of audio frames in circular buffer
+    pCb->numAfCb++;
+
+    // (***) FL: hackin'
+    // Write back circular buffer configuration
+    Cache_wb(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+    // write back audio frame
+    Cache_wb(pAfCb, sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
+    Cache_wb(pAfCb->data.samsiz, PAF_DECOP_CB_MAX_NUM_PCM_CH*sizeof(PAF_AudioSize), Cache_Type_ALLD, 0);
+    // write back PCM data
+    for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+    {
+        if ((streamMask >> i) & 0x1)
+        {
+            Cache_wb(pAfCb->data.sample[i], pCb->decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+        }
+    }
+    Cache_wait();
+    
+    return PAF_DECOP_CB_SOK;
+}
+
+// Get next audio frame to write in circular buffer
+Int cbGetNextWriteAf(
+    PAF_DecodeOpCircBuf *pCb, // decoder output circular buffer
+    PAF_AudioFrame **ppAfWrt  // audio frame next to be written
+)
+{
+    // get pointer to current audio frame in circular buffer
+    *ppAfWrt = &pCb->afCb[pCb->afWrtIdx];
+    
+    // update audio frame write index
+    pCb->afWrtIdx++;
+    if (pCb->afWrtIdx > pCb->maxNumAfCb)
+    {
+        pCb->afWrtIdx = 0;
+    }    
+    
+    return PAF_DECOP_CB_SOK;
+}
+
+Int cbLog(
+    PAF_DecodeOpCircBuf *pCb,
+    Int fullLog
+)
+{
+    Log_info4("afRdIdx=%d, pcmRdIdx=%d, afWrtIdx=%d, numAfCb=%d", pCb->afRdIdx, pCb->pcmRdIdx, 
+        pCb->afWrtIdx, 
+        pCb->numAfCb);
+    if (fullLog)
+    {
+        Log_info1("maxNumAfCb=%d", pCb->maxNumAfCb);  
+        Log_info2("decOpFrameLen=%d, pafFrameLen=%d", pCb->decOpFrameLen, pCb->pafFrameLen);
+        Log_info1("cbWriteInit=%d", pCb->cbWriteInit);
+    }
+    
+    return 0;
+}
diff --git a/procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.h b/procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.h
new file mode 100644 (file)
index 0000000..97bdbd5
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef _DEC_OP_CIRC_BUF_H_
+#define _DEC_OP_CIRC_BUF_H_
+
+#include <xdc/std.h>
+#include "paftyp.h"
+
+#define PAF_DECOP_CB_SOK                    (  0 )  // ok
+#define PAF_DECOP_CB_INIT_INV_SOURCE_SEL    ( -1 )  // error: invalid source selection on init
+#define PAF_DECOP_CB_WRITE_OVERFLOW         ( -2 )  // error: write overflow
+#define PAF_DECOP_CB_READ_UNDERFLOW         ( -3 )  // error: read underflow
+
+#define PAF_DECOP_CB_MAX_NUM_AF         ( 4 )       // decoder output circular buffer maximum number audio frames
+#define PAF_DECOP_CB_MAX_NUM_PCM_CH     ( 16 )      // decoder output circular buffer maximum number audio PCM channels
+#define PAF_DECOP_CB_MAX_NUM_PCM_FRAMES ( 2 )       // decoder output circular buffer maximum number PCM frames
+#define PAF_DECOP_CB_MAX_PCM_FRAME_LEN  ( 6*256 )   // decoder output circular buffer maximum PCM frame length
+#define PAF_DECOP_CB_PCM_BUF_SZ         ( PAF_DECOP_CB_MAX_NUM_PCM_CH * PAF_DECOP_CB_MAX_NUM_PCM_FRAMES * PAF_DECOP_CB_MAX_PCM_FRAME_LEN )
+
+// Decoder output circular buffer
+typedef struct PAF_DecodeOpCircBuf {
+        PAF_AudioFrame *afCb;   // audio frame circular buffer
+        PAF_AudioData *pcmBuf;  // PCM buffer, contains PCM data associated with audio frames
+        Int8 afRdIdx;           // audio frame circular buffer read index
+        Int8 afWrtIdx;          // audio frame circular buffer write index
+        Int pcmRdIdx;           // pcm buffer read index
+        Int8 numAfCb;           // current number frames in circular buffer 
+        Int8 maxNumAfCb;        // maximum number of audio frames in circular buffer
+        Int decOpFrameLen;      // selected decoder output frame length (input transaction size)
+        Int pafFrameLen;        // PAF frame length (output transaction size)
+        Int cbWriteInit;        // indicates whether CB write has been initialized
+} PAF_DecodeOpCircBuf;
+
+// Initialize circular buffer
+Int cbInit(
+    Int8 sourceSelect,          // source select (PCM, DDP, etc.)
+    Int decOpFrameLen,          // decoder output frame length
+    Int pafFrameLen,            // PAF frame length
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
+);
+
+// Read audio frame from circular buffer
+Int cbReadAf(
+    PAF_DecodeOpCircBuf *pCb,   // decoder output circular buffer
+    PAF_AudioFrame *pAfRd       // audio frame into which to read
+);
+
+// Write audio frame to circular buffer
+Int cbWriteAf(
+    PAF_DecodeOpCircBuf *pCb,   // decoder output circular buffer
+    PAF_AudioFrame *pAfWrt      // audio frame from which to write
+);
+
+// Get next audio frame to write in circular buffer
+Int cbGetNextWriteAf(
+    PAF_DecodeOpCircBuf *pCb,   // decoder output circular buffer
+    PAF_AudioFrame **ppAfWrt    // audio frame next to be written
+);
+
+Int cbLog(
+    PAF_DecodeOpCircBuf *pCb,
+    Int fullLog
+);
+
+#endif /* _DEC_OP_CIRC_BUF_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/common/paf_heapMgr.c b/procsdk_audio_x_xx_xx_xx/common/paf_heapMgr.c
new file mode 100644 (file)
index 0000000..84b1d36
--- /dev/null
@@ -0,0 +1,68 @@
+#include <xdc\std.h>
+#include <xdc\runtime\IHeap.h>
+
+#include "paf_heapMgr.h"
+
+Int gPafHeapIdInt       = PAF_HEAP_ID_INT;
+Int gPafHeapIdInt1      = PAF_HEAP_ID_INT1;
+Int gPafHeapIdExt       = PAF_HEAP_ID_EXT;
+Int gPafHeapIdInt1Shm   = PAF_HEAP_ID_INT1_SHM;
+Int gPafHeapIdExtShm    = PAF_HEAP_ID_EXT_SHM;
+
+// heap handle array
+//static IHeap_Handle gHeapIdToHandle[PAF_NUM_HEAPS] =
+IHeap_Handle gHeapIdToHandle[PAF_NUM_HEAPS] =
+{
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+
+/* Initialize PAF heap manager */
+Void pafHeapMgr_init(
+    IHeap_Handle hIntHeap,
+    IHeap_Handle hIntHeap1,
+    IHeap_Handle hExtHeap,
+    IHeap_Handle hIntHeap1Shm,
+    IHeap_Handle hExtHeapShm
+)
+{
+    gHeapIdToHandle[PAF_HEAP_ID_INT]        = hIntHeap;
+    gHeapIdToHandle[PAF_HEAP_ID_INT1]       = hIntHeap1;
+    gHeapIdToHandle[PAF_HEAP_ID_EXT]        = hExtHeap;
+    gHeapIdToHandle[PAF_HEAP_ID_INT1_SHM]   = hIntHeap1Shm;
+    gHeapIdToHandle[PAF_HEAP_ID_EXT_SHM]    = hExtHeapShm;
+}
+
+/* Write heap handle to PAF heap manager for provided index */
+Void pafHeapMgr_writeHeapHandle(
+    Int heapId,
+    IHeap_Handle hHeap
+)
+{
+    if (heapId < PAF_NUM_HEAPS)
+    {
+        gHeapIdToHandle[heapId] = hHeap;
+    }
+}
+
+/* Read heap handle from PAF heap manager for provided index */
+IHeap_Handle pafHeapMgr_readHeapHandle(
+    Int heapId
+)
+{
+    IHeap_Handle hHeap;
+    
+    if (heapId < PAF_NUM_HEAPS)
+    {
+        hHeap = gHeapIdToHandle[heapId];
+    }
+    else
+    {
+        hHeap = NULL;
+    }
+    
+    return hHeap;
+}
diff --git a/procsdk_audio_x_xx_xx_xx/common/paf_heapMgr.h b/procsdk_audio_x_xx_xx_xx/common/paf_heapMgr.h
new file mode 100644 (file)
index 0000000..f5b4f3c
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef _PSDKAF_HEAPMGR_H_
+#define _PSDKAF_HEAPMGR_H_
+
+#include <xdc/std.h>
+#include <xdc/runtime/IHeap.h>
+
+#define PAF_NUM_PRVMEM_HEAPS    ( 3 )
+#define PAF_NUM_SHMEM_HEAPS     ( 2 )
+#define PAF_NUM_HEAPS           ( PAF_NUM_PRVMEM_HEAPS + PAF_NUM_SHMEM_HEAPS )
+#define PAF_HEAP_ID_INT         ( 0 )   // L2 SRAM
+#define PAF_HEAP_ID_INT1        ( 1 )   // MSMC SRAM
+#define PAF_HEAP_ID_EXT         ( 2 )   // DDR3
+#define PAF_HEAP_ID_INT1_SHM    ( 3 )   // MSMC SRAM, Shared
+#define PAF_HEAP_ID_EXT_SHM     ( 4 )   // DDR3, Shared
+
+extern Int gPafHeapIdInt;
+extern Int gPafHeapIdInt1;
+extern Int gPafHeapIdExt;
+extern Int gPafHeapIdInt1Shm;
+extern Int gPafHeapIdExtShm;
+
+/* Initialize PAF heap manager */
+Void pafHeapMgr_init(
+    IHeap_Handle hIntHeap,
+    IHeap_Handle hIntHeap1,
+    IHeap_Handle hExtHeap,
+    IHeap_Handle hIntHeap1Shm,
+    IHeap_Handle hExtHeapShm
+);
+
+/* Write heap handle to PAF heap manager for provided index */
+Void pafHeapMgr_writeHeapHandle(
+    Int heapId,
+    IHeap_Handle hHeap
+);
+
+/* Read heap handle from PAF heap manager for provided index */
+IHeap_Handle pafHeapMgr_readHeapHandle(
+    Int heapId
+);
+
+#endif /* _PSDKAF_HEAPMGR_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/shared/aspMsg_common.h b/procsdk_audio_x_xx_xx_xx/shared/aspMsg_common.h
new file mode 100644 (file)
index 0000000..d5eca30
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef _ASP_MSG_COMMON_H_
+#define _ASP_MSG_COMMON_H_
+
+#include <xdc/std.h>
+#include <ti/xdais/ialg.h>
+#include <ti/ipc/MessageQ.h>
+
+/* round up the value 'size' to the next 'align' boundary */
+#define ROUNDUP(size, align) \
+    (UInt32)(((UInt32)(size) + ((UInt32)(align) - 1)) & ~((UInt32)(align) - 1))
+
+#define MASTER_NAME                     ( "CORE0" ) // DSP is MASTER
+#define SLAVE_NAME                      ( "HOST" )  // ARM is SLAVE
+
+#define AspMsg_MasterMsgQueName         ( "MASTER:MsgQ:01" )
+#define AspMsg_SlaveMsgQueName          ( "%s:MsgQ:01"   ) /* %s is each slave's Proc Name */
+
+// ASP (Master-To-)Slave Commands
+typedef enum ASP_Slave_Cmd {
+    ASP_SLAVE_NULL,                         // 0
+    ASP_SLAVE_START,                        // 1
+    ASP_SLAVE_EXIT,                         // 2
+    ASP_SLAVE_DEC_SOURCE_SELECT,            // 3
+    ASP_SLAVE_DEC_EXIT,                     // 4
+    ASP_SLAVE_DEC_CONTROL,                  // 5
+    ASP_SLAVE_DEC_ACTIVATE,                 // 6
+    ASP_SLAVE_DEC_RESET,                    // 7
+    ASP_SLAVE_DEC_INFO,                     // 8
+    ASP_SLAVE_DEC_DECODE,                   // 9
+    ASP_SLAVE_DEC_DEACTIVATE,               // 10
+    ASP_SLAVE_NCOMMANDS                     // 11
+} ASP_Slave_Cmd;
+
+// ASP (Slave-To-)Master Commands
+typedef enum ASP_Master_Cmd {
+    ASP_MASTER_NULL = ASP_SLAVE_NCOMMANDS,  // 11
+    ASP_MASTER_START_DONE,                  // 12
+    ASP_MASTER_EXIT_DONE,                   // 13
+    ASP_MASTER_DEC_SOURCE_SELECT_DONE,      // 14
+    ASP_MASTER_DEC_EXIT_DONE,               // 15
+    ASP_MASTER_DEC_CONTROL_DONE,            // 16
+    ASP_MASTER_DEC_ACTIVATE_DONE,           // 17
+    ASP_MASTER_DEC_RESET_DONE,              // 18
+    ASP_MASTER_DEC_INFO_DONE,               // 19     // temp
+    ASP_MASTER_DEC_DECODE_DONE,             // 20     // temp
+    ASP_MASTER_DEC_DEACTIVATE_DONE          // 21
+} ASP_Master_Cmd;
+
+// ASP Message
+typedef struct ASP_Msg
+{
+    MessageQ_MsgHeader reserved;
+    
+    UInt32  cmd;        // command
+    UInt16  procId;     // processor Id of sender
+    Uint16  expectResp; // whether response expected from receiver + align buf to 32-bit boundary
+    UInt32  messageId;  // MB bit: response bit, LS 31 bits: message Id
+    Char    buf[32];    // buffer for message parameters
+} ASP_Msg;
+
+
+#endif /* _ASP_MSG_COMMON_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/shared/config.bld b/procsdk_audio_x_xx_xx_xx/shared/config.bld
new file mode 100644 (file)
index 0000000..8a1493e
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/*  Memory Map for ti.platforms.evmTCI66AK2G02
+ *
+ *    Address          Size             Comment
+ *  -------------------------------------------------------------
+ *    0C00_0000   0008_0000  ( 512 KB)  SR_MSMC     (ipc:data)
+ *    0C08_0000   0004_0000  ( 256 KB)  HOST_MSMC   (code, data)
+ *    0C0C_0000   0004_0000  ( 256 KB)  CORE_MSMC   (code, data)
+ *    8000_0000   0020_0000  (   2 MB)  SR_0        (ipc)
+ *    8020_0000   0080_0000  (   8 MB)  SR_DDR3     (ipc:data)
+ *    80A0_0000   0080_0000  (   8 MB)  COMMON_DDR3 (data)
+ *    8120_0000   0400_0000  (  64 MB)  HOST_DDR3   (code, data)
+ *    8520_0000   0400_0000  (  64 MB)  CORE0_DDR3  (code, data)
+ *    8920_0000   75E0_0000  (1886 MB)  DDR3        (code, data)
+ */
+
+var SR_MSMC = {
+        name: "SR_MSMC", space: "data", access: "RW",
+        base: 0x0C000000, len: 0x00080000,
+        comment: "SR MSMC Memory (512 KB)"
+    };
+
+var SR_0 = {
+        name: "SR_0", space: "data", access: "RW",
+        base: 0x80000000, len: 0x00200000,
+        comment: "SR#0 Memory"
+    };
+
+var SR_DDR3 = {
+        name: "SR_DDR3", space: "data", access: "RW",
+        base: 0x80200000, len: 0x00800000,
+        comment: "SR DDR3 Memory"
+    };
+
+var COMMON_DDR3 = {
+        name: "COMMON_DDR3", space: "data", access: "RW",
+        base: 0x80A00000, len: 0x00800000,
+        comment: "COMMON DDR3 Memory"
+    };
+
+var DDR3 = {
+        name: "DDR3", space: "code/data", access: "RW",
+        base: 0x89200000, len: 0x75E00000,
+        comment: "DDR3 Memory"
+    };
+
+// This is ARM    
+Build.platformTable["ti.platforms.evmTCI66AK2G02:host"] = {
+    customMemoryMap: [
+        ["SR_MSMC", SR_MSMC], 
+    
+        [ "HOST_MSMC",  {
+            name: "HOST_MSMC", space: "code/data", access: "RWX",
+            base: 0x0C080000, len: 0x00040000,
+            comment: "HOST MSMC SRAM"
+        }], 
+        
+        ["SR_0", SR_0], 
+        
+        ["SR_DDR3", SR_DDR3], 
+        
+        ["COMMON_DDR3", COMMON_DDR3], 
+        
+        [ "HOST_DDR3",  {
+            name: "HOST_DDR3", space: "code/data", access: "RWX",
+            base: 0x81200000, len: 0x04000000,
+            comment: "HOST DDR3"
+        }], 
+        
+        ["DDR3", DDR3]
+    ],
+    
+    codeMemory:  "HOST_DDR3",
+    dataMemory:  "HOST_DDR3",
+    stackMemory: "HOST_DDR3"
+};
+
+// This is DSP
+Build.platformTable["ti.platforms.evmTCI66AK2G02:core0"] = {
+    customMemoryMap: [
+        ["L2SRAM", {
+            comment:    "1MB L2 SRAM/CACHE",
+            name:       "L2SRAM",
+            base:       0x00800000,
+            len:        0x00100000,
+            space:      "code/data",
+            access:     "RWX"
+        }],
+
+        ["L1PSRAM", {
+            comment:    "32KB RAM/CACHE L1 program memory",
+            name:       "L1PSRAM",
+            base:       0x00E00000,
+            len:        0x00008000,
+            space:      "code",
+            access:     "RWX"
+        }],
+
+        ["L1DSRAM", {
+            comment:    "32KB RAM/CACHE L1 data memory",
+            name:       "L1DSRAM",
+            base:       0x00F00000,
+            len:        0x00008000,
+            space:      "data",
+            access:     "RW"
+        }],
+    
+        ["SR_MSMC", SR_MSMC], 
+    
+        [ "CORE0_MSMC",  {
+            name: "CORE0_MSMC", space: "code/data", access: "RWX",
+            base: 0x0C0C0000, len: 0x00040000,
+            comment: "CORE0 MSMC SRAM"
+        }], 
+        
+        ["SR_0", SR_0], 
+        
+        ["SR_DDR3", SR_DDR3], 
+        
+        ["COMMON_DDR3", COMMON_DDR3], 
+        
+        [ "CORE0_DDR3",  {
+            name: "CORE0_DDR3", space: "code/data", access: "RWX",
+            base: 0x85200000, len: 0x04000000,
+            comment: "CORE0 DDR3"
+        }], 
+        
+        ["DDR3", DDR3]
+    ],
+    
+    codeMemory:  "CORE0_DDR3",
+    dataMemory:  "CORE0_DDR3",
+    stackMemory: "CORE0_DDR3",
+    
+    l1DMode: "32k",
+    l1PMode: "32k",
+    l2Mode: "256k"
+};
diff --git a/procsdk_audio_x_xx_xx_xx/shared/ipc.cfg.xs b/procsdk_audio_x_xx_xx_xx/shared/ipc.cfg.xs
new file mode 100644 (file)
index 0000000..32e5d6b
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *  ======== ipc.cfg.xs ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+var procNameAry = ["HOST", "CORE0"];
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(xdc.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var Sr0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+    new SharedRegion.Entry({
+        name:           "SR_0",
+        base:           Sr0Mem.base,
+        len:            Sr0Mem.len,
+        ownerProcId:    1,
+        isValid:        true,
+        cacheEnable:    xdc.global.SR0_cacheEnable
+    })
+);
+
+/* configure SharedRegion #1 (MSMC) */
+var SrMsmcMem = Program.cpu.memoryMap["SR_MSMC"];
+
+SharedRegion.setEntryMeta(1,
+    new SharedRegion.Entry({
+        name:           "SR_MSMC",
+        base:           SrMsmcMem.base,
+        len:            SrMsmcMem.len,
+        ownerProcId:    1,
+        isValid:        true,
+        cacheEnable:    xdc.global.SrMsmcMem_cacheEnable,
+        createHeap:     true
+    })
+);
+
+/* configure SharedRegion #2 (DDR3) */
+var SrDDr3Mem = Program.cpu.memoryMap["SR_DDR3"];
+
+SharedRegion.setEntryMeta(2,
+    new SharedRegion.Entry({
+        name:           "SR_DDR3",
+        base:           SrDDr3Mem.base,
+        len:            SrDDr3Mem.len,
+        ownerProcId:    1,
+        isValid:        true,
+        cacheEnable:    xdc.global.SrDDr3Mem_cacheEnable,
+        createHeap:     true
+    })
+);
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/.ccsproject b/procsdk_audio_x_xx_xx_xx/test_arm/.ccsproject
new file mode 100644 (file)
index 0000000..00d2481
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?ccsproject version="1.0"?>
+<projectOptions>
+       <deviceVariant value="Cortex A.66AK2G02"/>
+       <deviceFamily value="TMS470"/>
+       <deviceEndianness value="little"/>
+       <codegenToolVersion value="GNU_4.8.4:Linaro"/>
+       <isElfFormat value="true"/>
+       <rts value="libc.a"/>
+       <createSlaveProjects value=""/>
+       <templateProperties value="id=com.ti.rtsc.SYSBIOS.example_43,type=rtsc,products=com.ti.rtsc.SYSBIOS,target=gnu.targets.arm.A15F,buildProfile=release,isHybrid=true,"/>
+       <isTargetManual value="false"/>
+</projectOptions>
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/.cproject b/procsdk_audio_x_xx_xx_xx/test_arm/.cproject
new file mode 100644 (file)
index 0000000..1dd5591
--- /dev/null
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+       <storageModule configRelations="2" moduleId="org.eclipse.cdt.core.settings">
+               <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1859149112">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1859149112" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+                               <macros>
+                                       <stringMacro name="FFTC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SA_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PASS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="GPIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/pdk_k2g_1_0_1/packages"/>
+                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="OSAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NIMU_INSTAL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PCIE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NIMU_ICSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="TCP3D_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="QMSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="BCP_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PROCSDK_AUDIO_ROOT" type="VALUE_PATH_DIR" value="C:/ti/procsdk_audio_x_xx_xx_xx"/>
+                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                               </macros>
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.rtsc.xdctools.parsers.ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" errorParsers="org.eclipse.rtsc.xdctools.parsers.ErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1859149112" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug" postbuildStep="" prebuildStep="">
+                                       <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1859149112." name="/" resourcePath="">
+                                               <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.DebugToolchain.674239824" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.linkerDebug.1772732929">
+                                                       <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1822087327" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+                                                               <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex A.66AK2G02"/>
+                                                               <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
+                                                               <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
+                                                               <listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.5.0"/>
+                                                               <listOptionValue builtIn="false" value="LINKER_COMMAND_FILE="/>
+                                                               <listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
+                                                               <listOptionValue builtIn="false" value="RTSC_MBS_VERSION=2.2.0"/>
+                                                               <listOptionValue builtIn="false" value="XDC_VERSION=3.32.0.06_core"/>
+                                                               <listOptionValue builtIn="false" value="RTSC_PRODUCTS=com.ti.rtsc.IPC:3.43.0.00_eng;com.ti.rtsc.SYSBIOS:6.45.1.29;com.ti.uia:2.0.3.43;com.ti.rtsc.XDAIS:7.24.0.04;"/>
+                                                               <listOptionValue builtIn="false" value="EXPANDED_REPOS="/>
+                                                               <listOptionValue builtIn="false" value="OUTPUT_TYPE=rtscApplication:executable"/>
+                                                       </option>
+                                                       <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1106749875" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="GNU_4.8.4:Linaro" valueType="string"/>
+                                                       <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.targetPlatformDebug.1028544156" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.targetPlatformDebug"/>
+                                                       <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.builderDebug.1343470269" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.builderDebug"/>
+                                                       <tool id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.compilerDebug.1227706836" name="GNU Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.compilerDebug">
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DEFINE.1708873009" name="Define symbols (-D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DEFINE" valueType="definedSymbols">
+                                                                       <listOptionValue builtIn="false" value="k2g02"/>
+                                                                       <listOptionValue builtIn="false" value="arm0"/>
+                                                                       <listOptionValue builtIn="false" value="ARMCOMPILE"/>
+                                                                       <listOptionValue builtIn="false" value="PAF_DEVICE=0xDA000000"/>
+                                                                       <listOptionValue builtIn="false" value="far="/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MCPU.1180163032" name="Target CPU (-mcpu)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MCPU" value="cortex-a15" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MTUNE.1670792469" name="Tune code for the given processor (-mtune)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MTUNE" value="cortex-a15" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.CODE_STATE.208949821" name="Code state" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.CODE_STATE.ARM" valueType="enumerated"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DEBUG.2062174578" name="Generate debug information (-g)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DEBUG" value="true" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.STRICT_DWARF.92725114" name="Do not emit DWARF additions beyond selected version (-gstrict-dwarf)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.STRICT_DWARF" value="true" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DWARF_VERSION.1855168378" name="Generate debug information in DWARF version (-gdwarf-)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DWARF_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DWARF_VERSION.3" valueType="enumerated"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.INCLUDE_PATH.2049662485" name="Include paths (-I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.INCLUDE_PATH" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${CG_TOOL_INCLUDE_PATH}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/packages&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/asp/com&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/asp/std&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/dec/com&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/dec/pcm1/alg&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/dec/pcm1/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/sio/acp1&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/sio/paf&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/f/s3&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/f/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/f/alpha&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/common&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/shared&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/test_dsp/sio&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/test_dsp/sio_dev2&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/paf/pa/util/c67x_cintrins&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/ddp/Dolby_Digital_Plus_Decoder_Imp/Source_Code/alg&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/ddp/Dolby_Digital_Plus_Decoder_Imp/Source_Code/include&quot;"/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MFLOAT_ABI.576208136" name="Specify if floating point hardware should be used (-mfloat-abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MFLOAT_ABI" value="hard" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.OTHER_PREPROC_FLAGS.1983639225" name="Other preprocessor flags (-Xpreprocessor)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.OTHER_PREPROC_FLAGS"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.NOWARN.216809841" name="Suppress warnings (-w)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.NOWARN" value="false" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.ALLWARN.1589681891" name="Enable most warning messages (-Wall)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.ALLWARN" value="true" valueType="boolean"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__C_SRCS.1257622403" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__C_SRCS"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__CPP_SRCS.1477518917" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__CPP_SRCS"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__ASM_SRCS.1367340660" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__ASM_SRCS"/>
+                                                       </tool>
+                                                       <tool id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.linkerDebug.1772732929" name="GNU Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.linkerDebug">
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.DEFSYM.1990755153" name="Define a symbol (--defsym)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.DEFSYM" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="ARM_CORE=1"/>
+                                                                       <listOptionValue builtIn="false" value="STACKSIZE=0x10000"/>
+                                                                       <listOptionValue builtIn="false" value="HEAPSIZE=0x400"/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.OUTPUT_FILE.2097714527" name="Output file (-o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.OUTPUT_FILE" value="&quot;${ProjName}.out&quot;" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.MAP_FILE.1370331025" name="Write a map file (-Map)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.MAP_FILE" value="&quot;${ProjName}.map&quot;" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.LIBRARY.2054026216" name="Libraries (-l, --library)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.LIBRARY" valueType="libs">
+                                                                       <listOptionValue builtIn="false" value="&quot;gcc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;m&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;nosys&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;c&quot;"/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.NOSTARTFILES.1010281651" name="Do not use the standard system startup files when linking (-nostartfiles)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.NOSTARTFILES" value="true" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.STATIC.1145307066" name="Do not link with the shared libraries (-static)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.STATIC" value="true" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.GC_SECTIONS.232328193" name="Remove unused sections (--gc-sections)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.GC_SECTIONS" value="true" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.SEARCH_PATH.527167736" name="Library search path (-L, --library-path)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.SEARCH_PATH" valueType="libPaths">
+                                                                       <listOptionValue builtIn="false" value="&quot;${xdc_find:gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu:${ProjName}}&quot;"/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.SCRIPTS.2043320382" name="Linker command files (-T, --script)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.SCRIPTS" valueType="libs">
+                                                                       <listOptionValue builtIn="false" value="&quot;${PROCSDK_AUDIO_ROOT}/test_arm/application/app.cmd&quot;"/>
+                                                               </option>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__CMD_SRCS.1439870174" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__CMD_SRCS"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__CMD2_SRCS.2053444062" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__CMD2_SRCS"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__GEN_CMDS.14648911" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__GEN_CMDS"/>
+                                                       </tool>
+                                                       <tool id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.hex.578276684" name="GNU Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.hex"/>
+                                                       <tool id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.1108422400" name="XDCtools" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool">
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR.1759178110" name="Compiler tools directory (-c)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR" value="&quot;${CG_TOOL_ROOT}&quot;" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET.233155794" name="Target (-t)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET" value="gnu.targets.arm.A15F" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.761924061" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="ti.platforms.evmTCI66AK2G02:host" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.47051977" name="Platform (-p)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="ti.platforms.evmTCI66AK2G02" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE.1815558140" name="Build-profile (-r)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE" value="release" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.1954753218" name="Package repositories (--xdcpath)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="&quot;${BIOS_CG_ROOT}/packages&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${COM_TI_UIA_INSTALL_DIR}/packages&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${XDAIS_CG_ROOT}/packages&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${XDAIS_CG_ROOT}/examples&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${IPC_CG_ROOT}/packages&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${TARGET_CONTENT_BASE}&quot;"/>
+                                                               </option>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.JAVA_PROPERTIES.1206887698" name="Java properties (-D)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.JAVA_PROPERTIES" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="xdc.platform.custom.check=false"/>
+                                                                       <listOptionValue builtIn="false" value="ProjName=pa_i13_evmk2g_arm"/>
+                                                               </option>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_CONFIGURATION_FILE.1366602239" name="Build configuration file (-b)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_CONFIGURATION_FILE" value="${PROCSDK_AUDIO_ROOT}/shared/config.bld" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CFG_ARGS.593412547" name="Configuration script arguments (--cfgArgs)" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CFG_ARGS" value="&quot;{ profile: \&quot;debug\&quot; }&quot;" valueType="string"/>
+                                                       </tool>
+                                               </toolChain>
+                                       </folderInfo>
+                                       <sourceEntries>
+                                               <entry excluding="application/src|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+                                       </sourceEntries>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+               <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Release.1022052129">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.1022052129" moduleId="org.eclipse.cdt.core.settings" name="Release">
+                               <macros>
+                                       <stringMacro name="FFTC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SA_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PASS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="GPIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="AIF2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="CSL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="MMCSD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PDK_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti/pdk_k2g_1_0_1/packages"/>
+                                       <stringMacro name="ICSS_EMAC_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="USB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="I2C_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="CPPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="IQN2_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="OSAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NIMU_INSTAL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PCIE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NIMU_ICSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="TCP3D_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="QMSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="BCP_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="IQN_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PKTLIB_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SRIO_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PRUSS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="DFE_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="PROCSDK_AUDIO_ROOT" type="VALUE_PATH_DIR" value="C:/ti/procsdk_audio_x_xx_xx_xx"/>
+                                       <stringMacro name="UART_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="FATFS_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SBL_BOOT_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="BOARD_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="NWAL_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                                       <stringMacro name="SPI_INSTALL_PATH" type="VALUE_PATH_DIR" value="C:/ti"/>
+                               </macros>
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.rtsc.xdctools.parsers.ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" errorParsers="org.eclipse.rtsc.xdctools.parsers.ErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.1022052129" name="Release" parent="com.ti.ccstudio.buildDefinitions.TMS470.Release" postbuildStep="" prebuildStep="">
+                                       <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.1022052129." name="/" resourcePath="">
+                                               <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.ReleaseToolchain.1287062990" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.linkerRelease.1878063989">
+                                                       <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.2044542616" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+                                                               <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex A.66AK2G02"/>
+                                                               <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
+                                                               <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
+                                                               <listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.5.0"/>
+                                                               <listOptionValue builtIn="false" value="LINKER_COMMAND_FILE="/>
+                                                               <listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
+                                                               <listOptionValue builtIn="false" value="RTSC_MBS_VERSION=2.2.0"/>
+                                                               <listOptionValue builtIn="false" value="XDC_VERSION=3.32.0.06_core"/>
+                                                               <listOptionValue builtIn="false" value="RTSC_PRODUCTS=com.ti.rtsc.SYSBIOS:6.45.1.29;com.ti.uia:2.0.3.43;"/>
+                                                               <listOptionValue builtIn="false" value="EXPANDED_REPOS="/>
+                                                               <listOptionValue builtIn="false" value="OUTPUT_TYPE=rtscApplication:executable"/>
+                                                       </option>
+                                                       <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.171604478" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="GNU_4.8.4:Linaro" valueType="string"/>
+                                                       <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.targetPlatformRelease.1310759009" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.targetPlatformRelease"/>
+                                                       <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.builderRelease.96146123" name="GNU Make.Release" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.builderRelease"/>
+                                                       <tool id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.compilerRelease.1785492850" name="GNU Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.compilerRelease">
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DEFINE.2040421765" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.DEFINE" valueType="definedSymbols">
+                                                                       <listOptionValue builtIn="false" value="k2g02"/>
+                                                                       <listOptionValue builtIn="false" value="arm0"/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MCPU.1911683080" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MCPU" value="cortex-a15" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MTUNE.984143956" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MTUNE" value="cortex-a15" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.CODE_STATE.1039877330" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.CODE_STATE.ARM" valueType="enumerated"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.INCLUDE_PATH.295112765" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.INCLUDE_PATH" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${CG_TOOL_INCLUDE_PATH}&quot;"/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MFLOAT_ABI.2126896900" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compilerID.MFLOAT_ABI" value="hard" valueType="string"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__C_SRCS.398783393" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__C_SRCS"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__CPP_SRCS.1350136317" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__CPP_SRCS"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__ASM_SRCS.469726745" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.compiler.inputType__ASM_SRCS"/>
+                                                       </tool>
+                                                       <tool id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.linkerRelease.1878063989" name="GNU Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exe.linkerRelease">
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.DEFSYM.1538224789" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.DEFSYM" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="ARM_CORE=1"/>
+                                                                       <listOptionValue builtIn="false" value="STACKSIZE=0x10000"/>
+                                                                       <listOptionValue builtIn="false" value="HEAPSIZE=0x400"/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.OUTPUT_FILE.2054356651" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.OUTPUT_FILE" value="&quot;${ProjName}.out&quot;" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.MAP_FILE.1015745917" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.MAP_FILE" value="&quot;${ProjName}.map&quot;" valueType="string"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.LIBRARY.1915363591" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.LIBRARY" valueType="libs">
+                                                                       <listOptionValue builtIn="false" value="&quot;gcc&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;m&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;nosys&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;c&quot;"/>
+                                                               </option>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.NOSTARTFILES.1228675558" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.NOSTARTFILES" value="true" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.STATIC.1528320405" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.STATIC" value="true" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.GC_SECTIONS.1653219347" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.GC_SECTIONS" value="true" valueType="boolean"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.SEARCH_PATH.491248426" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.linkerID.SEARCH_PATH" valueType="libPaths">
+                                                                       <listOptionValue builtIn="false" value="&quot;${xdc_find:gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu:${ProjName}}&quot;"/>
+                                                               </option>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__CMD_SRCS.200987645" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__CMD_SRCS"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__CMD2_SRCS.398435472" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__CMD2_SRCS"/>
+                                                               <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__GEN_CMDS.1742684503" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.exeLinker.inputType__GEN_CMDS"/>
+                                                       </tool>
+                                                       <tool id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.hex.58897168" name="GNU Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_4.0.hex"/>
+                                                       <tool id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.1188116819" name="XDCtools" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool">
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR.524339146" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.CODEGEN_TOOL_DIR" value="&quot;${CG_TOOL_ROOT}&quot;" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET.20052065" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.TARGET" value="gnu.targets.arm.A15F" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM.818273957" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM" value="ti.platforms.evmTCI66AK2G02" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW.16659581" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.PLATFORM_RAW" value="ti.platforms.evmTCI66AK2G02" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE.1240299632" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_PROFILE" value="release" valueType="string"/>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH.1150486285" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.XDC_PATH" valueType="stringList">
+                                                                       <listOptionValue builtIn="false" value="${BIOS_CG_ROOT}/packages"/>
+                                                                       <listOptionValue builtIn="false" value="${COM_TI_UIA_INSTALL_DIR}/packages"/>
+                                                                       <listOptionValue builtIn="false" value="${TARGET_CONTENT_BASE}"/>
+                                                               </option>
+                                                               <option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_CONFIGURATION_FILE.704905412" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.BUILD_CONFIGURATION_FILE" value="&quot;${PROJECT_ROOT}/config.bld&quot;" valueType="string"/>
+                                                       </tool>
+                                               </toolChain>
+                                       </folderInfo>
+                                       <sourceEntries>
+                                               <entry excluding="application/src|src|66AK2Gxx.lds" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+                                       </sourceEntries>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+       </storageModule>
+       <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+               <project id="test_arm.com.ti.ccstudio.buildDefinitions.TMS470.ProjectType.263593260" name="ARM" projectType="com.ti.ccstudio.buildDefinitions.TMS470.ProjectType"/>
+       </storageModule>
+       <storageModule moduleId="scannerConfiguration"/>
+       <storageModule moduleId="org.eclipse.cdt.core.language.mapping">
+               <project-mappings>
+                       <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.asmSource" language="com.ti.ccstudio.core.TIASMLanguage"/>
+                       <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cHeader" language="com.ti.ccstudio.core.TIGCCLanguage"/>
+                       <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cSource" language="com.ti.ccstudio.core.TIGCCLanguage"/>
+                       <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxHeader" language="com.ti.ccstudio.core.TIGPPLanguage"/>
+                       <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/>
+               </project-mappings>
+       </storageModule>
+</cproject>
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/.project b/procsdk_audio_x_xx_xx_xx/test_arm/.project
new file mode 100644 (file)
index 0000000..892d2c1
--- /dev/null
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>test_arm</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.rtsc.xdctools.buildDefinitions.XDC.xdcNature</nature>
+               <nature>com.ti.ccstudio.core.ccsNature</nature>
+               <nature>org.eclipse.cdt.core.cnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+               <nature>org.eclipse.cdt.core.ccnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+       </natures>
+       <linkedResources>
+               <link>
+                       <name>common</name>
+                       <type>2</type>
+                       <locationURI>PROCSDK_AUDIO_ROOT/common</locationURI>
+               </link>
+       </linkedResources>
+       <variableList>
+               <variable>
+                       <name>AIF2_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>BCP_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>BOARD_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>CPPI_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>CSL_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>DFE_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>FATFS_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>FFTC_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>GPIO_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>I2C_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>ICSS_EMAC_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>IQN2_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>IQN_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>MMCSD_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>NIMU_ICSS_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>NIMU_INSTAL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>NWAL_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>OSAL_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>PASS_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>PCIE_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>PDK_INSTALL_PATH</name>
+                       <value>file:/C:/ti/pdk_k2g_1_0_1/packages</value>
+               </variable>
+               <variable>
+                       <name>PKTLIB_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>PROCSDK_AUDIO_ROOT</name>
+                       <value>file:/C:/ti/procsdk_audio_x_xx_xx_xx</value>
+               </variable>
+               <variable>
+                       <name>PRUSS_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>QMSS_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>SA_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>SBL_BOOT_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>SPI_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>SRIO_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>TCP3D_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>UART_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+               <variable>
+                       <name>USB_INSTALL_PATH</name>
+                       <value>file:/C:/ti</value>
+               </variable>
+       </variableList>
+</projectDescription>
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/application/app.cfg b/procsdk_audio_x_xx_xx_xx/test_arm/application/app.cfg
new file mode 100644 (file)
index 0000000..1c4827a
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+ *  ======== app.cfg ========
+ *  Platform: 66AK2G_bios_elf
+ *  Target: gnu.targets.arm.A15F
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+/* application uses the following modules and packages */
+var Defaults        = xdc.useModule('xdc.runtime.Defaults');
+var Diags           = xdc.useModule('xdc.runtime.Diags');
+var Error           = xdc.useModule('xdc.runtime.Error');
+var Log             = xdc.useModule('xdc.runtime.Log');
+var LoggerBuf       = xdc.useModule('xdc.runtime.LoggerBuf');
+var Main            = xdc.useModule('xdc.runtime.Main');
+var Memory          = xdc.useModule('xdc.runtime.Memory')
+var SysMin          = xdc.useModule('xdc.runtime.SysMin');
+var System          = xdc.useModule('xdc.runtime.System');
+var Text            = xdc.useModule('xdc.runtime.Text');
+
+var BIOS            = xdc.useModule('ti.sysbios.BIOS');
+var Hwi             = xdc.useModule('ti.sysbios.hal.Hwi');
+var Timer           = xdc.useModule('ti.sysbios.hal.Timer');
+var Clock           = xdc.useModule('ti.sysbios.knl.Clock');
+var Task            = xdc.useModule('ti.sysbios.knl.Task');
+var Semaphore       = xdc.useModule('ti.sysbios.knl.Semaphore');
+var HeapMem         = xdc.useModule('ti.sysbios.heaps.HeapMem');
+
+var LoggingSetup    = xdc.useModule('ti.uia.sysbios.LoggingSetup');
+
+xdc.useModule('ti.sdo.utils.MultiProc');
+
+
+/*
+ *  ======== IPC Configuration ========
+ */
+xdc.global.SR0_cacheEnable = true;
+xdc.global.SrMsmcMem_cacheEnable = true;
+xdc.global.SrDDr3Mem_cacheEnable = true;
+xdc.global.procName = "HOST";
+var ipc_cfg = xdc.loadCapsule("../../shared/ipc.cfg.xs");
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+
+/*
+ * Uncomment this line to globally disable Asserts.
+ * All modules inherit the default from the 'Defaults' module.  You
+ * can override these defaults on a per-module basis using Module.common$. 
+ * Disabling Asserts will save code space and improve runtime performance.
+Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
+ */
+
+/*
+ * Uncomment this line to keep module names from being loaded on the target.
+ * The module name strings are placed in the .const section. Setting this
+ * parameter to false will save space in the .const section.  Error and
+ * Assert messages will contain an "unknown module" prefix instead
+ * of the actual module name.
+Defaults.common$.namedModule = false;
+ */
+
+/*
+ * Minimize exit handler array in System.  The System module includes
+ * an array of functions that are registered with System_atexit() to be
+ * called by System_exit().
+ */
+System.maxAtexitHandlers = 4;       
+
+/* 
+ * Uncomment this line to disable the Error print function.  
+ * We lose error information when this is disabled since the errors are
+ * not printed.  Disabling the raiseHook will save some code space if
+ * your app is not using System_printf() since the Error_print() function
+ * calls System_printf().
+Error.raiseHook = null;
+ */
+
+/* 
+ * Uncomment this line to keep Error, Assert, and Log strings from being
+ * loaded on the target.  These strings are placed in the .const section.
+ * Setting this parameter to false will save space in the .const section.
+ * Error, Assert and Log message will print raw ids and args instead of
+ * a formatted message.
+Text.isLoaded = false;
+ */
+
+/*
+ * Uncomment this line to disable the output of characters by SysMin
+ * when the program exits.  SysMin writes characters to a circular buffer.
+ * This buffer can be viewed using the SysMin Output view in ROV.
+SysMin.flushAtExit = false;
+ */
+
+/*
+ * The BIOS module will create the default heap for the system.
+ * Specify the size of this default heap.
+ */
+//BIOS.heapSize = 0x1000; // initial setting
+BIOS.heapSize = 0x2000; // from pa.cfg
+BIOS.heapSection = ".systemHeap";
+Program.sectMap[".systemHeap"] = "HOST_DDR3";
+
+/*
+ * Build a custom SYS/BIOS library from sources.
+ */
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+
+/* System stack size (used by ISRs and Swis) */
+Program.stack = 0x2000;
+Program.sectMap[".stack"] = "HOST_MSMC"
+
+/* Circular buffer size for System_printf() */
+SysMin.bufSize = 0x200;
+
+/* 
+ * Create and install logger for the whole system
+ */
+var loggerBufParams = new LoggerBuf.Params();
+//loggerBufParams.numEntries = 64; // FL: removed for UIA logging
+//var logger0 = LoggerBuf.create(loggerBufParams);
+//Defaults.common$.logger = logger0;
+//Main.common$.diags_INFO = Diags.ALWAYS_ON;
+
+System.SupportProxy = SysMin;
+
+
+/* --- FL: started adding below this line --- */
+LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
+LoggingSetup.sysbiosTaskLogging = false;
+LoggingSetup.loadLogging = false;
+LoggingSetup.mainLoggingRuntimeControl = false;
+LoggingSetup.mainLoggerSize = 8196;
+
+//Task.common$.diags_USER1 = Diags.ALWAYS_ON;
+Task.common$.diags_INFO = Diags.ALWAYS_ON;
+
+var ProjName = environment["ProjName"];
+var topo = ProjName.replace( /pa_([a-z])[0-9]+_.*/, "$1");
+var AudioClockSim = environment["AudioClockSim"];
+var acSimBuild = (AudioClockSim == "1" ? true : false);
+
+/* Set CPU frequency to 600 MHz */
+BIOS.cpuFreq.lo = 600000000;
+BIOS.cpuFreq.hi = 0;
+
+/* Disallow nested hardware interrupts */
+Hwi.dispatcherAutoNestingSupport = false;
+
+if (acSimBuild == true)
+{
+    // 
+    // IPC simulation
+    // 
+
+    /* Add timer to simulate Rx audio IPC message */
+    var timer0Params = new Timer.Params();
+    timer0Params.instance.name = "timerRxAudio";
+    timer0Params.period = 5330;
+    timer0Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
+    Program.global.timerRxAudio = Timer.create(1, null, timer0Params);
+
+    /* Add timer to simulate Tx audio IPC message */
+    var timer1Params = new Timer.Params();
+    timer1Params.instance.name = "timerTxAudio";
+    timer1Params.startMode = xdc.module("ti.sysbios.interfaces.ITimer").StartMode_USER;
+    timer1Params.period = 5330;
+    Program.global.timerTxAudio = Timer.create(2, null, timer1Params);
+
+    /* Add semaphore for Rx audio DMA */
+    var semaphore0Params = new Semaphore.Params();
+    semaphore0Params.instance.name = "semaphoreRxAudio";
+    Program.global.semaphoreRxAudio = Semaphore.create(null, semaphore0Params);
+
+    /* Add semaphore for Tx audio DMA */
+    var semaphore1Params = new Semaphore.Params();
+    semaphore1Params.instance.name = "semaphoreTxAudio";
+    Program.global.semaphoreTxAudio = Semaphore.create(null, semaphore1Params);
+}
+
+/* Set default stack size for tasks */
+Task.defaultStackSize = 2048;
+
+/* Set size of idle task stack */
+Task.idleTaskStackSize = 2048;
+
+/* Add Audio Stream Processing (ASP) slave task */
+var task0Params = new Task.Params();
+task0Params.instance.name = "TaskAspSlave";
+task0Params.stackSize = 0x4000; // initial value from pa.cfg
+task0Params.stackSection = ".far:taskStackSectionAspSlave";
+//task0Params.arg0 = 0;
+task0Params.arg0 = $externPtr("params_PA" + topo + "_Slave");
+task0Params.arg1 = $externPtr("patchs_PA" + topo + "_Slave");
+task0Params.priority = -1; //3;
+Program.global.TaskAsp = Task.create("&taskAspSlaveFxn", task0Params);
+Program.sectMap[".far:taskStackSectionAspSlave"] = "HOST_MSMC"; // L3RAM in pa.cfg
+
+/* Add System Initialization task */
+var task1Params = new Task.Params();
+task1Params.instance.name = "TaskSysInit";
+task1Params.stackSize   = 0x1000;
+task1Params.stackSection = ".far:taskStackSectionSysInit";
+task1Params.priority = 4;
+Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task1Params);
+Program.sectMap[".far:taskStackSectionSysInit"] = "HOST_DDR3";
+
+Program.sectMap[".far:taskStackSection"] = "HOST_DDR3"; // SDRAM in pa.cfg
+
+// Dec ip circular buffer will be in MSMC, size~=180 kB.
+// Dec op circular buffer will be in MSMC, size~=192 kB.
+// However, both buffers will be in Shared Region MSMC.
+// So this is heap is for other use local to ARM (e.g. Dec chain). Set to 128 kB for now.
+/* Add MSMC SRAM heap */ // formerly L3RAM
+var heapMem1Params = new HeapMem.Params();
+heapMem1Params.instance.name = "heapMemMsmcSram";
+heapMem1Params.size = 224*1024; //128*1024
+heapMem1Params.sectionName = ".msmcSramHeap";
+Program.global.heapMemMsmcSram = HeapMem.create(heapMem1Params);
+Program.sectMap[".msmcSramHeap"] = "HOST_MSMC";
+
+/* Add DDR3 heap */ // formerly SDRAM
+var heapMem2Params = new HeapMem.Params();
+heapMem2Params.instance.name = "heapMemDdr3";
+heapMem2Params.size = 3350528;
+heapMem2Params.sectionName = ".ddr3Heap";
+Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
+Program.sectMap[".ddr3Heap"] = "HOST_DDR3";
+
+//Program.sectMap[".globalSectionPafAstConfig"] = "COMMON_DDR3";
+//Program.sectMap[".globalSectionAcpStdBetaTable"] = "COMMON_DDR3";
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/application/app.cmd b/procsdk_audio_x_xx_xx_xx/test_arm/application/app.cmd
new file mode 100644 (file)
index 0000000..19535c7
--- /dev/null
@@ -0,0 +1,27 @@
+SEARCH_DIR ( C:\ti\procsdk_audio_x_xx_xx_xx\paf\pa\build\a15\release )
+SEARCH_DIR ( C:\ti\procsdk_audio_x_xx_xx_xx\intrinsics\Dolby_Intrinsics_Imp\lib_float_A15 )
+SEARCH_DIR ( C:\ti\procsdk_audio_x_xx_xx_xx\ddp\Dolby_Digital_Plus_Decoder_Imp\Source_Code\make\k2g\Wrapper\ddp_application )
+
+INPUT ( c67x_cintrins_elf.lib simulate_dma_elf.lib )
+INPUT ( acp_elf.lib asp_std_elf.lib com_asp_elf.lib com_dec_elf.lib pcm1_elf.lib  )
+INPUT ( dlb_intrinsics_generic_float32_release.a )
+INPUT ( ddp_dec_lib_generic_wrapper_release.a ddp_dec_lib_generic_float32_release.a )
+
+SECTIONS
+{
+    .globalSection :
+    {
+        *(.globalSectionPafAstConfig)
+        *(.globalSectionAcpStdBetaTable)
+        *(.globalSectionAcpCusBetaTable)
+        *(.globalSectionAcpCusPhiTable)
+        *(.globalSectionAcpCusSigmaTable)
+    } > COMMON_DDR3
+    
+    .capBufSection (NOLOAD):
+    {
+        *(.gCapIbBufPcm)
+        *(.gCapIbBuf)
+        *(.gCapAfBuf)
+    } > DDR3
+}
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/application/main.c b/procsdk_audio_x_xx_xx_xx/test_arm/application/main.c
new file mode 100644 (file)
index 0000000..0effb6e
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ *  ======== main.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/ipc/Ipc.h>
+
+/*
+ *  ======== main ========
+ */
+Int main()
+{ 
+    Int status;
+    
+    Log_info0("Enter main()");
+
+    // Initialize IPC
+    status = Ipc_start();
+    if (status < 0) 
+    {
+        System_abort("Ipc_start failed\n");
+    }
+
+    BIOS_start();    /* does not return */
+    return(0);
+}
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/framework/aspMsg_slave.c b/procsdk_audio_x_xx_xx_xx/test_arm/framework/aspMsg_slave.c
new file mode 100644 (file)
index 0000000..9e4691e
--- /dev/null
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+#include "aspMsg_common.h"
+#include "aspMsg_slave.h"
+
+#define AspMsg_SlaveToMasterMsgHeapId   ( 1 )
+
+AspMsgSlave_Module gAspMsgSlave;
+AspMsgSlave_Handle hAspMsgSlave=&gAspMsgSlave;
+
+/* Initialize ASP slave messaging */
+Int AspMsgSlave_init(
+    AspMsgSlave_Handle hAspMsgSlave, 
+    UInt16 remoteProcId
+)
+{
+    Int                 status = 0;
+    MessageQ_Params     msgqParams;
+    char                msgqName[32];
+
+    Log_print0(Diags_ENTRY, "AspMsgSlave_init: -->");
+
+    // initialize module object state
+    // set processor Ids
+    hAspMsgSlave->masterProcId = remoteProcId;
+    hAspMsgSlave->slaveProcId = MultiProc_self();
+    
+    // create local message queue (inbound messages)
+    MessageQ_Params_init(&msgqParams);
+    System_sprintf(msgqName, AspMsg_SlaveMsgQueName, MultiProc_getName(MultiProc_self()));
+    hAspMsgSlave->slaveQue = MessageQ_create(msgqName, &msgqParams);
+
+    if (hAspMsgSlave->slaveQue == NULL)
+    {
+        status = -1;
+        Log_print1(Diags_EXIT, "<-- AspMsgSlave_init(): %d", (IArg)status);
+        return status;
+    }
+
+    Log_print0(Diags_INFO,"AspMsgSlave_init(): ASP Slave messaging ready");
+    
+    Log_print1(Diags_EXIT, "<-- AspMsgSlave_init(): %d", (IArg)status);
+    return status;
+}
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/framework/aspMsg_slave.h b/procsdk_audio_x_xx_xx_xx/test_arm/framework/aspMsg_slave.h
new file mode 100644 (file)
index 0000000..516851e
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef _ASP_MSG_SLAVE_H_
+#define _ASP_MSG_SLAVE_H_
+
+#include <xdc/std.h>
+#include <ti/ipc/MessageQ.h>
+
+#define ASP_MSG_SLAVE_DEF_NUMMSGS ( 4 )
+
+/* module structure */
+typedef struct AspMsgSlave_Module
+{
+    UInt16              masterProcId;       // master processor id
+    UInt16              slaveProcId;        // slave processor id
+    UInt32              masterMessageId;    // master message Id
+    MessageQ_Handle     slaveQue;           // created locally
+} AspMsgSlave_Module;
+
+/* module handle */
+typedef AspMsgSlave_Module *   AspMsgSlave_Handle;
+
+/* Initialize ASP slave messaging */
+Int AspMsgSlave_init(
+    AspMsgSlave_Handle hAspMsgSlave, 
+    UInt16 remoteProcId
+);
+
+extern AspMsgSlave_Handle hAspMsgSlave;
+
+
+#endif /* _ASP_MSG_SLAVE_H_ */
+
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_paramsFxns_slave.c b/procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_paramsFxns_slave.c
new file mode 100644 (file)
index 0000000..bef34f2
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ *  ======== audioStreamProc_paramsFxns_slave.c ========
+ */
+
+#include <xdc/std.h>
+#include "as0.h"
+#include "audioStreamProc_slave.h"
+// .............................................................................
+// Audio Stream Task Parameter Functions - PA17
+//
+//   Name:      PAF_AST_params_fxnsPA17
+//   Purpose:   Collect the functions that embody the implementation of
+//              Audio Framework Number 2 for use as a jump table.
+//   From:      PAF_AST_Params
+//   Uses:      See contents.
+//   States:    N.A.
+//   Return:    N.A.
+//   Trace:     None.
+//
+const PAF_AST_Fxns PAF_AST_params_fxnsPA17_Slave =
+{
+    {   // initPhase[8]
+        PAF_AST_initPhaseMallocSlave,
+        PAF_AST_initPhaseConfigSlave,
+        PAF_AST_initPhaseAcpAlgSlave,
+        PAF_AST_initPhaseCommonSlave,
+        PAF_AST_initPhaseAlgKeySlave,
+        NULL,
+        NULL,
+        NULL
+    },
+    PAF_AST_initFrame0Slave,                // initFrame0
+    PAF_AST_initFrame1Slave,                // initFrame1
+    NULL, /* PAF_AST_passProcessing, */     // passProcessing        
+    NULL, /* PAF_AST_passProcessingCopy, */ // passProcessingCopy    
+    NULL, //PAF_AST_autoProcessing,         // autoProcessing
+    NULL, //PAF_AST_decodeProcessing,       // decodeProcessing
+    NULL, //PAF_AST_decodeCommand,          // decodeCommand
+    NULL, //PAF_AST_encodeCommand,          // encodeCommand
+    NULL, //PAF_AST_decodeInit,             // decodeInit
+    NULL, //PAF_AST_decodeInfo,             // decodeInfo
+    NULL, //PAF_AST_decodeInfo1,            // decodeInfo1
+    NULL, //PAF_AST_decodeInfo2,            // decodeInfo2
+    NULL, //PAF_AST_decodeCont,             // decodeCont
+    NULL, //PAF_AST_decodeDecode,
+    NULL, //PAF_AST_decodeStream,           // decodeStream
+    NULL, //PAF_AST_decodeEncode,           // decodeEncode
+    NULL, //PAF_AST_decodeFinalTest,        // decodeFinalTest
+    NULL, //PAF_AST_decodeComplete,         // decodeComplete
+    NULL, //PAF_AST_selectDevices,          // selectDevices
+    NULL, //PAF_AST_sourceDecode,           // sourceDecode
+    NULL, //PAF_AST_startOutput,            // startOutput
+    NULL, //PAF_AST_stopOutput,             // stopOutput
+    NULL, //PAF_AST_setCheckRateX,          // setCheckRateX
+    NULL, //PAF_AST_streamChainFunction,    // streamChainFunction
+    NULL, //PAF_DEC_deviceAllocate,         // deviceAllocate
+    NULL, //PAF_DEC_deviceSelect,           // deviceSelect
+    NULL, //PAF_DEC_computeFrameLength,     // computeFrameLength
+    NULL, //PAF_DEC_updateInputStatus,      // updateInputStatus
+    NULL, /* PAF_BUF_copy, */       // copy
+    NULL, /*headerPrint*/           // headerPrint
+    NULL, /*allocPrint*/            // allocPrint
+    NULL, /*commonPrint*/           // commonPrint
+    NULL, /*bufMemPrint*/           // bufMemPrint
+    NULL, /*memStatusPrint*/        // memStatusPrint
+    // For ARC                      
+    NULL, //PAF_ARC_controlRate,            // controlRate
+};
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.c b/procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.c
new file mode 100644 (file)
index 0000000..698278f
--- /dev/null
@@ -0,0 +1,1439 @@
+/*
+ *  ======== audioStreamProc_slave.c ========
+ */
+
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <acp_mds.h>
+#include <pcm.h>
+#include "as1-f2-params.h"
+#include "as1-f2-patchs.h"
+#include "as1-f2-config.h"
+#include "paf_decOpCircBuf.h"
+
+#include "common.h"
+#include "aspMsg_common.h"
+#include "aspMsg_slave.h"
+
+#include "audioStreamProc_common.h"
+#include "audioStreamProc_slave.h"
+
+// FL: debug
+//#include "fwkSim.h"
+#include "dbgCapAf.h"
+#include "dbgDib.h"
+
+
+//
+// Decoder Definitions
+//
+#define decLinkInit pQ->i_decLinkInit
+
+#define __TASK_NAME__  "TaskAspSlave"
+
+LINNO_DEFN(TaskAspSlave); /* Line number macros */
+ERRNO_DEFN(TaskAspSlave); /* Error number macros */
+
+extern struct {
+    Int size;
+    IALG_Status *pStatus[512];
+} IACP_STD_BETA_TABLE;
+
+extern const char AFChanPtrMap[PAF_MAXNUMCHAN+1][PAF_MAXNUMCHAN];
+extern PAF_ChannelConfigurationMaskTable PAF_ASP_stdCCMT;
+
+// Global debug counters */
+extern Uint32 gTaskAspSlaveCnt; // debug counter for ASP slave task
+
+PAF_AudioFrame *gpAudioFrameSlave=NULL;
+PAF_AudioData  *gAudioFrameChannelPointersSlave[PAF_MAXNUMCHAN_AF];
+PAF_AudioSize  gAudioFrameChannelSizesSlave[PAF_MAXNUMCHAN_AF];
+
+// Debug counters
+UInt32 gSlaveStartErrCnt=0;
+UInt32 gSlaveStartCnt=0;
+UInt32 gSlaveSourceSelectCnt=0;
+UInt32 gSlaveExitCnt=0;
+UInt32 gSlaveDecExitCnt=0;
+UInt32 gSlaveDecControlCnt=0;
+UInt32 gSlaveDecActivateCnt=0;
+UInt32 gSlaveDecResetCnt=0;
+UInt32 gSlaveDecInfoCnt=0;
+UInt32 gSlaveDecDecodeCnt=0;
+UInt32 gSlaveDecDeactivateCnt=0;
+
+
+/*
+ *  ======== taskAspSlaveFxn ========
+ *  Audio Stream Processing slave task function
+ */
+Void taskAspSlaveFxn(
+//    Int betaPrimeValue, // FL: comeback to this
+    const PAF_AST_Params *pP,
+    const PAF_AST_Patchs *pQ
+)
+{
+    Int as;                         /* Audio Stream Number (1, 2, etc.) */
+    Int z;                          /* input/encode/stream/decode/output counter */
+    Int i;                          /* phase */
+    Int zMD, zMS;
+    Bool done;
+    Bool decDone;
+    ALG_Handle alg[DECODEN_MAX];
+    ASP_Slave_Cmd slaveCmd;
+    Int sourceSelect;
+    DEC_Handle dec;
+    IALG_Cmd decCtrlCmd;            // decoder control command
+    Int decCtrlRet;                 // decoder control return
+    Int errno;                      /* error number */
+    Int size;
+    Int argIdx;
+    // FL: decoder output circular buffer
+    PAF_DecodeOpCircBuf *pCb;
+    PAF_AudioFrame *pAfWrt;
+    Int cbErrno;    
+    // FL: Messaging
+    PAF_InpBufConfig *pIpBufConfig;
+    ASP_Msg *pAspMsg;
+    MessageQ_QueueId queId;
+    Int status;
+    Int32 zI;
+
+    
+    Log_info0("Enter taskAspSlaveFxn()");
+    
+    //
+    // Audio Framework Parameters & Patch (*pP, *pQ):
+    //
+    if (!pP) 
+    {
+        TRACE_TERSE0("TaskAspSlave: No Parameters defined. Exiting.");
+        LINNO_RPRT(TaskAspSlave, -1);
+        return;
+    }
+
+    if (!pQ) 
+    {
+        TRACE_TERSE0("TaskAspSlave: No Patchs defined. Exiting.");
+        LINNO_RPRT(TaskAspSlave, -1);
+        return;
+    }    
+
+    // wait for initialization message from master
+    do {
+        status = MessageQ_get(hAspMsgSlave->slaveQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+        //TRACE_TERSE1("Rx ASP message: status=%d", status);
+    //} while ((status != MessageQ_S_SUCCESS || (pAspMsg->cmd != ASP_SLAVE_START));
+    } while (status != MessageQ_S_SUCCESS);
+    if ((pAspMsg->procId != hAspMsgSlave->masterProcId) ||
+        (pAspMsg->cmd != ASP_SLAVE_START))
+    {
+        TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+        SW_BREAKPOINT;
+    }
+    hAspMsgSlave->masterMessageId = pAspMsg->messageId; 
+    gSlaveStartCnt++;
+    TRACE_MSG3("Rx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+
+    Cache_inv(&gPAF_AST_config, sizeof(PAF_AST_Config), Cache_Type_ALLD, 0);
+    Cache_inv(&pC, sizeof(PAF_AST_Config *), Cache_Type_ALLD, 0);
+    Cache_wait();
+    if (!pC)
+    {
+        TRACE_TERSE0("TaskAspSlave: No Configuration defined. Exiting.");
+        LINNO_RPRT(TaskAspSlave, -1);
+        return;
+    }
+    
+    // (***) FL: hackin'
+    // invalidate Dec configuration
+    Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+    Cache_wait();
+
+    // (***) FL: hackin'
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[0]), 512*sizeof(IALG_Status *), Cache_Type_ALLD, 0); // invalidate entire beta table
+    Cache_wait();
+
+    // Audio Framework Configuration (*pC):
+    as = pC->as; // obtain audio stream number
+    
+    //
+    // Initialize message log trace and line number reporting
+    //
+    for (z=STREAM1; z < STREAMN; z++)
+    {
+        TRACE_TERSE1("TaskAspSlave: AS%d: initiated", as+z);
+    }
+    LINNO_RPRT(TaskAspSlave, -1);
+
+    // Get decoder and stream index associated with the master input
+    zMD = pC->masterDec;
+    zMS = pC->masterStr;
+
+    // 
+    // Initialize per parameterized phases.
+    //   - AcpAlg: ACP Algorithm Initialization and Local Attachment
+    //   - Common: Common Algorithm Initialization
+    //   - AlgKey: Dec/Enc chain to Array Initialization
+    //   - Unused: (available)
+    //
+    LINNO_RPRT(TaskAspSlave, -2);
+    for (i=0; i < lengthof(pP->fxns->initPhase); i++)
+    {
+        Int linno;
+        if (pP->fxns->initPhase[i])
+        {
+            if ((linno = pP->fxns->initPhase[i](pP, pQ, pC)))
+            {
+                LINNO_RPRT(TaskAspSlave, linno);
+                return;
+            }
+        }
+        else 
+        {
+            TRACE_TERSE1("TaskAspSlave: AS%d: initialization phase - null", as+zMS);
+        }
+        TRACE_TERSE2("TaskAspSlave: AS%d: initialization phase - %d completed", as+zMS, i);
+        LINNO_RPRT(TaskAspSlave, -i-3);
+    }
+    
+    //
+    // End of Initialization -- final memory usage report.
+    //
+    if (pP->fxns->memStatusPrint)
+    {
+        pP->fxns->memStatusPrint(HEAP_INTERNAL, HEAP_INTERNAL1, HEAP_EXTERNAL, HEAP_INTERNAL1_SHM);
+    }
+
+    // (***) FL: hackin'
+    // write back Status structure addresses for Beta Units initialized on Slave
+    Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wait();
+    
+    // (***) FL: hackin'
+    // write back Status structures for Beta Units initialized on Slave
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
+    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
+    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]->size;
+    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), size, Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
+    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
+    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
+    Cache_wait();
+
+    // (***) FL: hackin'
+    // write back Dec configuration
+    Cache_wb(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+    Cache_wait();
+    
+    // Send initialization complete message to master
+    queId = MessageQ_getReplyQueue(pAspMsg);
+    pAspMsg->procId = hAspMsgSlave->slaveProcId;
+    pAspMsg->cmd = ASP_MASTER_START_DONE;
+    pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+    TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+    status = MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+    if (status != MessageQ_S_SUCCESS)
+    {
+        SW_BREAKPOINT;
+    }
+
+    done = FALSE;
+    while (done==FALSE)
+    {
+        // wait for source select message from master
+        do {
+            status = MessageQ_get(hAspMsgSlave->slaveQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+        } while ((status < 0) || (pAspMsg->cmd != ASP_SLAVE_DEC_SOURCE_SELECT));
+        if ((pAspMsg->procId != hAspMsgSlave->masterProcId) ||
+            (pAspMsg->cmd != ASP_SLAVE_DEC_SOURCE_SELECT))
+        {
+            TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            SW_BREAKPOINT;
+        }            
+        hAspMsgSlave->masterMessageId = pAspMsg->messageId; 
+        sourceSelect = *(Int32 *)&pAspMsg->buf[0];
+        TRACE_MSG3("Rx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+        TRACE_MSG1("sourceSelect=%d.", sourceSelect);
+        // send source select complete message to master
+        queId = MessageQ_getReplyQueue(pAspMsg);
+        pAspMsg->procId = hAspMsgSlave->slaveProcId;
+        pAspMsg->cmd = ASP_MASTER_DEC_SOURCE_SELECT_DONE;
+        pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+        gSlaveSourceSelectCnt++;
+        TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+        MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+        
+        for (z=DECODE1; z < DECODEN; z++)
+        {
+            alg[z] = pC->xDec[z].decAlg[PAF_SOURCE_PCM];
+        }
+        alg[zMD] = pC->xDec[zMD].decAlg[sourceSelect];
+
+        // FL: debug, reset IB capture buffer
+        capIbReset();
+        Log_info0("capIbReset()");
+        // FL: debug, reset audio frame capture buffer
+        capAfReset();
+        
+        decDone = FALSE;
+        while (decDone==FALSE)
+        {
+            // wait for received message from master
+            do {
+                status = MessageQ_get(hAspMsgSlave->slaveQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+            } while (status < 0);
+            if (pAspMsg->procId != hAspMsgSlave->masterProcId)
+            {
+                TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                SW_BREAKPOINT;
+            }
+            hAspMsgSlave->masterMessageId = pAspMsg->messageId; 
+            slaveCmd = pAspMsg->cmd;
+            TRACE_MSG3("Rx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+
+            switch (slaveCmd)
+            {
+                case ASP_SLAVE_NULL:
+                case ASP_SLAVE_START:
+                    gSlaveStartErrCnt++;
+                    TRACE_TERSE1("ERROR: unexpected slaveCmd=%d", slaveCmd);
+                    
+                    break;
+                    
+                case ASP_SLAVE_EXIT:
+                    gSlaveExitCnt++;
+                    TRACE_TERSE1("slaveCmd=%d", slaveCmd);
+                    
+                    decDone = TRUE;
+                    done = TRUE;
+                    break;
+                    
+                case ASP_SLAVE_DEC_EXIT:
+                    gSlaveDecExitCnt++;
+                    TRACE_TERSE1("slaveCmd=%d", slaveCmd);
+                    
+                    // send dec exit complete message to master
+                    queId = MessageQ_getReplyQueue(pAspMsg);
+                    pAspMsg->procId = hAspMsgSlave->slaveProcId;
+                    pAspMsg->cmd = ASP_MASTER_DEC_EXIT_DONE;
+                    pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+                    TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                    status = MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+                    if (status != MessageQ_S_SUCCESS)
+                    {
+                        SW_BREAKPOINT;
+                    }
+                    
+                    decDone=TRUE;
+                    break;
+                    
+                case ASP_SLAVE_DEC_CONTROL:
+                    gSlaveDecControlCnt++;
+                    // simulate dec control load
+                    //simLoad(DEC_CONTROL_LOAD);
+                    
+                    argIdx = 0; // get decIdx
+                    z = *(Int32 *)&pAspMsg->buf[argIdx];
+                    argIdx += sizeof(Int32);
+                    decCtrlCmd = *(IALG_Cmd *)&pAspMsg->buf[argIdx]; // get decCtrlCmd
+                    TRACE_MSG3("slaveCmd=%d, decIdx=%d, decCtrlCmd=%d", slaveCmd, z, decCtrlCmd);
+                    
+                    decCtrlRet = alg[z]->fxns->algControl(alg[z], decCtrlCmd, NULL);
+
+                    // send dec control complete message to master
+                    queId = MessageQ_getReplyQueue(pAspMsg);
+                    pAspMsg->procId = hAspMsgSlave->slaveProcId;
+                    pAspMsg->cmd = ASP_MASTER_DEC_CONTROL_DONE;
+                    pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+                    argIdx = 0; // set decCtrlRet
+                    *(Int32 *)&pAspMsg->buf[argIdx] = decCtrlRet;
+                    TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                    status = MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+                    if (status != MessageQ_S_SUCCESS)
+                    {
+                        SW_BREAKPOINT;
+                    }
+
+                    break;
+                    
+                case ASP_SLAVE_DEC_ACTIVATE:
+                    gSlaveDecActivateCnt++;
+                    // simulate dec activate load
+                    //simLoad(DEC_ACTIVATE_LOAD);
+                    
+                    // (***) FL: hackin'
+                    // invalidate Status structures for shared Beta Units
+                    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
+                    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
+                    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
+                    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
+                    Cache_wait();
+                    
+                    argIdx = 0; // get decIdx
+                    z = *(Int32 *)&pAspMsg->buf[argIdx];
+                    TRACE_MSG2("slaveCmd=%d, decIdx=%d", slaveCmd, z);
+                    
+                    if (alg[z]->fxns->algActivate)
+                    {
+                        alg[z]->fxns->algActivate(alg[z]);
+                    }
+
+                    // send dec activate complete message to master
+                    queId = MessageQ_getReplyQueue(pAspMsg);
+                    pAspMsg->procId = hAspMsgSlave->slaveProcId;
+                    pAspMsg->cmd = ASP_MASTER_DEC_ACTIVATE_DONE;
+                    pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+                    TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                    status = MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+                    if (status != MessageQ_S_SUCCESS)
+                    {
+                        SW_BREAKPOINT;
+                    }
+
+                    // Re-init audio frame
+                    pP->fxns->initFrame1(pP, pQ, pC, z, sourceSelect);
+                    
+                    break;
+                    
+                case ASP_SLAVE_DEC_RESET:
+                    gSlaveDecResetCnt++;
+                    // simulate dec reset load
+                    //simLoad(DEC_RESET_LOAD);
+                    
+                    argIdx = 0; // get decIdx
+                    z = *(Int32 *)&pAspMsg->buf[argIdx];
+                    TRACE_TERSE2("slaveCmd=%d,decIdx=%d", slaveCmd, z);
+                    
+                    dec = (DEC_Handle)alg[z];
+                    errno = 0;
+                    if (dec->fxns->reset)
+                    {
+                        errno = dec->fxns->reset(dec, NULL, &pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus);
+                    }
+
+                    // (***) FL: hackin'
+                    // write back Status structures for shared Beta Units
+                    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
+                    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), size, Cache_Type_ALLD, 0);
+                    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]->size;
+                    Cache_wb((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
+                    Cache_wait();
+                    
+                    // send dec reset complete message to master
+                    queId = MessageQ_getReplyQueue(pAspMsg);
+                    pAspMsg->procId = hAspMsgSlave->slaveProcId;
+                    pAspMsg->cmd = ASP_MASTER_DEC_RESET_DONE;
+                    pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+                    argIdx = 0; // set decErrno
+                    *(Int32 *)&pAspMsg->buf[argIdx] = errno;
+                    TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                    status = MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+                    if (status != MessageQ_S_SUCCESS)
+                    {
+                        SW_BREAKPOINT;
+                    }
+
+                    break;
+                    
+                case ASP_SLAVE_DEC_INFO:
+                    gSlaveDecInfoCnt++;
+                    // simulate dec info load
+                    //simLoad(DEC_INFO_LOAD);
+                    
+                    argIdx = 0; // get decIdx
+                    z = *(Int32 *)&pAspMsg->buf[argIdx];
+                    TRACE_TERSE2("slaveCmd=%d,decIdx=%d", slaveCmd, z);
+                    zI = pP->inputsFromDecodes[z];
+                    
+                    // (***) FL: hackin'
+                    // invalidate Inp configuration
+                    Cache_inv(&gPAF_AST_config.xInp[zI], sizeof(PAF_AST_InpBuf), Cache_Type_ALLD, 0);
+                    // invalidate input data
+                    pIpBufConfig = &gPAF_AST_config.xInp[zI].inpBufConfig;
+                    size = pIpBufConfig->frameLength * pIpBufConfig->sizeofElement;
+                    if (sourceSelect == PAF_SOURCE_PCM)
+                    {
+                        size *= pIpBufConfig->stride;
+                    }
+                    Cache_inv((Ptr)pIpBufConfig->pntr.pSmInt, size, Cache_Type_ALLD, 0);
+                    // invalidate Dec configuration
+                    Cache_inv(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                    // status for selected decoder should be invalidated
+                    Cache_wait();
+            
+                    dec = (DEC_Handle)alg[z];
+                    errno = 0;
+                    if (dec->fxns->info)
+                    {
+                        errno = dec->fxns->info(dec, NULL, &pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus);
+                    }
+                    
+                    // write back Dec configuration
+                    Cache_wb(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                    Cache_wait();            
+                    
+                    // send dec info complete message to master
+                    queId = MessageQ_getReplyQueue(pAspMsg);
+                    pAspMsg->procId = hAspMsgSlave->slaveProcId;
+                    pAspMsg->cmd = ASP_MASTER_DEC_INFO_DONE;
+                    pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+                    argIdx = 0; // set decErrno
+                    *(Int32 *)&pAspMsg->buf[argIdx] = errno;
+                    TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                    status = MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+                    if (status != MessageQ_S_SUCCESS)
+                    {
+                        SW_BREAKPOINT;
+                    }
+                    
+                    break;
+                    
+                case ASP_SLAVE_DEC_DECODE:
+                    gSlaveDecDecodeCnt++;
+                    // simulate dec info load
+                    //simLoad(DEC_DECODE_LOAD);
+                    
+                    argIdx = 0; // get decIdx
+                    z = *(Int32 *)&pAspMsg->buf[argIdx];
+                    TRACE_TERSE2("slaveCmd=%d, decIdx=%d", slaveCmd, z);
+                    
+                    // invalidate Dec configuration
+                    Cache_inv(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                    Cache_wait();
+                    //TRACE_TERSE0("Dec:cache wb done");
+            
+                    dec = (DEC_Handle)alg[z];
+                    //TRACE_TERSE1("Dec:dec handle=0x%04x", (IArg)dec);
+
+                    errno = 0;
+                    cbErrno = 0;
+                    if (dec->fxns->decode)
+                    {
+                        // FL: debug, capture input buffer
+                        capIb(pC->xInp[z].pInpBuf);
+                    
+                        errno = dec->fxns->decode(dec, NULL, &pC->xDec[z].decodeInStruct, &pC->xDec[z].decodeOutStruct);
+                        if (errno < 0)
+                        {
+                            SW_BREAKPOINT;
+                        }
+                        //TRACE_TERSE0("Dec:decode done");
+                        
+                        // copy decoder output to decoder output circular buffers
+                        pCb = &pC->xDec[z].decOpCb;
+                        //TRACE_TERSE1("Dec:pCb=0x%04x", (IArg)pCb);
+                        
+                        pAfWrt = pC->xDec[z].decodeOutStruct.pAudioFrame;
+                        //TRACE_TERSE1("Dec:pAfWrt=0x%04x", (IArg)pAfWrt);
+                        //TRACE_TERSE1("nSamples=%d",pAfWrt->data.nSamples);
+                        
+                        // FL: debug, capture audio frame
+                        if (capAfWrite(pAfWrt, PAF_CNTR) != CAP_AF_SOK)
+                        {
+                            Log_info0("capAfWrite() error");
+                        }                        
+
+                        cbErrno = cbWriteAf(pCb, pAfWrt);
+                        if (cbErrno < 0)
+                        {
+                            SW_BREAKPOINT;
+                        }
+                        //TRACE_TERSE0("Dec:cbWriteAf() complete");
+                        
+                        // FL: debug, log circular buffer control variables
+                        cbLog(pCb, 0);
+                    }
+                    
+                    // write back Dec configuration
+                    Cache_wb(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                    Cache_wait();
+                    
+                    // send dec info complete message to master
+                    queId = MessageQ_getReplyQueue(pAspMsg);
+                    pAspMsg->procId = hAspMsgSlave->slaveProcId;
+                    pAspMsg->cmd = ASP_MASTER_DEC_DECODE_DONE;
+                    pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+                    argIdx = 0; // set decErrno
+                    *(Int32 *)&pAspMsg->buf[argIdx] = errno;
+                    argIdx += sizeof(Int32); // set cbErrno
+                    *(Int32 *)&pAspMsg->buf[argIdx] = cbErrno;                    
+                    TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                    status = MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+                    if (status != MessageQ_S_SUCCESS)
+                    {
+                        SW_BREAKPOINT;
+                    }
+                    
+                    break;
+                    
+                case ASP_SLAVE_DEC_DEACTIVATE:
+                    gSlaveDecDeactivateCnt++;
+                    // simulate dec info load
+                    //simLoad(DEC_DEACTIVATE_LOAD);
+                    
+                    argIdx = 0; // get decIdx
+                    z = *(Int32 *)&pAspMsg->buf[argIdx];
+                    TRACE_TERSE2("slaveCmd=%d, decIdx=%d", slaveCmd, z);
+                    
+                    if (alg[z]->fxns->algDeactivate)
+                    {
+                        alg[z]->fxns->algDeactivate(alg[z]);
+                    }
+                    
+                    // send dec deactivate complete message to master
+                    queId = MessageQ_getReplyQueue(pAspMsg);
+                    pAspMsg->procId = hAspMsgSlave->slaveProcId;
+                    pAspMsg->cmd = ASP_MASTER_DEC_DEACTIVATE_DONE;
+                    pAspMsg->messageId = hAspMsgSlave->masterMessageId | ((UInt32)1<<31);
+                    TRACE_MSG3("Tx ASP message, procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                    status = MessageQ_put(queId, (MessageQ_Msg)pAspMsg); /* send message back */
+                    if (status != MessageQ_S_SUCCESS)
+                    {
+                        SW_BREAKPOINT;
+                    }
+                    
+                    break;
+                    
+                default:
+                    TRACE_TERSE1("ERROR: invalid slaveCmd=%d", slaveCmd);
+                    break;
+            }
+        }
+    }
+    
+    Log_info0("exit taskAspSlaveFxn()");   
+}
+
+
+// -----------------------------------------------------------------------------
+// AST Initialization Function - Memory Allocation
+//
+//   Name:      PAF_AST_initPhaseMalloc
+//   Purpose:   Audio Stream Task Function for initialization of data pointers
+//              by allocation of memory.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    0 on success.
+//              Source code line number on MEM_calloc failure.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//              * Memory allocation errors.
+//
+Int
+PAF_AST_initPhaseMallocSlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int zMS = pC->masterStr;
+    Error_Block    eb;
+
+    TRACE_TERSE1("PAF_AST_initPhaseMallocSlave: AS%d: initialization phase - memory allocation", as+zMS);
+
+    // Initialize error block
+    Error_init(&eb); 
+
+    if (!(gpAudioFrameSlave = (PAF_AudioFrame *)Memory_calloc((IHeap_Handle)HEAP_INTERNAL1, 
+        DECODEN * sizeof (PAF_AudioFrame), 4, &eb)))
+    {
+        TRACE_TERSE1("PAF_AST_initPhaseMallocSlave: AS%d: Memory_calloc failed", as+zMS);
+        SW_BREAKPOINT;
+        return __LINE__;
+    }
+    TRACE_TERSE3("PAF_AST_initPhaseMalloc. (gpAudioFrameSlave) %d bytes from space %d at 0x%x.",
+            DECODEN * sizeof (PAF_AudioFrame),
+            HEAP_ID_INTERNAL1, (IArg)gpAudioFrameSlave);
+
+    TRACE_TERSE1("PAF_AST_initPhaseMallocSlave: AS%d: initialization phase - memory allocation complete.", as+zMS);
+    return 0;
+} //PAF_AST_initPhaseMallocSlave
+
+// -----------------------------------------------------------------------------
+// AST Initialization Function - Memory Initialization from Configuration
+//
+//   Name:      PAF_AST_initPhaseConfig
+//   Purpose:   Audio Stream Task Function for initialization of data values
+//              from parameters.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    0 on success.
+//              Other as per initFrame0 and initFrame1.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+
+Int
+PAF_AST_initPhaseConfigSlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+)
+{
+    Int z;
+
+    // overwrite pointer to audio frame in framework decode control
+    for (z=DECODE1; z < DECODEN; z++) {
+        pC->xDec[z].decodeControl.pAudioFrame = &gpAudioFrameSlave[z];
+        pC->xDec[z].decodeInStruct.pAudioFrame = &gpAudioFrameSlave[z];
+        pP->fxns->initFrame0(pP, pQ, pC, z);
+    }
+
+    return 0;
+}  //PAF_AST_initPhaseConfigSlave
+
+// -----------------------------------------------------------------------------
+// AST Initialization Function - ACP Algorithm Instantiation
+//
+//   Name:      PAF_AST_initPhaseAcpAlgSlave
+//   Purpose:   Audio Stream Task Function for initialization of ACP by
+//              instantiation of the algorithm.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    0 on success.
+//              Source code line number on ACP Algorithm creation failure.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//              * Memory allocation errors.
+//
+Int
+PAF_AST_initPhaseAcpAlgSlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                              /* input/encode/stream/decode/output */
+                                        /* counter                           */
+    Int betaPrimeOffset;
+    ACP_Handle acp;
+    Int zMS = pC->masterStr;
+    Int zS; //, zX;
+
+    TRACE_TERSE1("PAF_AST_initPhaseAcpAlgSlave: AS%d: initialization phase - ACP Algorithm", as+zMS);
+
+    ACP_MDS_init();
+
+    if (!(acp = (ACP_Handle )ACP_MDS_create (NULL))) 
+    {
+        TRACE_TERSE1("PAF_AST_initPhaseAcpAlgSlave: AS%d: ACP algorithm instance creation  failed", as+zMS);
+        return __LINE__;
+    }
+    pC->acpSlave = acp;
+
+    ((ALG_Handle)acp)->fxns->algControl((ALG_Handle)acp,
+        ACP_GETBETAPRIMEOFFSET, (IALG_Status *)&betaPrimeOffset);
+
+#if 0 // FL: master
+    for (z=INPUT1; z < INPUTN; z++) 
+    {
+        zS = z;
+        for (zX = DECODE1; zX < DECODEN; zX++) 
+        {
+            if (pP->inputsFromDecodes[zX] == z) 
+            {
+                zS = pP->streamsFromDecodes[zX];
+                break;
+            }
+        }
+        acp->fxns->attach(acp, ACP_SERIES_STD,
+            STD_BETA_IB + betaPrimeOffset * (as-1+zS),
+            (IALG_Status *)&pC->xInp[z].inpBufStatus);
+        /* Ignore errors, not reported. */
+    }
+#endif
+
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        zS = pP->streamsFromDecodes[z];
+        acp->fxns->attach(acp, ACP_SERIES_STD,
+            STD_BETA_DECODE + betaPrimeOffset * (as-1+zS),
+            (IALG_Status *)&pC->xDec[z].decodeStatus);
+        /* Ignore errors, not reported. */
+    }
+
+#if 0 // FL: master
+    for (z=ENCODE1; z < ENCODEN; z++) 
+    {
+        zS = pP->streamsFromEncodes[z];
+        acp->fxns->attach(acp, ACP_SERIES_STD,
+            STD_BETA_ENCODE + betaPrimeOffset * (as-1+zS),
+            (IALG_Status *)&pC->xEnc[z].encodeStatus);
+        acp->fxns->attach(acp, ACP_SERIES_STD,
+            STD_BETA_VOLUME + betaPrimeOffset * (as-1+zS),
+            (IALG_Status *)&pC->xEnc[z].volumeStatus);
+        /* Ignore errors, not reported. */
+    }
+#endif
+    
+#if 0 // FL: master
+    for (z=OUTPUT1; z < OUTPUTN; z++) 
+    {
+        zS = z;
+        for (zX = ENCODE1; zX < ENCODEN; zX++) 
+        {
+            if (pP->outputsFromEncodes[zX] == z) 
+            {
+                zS = pP->streamsFromEncodes[zX];
+                break;
+            }
+        }
+        acp->fxns->attach(acp, ACP_SERIES_STD,
+            STD_BETA_OB + betaPrimeOffset * (as-1+zS),
+            (IALG_Status *)&pC->xOut[z].outBufStatus);
+        /* Ignore errors, not reported. */
+    }
+#endif
+    
+    TRACE_TERSE1("PAF_AST_initPhaseAcpAlgSlave: AS%d: initialization phase - ACP Algorithm complete.", as+zMS);
+
+    return 0;
+} //PAF_AST_initPhaseAcpAlg
+
+// -----------------------------------------------------------------------------
+// AST Initialization Function - Common Memory and Algorithms
+//
+//   Name:      PAF_AST_initPhaseCommonSlave
+//   Purpose:   Audio Stream Task Function for initialization of data pointers
+//              by allocation for common memory and by instantiation for
+//              algorithms.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    0 on success.
+//              Source code line number on PAF_ALG_alloc failure.
+//              Source code line number on PAF_ALG_mallocMemory failure.
+//              Source code line number on Decode Chain initialization failure.
+//              Source code line number on ASP Chain initialization failure.
+//              Source code line number on Encode Chain initialization failure.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//              * Memory allocation errors.
+//
+
+#include <pafsio_ialg.h>
+
+Int
+PAF_AST_initPhaseCommonSlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                              /* stream counter */
+    //Int g;                              /* gear */
+    ACP_Handle acp = pC->acpSlave;
+    PAF_IALG_Config pafAlgConfig;
+    IALG_MemRec common[3][PAF_IALG_COMMON_MEMN+1];
+   
+    TRACE_TERSE0("PAF_AST_initPhaseCommonSlav: initialization phase - Common Algorithms");
+
+    //
+    // Determine memory needs and instantiate algorithms across audio streams
+    //
+
+    TRACE_TERSE0("PAF_AST_initPhaseCommonSlave: calling PAF_ALG_setup.");
+    PAF_ALG_setup(&pafAlgConfig, 
+        HEAP_ID_INTERNAL,       HEAP_INTERNAL, 
+        HEAP_ID_INTERNAL1,      HEAP_INTERNAL1, 
+        HEAP_ID_EXTERNAL,       HEAP_EXTERNAL, 
+        HEAP_ID_INTERNAL1_SHM,  HEAP_INTERNAL1_SHM, 
+        HEAP_CLEAR);
+
+    if (pP->fxns->headerPrint)
+        pP->fxns->headerPrint();
+
+    for (z=STREAM1; z < STREAMN; z++) 
+    {
+        //Int zD, zE, zX;
+        Int zD, zX;
+
+        TRACE_TERSE1("PAF_AST_initPhaseCommonSlave: AS%d: initialization phase - Common Algorithms", as+z);
+
+        //
+        // Determine common memory needs of Decode Algorithms
+        //
+        PAF_ALG_init (common[z], lengthof (common[z]), COMMONSPACE);
+
+        zD = -1;
+        for (zX = DECODE1; zX < DECODEN; zX++) 
+        {
+            if (pP->streamsFromDecodes[zX] == z) 
+            {
+                zD = zX;
+                break;
+            }
+        }
+
+#if 0 // FL: master
+        zE = -1;
+        for (zX = ENCODE1; zX < ENCODEN; zX++) 
+        {
+            if (pP->streamsFromEncodes[zX] == z) 
+            {
+                zE = zX;
+                break;
+            }
+        }
+#endif
+
+        if (zD >= 0) 
+        {
+            TRACE_TERSE1("PAF_AST_initPhaseCommonSlave: calling PAF_ALG_ALLOC for decoder common[%d].", z);
+            if (PAF_ALG_ALLOC (decLinkInit[zD-DECODE1], common[z])) 
+            {
+                TRACE_TERSE3("AS%d: %s.%d: PAF_ALG_alloc failed", as+z, (IArg)__FUNCTION__, __LINE__);
+                TRACE_TERSE2("Failed to alloc %d bytes from space %d", common[z]->size, common[z]->space);
+
+                SW_BREAKPOINT;
+                return __LINE__;
+            }
+            TRACE_TERSE3("alloced %d bytes from space %d at 0x%x", common[z]->size, common[z]->space, (IArg)common[z]->base);
+            if(pP->fxns->allocPrint)
+                pP->fxns->allocPrint ((const PAF_ALG_AllocInit *)(decLinkInit[z-DECODE1]),sizeof (*(decLinkInit[z-DECODE1])), &pafAlgConfig);
+        }
+
+#if 0 // FL: master
+        TRACE_TERSE3("%s.%d: calling PAF_ALG_ALLOC for stream common[%d].", (IArg)__FUNCTION__, __LINE__, z);
+        TRACE_TERSE3("%s.%d: calling PAF_ALG_ALLOC for stream common[%d].", (IArg)__FUNCTION__, __LINE__, z);
+        if (PAF_ALG_ALLOC (aspLinkInit[z-STREAM1][0], common[z])) 
+        {
+            TRACE_TERSE3("AS%d: %s.%d: PAF_ALG_alloc failed", as+z, (IArg)__FUNCTION__, __LINE__);
+            TRACE_TERSE2("Failed to alloc %d bytes from space %d ", common[z]->size, common[z]->space);
+            SW_BREAKPOINT;
+            return __LINE__;
+        }
+        TRACE_TERSE3("alloced %d bytes from space %d at 0x%x", common[z]->size, common[z]->space, (IArg)common[z]->base);
+        if(pP->fxns->allocPrint)
+            pP->fxns->allocPrint((const PAF_ALG_AllocInit *)(aspLinkInit[z-STREAM1][0]), sizeof (*(aspLinkInit[z-STREAM1][0])), &pafAlgConfig);
+#endif
+        
+#if 0 // FL: master
+        if (zE >= 0) 
+        {
+            TRACE_TERSE3("%s.%d: calling PAF_ALG_ALLOC/ for encoder common[%d].", (IArg)__FUNCTION__, __LINE__, z);
+            if (PAF_ALG_ALLOC (encLinkInit[zE-ENCODE1], common[z])) 
+            {
+                TRACE_TERSE3("AS%d: %s.%d: PAF_ALG_alloc failed",
+                             as+z, (IArg)__FUNCTION__, __LINE__);
+                SW_BREAKPOINT;
+                return __LINE__;
+            }
+            TRACE_TERSE3("alloced %d bytes from space %d at 0x%x", common[z]->size, common[z]->space, (IArg)common[z]->base);
+            if(pP->fxns->allocPrint)
+                pP->fxns->allocPrint((const PAF_ALG_AllocInit *)(encLinkInit[z-ENCODE1]), sizeof (*(encLinkInit[z-ENCODE1])), &pafAlgConfig);
+        }
+#endif
+
+        //
+        // Determine common memory needs of Logical IO drivers
+        //
+
+#if 0 // FL: master
+        // really need to loop over all inputs for this stream using the tables
+        // inputsFromDecodes and streamsFromDecodes. But these don't exist for this
+        // patch, and not needed for FS11, since there is only one input.
+        if (INPUT1 <= z && z < INPUTN) 
+        {
+            TRACE_TERSE3("AS%d: PAF_AST_initPhaseCommon.%d: alloc inpLinkInit common[%d]", as+z, __LINE__, z);
+            if (PAF_ALG_ALLOC (inpLinkInit[z-INPUT1], common[z])) 
+            {
+                TRACE_TERSE3("AS%d: %s.%d: PAF_ALG_alloc failed", as+z, (IArg)__FUNCTION__, __LINE__);
+                TRACE_TERSE2("failed to alloc %d bytes from space %d", common[z]->size, (IArg)common[z]->space);
+                SW_BREAKPOINT;
+                return __LINE__;
+            }
+            TRACE_TERSE3("alloced %d bytes from space %d at 0x%x", common[z]->size, common[z]->space, (IArg)common[z]->base);
+            if(pP->fxns->allocPrint)
+                pP->fxns->allocPrint((const PAF_ALG_AllocInit *)(inpLinkInit[z-INPUT1]), sizeof (*(inpLinkInit[z-INPUT1])), &pafAlgConfig);
+        }
+#endif        
+
+#if 0 // FL: master
+        if (OUTPUT1 <= z && z < OUTPUTN) 
+        {
+            TRACE_TERSE3("%s.%d: calling PAF_ALG_ALLOC outLinkInit common[%d].", (IArg)__FUNCTION__, __LINE__, z);
+            if (PAF_ALG_ALLOC (outLinkInit[z-OUTPUT1], common[z])) 
+            {
+                TRACE_TERSE3("AS%d: %s.%d: PAF_ALG_alloc failed", as+z, (IArg)__FUNCTION__, __LINE__);
+                TRACE_TERSE2("Failed to alloc %d bytes from space %d", common[z]->size, (IArg)common[z]->space);
+                SW_BREAKPOINT;
+                return __LINE__;
+            }
+            TRACE_TERSE3("alloced %d bytes from space %d at 0x%x", common[z]->size, common[z]->space, (IArg)common[z]->base);
+            if(pP->fxns->allocPrint)
+                pP->fxns->allocPrint((const PAF_ALG_AllocInit *)(outLinkInit[z-INPUT1]), sizeof (*(outLinkInit[z-INPUT1])), &pafAlgConfig);
+        }
+#endif        
+    }
+    {
+        // Changes made to share scratch between zones
+        // Assume maximum 3 zones and scratch common memory is at offset 0;
+        int max=0;
+        for (z=STREAM1; z < STREAMN; z++)
+        {
+            if (max<common[z][0].size)
+                max=common[z][0].size;
+        }
+        common[STREAM1][0].size=max;
+        for (z=STREAM1+1; z < STREAMN; z++)
+            common[z][0].size=0;
+    }
+    
+    //
+    // Provide common memory needs of Decode Algorithms
+    //
+    for (z=STREAM1; z < STREAMN; z++) 
+    {
+        //Int zD, zE, zX;
+        Int zD, zX;
+
+        zD = -1;        
+        for (zX = DECODE1; zX < DECODEN; zX++) 
+        {
+           if (pP->streamsFromDecodes[zX] == z) 
+           {
+               zD = zX;
+               break;
+           }
+        }
+
+#if 0 // FL: master
+        zE = -1;
+        for (zX = ENCODE1; zX < ENCODEN; zX++) 
+        {
+           if (pP->streamsFromEncodes[zX] == z) 
+           {
+               zE = zX;
+               break;
+           }
+        }
+#endif
+
+        TRACE_TERSE0("PAF_AST_initPhaseCommonSlave: calling PAF_ALG_mallocMemory for common space.");
+        if (PAF_ALG_mallocMemory (common[z], &pafAlgConfig)) 
+        {
+            TRACE_TERSE3("AS%d: %s.%d: PAF_ALG_mallocMemory failed", as+z, (IArg)__FUNCTION__, __LINE__);
+            TRACE_TERSE3("AS%d: z: %d.  Size 0x%x", as+z, z, common[z][0].size);
+            SW_BREAKPOINT;
+            return __LINE__;
+        }
+        TRACE_TERSE3("alloced %d bytes from space %d at 0x%x", common[z]->size, common[z]->space, (IArg)common[z]->base);
+        // share zone0 scratch with all zones 
+        common[z][0].base=common[0][0].base;
+        if (pP->fxns->commonPrint)
+                pP->fxns->commonPrint (common[z], &pafAlgConfig);
+
+        //
+        // Instantiate Decode Algorithms
+        //
+        if (zD >= 0) 
+        {
+            PAF_ASP_Chain *chain;
+            TRACE_TERSE0("PAF_AST_initPhaseCommonSlave: calling PAF_ASP_chainInit for decode.");
+            chain =
+                PAF_ASP_chainInit (&pC->xDec[zD].decChainData, pP->pChainFxns,
+                                   HEAP_INTERNAL, as+z, acp, &trace,
+                                   decLinkInit[zD-DECODE1], NULL, common[z], &pafAlgConfig);
+            if (!chain) 
+            {
+                TRACE_TERSE1("AS%d: Decode chain initialization failed", as+z);
+                return __LINE__;
+            }
+        }
+
+#if 0 // FL: master
+        pC->xStr[z].aspChain[0] = NULL;
+        for (g=0; g < GEARS; g++) 
+        {
+            PAF_ASP_Chain *chain;
+            TRACE_TERSE2("%s.%d: calling PAF_ASP_chainInit for ASPs.", (IArg)__FUNCTION__, __LINE__);
+            chain =
+                PAF_ASP_chainInit (&pC->xStr[z].aspChainData[g], pP->pChainFxns,
+                                   HEAP_INTERNAL, as+z, acp, &trace,
+                                   aspLinkInit[z-STREAM1][g], pC->xStr[z].aspChain[0], common[z], &pafAlgConfig);
+            if (! chain) 
+            {
+                TRACE_TERSE2("AS%d: ASP chain %d initialization failed", as+z, g);
+                return __LINE__;
+            }
+            else
+                pC->xStr[z].aspChain[g] = chain;
+        }
+#endif
+
+#if 0 // FL: master
+        if (zE >= 0) 
+        {
+            PAF_ASP_Chain *chain;
+            TRACE_TERSE2("%s.%d: calling PAF_ASP_chainInit for encode.", (IArg)__FUNCTION__, __LINE__);
+            chain =
+                PAF_ASP_chainInit (&pC->xEnc[zE].encChainData, pP->pChainFxns,
+                                   HEAP_INTERNAL, as+z, acp, &trace,
+                                   encLinkInit[zE-ENCODE1], NULL, common[z], &pafAlgConfig);
+            if (!chain) 
+            {
+                TRACE_TERSE1("AS%d: Encode chain initialization failed", as+z);
+                return __LINE__;
+            }
+        }
+#endif
+
+#if 0 // FL: master
+        //
+        // Allocate non-common memories for Logical IO drivers
+        //    Since these structures are used at run-time we allocate from external memory
+        if (INPUT1 <= z && z < INPUTN) 
+        {
+            PAF_ASP_Chain *chain;
+            TRACE_TERSE3("AS%d: PAF_AST_initPhaseCommon.%d: non-common input chain init for %d",
+                           as+z, __LINE__, z);
+            chain = PAF_ASP_chainInit (&pC->xInp[z].inpChainData, pP->pChainFxns,
+                    HEAP_EXTERNAL, as+z, acp, &trace,
+                    inpLinkInit[z-INPUT1], NULL, common[z], &pafAlgConfig);
+            if (!chain) 
+            {
+                TRACE_TERSE1("AS%d: Input chain initialization failed", as+z);
+                return __LINE__;
+            }
+        }
+#endif        
+
+#if 0 // FL: master
+        if (OUTPUT1 <= z && z < OUTPUTN) 
+        {
+            PAF_ASP_Chain *chain;
+            TRACE_TERSE3("AS%d: PAF_AST_initPhaseCommon.%d: non-common output chain init for %d",
+                           as+z, __LINE__, z);
+            chain = PAF_ASP_chainInit (&pC->xOut[z].outChainData, pP->pChainFxns,
+                    HEAP_EXTERNAL, as+z, acp, &trace,
+                    outLinkInit[z-OUTPUT1], NULL, common[z], &pafAlgConfig);
+            if (!chain) 
+            {
+                TRACE_TERSE1("AS%d: Output chain initialization failed", as+z);
+                return __LINE__;
+            }
+        }
+#endif        
+    }
+    TRACE_TERSE1("PAF_AST_initPhaseCommonSlave: AS%d: Returning complete.", as+z);
+
+    return 0;
+} //PAF_AST_initPhaseCommon
+
+// -----------------------------------------------------------------------------
+// AST Initialization Function - Algorithm Keys
+//
+//   Name:      PAF_AST_initPhaseAlgKeySlave
+//   Purpose:   Audio Stream Task Function for initialization of data values
+//              from parameters for Algorithm Keys.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    0.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+// .............................................................................
+Int
+PAF_AST_initPhaseAlgKeySlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                              /* decode/encode counter */
+    Int s;                              /* key number */
+    PAF_ASP_Link *that;
+
+    (void)as;  // clear warning.
+
+    TRACE_VERBOSE1("PAF_AST_initPhaseCommonSlave: AS%d: initialization phase - Algorithm Keys", as);
+
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        for (s=0; s < pP->pDecAlgKey->length; s++) 
+        {
+            if ((pP->pDecAlgKey->code[s].full != 0)
+                && (that = PAF_ASP_chainFind (&pC->xDec[z].decChainData, pP->pDecAlgKey->code[s])))
+            {
+                pC->xDec[z].decAlg[s] = (ALG_Handle )that->alg;
+                    /* Cast in interface, for now --Kurt */
+            }
+            else
+                pC->xDec[z].decAlg[s] = NULL;
+        }
+    }
+
+#if 0 // FL: master
+    for (z=ENCODE1; z < ENCODEN; z++) 
+    {
+        for (s=0; s < pP->pEncAlgKey->length; s++) 
+        {
+            if (pP->pEncAlgKey->code[s].full != 0
+                && (that = PAF_ASP_chainFind (&pC->xEnc[z].encChainData, pP->pEncAlgKey->code[s])))
+                pC->xEnc[z].encAlg[s] = (ALG_Handle )that->alg;
+            /* Cast in interface, for now --Kurt */
+            else
+                pC->xEnc[z].encAlg[s] = NULL;
+        }
+    }
+#endif    
+
+    return 0;
+} //PAF_AST_initPhaseAlgKey
+
+Int
+PAF_AST_initFrame0Slave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int z
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int aLen;
+    Int aSize = sizeof(PAF_AudioData);
+    Int aAlign = aSize < sizeof (int) ? sizeof (int) : aSize;
+    Int maxFrameLength = pP->maxFramelength;
+    PAF_AudioData *aBuf=NULL;
+    XDAS_UInt8 *metadataBuf;
+    Int8 i;
+    Error_Block    eb;
+    PAF_AudioFrame *pAudioFrame;
+
+    pAudioFrame = &gpAudioFrameSlave[z];
+    if (pAudioFrame == NULL)
+    {
+        SW_BREAKPOINT;
+    }
+    
+    // Initialize error block
+    Error_init(&eb); 
+    
+    //maxFrameLength += PA_MODULO - maxFrameLength % PA_MODULO; // compute maximum framelength (needed for ARC support)
+    aLen = numchan[z] * maxFrameLength;
+
+    //
+    // Initialize audio frame elements directly
+    //
+    pAudioFrame->fxns = pP->pAudioFrameFunctions;
+    pAudioFrame->data.nChannels = PAF_MAXNUMCHAN;
+    pAudioFrame->data.nSamples = FRAMELENGTH;
+    pAudioFrame->data.sample = gAudioFrameChannelPointersSlave;
+    pAudioFrame->data.samsiz = gAudioFrameChannelSizesSlave;
+    pAudioFrame->pChannelConfigurationMaskTable = &PAF_ASP_stdCCMT;
+
+    //
+    // Allocate memory for and initialize pointers to audio data buffers
+    //
+    //   The NUMCHANMASK is used to identify the channels for which data
+    //   buffers can be allocated. Using this mask and switch statement
+    //   rather than some other construct allows efficient code generation,
+    //   providing just the code necessary (with significant savings).
+    //
+    if (pP->fxns->bufMemPrint)
+    {
+        pP->fxns->bufMemPrint(z, aLen*aSize, HEAP_ID_FRMBUF, 2);
+    }
+
+    TRACE_TERSE1("PAF_AST_initFrame0Slave: AS%d: Memory_calloc for audio buffers", as+z);
+    
+    if (aLen != 0)
+    {
+        if (!(aBuf = (PAF_AudioData *)Memory_calloc((IHeap_Handle)HEAP_FRMBUF, aLen*aSize, aAlign, &eb)))
+        {
+            TRACE_TERSE2("AS%d: %s: MEM_calloc failed", as+z, (IArg)__FUNCTION__);
+            TRACE_TERSE2("  maxFrameLength: %d.  aLen*aSize: %d", maxFrameLength, aLen*aSize);
+            SW_BREAKPOINT;
+            return __LINE__;
+        }
+    }
+
+    TRACE_TERSE3("  maxFrameLength: %d.  aLen*aSize: %d.  aBuf: 0x%x", maxFrameLength, aLen*aSize, (IArg)aBuf);
+
+    TRACE_TERSE1("PAF_AST_initFrame0Slave: AS%d: Memory_calloc for metadata buffers", as+z);
+    if (!(metadataBuf = (XDAS_UInt8 *)Memory_calloc((IHeap_Handle)HEAP_MDBUF, pP->pMetadataBufStatus->bufSize*pP->pMetadataBufStatus->NumBuf, pP->pMetadataBufStatus->alignment, &eb)))
+    {
+        TRACE_TERSE1("PAF_AST_initFrame0Slave: AS%d: Memory_calloc failed", as+z);
+        TRACE_TERSE1("  bufSize*NumBuf: %d", pP->pMetadataBufStatus->bufSize*pP->pMetadataBufStatus->NumBuf);
+        SW_BREAKPOINT;
+        return __LINE__;
+    }
+
+    {
+        Int i;
+
+        for (i=0; i < PAF_MAXNUMCHAN_AF; i++)
+            gAudioFrameChannelPointersSlave[i] = NULL;
+    }
+
+    // MID 314
+    if((numchan[z] > PAF_MAXNUMCHAN) || (numchan[z] < 1)) 
+    {
+        TRACE_TERSE1("PAF_AST_initFrame0Slave: AS%d: unsupported option", as+z);
+        return __LINE__;
+    }
+    else 
+    {
+        Int j = 0;
+        TRACE_TERSE1("PAF_AST_initFrame0Slave: AFChanPtrMap[%d][i]", numchan[z]);
+        for (i=0; i<numchan[z]; i++)
+        {
+            Int8 chan = AFChanPtrMap[numchan[z]][i];
+            if (chan != -1)
+            {
+                gAudioFrameChannelPointersSlave[chan] = aBuf + maxFrameLength*(j+1) - FRAMELENGTH;
+                j++;
+                TRACE_TERSE3("PAF_AST_initFrame0Slave: chan = %d = AFChanPtrMap[%d][%d].", chan, numchan[z], i);
+                TRACE_TERSE2("PAF_AST_initFrame0Slave: audioFrameChannelPointers[%d]: 0x%x", chan, (IArg)gAudioFrameChannelPointersSlave[chan]);
+            }
+        }
+    }
+
+    //
+    // Initialize meta data elements
+    //
+    pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
+    pAudioFrame->numPrivateMetadata = 0;
+    pAudioFrame->bsMetadata_offset = 0;
+    pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
+    pAudioFrame->privateMetadataBufSize = pP->pMetadataBufStatus->bufSize;
+    for (i=0; i<pP->pMetadataBufStatus->NumBuf; i++)
+    {
+        pAudioFrame->pafPrivateMetadata[i].offset = 0;
+        pAudioFrame->pafPrivateMetadata[i].size = 0;
+        pAudioFrame->pafPrivateMetadata[i].pMdBuf = metadataBuf + pP->pMetadataBufStatus->bufSize*i;
+    }
+
+    return 0;
+} //PAF_AST_initFrame0Slave
+
+Int
+PAF_AST_initFrame1Slave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int z, 
+    Int sourceSelect
+)
+{
+    PAF_AudioFrame *pAudioFrame;
+
+    pAudioFrame = &gpAudioFrameSlave[z];
+    if (pAudioFrame == NULL)
+    {
+        SW_BREAKPOINT;
+    }
+
+    // Reinitialize audio frame elements:
+    pAudioFrame->sampleRate = PAF_SAMPLERATE_UNKNOWN;
+    pAudioFrame->sampleCount = 0;
+    pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_NONE;
+    pAudioFrame->channelConfigurationStream.legacy = PAF_CC_NONE;
+    pAudioFrame->data.nChannels = PAF_MAXNUMCHAN;
+    
+    if (sourceSelect == PAF_SOURCE_PCM)
+    {
+        pAudioFrame->data.nSamples = FRAMELENGTH;
+    }
+    else if (sourceSelect == PAF_SOURCE_DDP)
+    {
+        pAudioFrame->data.nSamples = 1536;        
+    }
+    else
+    {
+        pAudioFrame->data.nSamples = FRAMELENGTH;
+    }   
+
+    return 0;
+} //PAF_AST_initFrame1Slave
+
+
+#if 0
+// .............................................................................
+// Audio Stream Task Parameter Functions - PA17
+//
+//   Name:      PAF_AST_params_fxnsPA17
+//   Purpose:   Collect the functions that embody the implementation of
+//              Audio Framework Number 2 for use as a jump table.
+//   From:      PAF_AST_Params
+//   Uses:      See contents.
+//   States:    N.A.
+//   Return:    N.A.
+//   Trace:     None.
+//
+const PAF_AST_Fxns PAF_AST_params_fxnsPA17_Slave =
+{
+    {   // initPhase[8]
+        NULL,
+        NULL,
+        PAF_AST_initPhaseAcpAlgSlave,
+        PAF_AST_initPhaseCommonSlave,
+        PAF_AST_initPhaseAlgKeySlave,
+        NULL,
+        NULL,
+        NULL
+    },
+    NULL, //PAF_AST_initFrame0,             // initFrame0
+    NULL, //PAF_AST_initFrame1,             // initFrame1
+    NULL, /* PAF_AST_passProcessing, */     // passProcessing        
+    NULL, /* PAF_AST_passProcessingCopy, */ // passProcessingCopy    
+    NULL, //PAF_AST_autoProcessing,         // autoProcessing
+    NULL, //PAF_AST_decodeProcessing,       // decodeProcessing
+    NULL, //PAF_AST_decodeCommand,          // decodeCommand
+    NULL, //PAF_AST_encodeCommand,          // encodeCommand
+    NULL, //PAF_AST_decodeInit,             // decodeInit
+    NULL, //PAF_AST_decodeInfo,             // decodeInfo
+    NULL, //PAF_AST_decodeInfo1,            // decodeInfo1
+    NULL, //PAF_AST_decodeInfo2,            // decodeInfo2
+    NULL, //PAF_AST_decodeCont,             // decodeCont
+    NULL, //PAF_AST_decodeDecode,
+    NULL, //PAF_AST_decodeStream,           // decodeStream
+    NULL, //PAF_AST_decodeEncode,           // decodeEncode
+    NULL, //PAF_AST_decodeFinalTest,        // decodeFinalTest
+    NULL, //PAF_AST_decodeComplete,         // decodeComplete
+    NULL, //PAF_AST_selectDevices,          // selectDevices
+    NULL, //PAF_AST_sourceDecode,           // sourceDecode
+    NULL, //PAF_AST_startOutput,            // startOutput
+    NULL, //PAF_AST_stopOutput,             // stopOutput
+    NULL, //PAF_AST_setCheckRateX,          // setCheckRateX
+    NULL, //PAF_AST_streamChainFunction,    // streamChainFunction
+    NULL, //PAF_DEC_deviceAllocate,         // deviceAllocate
+    NULL, //PAF_DEC_deviceSelect,           // deviceSelect
+    NULL, //PAF_DEC_computeFrameLength,     // computeFrameLength
+    NULL, //PAF_DEC_updateInputStatus,      // updateInputStatus
+    NULL, /* PAF_BUF_copy, */       // copy
+    NULL, /*headerPrint*/           // headerPrint
+    NULL, /*allocPrint*/            // allocPrint
+    NULL, /*commonPrint*/           // commonPrint
+    NULL, /*bufMemPrint*/           // bufMemPrint
+    NULL, /*memStatusPrint*/        // memStatusPrint
+    // For ARC                      
+    NULL, //PAF_ARC_controlRate,            // controlRate
+};
+#endif
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.h b/procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.h
new file mode 100644 (file)
index 0000000..6880c5d
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ *  ======== audioStreamProc_slave.h ========
+ */
+
+#ifndef _ASP_SLAVE_H_
+#define _ASP_SLAVE_H_
+#include <xdc/std.h>
+
+#include "as1-f2-params.h"
+#include "as1-f2-patchs.h"
+#include "as1-f2-config.h"
+
+// Global debug counter */
+extern Uint32 gTaskAspSlaveCnt; // debug counter for ASP slave task
+
+//   Purpose:   Audio Stream Task Function for initialization of data pointers
+//              by allocation of memory.
+Int
+PAF_AST_initPhaseMallocSlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+//   Purpose:   Audio Stream Task Function for initialization of data values
+//              from parameters.
+Int
+PAF_AST_initPhaseConfigSlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+//   Purpose:   Audio Stream Task Function for initialization of ACP by
+//              instantiation of the algorithm.
+Int
+PAF_AST_initPhaseAcpAlgSlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+//   Purpose:   Audio Stream Task Function for initialization of data pointers
+//              by allocation for common memory and by instantiation for
+//              algorithms.
+Int
+PAF_AST_initPhaseCommonSlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+//   Purpose:   Audio Stream Task Function for initialization of data values
+//              from parameters for Algorithm Keys.
+Int 
+PAF_AST_initPhaseAlgKeySlave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+Int
+PAF_AST_initFrame0Slave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int z
+);
+
+Int
+PAF_AST_initFrame1Slave(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int z, 
+    Int sourceSelect
+);
+
+#endif /* _ASP_SLAVE_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/framework/itopo/params_slave.c b/procsdk_audio_x_xx_xx_xx/test_arm/framework/itopo/params_slave.c
new file mode 100644 (file)
index 0000000..952b12a
--- /dev/null
@@ -0,0 +1,907 @@
+
+/*
+* Copyright (C) 2004-2014 Texas Instruments Incorporated - http://www.ti.com/
+* All rights reserved. 
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+//
+// PAF_DEVICE_VERSION Symbol Definitions
+
+#define PAF_DEVICE_VERSION (PAF_DEVICE & 0xffff)
+
+#include <xdc/cfg/global.h>
+#include <ti/procsdk_audio/procsdk_audio_typ.h>
+
+#include <stdasp.h>
+#include <pafsio_ialg.h>
+
+#include "paf_heapMgr.h"
+
+#include "asp1.h"
+#include "as1-f2-params.h"
+
+//
+// Framework Declarations
+//
+
+//#define PAF_AST_params_fxnsPA PAF_AST_params_fxnsPA17
+#define PAF_AST_params_fxnsPA PAF_AST_params_fxnsPA17_Slave
+
+//
+// Audio Data Representation Definitions
+//
+//   External declarations to patched IROM provide standard functionality.
+//
+
+#if 1
+// FL: extern this, making it look like shared information between ARM/DSP.
+// FL: Note could just define the same thing in separate file for ARM application (i.e. add "Slave" at end of identifier).
+/* audio frame "width" in channels */
+const SmInt PAF_AST_params_numchan[1] =
+{
+    32,
+};
+#else
+extern const SmInt PAF_AST_params_numchan[];
+#endif
+
+///
+// Audio Stream Processing Function Table Definition
+//
+
+const PAF_AudioFunctions PAF_AST_params_audioFrameFunctions_Slave =
+{
+    &PAF_ASP_dB2ToLinear,
+    &PAF_ASP_channelMask,
+    &PAF_ASP_programFormat,
+    &PAF_ASP_sampleRateHz,
+    &PAF_ASP_delay,
+};
+
+//
+// Source Select Array Declarations -- algorithm keys & sio map
+//
+//   External declarations to patched IROM provide standard functionality.
+//
+
+#if 1
+// FL: extern this, making it look like shared information between ARM/DSP.
+// FL: Note could just define the same thing in separate file for ARM application (i.e. add "Slave" at end of identifier).
+const PAF_ASP_AlgKey PAF_ASP_params_decAlgKey =
+{
+    PAF_SOURCE_N,                                           // length
+    /* Relies on the fact that ACP_SERIES_* != 0 here */
+    0,                                                      // PAF_SOURCE_UNKNOWN
+    0,                                                      // PAF_SOURCE_NONE
+    0,                                                      // PAF_SOURCE_PASS
+    PAF_ASP_ALPHACODE (STD, SNG),                           // PAF_SOURCE_SNG
+    0,                                                      // PAF_SOURCE_AUTO
+    0,                                                      // PAF_SOURCE_BITSTREAM
+    PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTSALL
+    PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCMAUTO
+    PAF_ASP_ALPHACODE (STD, PCM),                           // PAF_SOURCE_PCM
+    PAF_ASP_ALPHACODE (STD, PCN),                           // PAF_SOURCE_PC8 /* unused */
+    PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_AC3
+    PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS
+    PAF_ASP_ALPHACODE (STD, AAC),                           // PAF_SOURCE_AAC
+    PAF_ASP_ALPHACODE (STD, MPG),                           // PAF_SOURCE_MPEG /* unused */
+    PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS12
+    PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS13
+    PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS14
+    PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTS16
+    0,                                                      // PAF_SOURCE_WMA9PRO
+    0,                                                      // PAF_SOURCE_MP3
+    PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD1
+    PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD2
+    PAF_ASP_ALPHACODE (STD, DSD),                           // PAF_SOURCE_DSD3
+    PAF_ASP_ALPHACODE (STD, DDP),                           // PAF_SOURCE_DDP
+    PAF_ASP_ALPHACODE (STD, DTSHD),                         // PAF_SOURCE_DTSHD
+    PAF_ASP_ALPHACODE (STD, THD),                           // PAF_SOURCE_THD
+    PAF_ASP_ALPHACODE (STD, DXP),                           // PAF_SOURCE_DXP
+};
+#else
+extern const PAF_ASP_AlgKey PAF_ASP_params_decAlgKey;
+#endif
+
+#if 0
+const PAF_ASP_AlgKey PAF_ASP_params_encAlgKey =
+{
+    PAF_SOURCE_N,                                           // length
+    /* Relies on the fact that ACP_SERIES_* != 0 here */
+    0,                                                      // PAF_SOURCE_UNKNOWN
+    0,                                                      // PAF_SOURCE_NONE
+    0,                                                      // PAF_SOURCE_PASS
+    0,                                                      // PAF_SOURCE_SNG
+    0,                                                      // PAF_SOURCE_AUTO
+    0,                                                      // PAF_SOURCE_BITSTREAM
+    0,                                                      // PAF_SOURCE_DTSALL
+    0,                                                      // PAF_SOURCE_PCMAUTO
+    PAF_ASP_ALPHACODE (STD, PCE),                           // PAF_SOURCE_PCM
+    0,                                                      // PAF_SOURCE_PC8
+    0,                                                      // PAF_SOURCE_AC3
+    0,                                                      // PAF_SOURCE_DTS
+    0,                                                      // PAF_SOURCE_AAC
+    0,                                                      // PAF_SOURCE_MPEG
+    0,                                                      // PAF_SOURCE_DTS12
+    0,                                                      // PAF_SOURCE_DTS13
+    0,                                                      // PAF_SOURCE_DTS14
+    0,                                                      // PAF_SOURCE_DTS16
+    0,                                                      // PAF_SOURCE_WMA9PRO
+    PAF_ASP_ALPHACODE (STD, MPE),                           // PAF_SOURCE_MP3
+    0,                                                      // PAF_SOURCE_DSD1
+    0,                                                      // PAF_SOURCE_DSD2
+    0                                                       // PAF_SOURCE_DSD3
+};
+#endif // FL: #if 0
+
+#if 0
+const PAF_ASP_SioMap PAF_ASP_params_decSioMap =
+{
+    PAF_SOURCE_N,                                           // length
+    PAF_SOURCE_UNKNOWN,                                     // PAF_SOURCE_UNKNOWN -> ...
+    PAF_SOURCE_NONE,                                        // PAF_SOURCE_NONE -> ...
+    PAF_SOURCE_PASS,                                        // PAF_SOURCE_PASS -> ...
+    PAF_SOURCE_PCM,                                         // PAF_SOURCE_SNG -> PCM
+    PAF_SOURCE_AUTO,                                        // PAF_SOURCE_AUTO -> ...
+    PAF_SOURCE_BITSTREAM,                                   // PAF_SOURCE_BITSTREAM -> ...
+    PAF_SOURCE_DTSALL,                                      // PAF_SOURCE_UNUSED1 -> ...
+    PAF_SOURCE_PCMAUTO,                                     // PAF_SOURCE_UNUSED2 -> ...
+    PAF_SOURCE_PCM,                                         // PAF_SOURCE_PCM -> ...
+    PAF_SOURCE_PC8,                                         // PAF_SOURCE_PC8 -> ...
+    PAF_SOURCE_AC3,                                         // PAF_SOURCE_AC3 -> ...
+    PAF_SOURCE_DTS,                                         // PAF_SOURCE_DTS -> ...
+    PAF_SOURCE_AAC,                                         // PAF_SOURCE_AAC -> ...
+    PAF_SOURCE_MPEG,                                        // PAF_SOURCE_MPEG -> ...
+    PAF_SOURCE_DTS12,                                       // PAF_SOURCE_DTS12 -> ...
+    PAF_SOURCE_DTS13,                                       // PAF_SOURCE_DTS13 -> ...
+    PAF_SOURCE_DTS14,                                       // PAF_SOURCE_DTS14 -> ...
+    PAF_SOURCE_DTS16,                                       // PAF_SOURCE_DTS16 -> ...
+    PAF_SOURCE_WMA9PRO,                                     // PAF_SOURCE_WMA9PRO -> ...
+    PAF_SOURCE_MP3,                                         // PAF_SOURCE_MP3 -> ...
+    PAF_SOURCE_DSD1,                                        // PAF_SOURCE_DSD1 -> ...
+    PAF_SOURCE_DSD2,                                        // PAF_SOURCE_DSD2 -> ...
+    PAF_SOURCE_DSD3,                                        // PAF_SOURCE_DSD3 -> ...
+    PAF_SOURCE_DDP,                                         // PAF_SOURCE_DDP -> ...
+    PAF_SOURCE_DTSHD,                                       // PAF_SOURCE_DTSHD -> ...
+    PAF_SOURCE_THD,                                         // PAF_SOURCE_THD -> ...
+    PAF_SOURCE_DXP,                                         // PAF_SOURCE_DXP -> ...
+};
+#endif // FL: #if 0
+
+#if 1
+// FL: This MUST be shared between ARM/DSP.
+// FL: extern this, making it look like shared information between ARM/DSP.
+//
+// Mapping Declarations -- from *coders to *puts
+//
+//   External declarations to patched IROM provide standard functionality.
+//
+const SmInt PAF_AST_streamsFromDecodes_std[DECODEN_MAX] =
+{
+    0, 1, 2,
+};
+#else
+extern const SmInt PAF_AST_streamsFromDecodes_std[DECODEN_MAX];
+#endif
+
+#if 0
+const SmInt PAF_AST_streamsFromEncodes_std[ENCODEN_MAX] =
+{
+    0, 1, 2,
+};
+#endif
+
+const SmInt PAF_AST_inputsFromDecodes_std[DECODEN_MAX] =
+{
+    0, 1, 2,
+};
+
+#if 0
+extern const SmInt PAF_AST_outputsFromEncodes_std[ENCODEN_MAX];
+#ifndef __TI_EABI__
+asm ("_PAF_AST_outputsFromEncodes_std .set _PAF_AST_inputsFromDecodes_std");
+#else
+asm ("PAF_AST_outputsFromEncodes_std .set PAF_AST_inputsFromDecodes_std");
+#endif
+
+#endif // FL: #if 0
+
+#if 0
+//
+// Setting of audio stream order
+//
+
+const SmInt PAF_AST_streamOrder[1] =
+{
+    0,
+};
+#endif // FL: #if 0
+
+//
+// Audio Framework Initialization Function Table Declarations
+//
+//   External declarations to patched IROM provide standard functionality.
+//
+
+extern const PAF_AST_Fxns PAF_AST_params_fxnsPA;
+
+#if 0
+//
+// Audio Framework Status Initialization Declarations
+//
+//   External declarations to patched IROM provide standard functionality.
+//
+
+const PAF_InpBufStatus PAF_AST_params_inpBufStatus =
+{
+    sizeof (PAF_InpBufStatus),                              // size
+    0,                                                      // mode
+    0,                                                      // sioSelect
+    0x80,                                                   // lockOverride = none
+    0,                                                      // unused
+    PAF_SAMPLERATE_UNKNOWN,                                 // sampleRateOverride
+    PAF_SAMPLERATE_NONE,                                    // sampleRateData
+    PAF_SAMPLERATE_NONE,                                    // sampleRateMeasured
+    PAF_SAMPLERATE_UNKNOWN,                                 // sampleRateStatus
+    PAF_IEC_AUDIOMODE_UNKNOWN,                              // nonaudio
+    PAF_IEC_PREEMPHASIS_UNKNOWN,                            // emphasisData
+    0,                                                      // emphasisOverride
+    PAF_IEC_PREEMPHASIS_NO,                                 // emphasisStatus
+    0,                                                      // lock
+    0,                                                      // scanAtHighSampleRateMode
+    0,                                                      // zeroRun
+    0,                                                      // unused2[1] // FL: rateTrackMode
+    24,                                                     // precisionDefault
+    -1,                                                     // precisionDetect
+    0,                                                      // precisionOverride
+    0,                                                      // precisionInput
+    100,                                                    // zeroRunTrigger
+    100,                                                    // zeroRunRestart
+    2048,                                                   // unknownTimeout
+    0,                                                      // lastFrameMask
+    0,                                                      // lastFrameFlag
+    0,                                                      // reportDTS16AsDTSForLargeSampleRate
+    0, 0                                                    // reserved
+};
+#endif // FL: #if 0
+
+#if 1
+// FL: This MUST be shared between ARM/DSP.
+// FL: extern this, making it look like shared information between ARM/DSP.
+const PAF_DecodeStatus PAF_AST_params_decodeStatus_primary =
+{
+    sizeof (PAF_DecodeStatus),                              // size
+    1,                                                      // mode
+    0,                                                      // unused1
+    0,                                                      // command.action
+    0,                                                      // command.result
+    PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
+    PAF_SOURCE_NONE,                                        // sourceSelect
+    PAF_SOURCE_UNKNOWN,                                     // sourceProgram
+    PAF_SOURCE_UNKNOWN,                                     // sourceDecode
+    PAF_SOURCE_DUAL_STEREO,                                 // sourceDual
+    4,                                                      // sourceKaraoke: both
+    0,                                                      // aspGearControl: unused
+    0,                                                      // aspGearStatus: unused
+    0, 0, 0, 0,                                                                                                // Unused
+    0, 0, 0, 0,                                                                                                // Unused
+    0, 0, 0, 0,                                                                                                // Unused
+    0, 0, 0, 0,                                                                                                // Unused
+    0, 0, 0, 0,                                                                                                // Unused
+    0,                                                      // frameCount
+    0x40,                                                   // karaoka: Vocal 1 Level
+    0x40,                                                   // karaoka: Vocal 1 Pan
+    0x40,                                                   // karaoka: Vocal 2 Level
+    0xc0,                                                   // karaoka: Vocal 2 Pan
+    0x40,                                                   // karaoka: Melody Level
+    0x00,                                                   // karaoka: Melody Pan
+    0,                                                      // decBypass
+    0,                                                      // unused
+       0,                                                                              // frameLength: reset later
+    1,                                                                         // bufferRatio: unity
+    PAF_IEC_PREEMPHASIS_UNKNOWN,                                               // emphasis
+       0,                                                                                                      // bufferDrift
+       0, 0,
+       PAF_CC_SAT_SURROUND4, PAF_CC_SUB_ONE, PAF_CC_AUX_SURROUND4_UNKNOWN, 0, 0, 0, 0, 0,      
+    // channelConfigurationRequest.full
+    PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,     
+    // channelConfigurationProgram.full
+    PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,     
+    // channelConfigurationDecode.full
+    PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,     
+    // channelConfigurationDownmix.full
+    PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0, 0, 0, 0, 0,     
+    // channelConfigurationOverride.full 
+    -3,                                                     // channelMap.from[0]
+    -3,                                                     // channelMap.from[1]
+    -3,                                                     // channelMap.from[2]
+    -3,                                                     // channelMap.from[3]
+    -3,                                                     // channelMap.from[4]
+    -3,                                                     // channelMap.from[5]
+    -3,                                                     // channelMap.from[6]
+    -3,                                                     // channelMap.from[7]
+    -3,                                                     // channelMap.from[8]
+    -3,                                                     // channelMap.from[9]
+    -3,                                                     // channelMap.from[10]
+    -3,                                                     // channelMap.from[11]
+    -3,                                                     // channelMap.from[12]
+    -3,                                                     // channelMap.from[13]
+    -3,                                                     // channelMap.from[14]
+    -3,                                                     // channelMap.from[15]
+    -3,                                                     // channelMap.from[16]
+    -3,                                                     // channelMap.from[17]
+    -3,                                                     // channelMap.from[18]
+    -3,                                                     // channelMap.from[19]
+    -3,                                                     // channelMap.from[20]
+    -3,                                                     // channelMap.from[21]
+    -3,                                                     // channelMap.from[22]
+    -3,                                                     // channelMap.from[23]
+    -3,                                                     // channelMap.from[24]
+    -3,                                                     // channelMap.from[25]
+    -3,                                                     // channelMap.from[26]
+    -3,                                                     // channelMap.from[27]
+    -3,                                                     // channelMap.from[28]
+    -3,                                                     // channelMap.from[29]
+    -3,                                                     // channelMap.from[30]
+    -3,                                                     // channelMap.from[31]
+    -3,                                                     // channelMap.to[0]
+    -3,                                                     // channelMap.to[1]
+    -3,                                                     // channelMap.to[2]
+    -3,                                                     // channelMap.to[3]
+    -3,                                                     // channelMap.to[4]
+    -3,                                                     // channelMap.to[5]
+    -3,                                                     // channelMap.to[6]
+    -3,                                                     // channelMap.to[7]
+    -3,                                                     // channelMap.to[8]
+    -3,                                                     // channelMap.to[9]
+    -3,                                                     // channelMap.to[10]
+    -3,                                                     // channelMap.to[11]
+    -3,                                                     // channelMap.to[12]
+    -3,                                                     // channelMap.to[13]
+    -3,                                                     // channelMap.to[14]
+    -3,                                                     // channelMap.to[15]
+    -3,                                                     // channelMap.to[16]
+    -3,                                                     // channelMap.to[17]
+    -3,                                                     // channelMap.to[18]
+    -3,                                                     // channelMap.to[19]
+    -3,                                                     // channelMap.to[20]
+    -3,                                                     // channelMap.to[21]
+    -3,                                                     // channelMap.to[22]
+    -3,                                                     // channelMap.to[23]
+    -3,                                                     // channelMap.to[24]
+    -3,                                                     // channelMap.to[25]
+    -3,                                                     // channelMap.to[26]
+    -3,                                                     // channelMap.to[27]
+    -3,                                                     // channelMap.to[28]
+    -3,                                                     // channelMap.to[29]
+    -3,                                                     // channelMap.to[30]
+    -3,                                                     // channelMap.to[31]
+    0,                                                      // programFormat.mask
+    0,                                                      // programFormat.form
+   
+};
+#else
+extern const PAF_DecodeStatus PAF_AST_params_decodeStatus_primary;
+#endif
+
+#if 1
+// FL: extern this, making it look like shared information between ARM/DSP.
+// FL: Note could just define the same thing in separate file for ARM application (i.e. add "Slave" at end of identifier).
+/* audio frame "width" in channels */
+const PAF_DecodeStatus *const PAF_AST_params_decodeStatus[] =
+{
+    &PAF_AST_params_decodeStatus_primary,
+};
+#else   
+extern const PAF_DecodeStatus *const PAF_AST_params_decodeStatus[];
+#endif // FL: #if 0
+
+#if 0
+const PAF_OutBufStatus PAF_AST_params_outBufStatus =
+{
+    sizeof (PAF_OutBufStatus),                              // size
+    1,                                                      // mode
+    0,                                                      // sioSelect
+    PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
+    0,                                                      // audio
+    PAF_OB_CLOCK_INTERNAL,                                  // clock
+    PAF_OB_FLUSH_ENABLE,                                    // flush
+    0,                                                      // unused[2] // FL: rateTrackMode
+    0,                                                      // PAF_OB_MARKER_ENABLED // FL: markerMode
+    0                                                       // FL: maxNumBufOverride
+                                                            // FL: (*** ?) missing init. values for numBufOverride[PAF_SOURCE_N]
+};
+#endif // FL: #if 0
+
+#if 0
+const PAF_EncodeStatus PAF_AST_params_encodeStatus_primary =
+{
+    sizeof (PAF_EncodeStatus),                              // size
+    1,                                                      // mode
+    0,                                                      // unused1
+    PAF_SAMPLERATE_UNKNOWN,                                 // sampleRate
+    0,                                                      // channelCount
+    0, 0, 0, 0,                                                                                                //Unused                                        
+    0, 0, 0, 0,                                                                                                //Unused
+    0, 0, 0, 0,                                                                                        //Unused
+    0, 0, 0, 0,                                                                                                //Unused
+    0, 0, 0, 0,                                                                                        //Unused
+    0,                                                      // frameLength
+    0,                                                      // encBypass
+    PAF_SOURCE_PCM,                                         // select
+       PAF_CC_SAT_SURROUND4, PAF_CC_SUB_ONE, PAF_CC_AUX_SURROUND4_UNKNOWN, 0,0,0,0,0,
+    // channelConfigurationRequest.full
+    PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0,0,0,0,0,
+    // channelConfigurationStream.full
+    PAF_CC_SAT_UNKNOWN, PAF_CC_SUB_ZERO, 0, 0,0,0,0,0,
+    // channelConfigurationEncode.full
+    0, 0, 0, 0,        0, 0, 0, 0,                                                             //Unused
+    -3,                                                     // channelMap.from[0]
+    -3,                                                     // channelMap.from[1]
+    -3,                                                     // channelMap.from[2]
+    -3,                                                     // channelMap.from[3]
+    -3,                                                     // channelMap.from[4]
+    -3,                                                     // channelMap.from[5]
+    -3,                                                     // channelMap.from[6]
+    -3,                                                     // channelMap.from[7]
+    -3,                                                     // channelMap.from[8]
+    -3,                                                     // channelMap.from[9]
+    -3,                                                     // channelMap.from[10]
+    -3,                                                     // channelMap.from[11]
+    -3,                                                     // channelMap.from[12]
+    -3,                                                     // channelMap.from[13]
+    -3,                                                     // channelMap.from[14]
+    -3,                                                     // channelMap.from[15]
+    -3,                                                     // channelMap.to[0]
+    -3,                                                     // channelMap.to[1]
+    -3,                                                     // channelMap.to[2]
+    -3,                                                     // channelMap.to[3]
+    -3,                                                     // channelMap.to[4]
+    -3,                                                     // channelMap.to[5]
+    -3,                                                     // channelMap.to[6]
+    -3,                                                     // channelMap.to[7]
+    -3,                                                     // channelMap.to[8]
+    -3,                                                     // channelMap.to[9]
+    -3,                                                     // channelMap.to[10]
+    -3,                                                     // channelMap.to[11]
+    -3,                                                     // channelMap.to[12]
+    -3,                                                     // channelMap.to[13]
+    -3,                                                     // channelMap.to[14]
+    -3,                                                     // channelMap.to[15]
+    -3,                                                     // channelMap.from[0]
+    -3,                                                     // channelMap.from[1]
+    -3,                                                     // channelMap.from[2]
+    -3,                                                     // channelMap.from[3]
+    -3,                                                     // channelMap.from[4]
+    -3,                                                     // channelMap.from[5]
+    -3,                                                     // channelMap.from[6]
+    -3,                                                     // channelMap.from[7]
+    -3,                                                     // channelMap.from[8]
+    -3,                                                     // channelMap.from[9]
+    -3,                                                     // channelMap.from[10]
+    -3,                                                     // channelMap.from[11]
+    -3,                                                     // channelMap.from[12]
+    -3,                                                     // channelMap.from[13]
+    -3,                                                     // channelMap.from[14]
+    -3,                                                     // channelMap.from[15]
+    -3,                                                     // channelMap.to[0]
+    -3,                                                     // channelMap.to[1]
+    -3,                                                     // channelMap.to[2]
+    -3,                                                     // channelMap.to[3]
+    -3,                                                     // channelMap.to[4]
+    -3,                                                     // channelMap.to[5]
+    -3,                                                     // channelMap.to[6]
+    -3,                                                     // channelMap.to[7]
+    -3,                                                     // channelMap.to[8]
+    -3,                                                     // channelMap.to[9]
+    -3,                                                     // channelMap.to[10]
+    -3,                                                     // channelMap.to[11]
+    -3,                                                     // channelMap.to[12]
+    -3,                                                     // channelMap.to[13]
+    -3,                                                     // channelMap.to[14]
+    -3,                                                     // channelMap.to[15]
+    0,                                                                         // programFormat.mask
+    0,                                                                         // programFormat.form
+    0,                                                      // sampleProcess[0]
+};
+#endif // FL: #if 0
+
+#if 0
+const PAF_EncodeStatus *const PAF_AST_params_encodeStatus[] =
+{
+    &PAF_AST_params_encodeStatus_primary,
+};
+#endif // FL: #if 0
+
+#if 0
+const PAF_VolumeStatus PAF_AST_params_volumeStatus =
+{
+    sizeof (PAF_VolumeStatus),                              // size
+    1,                                                      // mode
+    PAF_MAXNUMCHAN,                                         // channelCount
+    0x0f,                                                   // implementation
+    0,                                                      // unused1
+    50,                                                     // rampTime: 50 msec/dB (20 dB/sec)
+    0,                                                      // unused2
+    0,                                                      // unused3
+    -2 * 20, 0, 0, 0,                                       // master
+    -2 * 0, 0, 0, 0,                                        // trim
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //  
+    -2 * 0, 0, 0, 0,                                        // trim - upper16
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+    -2 * 0, 0, 0, 0,                                        //
+
+};
+#endif // FL: #if 0
+
+//
+// Common Space Parameter Declarations and Definitions
+//
+//   Local definitions in RAM provide non-standard functionality.
+//   The NULL pointer provides standard functionality.
+//
+
+/* baseline definition - NULL equivalent */
+/* May be used for overrides of IALG_MemSpace */
+
+static const IALG_MemSpace params_memspace_PAi_Slave[] = {
+    PAF_IALG_NONE,                                          // Scratch
+    PAF_IALG_NONE,                                          // Persistant
+    PAF_IALG_NONE,                                          // Write once
+    PAF_IALG_NONE,                                          // Common 1
+    PAF_IALG_NONE,                                          // Common 2
+    PAF_IALG_NONE,                                          // Common 3
+    PAF_IALG_NONE,                                          // Common 4
+    PAF_IALG_NONE,                                          // Common 5
+    PAF_IALG_NONE,                                          // Common 6
+    PAF_IALG_NONE,                                          // Common 7
+    IALG_EXTERNAL,                                          // Common 8
+    PAF_IALG_NONE,                                          // Common 9
+    PAF_IALG_NONE,                                          // Common 10
+    PAF_IALG_NONE,                                          // Common 11
+    PAF_IALG_NONE,                                          // Common 12
+    PAF_IALG_NONE,                                          // Common 13
+    PAF_IALG_NONE,                                          // Common 14
+    PAF_IALG_NONE,                                          // Common 15
+};
+
+//
+// Heap Declarations
+//
+
+//#include <pafhjt.h>
+
+//extern int IRAM;
+//extern int SDRAM;
+//extern int L3RAM;
+
+#if 0
+// .............................................................................
+// DIB memory requirements
+
+// primary input
+const IALG_MemRec inpMemTabPrimary[] =
+{
+    // SDRAM circular buffer
+    // 2 buffers * 256 samples/buffer * 8 words/sample * 3 bytes/word
+    {
+        3 * 60 * 1024,                                          // size
+        //180 * 1024,                                           // size
+        //6 * 60 * 1024,                                        // size
+        128,                                                    // alignment
+        IALG_SARAM1, //IALG_EXTERNAL,                           // space
+        IALG_PERSIST,                                           // attrs
+        NULL,                                                   // base
+     },
+
+    // IRAM scratch memory for autodetection and stereo PCM input
+    // High watermark needs are set by the latter:
+    // double buffer stereo 32bit PCM input 512 max frame size
+    // 1 buffers * 512 samples/buffer * 2 words/sample * 4 bytes/word
+    {
+        8 * 1024,                                              // size
+        128,                                                   // alignment
+        IALG_SARAM,                                            // space
+        IALG_SCRATCH,                                          // attrs
+        NULL,                                                  // base
+    }
+};
+
+const PAF_SIO_IALG_Params inpSioAlgParamsPrimary =
+{
+    2,
+    inpMemTabPrimary
+};
+
+const PAF_ASP_LinkInit inpLinkInitPrimary[] =
+{
+    PAF_ASP_LINKINITPARAMS (STD, IB, TIH, &inpSioAlgParamsPrimary),
+    PAF_ASP_LINKNONE
+};
+
+const PAF_ASP_LinkInit *const inpLinkInit[] =
+{
+    inpLinkInitPrimary
+};
+
+// .............................................................................
+// DOB memory requirements
+
+// primary output
+const IALG_MemRec outMemTabPrimary[] =
+{
+    // SDRAM buffer
+    // 4 buffers * 256 samples * 32 ch * 4 bytes
+               {
+                       4 * 256 * 32 * 4,                                      // size: note:
+                       //6 * 256 * 32 * 4,                                      // size: note:
+                       //16 * 256 * 32 * 4,                                      // size: note:
+                       128,                                                   // alignment
+                       IALG_EXTERNAL,                                         // space
+                       IALG_PERSIST,                                          // attrs
+                       NULL,                                                  // base
+               }
+};
+
+
+const PAF_SIO_IALG_Params outSioAlgParamsPrimary =
+{
+    1,
+    outMemTabPrimary
+};
+
+const PAF_ASP_LinkInit outLinkInitPrimary[] =
+{
+    PAF_ASP_LINKINITPARAMS (STD, OB, TIH, &outSioAlgParamsPrimary),
+    PAF_ASP_LINKNONE
+};
+
+const PAF_ASP_LinkInit * const outLinkInit[] =
+{
+    outLinkInitPrimary,
+};
+
+
+// .............................................................................
+// sourceProgram mapped to DOB num of buffers
+const PAF_ASP_outNumBufMap outPrimaryNumBufMap =
+{
+    4,                                                      // maxNumBuf
+//    6,                                                      // maxNumBuf
+//    16,                                                      // maxNumBuf
+    PAF_SOURCE_N,                                           // length
+    0,                                                      // PAF_SOURCE_UNKNOWN
+    0,                                                      // PAF_SOURCE_NONE
+    2,                                                      // PAF_SOURCE_PASS
+    2,                                                      // PAF_SOURCE_SNG
+    0,                                                      // PAF_SOURCE_AUTO
+    0,                                                      // PAF_SOURCE_BITSTREAM
+    0,                                                      // PAF_SOURCE_DTSALL
+    0,                                                      // PAF_SOURCE_PCMAUTO
+    2,                                                      // PAF_SOURCE_PCM
+    0,                                                      // PAF_SOURCE_PC8
+    2,                                                      // PAF_SOURCE_AC3
+    2,                                                      // PAF_SOURCE_DTS
+    2,                                                      // PAF_SOURCE_AAC
+    0,                                                      // PAF_SOURCE_MPEG
+    2,                                                      // PAF_SOURCE_DTS12
+    2,                                                      // PAF_SOURCE_DTS13
+    2,                                                      // PAF_SOURCE_DTS14
+    2,                                                      // PAF_SOURCE_DTS16
+    0,                                                      // PAF_SOURCE_WMA9PRO
+    0,                                                      // PAF_SOURCE_MP3
+    2,                                                      // PAF_SOURCE_DSD1,
+    2,                                                      // PAF_SOURCE_DSD2,
+    2,                                                      // PAF_SOURCE_DSD3,
+    4,                                                      // PAF_SOURCE_DDP
+    4,                                                      // PAF_SOURCE_DTSHD
+    4,                                                      // PAF_SOURCE_THD
+//    6,                                                      // PAF_SOURCE_THD
+//    16,                                                      // PAF_SOURCE_THD
+    4,                                                      // PAF_SOURCE_DXP
+
+};
+
+const PAF_ASP_outNumBufMap *const outNumBufMap[] =
+{
+       &outPrimaryNumBufMap,
+};
+#endif // FL: #if 0
+
+// .............................................................................
+const PAF_MetadataBufStatus PAF_AST_params_MetadataBufStatus_Slave[] =
+{
+    4 * 1024,               // bufSize
+    PAF_MAX_NUM_PRIVATE_MD, // NumBuf
+    128,                    // alignment
+    &gPafHeapIdExt //&SDRAM // &IRAM,        // pSpace
+};
+
+#if 0 // FL: maybe needed on ARM if there's an audio frame buffer defined for decode (and possible stream)
+// .............................................................................
+//
+// This structure defines the memory allocation of audio frame buffers (channel buffers). Users can customize this structure based
+// on their requirement. IALG_SARAM specifies the audio frame buffer is allocated in IRAM and IALG_EXTERNAL
+// specifies the audio frame buffer is allocated in SDRAM. By allocating few channel buffers in SDRAM, users can save internal memory
+// but trading performance
+// This structure defined for PAF_MAXNUMCHAN number of channels. But channel buffers will be allocated  for "PAF_AST_params_numchan"
+// number of channels only.
+//
+
+const PAF_AudioFrameBufStatus  PAF_AST_params_AudioFrameBufStatus[PAF_MAXNUMCHAN] =
+{
+       IALG_SARAM, // 0
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM, // 16
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM,
+       IALG_SARAM, // 31
+       //IALG_EXTERNAL, // 16
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL,
+       //IALG_EXTERNAL // 31
+};
+#endif // FL: #if 0
+
+// .............................................................................
+//
+// Audio Stream Parameter Definitions
+//
+//   Global definition in RAM provides standard & non-standard functionality.
+//
+
+const PAF_AST_Params params_PAi_Slave =
+{
+    &PAF_AST_params_fxnsPA,                               // fxns
+    {                                                       // zone
+        0,                                                     // master
+        1,                                                     // inputs
+        0,                                                     // input1
+        1,                                                     // inputN
+        1,                                                     // decodes
+        0,                                      &nbs