]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/commitdiff
AST split, initial code
authorFrank Livingston <frank-livingston@ti.com>
Thu, 21 Jul 2016 21:23:21 +0000 (16:23 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Thu, 21 Jul 2016 21:23:21 +0000 (16:23 -0500)
30 files changed:
procsdk_audio_x_xx_xx_xx/common/audioStreamProc_common.c
procsdk_audio_x_xx_xx_xx/common/audioStreamProc_common.h
procsdk_audio_x_xx_xx_xx/common/audioStreamProc_config.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/audioStreamProc_params.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/audioStreamProc_patchs.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.c
procsdk_audio_x_xx_xx_xx/common/paf_decOpCircBuf.h
procsdk_audio_x_xx_xx_xx/test_arm/application/app.cfg
procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamDecodeProc.c [moved from procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.c with 83% similarity]
procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamDecodeProc.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamDecodeProc_paramsFxns.c [moved from procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_paramsFxns_slave.c with 58% similarity]
procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.h [deleted file]
procsdk_audio_x_xx_xx_xx/test_arm/framework/itopo/params_slave.c [deleted file]
procsdk_audio_x_xx_xx_xx/test_arm/framework/itopo/patchs_slave.c [deleted file]
procsdk_audio_x_xx_xx_xx/test_arm/framework/systemInit.c
procsdk_audio_x_xx_xx_xx/test_dsp/application/app.cfg
procsdk_audio_x_xx_xx_xx/test_dsp/application/itopo/evmk2g/io.c
procsdk_audio_x_xx_xx_xx/test_dsp/framework/as0.c
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc.h [moved from procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamProc.h with 51% similarity]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc_paramsFxns.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamOutProc.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamOutProc.h [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamOutProc_paramsFxns.c [new file with mode: 0644]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamProc.c [deleted file]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamProc_paramsFxns.c [deleted file]
procsdk_audio_x_xx_xx_xx/test_dsp/framework/itopo/params.c
procsdk_audio_x_xx_xx_xx/test_dsp/framework/itopo/patchs.c
procsdk_audio_x_xx_xx_xx/test_dsp/framework/systemInit.c
procsdk_audio_x_xx_xx_xx/test_dsp/sio/dbgDob.c

index fc4b2f85ac40461ea7465d4ec74865a932cc5edf..df60dd5e9e349415064c26176ae6aae641cbb9ec 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <xdc/std.h>
 
-#include "as1-f2-config.h"
+#include "audioStreamProc_config.h"
 
 // Task data
 #ifndef _TMS320C6X
index cf867768ba1ca677800ed429a3ff972c71e7a8ab..e0f1424bc8e8b61ce43b2dcc2df7c83c5c0f962b 100644 (file)
@@ -6,7 +6,7 @@
 #define _ASP_COMMON_H_
  
 #include <xdc/std.h>
-#include "as1-f2-config.h"
+#include "audioStreamProc_config.h"
 #include "paf_heapMgr.h"
 
 // .............................................................................
diff --git a/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_config.h b/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_config.h
new file mode 100644 (file)
index 0000000..533faa6
--- /dev/null
@@ -0,0 +1,149 @@
+
+/*
+* 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 #2 -- Configuration Declarations
+//
+//
+//
+
+#ifndef _AS1_F2_CONFIG_H_
+#define _AS1_F2_CONFIG_H_
+
+#include <xdc/std.h>
+//#include <ti/procsdk_audio/procsdk_audio_typ.h>
+#include <procsdk_audio_typ.h>
+
+#include "alg.h"
+#include <sio.h>
+
+#include <acp.h>
+
+#include <paftyp.h>
+#include <inpbuf.h>
+#include <pafdec.h>
+#include <pafenc.h>
+#include <pafvol.h>
+#include <outbuf.h>
+
+#include "as1-f2.h"
+#include "asp0.h"
+
+#include "paf_decOpCircBuf.h"
+
+#ifdef HSE_MSGQ
+#include <msgq.h>
+#include <pool.h>
+#include <staticpool.h>
+#endif
+
+//
+// Audio Framework Configuration
+//
+
+typedef struct PAF_AST_InpBuf {
+    SIO_Handle          hRxSio;
+    PAF_InpBufConfig    inpBufConfig;
+    PAF_InpBufConfig   *pInpBuf; /* Decode Processing Temporary */
+    PAF_InpBufStatus    inpBufStatus;
+    PAF_ASP_Chain       inpChainData;
+} PAF_AST_InpBuf;
+
+typedef struct PAF_AST_Decode {
+    PAF_DecodeControl   decodeControl;
+    PAF_DecodeStatus    decodeStatus;
+    PAF_DecodeInStruct  decodeInStruct;
+    PAF_DecodeOutStruct decodeOutStruct;
+    PAF_ASP_Chain       decChainData;
+    ALG_Handle          decAlg[PAF_SOURCE_N];
+    PAF_AudioFrame     *pAudioFrame;
+    PAF_DecodeOpCircBuf decOpCb;
+} PAF_AST_Decode;
+
+typedef struct PAF_AST_Stream {
+    PAF_AudioData      *audioFrameChannelPointers[PAF_MAXNUMCHAN_AF];
+    PAF_AudioSize       audioFrameChannelSizes[PAF_MAXNUMCHAN_AF];
+    PAF_AudioFrame     *pAudioFrame;
+    PAF_ASP_Chain       aspChainData[GEARS];
+    PAF_ASP_Chain      *aspChain[GEARS];
+    PAF_AudioData      *origAudioFrameChannelPointers[PAF_MAXNUMCHAN_AF];
+} PAF_AST_Stream;
+
+typedef struct PAF_AST_OutBuf {
+    SIO_Handle          hTxSio; // (*** ?) FL: SIO
+    PAF_OutBufConfig    outBufConfig;
+    PAF_OutBufConfig   *pOutBuf; /* Decode Processing Temporary */
+    PAF_OutBufStatus    outBufStatus;
+    PAF_ASP_Chain       outChainData;
+} PAF_AST_OutBuf;
+
+typedef struct PAF_AST_Encode {
+    PAF_EncodeControl   encodeControl;
+    PAF_EncodeStatus    encodeStatus;
+    PAF_VolumeStatus    volumeStatus;
+    PAF_EncodeInStruct  encodeInStruct;
+    PAF_EncodeOutStruct encodeOutStruct;
+    PAF_ASP_Chain       encChainData;
+    ALG_Handle          encAlg[PAF_SOURCE_N];
+} PAF_AST_Encode;
+
+#ifdef HSE_MSGQ
+typedef struct PAF_AST_MQ {
+    MSGQ_Queue rx;
+    MSGQ_Queue reply;
+} PAF_AST_MQ;
+#endif
+
+typedef struct PAF_AST_Config {
+    Int                 as;
+    ACP_Handle          acp;
+    ACP_Handle          acpSlave;
+    PAF_AST_InpBuf      *xInp; /* INPUT1 -INPUTN  */
+    PAF_AST_Decode      *xDec; /* DECODE1-DECODEN  */
+    PAF_AST_Stream      *xStr; /* STREAM1-STREAMN */
+    PAF_AST_Encode      *xEnc; /* ENCODE1-ENCODEN */
+    PAF_AST_OutBuf      *xOut; /* OUTPUT1-OUTPUTN */
+    SmInt               masterDec; // these two are computer based on MASTER input
+    SmInt               masterStr;
+#ifdef HSE_MSGQ
+    PAF_AST_MQ          mq;
+#endif
+} PAF_AST_Config;
+
+extern PAF_AST_Config *pC;  /* Global configuration pointer */
+
+
+#endif  /* _AS1_F2_CONFIG_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_params.h b/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_params.h
new file mode 100644 (file)
index 0000000..0d57f9f
--- /dev/null
@@ -0,0 +1,254 @@
+
+/*
+* 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 #2 -- Parameter Declarations
+//
+//
+//
+
+#ifndef _AS1_F2_PARAMS_H_
+#define _AS1_F2_PARAMS_H_
+
+//#include <ti/procsdk_audio/procsdk_audio_typ.h>
+#include <procsdk_audio_typ.h>
+#include <ti/sysbios/heaps/HeapMem.h>
+
+#include <xdc/std.h>
+#include <ti/xdais/ialg.h>
+#include <sio.h>
+
+#include <acp.h>
+
+#include "alg.h"
+#include "asp0.h"
+
+#include <paftyp.h>
+#include <inpbuf.h>
+#include <pafdec.h>
+#include <pafenc.h>
+#include <pafvol.h>
+#include <outbuf.h>
+
+#include <as1-f2.h>
+
+//
+// Source Select Arrays -- algorithm keys & sio map
+//
+
+typedef struct PAF_ASP_AlgKey {
+    Int length;
+    PAF_ASP_AlphaCode code[PAF_SOURCE_N /* ostensibly */];
+} PAF_ASP_AlgKey;
+
+typedef struct PAF_ASP_SioMap {
+    Int length;
+    SmInt map[PAF_SOURCE_N /* ostensibly */];
+} PAF_ASP_SioMap;
+
+typedef struct PAF_ASP_outNumBufMap {
+    Int maxNumBuf;
+    Int length;
+    SmInt map[PAF_SOURCE_N];
+} PAF_ASP_outNumBufMap;
+
+typedef struct PAF_MetadataBufStatus {
+    Int bufSize;    //Meta data buffer size
+    Int NumBuf;     //Number of metadata buffers
+    Int alignment;  //Buffer alignment
+    Int *pHeadIdSpace; //Int *pSpace;    //Internal/external memory
+} PAF_MetadataBufStatus;
+
+typedef struct PAF_AudioFrameBufStatus {
+    IALG_MemSpace   space[PAF_MAXNUMCHAN];
+}PAF_AudioFrameBufStatus;
+
+//
+// Audio Framework Functions
+//
+
+struct PAF_AST_Params;
+struct PAF_AST_Patchs;
+struct PAF_AST_Config;
+
+typedef struct PAF_AST_Fxns {
+    Int (*initPhase[8]) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
+    Int (*initFrame0) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
+    Int (*initFrame1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
+    Int (*passProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
+    Int (*passProcessingCopy) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
+    Int (*autoProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, ALG_Handle);
+
+    //FL: Source select index takes place of ALG_Handle. Temporary retain ALG_Handle.
+    //Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle);
+    //Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle, Int);
+    Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
+    
+    Int (*decodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
+    Int (*encodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
+    
+    //FL: Source select index takes place of ALG_Handle. Temporary retain ALG_Handle.
+    //Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *);
+    //Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int);
+    Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
+    
+    //Int (*decodeInfo) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    Int (*decodeInfo) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
+    
+    //Int (*decodeInfo1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    Int (*decodeInfo1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
+    
+    //Int (*decodeInfo2) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    Int (*decodeInfo2) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
+    
+    Int (*decodeCont) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    
+    //FL: Source select index takes place of ALG_Handle. Temporary retain ALG_Handle.
+    //Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    //Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int, Int);
+    Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
+    
+    //Int (*decodeStream) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    Int (*decodeStream) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
+    
+    //Int (*decodeEncode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    Int (*decodeEncode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
+    
+    //Int (*decodeFinalTest) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    Int (*decodeFinalTest) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
+    
+    Int (*decodeComplete) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
+    Int (*selectDevices) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
+    Int (*sourceDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
+    
+    Int (*startOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
+    //Int (*startOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, double);
+    
+    Int (*stopOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
+    Int (*setCheckRateX) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
+    Int (*streamChainFunction) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
+    Int (*deviceAllocate) (SIO_Handle *, int, int, int, Ptr); // FL: (***? ) SIO
+    Int (*deviceSelect) (SIO_Handle *, int, int, Ptr); // FL: (***? ) SIO
+    
+    //Int (*computeFrameLength) (ALG_Handle, Int, Int);
+    Int (*computeFrameLength) (Int, Int, Int); //FL: change ALG_Handle to zone index
+    
+    Int (*updateInputStatus) (SIO_Handle, PAF_InpBufStatus *, PAF_InpBufConfig *); // (***? ) FL: SIO
+    Int (*copy) (Uns, PAF_InpBufConfig *, Uns, PAF_OutBufConfig *);
+
+#ifdef HSE
+    Int (*setPri) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
+#endif
+
+    // For RAM_report
+    Void (*headerPrint)();
+    Int  (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
+    Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
+    Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
+    //Void (*memStatusPrint)(Int internal, Int external, Int internal1);
+    Void (*memStatusPrint)(HeapMem_Handle hInternalHeap, HeapMem_Handle hInternal1Heap, HeapMem_Handle hExternalHeap, HeapMem_Handle hInternal1HeapShm);
+
+    // For ARC
+    //Int (*controlRate) (SIO_Handle, SIO_Handle, ACP_Handle);
+    //Int (*controlRate) (SIO_Handle, SIO_Handle, ACP_Handle, double);
+
+} PAF_AST_Fxns;
+
+//
+// Audio Framework Parameters
+//
+
+typedef struct PAF_AST_Params {
+    const PAF_AST_Fxns *fxns;
+    struct {
+        SmInt master;
+        SmInt inputs;
+        SmInt input1;
+        SmInt inputN;
+        SmInt decodes;
+        SmInt decode1;
+        SmInt decodeN;
+        SmInt streams;
+        SmInt stream1; /* unused */
+        SmInt streamN; /* unused */
+        SmInt encodes;
+        SmInt encode1;
+        SmInt encodeN;
+        SmInt outputs;
+        SmInt output1;
+        SmInt outputN;
+    } zone;
+    const SmInt *inputsFromDecodes;
+    const SmInt *outputsFromEncodes;
+    struct {
+        int *pHeapIdIntern;   //int *pIntern;
+        int *pHeapIdExtern;   //int *pExtern;
+        int *pHeapIdInpbuf;   //int *pInpbuf;
+        int *pHeapIdOutbuf;   //int *pOutbuf;
+        int *pHeapIdFrmbuf;   //int *pFrmbuf;
+        int *pHeapIdIntern1;  //int *pIntern1;
+        int clear; 
+    } heap;
+    struct {
+        const IALG_MemSpace *space;
+    } common;
+    const LgInt *z_rx_bufsiz;
+    const LgInt *z_tx_bufsiz;
+    const SmInt *z_numchan;
+    MdInt framelength;
+    const PAF_AudioFunctions *pAudioFrameFunctions;
+    const struct PAF_ASP_ChainFxns *pChainFxns;
+    const PAF_InpBufStatus *pInpBufStatus;
+    const PAF_DecodeStatus * const *z_pDecodeStatus;
+    const PAF_OutBufStatus *pOutBufStatus;
+    const PAF_EncodeStatus * const *z_pEncodeStatus;
+    const PAF_VolumeStatus *pVolumeStatus;
+    const PAF_ASP_AlgKey *pDecAlgKey;
+    const PAF_ASP_AlgKey *pEncAlgKey;
+    const PAF_ASP_SioMap *pDecSioMap;
+    const SmInt *streamsFromDecodes;
+    const SmInt *streamsFromEncodes;
+    const MdInt maxFramelength;
+    const SmInt *streamOrder;
+    const PAF_ASP_LinkInit * const (*i_inpLinkInit);
+    const PAF_ASP_LinkInit * const (*i_outLinkInit);
+    const PAF_ASP_outNumBufMap *  const (*poutNumBufMap);
+    const PAF_MetadataBufStatus *pMetadataBufStatus;
+    const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
+} PAF_AST_Params;
+
+#endif  /* _AS1_F2_PARAMS_H_ */
+
diff --git a/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_patchs.h b/procsdk_audio_x_xx_xx_xx/common/audioStreamProc_patchs.h
new file mode 100644 (file)
index 0000000..a1508c1
--- /dev/null
@@ -0,0 +1,93 @@
+
+/*
+* 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 #2 -- Patch Declarations
+//
+//
+//
+
+#ifndef AS1_F2_PATCHS_
+#define AS1_F2_PATCHS_
+
+#include <xdc/std.h>
+#include <pafsio.h>
+#include <asp0.h>
+
+#include <as1-f2.h>
+
+//
+// IROM-Inclusion Definitions
+//
+
+/* optional */
+// #define PAF_AST_PATCHS_PA17
+// #define PAF_AST_PATCHS_PA17U
+// #define PAF_AST_PATCHS_PA17I
+// #define PAF_AST_PATCHS_PA17Y /* not working? */
+// #define PAF_AST_PATCHS_PA17Z /* not working? */
+
+#if ! defined (PAF_AST_PATCHS_PA17) \
+    && ! defined (PAF_AST_PATCHS_PA17U) \
+    && ! defined (PAF_AST_PATCHS_PA17I) \
+    && ! defined (PAF_AST_PATCHS_PA17D) \
+    && ! defined (PAF_AST_PATCHS_PA17Y) \
+    && ! defined (PAF_AST_PATCHS_PA17Z)
+#define PAF_AST_PATCHS_PA17
+#endif /* defined (...) */
+
+//
+// SIO Parameters
+//
+
+typedef struct PAF_SIO_ParamsN {
+    Int n;
+    const PAF_SIO_Params *x[1];
+} PAF_SIO_ParamsN;
+
+//
+// Audio Framework Patch
+//
+
+typedef struct PAF_AST_Patchs {
+    const PAF_SIO_ParamsN * devinp;
+    const PAF_SIO_ParamsN * devout;
+    const PAF_ASP_LinkInit * const (*i_decLinkInit);
+    const PAF_ASP_LinkInit * const (*i_aspLinkInit)[GEARS];
+    const PAF_ASP_LinkInit * const (*i_encLinkInit);
+} PAF_AST_Patchs;
+
+#endif  /* AS1_F2_PATCHS_ */
index 19622fc095f148af9c3973e2bdb9d7a3b8daada7..b7e8462d495c0190c8fdceb719dbc6fac65fff6a 100644 (file)
 
 #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
+    Int16 decOpFrameLen,        // decoder output frame length (PCM samples)
+    Int16 strFrameLen,          // stream frame length (PCM samples)
     PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
 )
 {
     PAF_AudioFrame *pAfCb;
     PAF_AudioData *pPcmBuf;
-    Int n;
-    Int i;
+    Int8 n;
+    Int8 i;
 
     // set input frame length
     pCb->decOpFrameLen = decOpFrameLen;
     
     // set output frame length
-    pCb->pafFrameLen = pafFrameLen;
+    pCb->strFrameLen = strFrameLen;
     
     // initialize circular buffer maximum number of audio frames
     if (sourceSelect == PAF_SOURCE_PCM)
@@ -64,7 +60,7 @@ Int cbInit(
         pCb->maxNumAfCb = MAX_NUM_AF_DDP;
         pCb->afRdIdx = 0;
         pCb->afWrtIdx = 1;
-        pCb->pcmRdIdx = decOpFrameLen - CB_INIT_RD_LAG*pafFrameLen; // 2*256 behind
+        pCb->pcmRdIdx = decOpFrameLen - CB_INIT_RD_LAG*strFrameLen; // 2*256 behind
         
         // initialize audio frames
         for (n=0; n<pCb->maxNumAfCb; n++)
@@ -107,7 +103,11 @@ Int cbInit(
         }
     }
     
-    pCb->cbWriteInit = FALSE;
+    // update flags
+    pCb->writerActiveFlag = 0;
+    pCb->readerActiveFlag = 0;
+    pCb->emptyFlag = 0;
+    //pCb->cbWriteAfInit = 0;
     
     // (***) FL: hackin'
     // Write back circular buffer configuration
@@ -130,94 +130,239 @@ Int cbInit(
     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
+// Start writes to circular buffer
+Int cbWriteStart(
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
 )
 {
     PAF_AudioFrame *pAfCb;
-    PAF_ChannelMask_HD streamMask;
-    Int i, j;
+    Int8 n;
 
     // (***) 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();
     
-    // check underflow
-    if (pCb->numAfCb <= 0)
+    // Invalidate AF circular buffer
+    Cache_inv(pCb->afCb, pCb->maxNumAfCb*sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
+    for (n=0; n<pCb->maxNumAfCb; n++)
     {
-        return PAF_DECOP_CB_READ_UNDERFLOW;
+        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();
+            
+    // update flags
+    pCb->writerActiveFlag = 1;
+    pCb->emptyFlag = 0;
     
-    // get pointer to current audio frame in circular buffer
-    pAfCb = &pCb->afCb[pCb->afRdIdx];
+    // (***) FL: hackin'
+    // Write back circular buffer configuration
+    Cache_wb(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+
+    return PAF_DECOP_CB_SOK;
+};
+
+// Stop writes to circular buffer
+Int cbWriteStop(
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
+)
+{
+    // update flags
+    pCb->writerActiveFlag = 0;
+    pCb->emptyFlag = 1;
+
+    // (***) FL: hackin'
+    // Write back circular buffer configuration
+    Cache_wb(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+    
+    return PAF_DECOP_CB_SOK;
+}
 
+// Start reads from circular buffer
+Int cbReadStart(
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
+)
+{
+    // update flags
+    pCb->readerActiveFlag = 1;
+    
     // (***) 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);
+    // Write back circular buffer configuration
+    Cache_wb(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+
+    return PAF_DECOP_CB_SOK;
+}
+
+// Stop reads from circular buffer
+Int cbReadStop(
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
+)
+{
+    // update flags
+    pCb->readerActiveFlag = 0;
+    
+    // (***) FL: hackin'
+    // Write back circular buffer configuration
+    Cache_wb(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
+
+    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;
+    Int8 i;
+    Int16 j;
+
+    // (***) FL: hackin'
+    // Invalidate circular buffer configuration.
+    Cache_inv(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
 
-    // compute stream mask
-    streamMask = pAfRd->fxns->channelMask(pAfRd, pAfCb->channelConfigurationStream);
+    if ((pCb->writerActiveFlag == 1) && (pCb->emptyFlag == 1))
+    {
+        // This shouldn't occur:
+        //  writer is active AND draining circular buffer
+        Log_info2("cbReadAf: ERROR: writerActiveFlag=%d, emptyFlag=%d", pCb->writerActiveFlag, pCb->emptyFlag);
+        return PAF_DECOP_CB_READ_INVSTATE;
+    }
 
-    // Invalidate PCM data
-    for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+    if ((pCb->writerActiveFlag == 0) && (pCb->emptyFlag == 0))
+    {
+        //
+        // No active writer, not draining circular buffer.
+        // Skip UNDerflow check, mute output.
+        //
+        
+        pAfRd->sampleDecode = PAF_SOURCE_PCM;
+        PAF_PROCESS_ZERO(pAfRd->sampleProcess);
+        pAfRd->sampleRate = PAF_SAMPLERATE_48000HZ;
+        pAfRd->sampleCount = pCb->strFrameLen;
+        pAfRd->channelConfigurationRequest.full = 0;
+        pAfRd->channelConfigurationRequest.part.sat = PAF_CC_SAT_SURROUND4;
+        pAfRd->channelConfigurationRequest.part.sub = PAF_CC_SUB_ONE;
+        pAfRd->channelConfigurationStream.full = 0;
+        pAfRd->channelConfigurationStream.part.sat = PAF_CC_SAT_SURROUND4;
+        pAfRd->channelConfigurationStream.part.sub = PAF_CC_SUB_ONE;
+        
+        // compute stream mask
+        streamMask = pAfRd->fxns->channelMask(pAfRd, pAfRd->channelConfigurationStream);
+        // Clear PCM data
+        for (i = 0; i < PAF_DECOP_CB_MAX_NUM_PCM_CH; i++)
+        {
+            if ((streamMask >> i) & 0x1)
+            {
+                memset(pAfRd->data.sample[i], pCb->strFrameLen, 0);
+            }
+            pAfRd->data.samsiz[i] = 0;
+        }
+        
+        return PAF_DECOP_CB_SOK;
+    }
+        
+    if ((pCb->writerActiveFlag == 1))
     {
-        if ((streamMask >> i) & 0x1)
+        // check underflow
+        if (pCb->numAfCb <= 0)
         {
-            Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], pCb->pafFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+            return PAF_DECOP_CB_READ_UNDERFLOW;
         }
     }
-    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 ((pCb->writerActiveFlag == 1) || (pCb->emptyFlag == 1))
     {
-        if ((streamMask >> i) & 0x1)
+        //
+        // Writer active or draining remaining frames in circular buffer.
+        // Get next output audio frame.
+        //
+        
+        // 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++)
         {
-            for (j = 0; j < pCb->pafFrameLen; j++)
+            if ((streamMask >> i) & 0x1)
             {
-                pAfRd->data.sample[i][j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
+                Cache_inv(&pAfCb->data.sample[i][pCb->pcmRdIdx], pCb->strFrameLen*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->strFrameLen;
+        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->strFrameLen; j++)
+                {
+                    pAfRd->data.sample[i][j] = pAfCb->data.sample[i][pCb->pcmRdIdx+j];
+                }
 
-            pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
+                pAfRd->data.samsiz[i] = pAfCb->data.samsiz[i];
+            }
+        }
+        
+        pCb->pcmRdIdx += pCb->strFrameLen; // 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--;
         }
     }
     
-    pCb->pcmRdIdx += pCb->pafFrameLen; // update PCM read index
-    if (pCb->pcmRdIdx == pCb->decOpFrameLen)
+    if (pCb->emptyFlag == 1)
     {
-        // update audio frame read index
-        pCb->afRdIdx++;
-        if (pCb->afRdIdx >= pCb->maxNumAfCb)
+        //
+        // Writer inactive, but remaining frames in circular buffer.
+        // Update empty flag.
+        //
+        if (pCb->numAfCb <= 0)
         {
-            pCb->afRdIdx = 0;
+            pCb->emptyFlag = 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;
 }
 
@@ -229,8 +374,8 @@ Int cbWriteAf(
 {
     PAF_AudioFrame *pAfCb;
     PAF_ChannelMask_HD streamMask;
-    Int n;
-    Int i, j;
+    Int8 i;
+    Int16 j;
 
     // (***) FL: hackin'
     // Invalidate circular buffer configuration.
@@ -238,77 +383,86 @@ Int cbWriteAf(
     Cache_inv(pCb, sizeof(PAF_DecodeOpCircBuf), Cache_Type_ALLD, 0);
     Cache_wait();
     
-    if (pCb->cbWriteInit == FALSE)
+    if (pCb->readerActiveFlag == 1)
     {
-        // Invalidate AF circular buffer
-        Cache_inv(pCb->afCb, pCb->maxNumAfCb*sizeof(PAF_AudioFrame), Cache_Type_ALLD, 0);
-        for (n=0; n<pCb->maxNumAfCb; n++)
+        //
+        // Normal case, reader active.
+        // If reader not active, don't write to circular buffer or check OVRflow.
+
+#if 0        
+        if (pCb->cbWriteAfInit == 0)
         {
-            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();
+            // 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;
-    }
+            pCb->cbWriteAfInit = 1;
+        }
+#endif        
 
-    // check overflow
-    if (pCb->numAfCb >= pCb->maxNumAfCb)
-    {
-        return PAF_DECOP_CB_WRITE_OVERFLOW;
-    }
+        // 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)
+        // 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++)
         {
-            for (j = 0; j < pCb->decOpFrameLen; j++)
+            if ((streamMask >> i) & 0x1)
             {
-                pAfCb->data.sample[i][j] = pAfWrt->data.sample[i][j];
-            }            
-            
-            pAfCb->data.samsiz[i] = pAfWrt->data.samsiz[i];
+                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++;
+        
+        // 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)
+        // (***) 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++)
         {
-            Cache_wb(pAfCb->data.sample[i], pCb->decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+            if ((streamMask >> i) & 0x1)
+            {
+                Cache_wb(pAfCb->data.sample[i], pCb->decOpFrameLen*sizeof(PAF_AudioData), Cache_Type_ALLD, 0);
+            }
         }
-    }
-    Cache_wait();
+        Cache_wait();
+    }  
     
     return PAF_DECOP_CB_SOK;
 }
@@ -332,9 +486,10 @@ Int cbGetNextWriteAf(
     return PAF_DECOP_CB_SOK;
 }
 
+// Output log of circular buffer control variables (debug)
 Int cbLog(
     PAF_DecodeOpCircBuf *pCb,
-    Int fullLog
+    Int8 fullLog
 )
 {
     Log_info4("afRdIdx=%d, pcmRdIdx=%d, afWrtIdx=%d, numAfCb=%d", pCb->afRdIdx, pCb->pcmRdIdx, 
@@ -343,8 +498,8 @@ Int cbLog(
     if (fullLog)
     {
         Log_info1("maxNumAfCb=%d", pCb->maxNumAfCb);  
-        Log_info2("decOpFrameLen=%d, pafFrameLen=%d", pCb->decOpFrameLen, pCb->pafFrameLen);
-        Log_info1("cbWriteInit=%d", pCb->cbWriteInit);
+        Log_info2("decOpFrameLen=%d, strFrameLen=%d", pCb->decOpFrameLen, pCb->strFrameLen);
+        //Log_info1("cbWriteInit=%d", pCb->cbWriteAfInit);
     }
     
     return 0;
index 97bdbd5ac6073c2d8e917d7d097ce524f6029208..2bc567b9cd487412ac28b1ff499a2e4746ddc15c 100644 (file)
@@ -4,36 +4,52 @@
 #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_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_READ_INVSTATE          ( -4 )      // error: circular buffer invalid state on read
 
-#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 )
+#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_AudioFrame *afCb;   // audio frame CB
         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
+        Int8 afRdIdx;           // audio frame CB read index
+        Int8 afWrtIdx;          // audio frame CB write index
+        Int16 pcmRdIdx;         // pcm buffer read index
+        Int8 numAfCb;           // current number frames in CB
+        Int8 maxNumAfCb;        // maximum number of audio frames in CB
+        Int16 decOpFrameLen;    // selected decoder output frame length (input transaction size)
+        Int16 strFrameLen;      // stream frame length (output transaction size)
+        Int8 writerActiveFlag;  // flag indicates whether CB writer is active
+        Int8 readerActiveFlag;  // flag indicates whether CB reader is active
+        Int8 emptyFlag;         // flag indicates whether reader should empty (drain) remaining frames in CB
+        //Int cbWriteAfInit;      // indicates whether CB has been initialized for AF writes
 } 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
+// Start writes to circular buffer
+Int cbWriteStart(
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
+);
+
+// Stop writes to circular buffer
+Int cbWriteStop(
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
+);
+
+// Start reads from circular buffer
+Int cbReadStart(
+    PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
+);
+
+// Stop reads from circular buffer
+Int cbReadStop(
     PAF_DecodeOpCircBuf *pCb    // decoder output circular buffer
 );
 
@@ -55,9 +71,10 @@ Int cbGetNextWriteAf(
     PAF_AudioFrame **ppAfWrt    // audio frame next to be written
 );
 
+// Output log of circular buffer control variables (debug)
 Int cbLog(
     PAF_DecodeOpCircBuf *pCb,
-    Int fullLog
+    Int8 fullLog
 );
 
 #endif /* _DEC_OP_CIRC_BUF_H_ */
index 2428e09c3af0550aefaf56b5123c196fba8d6bd2..f74a8d58c8c9f057db2950a33cf972ca0be5adb0 100644 (file)
@@ -194,17 +194,17 @@ Task.defaultStackSize = 2048;
 /* Set size of idle task stack */
 Task.idleTaskStackSize = 2048;
 
-/* Add Audio Stream Processing (ASP) slave task */
+/* Add Audio Stream Decode Processing (ASDP) task */
 var task0Params = new Task.Params();
-task0Params.instance.name = "TaskAspSlave";
-task0Params.stackSize = 0x4000; // initial value from pa.cfg
-task0Params.stackSection = ".far:taskStackSectionAspSlave";
+task0Params.instance.name = "TaskAsdp";
+task0Params.stackSize = 0x4000;
+task0Params.stackSection = ".far:taskStackSectionAsdp";
 //task0Params.arg0 = 0;
-task0Params.arg0 = $externPtr("params_PA" + topo + "_Slave");
-task0Params.arg1 = $externPtr("patchs_PA" + topo + "_Slave");
+task0Params.arg0 = $externPtr("asdp_params_PA" + topo);
+task0Params.arg1 = $externPtr("asdp_patchs_PA" + topo);
 task0Params.priority = -1; //3;
-Program.global.TaskAsp = Task.create("&taskAspSlaveFxn", task0Params);
-Program.sectMap[".far:taskStackSectionAspSlave"] = "HOST_MSMC"; // L3RAM in pa.cfg
+Program.global.TaskAsdp = Task.create("&taskAsdpFxn", task0Params);
+Program.sectMap[".far:taskStackSectionAsdp"] = "HOST_MSMC";
 
 /* Add System Initialization task */
 var task1Params = new Task.Params();
@@ -237,5 +237,7 @@ heapMem2Params.sectionName = ".ddr3Heap";
 Program.global.heapMemDdr3 = HeapMem.create(heapMem2Params);
 Program.sectMap[".ddr3Heap"] = "HOST_DDR3";
 
+Program.global.heapMemL2Sram = Program.global.heapMemMsmcSram;
+
 //Program.sectMap[".globalSectionPafAstConfig"] = "COMMON_DDR3";
 //Program.sectMap[".globalSectionAcpStdBetaTable"] = "COMMON_DDR3";
similarity index 83%
rename from procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_slave.c
rename to procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamDecodeProc.c
index 698278f6705947f1eef04e89176dd3004678d436..6665e3e192e5ced2a2e0084cc9cab6d69f5f0b80 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  ======== audioStreamProc_slave.c ========
+ *  ======== audioStreamDecodeProc.c ========
  */
 
 #include <xdc/cfg/global.h>
@@ -15,9 +15,9 @@
 
 #include <acp_mds.h>
 #include <pcm.h>
-#include "as1-f2-params.h"
-#include "as1-f2-patchs.h"
-#include "as1-f2-config.h"
+#include "audioStreamProc_params.h"
+#include "audioStreamProc_patchs.h"
+#include "audioStreamProc_config.h"
 #include "paf_decOpCircBuf.h"
 
 #include "common.h"
@@ -25,7 +25,7 @@
 #include "aspMsg_slave.h"
 
 #include "audioStreamProc_common.h"
-#include "audioStreamProc_slave.h"
+#include "audioStreamDecodeProc.h"
 
 // FL: debug
 //#include "fwkSim.h"
 //
 #define decLinkInit pQ->i_decLinkInit
 
-#define __TASK_NAME__  "TaskAspSlave"
+#define __TASK_NAME__  "TaskAsdp"
 
-LINNO_DEFN(TaskAspSlave); /* Line number macros */
-ERRNO_DEFN(TaskAspSlave); /* Error number macros */
+LINNO_DEFN(TaskAsdp); /* Line number macros */
+ERRNO_DEFN(TaskAsdp); /* Error number macros */
 
 extern struct {
     Int size;
@@ -52,31 +52,32 @@ 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
+extern Uint32 gTaskAsdpCnt; // debug counter for ASDP task
 
-PAF_AudioFrame *gpAudioFrameSlave=NULL;
-PAF_AudioData  *gAudioFrameChannelPointersSlave[PAF_MAXNUMCHAN_AF];
-PAF_AudioSize  gAudioFrameChannelSizesSlave[PAF_MAXNUMCHAN_AF];
+PAF_AudioFrame *gpDecAudioFrame=NULL;
+PAF_AudioData  *gDecAudioFrameChannelPointers[PAF_MAXNUMCHAN_AF];
+PAF_AudioSize  gDecAudioFrameChannelSizes[PAF_MAXNUMCHAN_AF];
+PAF_AudioData  *gDecOrigAudioFrameChannelPointers[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;
+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
+ *  ======== taskAsdpFxn ========
+ *  Audio Stream Decode Processing task function
  */
-Void taskAspSlaveFxn(
+Void taskAsdpFxn(
 //    Int betaPrimeValue, // FL: comeback to this
     const PAF_AST_Params *pP,
     const PAF_AST_Patchs *pQ
@@ -106,25 +107,25 @@ Void taskAspSlaveFxn(
     ASP_Msg *pAspMsg;
     MessageQ_QueueId queId;
     Int status;
-    Int32 zI;
+    Int zI;
 
     
-    Log_info0("Enter taskAspSlaveFxn()");
+    Log_info0("Enter taskAsdpFxn()");
     
     //
     // Audio Framework Parameters & Patch (*pP, *pQ):
     //
     if (!pP) 
     {
-        TRACE_TERSE0("TaskAspSlave: No Parameters defined. Exiting.");
-        LINNO_RPRT(TaskAspSlave, -1);
+        TRACE_TERSE0("TaskAsdp: No Parameters defined. Exiting.");
+        LINNO_RPRT(TaskAsdp, -1);
         return;
     }
 
     if (!pQ) 
     {
-        TRACE_TERSE0("TaskAspSlave: No Patchs defined. Exiting.");
-        LINNO_RPRT(TaskAspSlave, -1);
+        TRACE_TERSE0("TaskAsdp: No Patchs defined. Exiting.");
+        LINNO_RPRT(TaskAsdp, -1);
         return;
     }    
 
@@ -149,8 +150,8 @@ Void taskAspSlaveFxn(
     Cache_wait();
     if (!pC)
     {
-        TRACE_TERSE0("TaskAspSlave: No Configuration defined. Exiting.");
-        LINNO_RPRT(TaskAspSlave, -1);
+        TRACE_TERSE0("TaskAsdp: No Configuration defined. Exiting.");
+        LINNO_RPRT(TaskAsdp, -1);
         return;
     }
     
@@ -171,9 +172,9 @@ Void taskAspSlaveFxn(
     //
     for (z=STREAM1; z < STREAMN; z++)
     {
-        TRACE_TERSE1("TaskAspSlave: AS%d: initiated", as+z);
+        TRACE_TERSE1("TaskAsdp: AS%d: initiated", as+z);
     }
-    LINNO_RPRT(TaskAspSlave, -1);
+    LINNO_RPRT(TaskAsdp, -1);
 
     // Get decoder and stream index associated with the master input
     zMD = pC->masterDec;
@@ -186,7 +187,7 @@ Void taskAspSlaveFxn(
     //   - AlgKey: Dec/Enc chain to Array Initialization
     //   - Unused: (available)
     //
-    LINNO_RPRT(TaskAspSlave, -2);
+    LINNO_RPRT(TaskAsdp, -2);
     for (i=0; i < lengthof(pP->fxns->initPhase); i++)
     {
         Int linno;
@@ -194,16 +195,16 @@ Void taskAspSlaveFxn(
         {
             if ((linno = pP->fxns->initPhase[i](pP, pQ, pC)))
             {
-                LINNO_RPRT(TaskAspSlave, linno);
+                LINNO_RPRT(TaskAsdp, linno);
                 return;
             }
         }
         else 
         {
-            TRACE_TERSE1("TaskAspSlave: AS%d: initialization phase - null", as+zMS);
+            TRACE_TERSE1("TaskAsdp: AS%d: initialization phase - null", as+zMS);
         }
-        TRACE_TERSE2("TaskAspSlave: AS%d: initialization phase - %d completed", as+zMS, i);
-        LINNO_RPRT(TaskAspSlave, -i-3);
+        TRACE_TERSE2("TaskAsdp: AS%d: initialization phase - %d completed", as+zMS, i);
+        LINNO_RPRT(TaskAsdp, -i-3);
     }
     
     //
@@ -395,6 +396,12 @@ Void taskAspSlaveFxn(
                         alg[z]->fxns->algActivate(alg[z]);
                     }
 
+                    // Start writes to circular buffer
+                    pCb = &pC->xDec[z].decOpCb;
+                    cbWriteStart(pCb);
+                    // Reset audio frame
+                    resetAf(pP, z, sourceSelect);
+                    
                     // send dec activate complete message to master
                     queId = MessageQ_getReplyQueue(pAspMsg);
                     pAspMsg->procId = hAspMsgSlave->slaveProcId;
@@ -406,10 +413,7 @@ Void taskAspSlaveFxn(
                     {
                         SW_BREAKPOINT;
                     }
-
-                    // Re-init audio frame
-                    pP->fxns->initFrame1(pP, pQ, pC, z, sourceSelect);
-                    
+                   
                     break;
                     
                 case ASP_SLAVE_DEC_RESET:
@@ -460,6 +464,7 @@ Void taskAspSlaveFxn(
                     argIdx = 0; // get decIdx
                     z = *(Int32 *)&pAspMsg->buf[argIdx];
                     TRACE_TERSE2("slaveCmd=%d,decIdx=%d", slaveCmd, z);
+                    // Get input associated w/ decoder
                     zI = pP->inputsFromDecodes[z];
                     
                     // (***) FL: hackin'
@@ -489,6 +494,13 @@ Void taskAspSlaveFxn(
                     Cache_wb(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
                     Cache_wait();            
                     
+                    // Re-initialize audio frame if decoder is disabled or 
+                    // doesn't have a valid input 
+                    if (!pC->xDec[z].decodeStatus.mode || !pC->xInp[zI].hRxSio)
+                    {
+                        pP->fxns->initFrame1(pP, pQ, pC, z, 0);
+                    }
+
                     // send dec info complete message to master
                     queId = MessageQ_getReplyQueue(pAspMsg);
                     pAspMsg->procId = hAspMsgSlave->slaveProcId;
@@ -513,6 +525,11 @@ Void taskAspSlaveFxn(
                     argIdx = 0; // get decIdx
                     z = *(Int32 *)&pAspMsg->buf[argIdx];
                     TRACE_TERSE2("slaveCmd=%d, decIdx=%d", slaveCmd, z);
+                    // Get input associated w/ decoder
+                    zI = pP->inputsFromDecodes[z];
+                    
+                    // Reset AF samsiz
+                    resetAfSamsiz(z);
                     
                     // invalidate Dec configuration
                     Cache_inv(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
@@ -565,6 +582,13 @@ Void taskAspSlaveFxn(
                     Cache_wb(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
                     Cache_wait();
                     
+                    // Re-initialize audio frame if decoder is disabled or 
+                    // doesn't have a valid input 
+                    if (!pC->xDec[z].decodeStatus.mode || !pC->xInp[zI].hRxSio)
+                    {
+                        pP->fxns->initFrame1(pP, pQ, pC, z, 0);
+                    }
+
                     // send dec info complete message to master
                     queId = MessageQ_getReplyQueue(pAspMsg);
                     pAspMsg->procId = hAspMsgSlave->slaveProcId;
@@ -597,6 +621,10 @@ Void taskAspSlaveFxn(
                         alg[z]->fxns->algDeactivate(alg[z]);
                     }
                     
+                    // Stop writes to circular buffer
+                    pCb = &pC->xDec[z].decOpCb;
+                    cbWriteStop(pCb);
+                    
                     // send dec deactivate complete message to master
                     queId = MessageQ_getReplyQueue(pAspMsg);
                     pAspMsg->procId = hAspMsgSlave->slaveProcId;
@@ -618,7 +646,7 @@ Void taskAspSlaveFxn(
         }
     }
     
-    Log_info0("exit taskAspSlaveFxn()");   
+    Log_info0("exit taskAsdpFxn()");   
 }
 
 
@@ -638,7 +666,7 @@ Void taskAspSlaveFxn(
 //              * Memory allocation errors.
 //
 Int
-PAF_AST_initPhaseMallocSlave(
+PAF_ASDT_initPhaseMalloc(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC
@@ -653,7 +681,7 @@ PAF_AST_initPhaseMallocSlave(
     // Initialize error block
     Error_init(&eb); 
 
-    if (!(gpAudioFrameSlave = (PAF_AudioFrame *)Memory_calloc((IHeap_Handle)HEAP_INTERNAL1, 
+    if (!(gpDecAudioFrame = (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);
@@ -662,11 +690,11 @@ PAF_AST_initPhaseMallocSlave(
     }
     TRACE_TERSE3("PAF_AST_initPhaseMalloc. (gpAudioFrameSlave) %d bytes from space %d at 0x%x.",
             DECODEN * sizeof (PAF_AudioFrame),
-            HEAP_ID_INTERNAL1, (IArg)gpAudioFrameSlave);
+            HEAP_ID_INTERNAL1, (IArg)gpDecAudioFrame);
 
     TRACE_TERSE1("PAF_AST_initPhaseMallocSlave: AS%d: initialization phase - memory allocation complete.", as+zMS);
     return 0;
-} //PAF_AST_initPhaseMallocSlave
+} //PAF_ASDT_initPhaseMalloc
 
 // -----------------------------------------------------------------------------
 // AST Initialization Function - Memory Initialization from Configuration
@@ -684,7 +712,7 @@ PAF_AST_initPhaseMallocSlave(
 //
 
 Int
-PAF_AST_initPhaseConfigSlave(
+PAF_ASDT_initPhaseConfig(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC
@@ -693,19 +721,23 @@ PAF_AST_initPhaseConfigSlave(
     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];
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        //Int zS = pP->streamsFromDecodes[z]; // FL: slave
+        //pC->xDec[z].decodeControl.pAudioFrame = pC->xStr[zS].pAudioFrame; // FL: slave
+        //pC->xDec[z].decodeInStruct.pAudioFrame = pC->xStr[zS].pAudioFrame; // FL: slave        
+        pC->xDec[z].decodeControl.pAudioFrame = &gpDecAudioFrame[z];
+        pC->xDec[z].decodeInStruct.pAudioFrame = &gpDecAudioFrame[z];
         pP->fxns->initFrame0(pP, pQ, pC, z);
     }
 
     return 0;
-}  //PAF_AST_initPhaseConfigSlave
+}  //PAF_ASDT_initPhaseConfig
 
 // -----------------------------------------------------------------------------
 // AST Initialization Function - ACP Algorithm Instantiation
 //
-//   Name:      PAF_AST_initPhaseAcpAlgSlave
+//   Name:      PAF_AST_initPhaseAcpAlg
 //   Purpose:   Audio Stream Task Function for initialization of ACP by
 //              instantiation of the algorithm.
 //   From:      audioStream1Task or equivalent
@@ -718,7 +750,7 @@ PAF_AST_initPhaseConfigSlave(
 //              * Memory allocation errors.
 //
 Int
-PAF_AST_initPhaseAcpAlgSlave(
+PAF_ASDT_initPhaseAcpAlg(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC
@@ -732,13 +764,13 @@ PAF_AST_initPhaseAcpAlgSlave(
     Int zMS = pC->masterStr;
     Int zS; //, zX;
 
-    TRACE_TERSE1("PAF_AST_initPhaseAcpAlgSlave: AS%d: initialization phase - ACP Algorithm", as+zMS);
+    TRACE_TERSE1("PAF_ASDT_initPhaseAcpAlg: 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);
+        TRACE_TERSE1("PAF_ASDT_initPhaseAcpAlg: AS%d: ACP algorithm instance creation  failed", as+zMS);
         return __LINE__;
     }
     pC->acpSlave = acp;
@@ -807,7 +839,7 @@ PAF_AST_initPhaseAcpAlgSlave(
     }
 #endif
     
-    TRACE_TERSE1("PAF_AST_initPhaseAcpAlgSlave: AS%d: initialization phase - ACP Algorithm complete.", as+zMS);
+    TRACE_TERSE1("PAF_ASDT_initPhaseAcpAlg: AS%d: initialization phase - ACP Algorithm complete.", as+zMS);
 
     return 0;
 } //PAF_AST_initPhaseAcpAlg
@@ -815,7 +847,7 @@ PAF_AST_initPhaseAcpAlgSlave(
 // -----------------------------------------------------------------------------
 // AST Initialization Function - Common Memory and Algorithms
 //
-//   Name:      PAF_AST_initPhaseCommonSlave
+//   Name:      PAF_AST_initPhaseCommon
 //   Purpose:   Audio Stream Task Function for initialization of data pointers
 //              by allocation for common memory and by instantiation for
 //              algorithms.
@@ -836,7 +868,7 @@ PAF_AST_initPhaseAcpAlgSlave(
 #include <pafsio_ialg.h>
 
 Int
-PAF_AST_initPhaseCommonSlave(
+PAF_ASDT_initPhaseCommon(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC
@@ -855,7 +887,7 @@ PAF_AST_initPhaseCommonSlave(
     // Determine memory needs and instantiate algorithms across audio streams
     //
 
-    TRACE_TERSE0("PAF_AST_initPhaseCommonSlave: calling PAF_ALG_setup.");
+    TRACE_TERSE0("PAF_ASDT_initPhaseCommon: calling PAF_ALG_setup.");
     PAF_ALG_setup(&pafAlgConfig, 
         HEAP_ID_INTERNAL,       HEAP_INTERNAL, 
         HEAP_ID_INTERNAL1,      HEAP_INTERNAL1, 
@@ -871,7 +903,7 @@ PAF_AST_initPhaseCommonSlave(
         //Int zD, zE, zX;
         Int zD, zX;
 
-        TRACE_TERSE1("PAF_AST_initPhaseCommonSlave: AS%d: initialization phase - Common Algorithms", as+z);
+        TRACE_TERSE1("PAF_ASDT_initPhaseCommon: AS%d: initialization phase - Common Algorithms", as+z);
 
         //
         // Determine common memory needs of Decode Algorithms
@@ -902,7 +934,7 @@ PAF_AST_initPhaseCommonSlave(
 
         if (zD >= 0) 
         {
-            TRACE_TERSE1("PAF_AST_initPhaseCommonSlave: calling PAF_ALG_ALLOC for decoder common[%d].", z);
+            TRACE_TERSE1("PAF_ASDT_initPhaseCommon: 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__);
@@ -1033,7 +1065,7 @@ PAF_AST_initPhaseCommonSlave(
         }
 #endif
 
-        TRACE_TERSE0("PAF_AST_initPhaseCommonSlave: calling PAF_ALG_mallocMemory for common space.");
+        TRACE_TERSE0("PAF_ASDT_initPhaseCommon: 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__);
@@ -1053,7 +1085,7 @@ PAF_AST_initPhaseCommonSlave(
         if (zD >= 0) 
         {
             PAF_ASP_Chain *chain;
-            TRACE_TERSE0("PAF_AST_initPhaseCommonSlave: calling PAF_ASP_chainInit for decode.");
+            TRACE_TERSE0("PAF_ASDT_initPhaseCommon: calling PAF_ASP_chainInit for decode.");
             chain =
                 PAF_ASP_chainInit (&pC->xDec[zD].decChainData, pP->pChainFxns,
                                    HEAP_INTERNAL, as+z, acp, &trace,
@@ -1139,15 +1171,15 @@ PAF_AST_initPhaseCommonSlave(
         }
 #endif        
     }
-    TRACE_TERSE1("PAF_AST_initPhaseCommonSlave: AS%d: Returning complete.", as+z);
+    TRACE_TERSE1("PAF_ASDT_initPhaseCommon: AS%d: Returning complete.", as+z);
 
     return 0;
-} //PAF_AST_initPhaseCommon
+} //PAF_ASDT_initPhaseCommon
 
 // -----------------------------------------------------------------------------
 // AST Initialization Function - Algorithm Keys
 //
-//   Name:      PAF_AST_initPhaseAlgKeySlave
+//   Name:      PAF_AST_initPhaseAlgKey
 //   Purpose:   Audio Stream Task Function for initialization of data values
 //              from parameters for Algorithm Keys.
 //   From:      audioStream1Task or equivalent
@@ -1159,7 +1191,7 @@ PAF_AST_initPhaseCommonSlave(
 //
 // .............................................................................
 Int
-PAF_AST_initPhaseAlgKeySlave(
+PAF_ASDT_initPhaseAlgKey(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC
@@ -1172,7 +1204,7 @@ PAF_AST_initPhaseAlgKeySlave(
 
     (void)as;  // clear warning.
 
-    TRACE_VERBOSE1("PAF_AST_initPhaseCommonSlave: AS%d: initialization phase - Algorithm Keys", as);
+    TRACE_VERBOSE1("PAF_ASDT_initPhaseCommon: AS%d: initialization phase - Algorithm Keys", as);
 
     for (z=DECODE1; z < DECODEN; z++) 
     {
@@ -1208,7 +1240,7 @@ PAF_AST_initPhaseAlgKeySlave(
 } //PAF_AST_initPhaseAlgKey
 
 Int
-PAF_AST_initFrame0Slave(
+PAF_ASDT_initFrame0(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
@@ -1222,11 +1254,11 @@ PAF_AST_initFrame0Slave(
     Int maxFrameLength = pP->maxFramelength;
     PAF_AudioData *aBuf=NULL;
     XDAS_UInt8 *metadataBuf;
-    Int8 i;
     Error_Block    eb;
     PAF_AudioFrame *pAudioFrame;
+    Int i;
 
-    pAudioFrame = &gpAudioFrameSlave[z];
+    pAudioFrame = &gpDecAudioFrame[z];
     if (pAudioFrame == NULL)
     {
         SW_BREAKPOINT;
@@ -1244,8 +1276,8 @@ PAF_AST_initFrame0Slave(
     pAudioFrame->fxns = pP->pAudioFrameFunctions;
     pAudioFrame->data.nChannels = PAF_MAXNUMCHAN;
     pAudioFrame->data.nSamples = FRAMELENGTH;
-    pAudioFrame->data.sample = gAudioFrameChannelPointersSlave;
-    pAudioFrame->data.samsiz = gAudioFrameChannelSizesSlave;
+    pAudioFrame->data.sample = gDecAudioFrameChannelPointers;
+    pAudioFrame->data.samsiz = gDecAudioFrameChannelSizes;
     pAudioFrame->pChannelConfigurationMaskTable = &PAF_ASP_stdCCMT;
 
     //
@@ -1261,7 +1293,7 @@ PAF_AST_initFrame0Slave(
         pP->fxns->bufMemPrint(z, aLen*aSize, HEAP_ID_FRMBUF, 2);
     }
 
-    TRACE_TERSE1("PAF_AST_initFrame0Slave: AS%d: Memory_calloc for audio buffers", as+z);
+    TRACE_TERSE1("PAF_ASDT_initFrame0: AS%d: Memory_calloc for audio buffers", as+z);
     
     if (aLen != 0)
     {
@@ -1276,45 +1308,51 @@ PAF_AST_initFrame0Slave(
 
     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);
+    TRACE_TERSE1("PAF_ASDT_initFrame0: 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("PAF_ASDT_initFrame0: AS%d: Memory_calloc failed", as+z);
         TRACE_TERSE1("  bufSize*NumBuf: %d", pP->pMetadataBufStatus->bufSize*pP->pMetadataBufStatus->NumBuf);
         SW_BREAKPOINT;
         return __LINE__;
     }
 
+    for (i=0; i < PAF_MAXNUMCHAN_AF; i++)
     {
-        Int i;
-
-        for (i=0; i < PAF_MAXNUMCHAN_AF; i++)
-            gAudioFrameChannelPointersSlave[i] = NULL;
+        gDecAudioFrameChannelPointers[i] = NULL;
     }
 
-    // MID 314
-    if((numchan[z] > PAF_MAXNUMCHAN) || (numchan[z] < 1)) 
+    if ((numchan[z] > PAF_MAXNUMCHAN) || (numchan[z] < 1)) 
     {
-        TRACE_TERSE1("PAF_AST_initFrame0Slave: AS%d: unsupported option", as+z);
+        TRACE_TERSE1("PAF_ASDT_initFrame0: AS%d: unsupported option", as+z);
         return __LINE__;
     }
     else 
     {
         Int j = 0;
-        TRACE_TERSE1("PAF_AST_initFrame0Slave: AFChanPtrMap[%d][i]", numchan[z]);
+        TRACE_TERSE1("PAF_ASDT_initFrame0: 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;
+                gDecAudioFrameChannelPointers[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]);
+                TRACE_TERSE3("PAF_ASDT_initFrame0: chan = %d = AFChanPtrMap[%d][%d].", chan, numchan[z], i);
+                TRACE_TERSE2("PAF_ASDT_initFrame0: audioFrameChannelPointers[%d]: 0x%x", chan, (IArg)gDecAudioFrameChannelPointers[chan]);
             }
         }
     }
 
+    // Initialize original audio frame channel pointers
+    for (i=PAF_LEFT; i < PAF_MAXNUMCHAN_AF; i++) 
+    {
+        if (gDecAudioFrameChannelPointers[i])
+        {
+            gDecOrigAudioFrameChannelPointers[i] = gDecAudioFrameChannelPointers[i];
+        }
+    }
+
     //
     // Initialize meta data elements
     //
@@ -1331,30 +1369,89 @@ PAF_AST_initFrame0Slave(
     }
 
     return 0;
-} //PAF_AST_initFrame0Slave
+} //PAF_ASDT_initFrame0
 
+// -----------------------------------------------------------------------------
+// ASOT Initialization Function Helper - Reinitialization of Audio Frame
+// AST Decoding Function              - Reinitialization of Audio Frame
+//
+//   Name:      PAF_ASOT_initFrame1
+//   Purpose:   Audio Stream Task Function for initialization or reinitiali-
+//              zation of the Audio Frame(s) by loading of data values of a
+//              time-varying nature.
+//   From:      audioStream1Task or equivalent
+//              AST Parameter Function -> decodeInfo
+//              AST Parameter Function -> decodeDecode
+//   Uses:      See code.
+//   States:    x
+//   Return:    0.
+//   Trace:     None.
+//
 Int
-PAF_AST_initFrame1Slave(
+PAF_ASDT_initFrame1(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
     Int z, 
+    Int apply
+)
+{
+    PAF_AudioFrame *pAudioFrame;
+
+    //
+    // Reinitialize audio frame elements:
+    //
+    //   Channel Configurations during sys init                 = Unknown
+    //      "          "        during info or decode           = None
+    //
+    //   Sample Rate / Count    during sys init, info or decode = Unknown / 0
+    //
+
+    pAudioFrame = &gpDecAudioFrame[z];
+
+    if (apply < 0) 
+    {
+        pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_UNKNOWN;
+        pAudioFrame->channelConfigurationStream.legacy = PAF_CC_UNKNOWN;
+    }
+    else 
+    {
+        pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_NONE;
+        pAudioFrame->channelConfigurationStream.legacy = PAF_CC_NONE;
+    }
+
+    if (apply < 1) 
+    {
+        pAudioFrame->sampleRate = PAF_SAMPLERATE_UNKNOWN;
+        pAudioFrame->sampleCount = 0;
+    }
+
+    return 0;
+} //PAF_ASDT_initFrame1
+
+// Reset AF, invoked during decode ACTIVATE (during state=INIT on Master)
+Int resetAf(
+    const PAF_AST_Params *pP, 
+    Int z, 
     Int sourceSelect
 )
 {
     PAF_AudioFrame *pAudioFrame;
+    Int ch;
+    Int i;
 
-    pAudioFrame = &gpAudioFrameSlave[z];
+    // Get audio frame
+    pAudioFrame = &gpDecAudioFrame[z];
     if (pAudioFrame == NULL)
     {
         SW_BREAKPOINT;
     }
 
-    // Reinitialize audio frame elements:
-    pAudioFrame->sampleRate = PAF_SAMPLERATE_UNKNOWN;
-    pAudioFrame->sampleCount = 0;
+    // Reinitialize audio frame elements
     pAudioFrame->channelConfigurationRequest.legacy = PAF_CC_NONE;
     pAudioFrame->channelConfigurationStream.legacy = PAF_CC_NONE;
+    pAudioFrame->sampleRate = PAF_SAMPLERATE_UNKNOWN;
+    pAudioFrame->sampleCount = 0;
     pAudioFrame->data.nChannels = PAF_MAXNUMCHAN;
     
     if (sourceSelect == PAF_SOURCE_PCM)
@@ -1370,70 +1467,49 @@ PAF_AST_initFrame1Slave(
         pAudioFrame->data.nSamples = FRAMELENGTH;
     }   
 
+    // Reset audio frame channel pointers
+    for (ch=PAF_LEFT; ch < PAF_MAXNUMCHAN_AF; ch++) 
+    {
+        if (gDecAudioFrameChannelPointers[ch])
+        {
+            gDecAudioFrameChannelPointers[ch] = gDecOrigAudioFrameChannelPointers[ch];
+        }
+    }
+    
+    // Reset audio frame meta data elements
+    pAudioFrame->pafBsMetadataUpdate = XDAS_FALSE;
+    pAudioFrame->numPrivateMetadata = 0;
+    pAudioFrame->bsMetadata_offset = 0;
+    pAudioFrame->bsMetadata_type = PAF_bsMetadata_channelData;
+    for (i=0; i<pP->pMetadataBufStatus->NumBuf; i++)
+    {
+        pAudioFrame->pafPrivateMetadata[i].offset = 0;
+        pAudioFrame->pafPrivateMetadata[i].size = 0;
+    }
+    
     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 =
+// Reset AF samsiz, invoked during DECODE
+Int resetAfSamsiz(
+    Int z
+)
 {
-    {   // 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
+    PAF_AudioFrame *pAudioFrame;
+    Int ch;
+    
+    // Get audio frame
+    pAudioFrame = &gpDecAudioFrame[z];
+    if (pAudioFrame == NULL)
+    {
+        SW_BREAKPOINT;
+    }
+    
+    // Clear samsiz for all channels - MID 208.
+    for (ch=0; ch < PAF_MAXNUMCHAN_AF; ch++) 
+    {
+        pAudioFrame->data.samsiz[ch] = 0;
+    }
+
+    return 0;
+}
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamDecodeProc.h b/procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamDecodeProc.h
new file mode 100644 (file)
index 0000000..be240d6
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ *  ======== audioStreamDecdeProc.h ========
+ */
+
+#ifndef _ASDP_H_
+#define _ASDP_H_
+#include <xdc/std.h>
+
+#include "audioStreamProc_params.h"
+#include "audioStreamProc_patchs.h"
+#include "audioStreamProc_config.h"
+
+// Global debug counter */
+extern Uint32 gTaskAspSlaveCnt; // debug counter for ASP slave task
+
+//   Purpose:   Audio Stream Decode Task Function for initialization of data pointers
+//              by allocation of memory.
+Int
+PAF_ASDT_initPhaseMalloc(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+//   Purpose:   Audio Stream Decode Task Function for initialization of data values
+//              from parameters.
+Int
+PAF_ASDT_initPhaseConfig(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+//   Purpose:   Audio Stream Decode Task Function for initialization of ACP by
+//              instantiation of the algorithm.
+Int
+PAF_ASDT_initPhaseAcpAlg(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+//   Purpose:   Audio Stream Decode Task Function for initialization of data pointers
+//              by allocation for common memory and by instantiation for
+//              algorithms.
+Int
+PAF_ASDT_initPhaseCommon(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+//   Purpose:   Audio Stream Decode Task Function for initialization of data values
+//              from parameters for Algorithm Keys.
+Int 
+PAF_ASDT_initPhaseAlgKey(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+);
+
+Int
+PAF_ASDT_initFrame0(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int z
+);
+
+//   Purpose:   Audio Stream Task Function for initialization or reinitiali-
+//              zation of the Audio Frame(s) by loading of data values of a
+//              time-varying nature.
+Int
+PAF_ASDT_initFrame1(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int z, 
+    Int sourceSelect
+);
+
+// Reset AF, invoked during activate (INIT stage from Master)
+Int resetAf(
+    const PAF_AST_Params *pP, 
+    Int z, 
+    Int sourceSelect
+);
+
+// Reset AF samsiz, invoked during DECODE
+Int resetAfSamsiz(
+    Int z
+);
+
+
+#endif /* _ASDP_H_ */
similarity index 58%
rename from procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamProc_paramsFxns_slave.c
rename to procsdk_audio_x_xx_xx_xx/test_arm/framework/audioStreamDecodeProc_paramsFxns.c
index bef34f219cbd84ff0ccba80eb22d70eea9fedc27..5b7b9a9add3ccbcf86c128bebf4e2943d85f989f 100644 (file)
@@ -1,40 +1,39 @@
 /*
- *  ======== audioStreamProc_paramsFxns_slave.c ========
+ *  ======== audioStreamDecodeProc_paramsFxns.c ========
  */
 
 #include <xdc/std.h>
  
 #include "as0.h"
-#include "audioStreamProc_slave.h"
+#include "audioStreamDecodeProc.h"
  
 // .............................................................................
-// Audio Stream Task Parameter Functions - PA17
+// Audio Stream Decode Task Parameter Functions
 //
-//   Name:      PAF_AST_params_fxnsPA17
-//   Purpose:   Collect the functions that embody the implementation of
-//              Audio Framework Number 2 for use as a jump table.
+//   Name:      PAF_ASDT_params_fxns
+//   Purpose:   ASDT 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 =
+const PAF_AST_Fxns PAF_ASDT_params_fxns =
 {
     {   // initPhase[8]
-        PAF_AST_initPhaseMallocSlave,
-        PAF_AST_initPhaseConfigSlave,
-        PAF_AST_initPhaseAcpAlgSlave,
-        PAF_AST_initPhaseCommonSlave,
-        PAF_AST_initPhaseAlgKeySlave,
+        PAF_ASDT_initPhaseMalloc,
+        PAF_ASDT_initPhaseConfig,
+        PAF_ASDT_initPhaseAcpAlg,
+        PAF_ASDT_initPhaseCommon,
+        PAF_ASDT_initPhaseAlgKey,
         NULL,
         NULL,
         NULL
     },
-    PAF_AST_initFrame0Slave,                // initFrame0
-    PAF_AST_initFrame1Slave,                // initFrame1
-    NULL, /* PAF_AST_passProcessing, */     // passProcessing        
-    NULL, /* PAF_AST_passProcessingCopy, */ // passProcessingCopy    
+    PAF_ASDT_initFrame0,                    // initFrame0
+    PAF_ASDT_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
@@ -44,7 +43,7 @@ const PAF_AST_Fxns PAF_AST_params_fxnsPA17_Slave =
     NULL, //PAF_AST_decodeInfo1,            // decodeInfo1
     NULL, //PAF_AST_decodeInfo2,            // decodeInfo2
     NULL, //PAF_AST_decodeCont,             // decodeCont
-    NULL, //PAF_AST_decodeDecode,
+    NULL, //PAF_AST_decodeDecode,           // decodeDecode
     NULL, //PAF_AST_decodeStream,           // decodeStream
     NULL, //PAF_AST_decodeEncode,           // decodeEncode
     NULL, //PAF_AST_decodeFinalTest,        // decodeFinalTest
@@ -59,12 +58,11 @@ const PAF_AST_Fxns PAF_AST_params_fxnsPA17_Slave =
     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
+    NULL, // PAF_BUF_copy,                  // copy
+    NULL, /*headerPrint*/                   // headerPrint
+    NULL, /*allocPrint*/                    // allocPrint
+    NULL, /*commonPrint*/                   // commonPrint
+    NULL, /*bufMemPrint*/                   // bufMemPrint
+    NULL, /*memStatusPrint*/                // memStatusPrint
+    NULL, //PAF_ARC_controlRate,            // controlRate // For ARC                      
 };
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
deleted file mode 100644 (file)
index 6880c5d..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  ======== 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
deleted file mode 100644 (file)
index 5e1d40b..0000000
+++ /dev/null
@@ -1,908 +0,0 @@
-
-/*
-* 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 <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,                                                     // decode1
-        1,                                                     // decodeN
-        1,                                                     // streams
-        0,                                                     // stream1 /* unused */
-        1,                                                     // streamN /* unused */
-        1,                                                     // encodes
-        0,                                                     // encode1
-        1,                                                     // encodeN
-        1,                                                     // outputs
-        0,                                                     // output1
-        1,                                                     // outputN
-    },
-    PAF_AST_inputsFromDecodes_std,
-    NULL, //PAF_AST_outputsFromEncodes_std,
-    {                                                       // heap
-        &gPafHeapIdInt1,    //&IRAM                         // pIntern
-        &gPafHeapIdExt,     //&SDRAM,                       // pExtern
-        NULL,               //&IRAM,                        // pInpbuf
-        NULL,               //&IRAM,                        // pOutbuf
-        &gPafHeapIdInt1,    //&IRAM,                        // pFrmbuf
-        &gPafHeapIdInt1,   //&L3RAM,                        // pIntern1
-        1,                                                  // clear
-    },
-    {                                                       // common
-        params_memspace_PAi_Slave,                          // space
-    },
-    NULL,                                                   // z_rx_bufsiz
-    NULL,                                                   // z_tx_bufsiz
-    PAF_AST_params_numchan,                                 // z_numchan
-    256,                                                    // framelength
-    &PAF_AST_params_audioFrameFunctions_Slave,              // pAudioFrameFunctions
-    &PAF_ASP_chainFxns,                                     // pChainFxns
-    NULL, //&PAF_AST_params_inpBufStatus,                           // pInpBufStatus
-    PAF_AST_params_decodeStatus,                            // z_pDecodeStatus
-    NULL, //&PAF_AST_params_outBufStatus,                           // pOutBufStatus
-    NULL, //PAF_AST_params_encodeStatus,                            // z_pEncodeStatus
-    NULL, //&PAF_AST_params_volumeStatus,                           // pVolumeStatus
-    &PAF_ASP_params_decAlgKey,                              // pDecAlgKey
-    NULL, //&PAF_ASP_params_encAlgKey,                              // pEncAlgKey
-    NULL, //&PAF_ASP_params_decSioMap,                              // pDecSioMap
-    PAF_AST_streamsFromDecodes_std,                         // streamsFromDecodes
-    NULL, //PAF_AST_streamsFromEncodes_std,                         // streamsFromEncodes
-    1536,                                                   // maxFramelength
-    NULL, //PAF_AST_streamOrder,                                    // streamOrder
-    NULL, //inpLinkInit,                                            // i_inpLinkInit
-    NULL, //outLinkInit,                                            // i_outLinkInit
-    NULL, //outNumBufMap,                                           // outNumBufMap // FL: poutNumBufMap
-    PAF_AST_params_MetadataBufStatus_Slave,                 //metadata buffer status
-    NULL, //PAF_AST_params_AudioFrameBufStatus                      //Audio frame buffer status
-};
-
-// EOF
diff --git a/procsdk_audio_x_xx_xx_xx/test_arm/framework/itopo/patchs_slave.c b/procsdk_audio_x_xx_xx_xx/test_arm/framework/itopo/patchs_slave.c
deleted file mode 100644 (file)
index f8f5a7a..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-
-/*
-* 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.
-*
-*/
-
-//
-//
-//
-//
-// Framework Declarations
-//
-
-#include <as1-f2-patchs.h>
-#include <asp0.h>
-#include <asp1.h>
-
-//
-// Decoder Definitions
-//
-
-//#include <dwr_inp.h>
-#include <pcm.h>
-#include <pcm_mds.h>
-
-#define _DDPAT_
-//#define _SRC4_
-
-#ifdef _DDPAT_
-#include <ddpat.h>
-#include <ddpat_tid.h>
-#endif
-
-#ifdef _SRC4_
-#include <src.h>
-#include <src_tih.h>
-#define SUC_TIH_init SRC_TIH_init
-#define SUC_TIH_ISUC SRC_TIH_ISRC
-#endif
-
-const PAF_ASP_LinkInit decLinkInitI13[] =
-{
-    //PAF_ASP_LINKINITPARAMS (STD, DWRPCM, TII, &IDWRPCM_PARAMS),
-    PAF_ASP_LINKINIT(STD, PCM, MDS),
-
-#ifdef _DDPAT_
-    PAF_ASP_LINKINIT(STD, DDP, TID),
-#endif
-    
-    PAF_ASP_LINKNONE,
-};
-
-const PAF_ASP_LinkInit *const patchs_decLinkInit[] =
-{
-    decLinkInitI13,
-};
-
-#if 0 // FL: master
-//
-// Audio Stream Processing Declarations & Definitions
-//
-
-//#include <ae.h>
-//#include <ae_mds.h>
-
-#include <aspstd.h>
-
-const PAF_ASP_LinkInit aspLinkInitAllI13[] =
-{
-#ifdef _SRC4_
-//    PAF_ASP_LINKINIT(STD, SRC, MDS),
-    PAF_ASP_LINKINITPARAMS (STD, SRC, TIH, &ISRC_PARAMS_DS_8CH_HBW),
-#endif
-
-    PAF_ASP_LINKNONE,
-};
-
-const PAF_ASP_LinkInit aspLinkInitNilI13[] =
-{
-    PAF_ASP_LINKNONE,
-};
-
-const PAF_ASP_LinkInit aspLinkInitStdI13[] =
-{
-    PAF_ASP_LINKNONE,
-};
-
-const PAF_ASP_LinkInit aspLinkInitCusI13[] =
-{
-    PAF_ASP_LINKNONE,
-};
-
-
-const PAF_ASP_LinkInit *const patchs_aspLinkInit[1][GEARS] =
-{
-    {
-        aspLinkInitAllI13,
-        aspLinkInitNilI13,
-        aspLinkInitStdI13,
-        aspLinkInitCusI13,
-    },
-};
-
-//
-// Encoder Definitions
-//
-
-#include <pce.h>
-#include <pce_tii.h>
-extern const IPCE_Params IPCE_PARAMS_NODELAY;
-
-const PAF_ASP_LinkInit encLinkInitI13[] =
-{
-    PAF_ASP_LINKINITPARAMS (STD, PCE, TII, &IPCE_PARAMS_NODELAY),
-    PAF_ASP_LINKNONE,
-};
-
-
-const PAF_ASP_LinkInit *const patchs_encLinkInit[] =
-{
-    encLinkInitI13,
-};
-#endif
-
-//
-// Audio Stream Patch Definition
-//
-
-// FL: master
-//extern const PAF_SIO_ParamsN patchs_devinp[];
-//extern const PAF_SIO_ParamsN patchs_devout[];
-
-const PAF_AST_Patchs patchs_PAi_Slave =
-{
-    NULL, //patchs_devinp,
-    NULL, //patchs_devout,
-    patchs_decLinkInit,
-    NULL, //patchs_aspLinkInit,
-    NULL, //patchs_encLinkInit,
-};
-
-// EOF
index 903cb99ba69eb3f41d4759dce981252a236e1dc2..6a4ff96bc73563f2f483c7cea769d173d5d004f8 100644 (file)
@@ -16,19 +16,15 @@ const PAFHJT_t *pafhjt;
 
 #define RAM_REPORT
 #ifdef RAM_REPORT
-#include <as1-f2-params.h>
+#include <audioStreamProc_params.h>
 #include <paf_alg_print.h>
-extern PAF_AST_Fxns PAF_AST_params_fxnsPA17_Slave;
+extern PAF_AST_Fxns PAF_ASDT_params_fxns;
 #endif
 
 #include "aspMsg_common.h"
 #include "aspMsg_slave.h"
 
-#ifdef ARMCOMPILE
-#define heapMemL2Sram heapMemMsmcSram
-#endif
-
-#define TASK_ASP_PRI    ( 3 )
+#define TASK_ASDP_PRI    ( 3 )
 
 #define __TASK_NAME__  "TaskSysInit"
 
@@ -78,14 +74,14 @@ Void taskSysInitFxn(Void)
     pafhjt = &PAFHJT_RAM;
     
 #ifdef RAM_REPORT
-    PAF_AST_params_fxnsPA17_Slave.headerPrint = PAF_ALG_headerPrint;
-    PAF_AST_params_fxnsPA17_Slave.allocPrint = PAF_ALG_allocPrint;
-    PAF_AST_params_fxnsPA17_Slave.commonPrint = PAF_ALG_commonPrint;
-    PAF_AST_params_fxnsPA17_Slave.bufMemPrint = PAF_ALG_bufMemPrint;
-    PAF_AST_params_fxnsPA17_Slave.memStatusPrint = PAF_ALG_memStatusPrint;
+    PAF_ASDT_params_fxns.headerPrint = PAF_ALG_headerPrint;
+    PAF_ASDT_params_fxns.allocPrint = PAF_ALG_allocPrint;
+    PAF_ASDT_params_fxns.commonPrint = PAF_ALG_commonPrint;
+    PAF_ASDT_params_fxns.bufMemPrint = PAF_ALG_bufMemPrint;
+    PAF_ASDT_params_fxns.memStatusPrint = PAF_ALG_memStatusPrint;
 #endif
 
-    Task_setPri(TaskAsp, TASK_ASP_PRI);
+    Task_setPri(TaskAsdp, TASK_ASDP_PRI);
 
     Log_info0("Exit taskSysInitFxn()");
 }
index fa83a733b1752a6a9d3ba6e728f041191594e179..f7e9e9486aac33be93fa47da78ccf8be2df41709 100644 (file)
@@ -260,25 +260,37 @@ task1Params.priority = -1; //2;
 Program.global.TaskAip = Task.create("&taskAipFxn", task1Params);
 Program.sectMap[".far:taskStackSectionAfp"] = "CORE0_MSMC"; // L3RAM in pa.cfg
 
-/* Add Audio Stream Processing (ASP) task */
+/* Add Audio Stream Input Processing (ASIP) task  */
 var task2Params = new Task.Params();
-task2Params.instance.name = "TaskAsp";
-task2Params.stackSize = 0x4000;  // initial value from pa.cfg
-task2Params.stackSection = ".far:taskStackSectionAsp";
+task2Params.instance.name = "TaskAsip";
+task2Params.stackSize = 0x4000;
+task2Params.stackSection = ".far:taskStackSectionAsip";
 //task2Params.arg0 = 0;
-task2Params.arg0 = $externPtr("params_PA" + topo);
-task2Params.arg1 = $externPtr("patchs_PA" + topo);
+task2Params.arg0 = $externPtr("asip_params_PA" + topo);
+task2Params.arg1 = $externPtr("asip_patchs_PA" + topo);
 task2Params.priority = -1; //3;
-Program.global.TaskAsp = Task.create("&taskAspFxn", task2Params);
-Program.sectMap[".far:taskStackSectionAsp"] = "CORE0_MSMC"; // L3RAM in pa.cfg
+Program.global.TaskAsip = Task.create("&taskAsipFxn", task2Params);
+Program.sectMap[".far:taskStackSectionAsip"] = "CORE0_MSMC";
 
-/* Add System Initialization task */
+/* Add Audio Stream Output Processing (ASOP) task  */
 var task3Params = new Task.Params();
-task3Params.instance.name = "TaskSysInit";
-task3Params.stackSize   = 0x1000;
-task3Params.stackSection = ".far:taskStackSectionSysInit";
-task3Params.priority = 4;
-Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task3Params);
+task3Params.instance.name = "TaskAsop";
+task3Params.stackSize = 0x4000;
+task3Params.stackSection = ".far:taskStackSectionAsop";
+//task3Params.arg0 = 0;
+task3Params.arg0 = $externPtr("asop_params_PA" + topo);
+task3Params.arg1 = $externPtr("asop_patchs_PA" + topo);
+task3Params.priority = -1; //3;
+Program.global.TaskAsop = Task.create("&taskAsopFxn", task3Params);
+Program.sectMap[".far:taskStackSectionAsop"] = "CORE0_MSMC";
+
+/* Add System Initialization task */
+var task4Params = new Task.Params();
+task4Params.instance.name = "TaskSysInit";
+task4Params.stackSize   = 0x1000;
+task4Params.stackSection = ".far:taskStackSectionSysInit";
+task4Params.priority = 4;
+Program.global.TaskSysInit = Task.create("&taskSysInitFxn", task4Params);
 Program.sectMap[".far:taskStackSectionSysInit"] = "CORE0_DDR3";
 
 Program.sectMap[".far:taskStackSection"] = "CORE0_DDR3"; // SDRAM in pa.cfg
index c96f344160782d449d9e4246b72031c0632ef014..f83eb4c53708c2498cbd9dafc79cecb3730ef18f 100644 (file)
@@ -475,6 +475,7 @@ const struct
 #endif // SIMULATE_SIO
 
 // .............................................................................
+#if 0 // (***) FL: remove change in Dec sourceSelect since this will cause break in TaskAsip
 // execPAIOutNone
 #define CUS_SIGMA48_S \
     rb32DECSourceSelect_3, \
@@ -483,7 +484,13 @@ const struct
     writeOBSioSelectN(DEVOUT_NULL), \
     wb32DECSourceSelect_3, \
     0xcdf0,execPAIOutNone
-
+#endif
+// execPAIOutNone
+#define CUS_SIGMA48_S \
+    writeOBSioSelectN(DEVOUT_NULL), \
+    writePA3Await(rb32OBSioSelect,ob32OBSioSelect(DEVOUT_NULL)), \
+    0xcdf0,execPAIOutNone
+    
 #pragma DATA_SECTION(cus_sigma48_s0, ".none")
 const ACP_Unit cus_sigma48_s0[] = {
     0xc900 + 0 - 1,
@@ -519,6 +526,7 @@ const ACP_Unit cus_sigma48_s[] = {
 #endif
 
 #else // SIMULATE_SIO
+#if 0 // (***) FL: remove change in Dec sourceSelect since this will cause break in TaskAsip
 #define CUS_SIGMA49_S \
     rb32DECSourceSelect_3, \
     writeDECSourceSelectNone, \
@@ -527,7 +535,13 @@ const ACP_Unit cus_sigma48_s[] = {
     writeENCChannelMapTo16(3,7,2,6,1,5,0,4,-3,-3,-3,-3,-3,-3,-3,-3), \
     wb32DECSourceSelect_3, \
     0xcdf0,execPAIOutAnalog
-
+#endif
+#define CUS_SIGMA49_S \
+    writeOBSioSelectN(1), \
+    writePA3Await(rb32OBSioSelect,ob32OBSioSelect(1)), \
+    writeENCChannelMapTo16(3,7,2,6,1,5,0,4,-3,-3,-3,-3,-3,-3,-3,-3), \
+    0xcdf0,execPAIOutAnalog
+    
 #endif // SIMULATE_SIO
 
 #pragma DATA_SECTION(cus_sigma49_s0, ".none")
index 5c73445a3d0b7e7832586ed437937eb23757a733..1fde5775a861b88d96c78a2c704f6deb6b8351ec 100644 (file)
@@ -546,9 +546,6 @@ PAF_DEC_updateInputStatus(
 
 #include <arc_a.h>
 
-/// can't use "PAF_AST_InpBuf *xInp" -- needs #include "as1-f2-config.h"
-/// use "    LOG_Obj *log,"?
-
 Int
 PAF_ARC_controlRate(
     SIO_Handle hRxSio,
diff --git a/procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc.c b/procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc.c
new file mode 100644 (file)
index 0000000..1c172e2
--- /dev/null
@@ -0,0 +1,3406 @@
+/*
+ *  ======== audioStreamInpProc.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/System.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sysbios/hal/Cache.h>
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <sio.h>
+#include <pafsio_ialg.h>
+
+#include "common.h"
+#include "paf_heapMgr.h"
+#include "aspMsg_common.h"
+#include "aspMsg_master.h"
+#include "audioStreamProc_common.h"
+#include "audioStreamInpProc.h"
+
+// FL: porting
+#include "fwkSim.h"
+//#include "fwkPort.h"
+// FL: debug
+#include "dbgCapAf.h"
+
+
+// -----------------------------------------------------------------------------
+// Debugging Trace Control, local to this file.
+// 
+#include "logp.h"
+
+#define TRACE_ARC(a)
+
+// allows you to set a different trace module in pa.cfg
+#define TR_MOD  trace
+
+// Allow a developer to selectively enable tracing.
+#define CURRENT_TRACE_MASK      0x21
+
+#define TRACE_MASK_TERSE        0x01   // only flag errors and show init
+#define TRACE_MASK_GENERAL      0x02   // half dozen lines per frame
+#define TRACE_MASK_VERBOSE      0x04   // trace full operation
+#define TRACE_MASK_DATA         0x08   // Show data
+#define TRACE_MASK_TIME         0x10   // Timing related traces
+#define TRACE_MASK_MSG          0x20   // Message related traces
+
+#if !(CURRENT_TRACE_MASK & TRACE_MASK_TERSE)
+    #undef  TRACE_TERSE0
+    #undef  TRACE_TERSE1
+    #undef  TRACE_TERSE2
+    #undef  TRACE_TERSE3
+    #undef  TRACE_TERSE4
+    #define TRACE_TERSE0(a)
+    #define TRACE_TERSE1(a,b)
+    #define TRACE_TERSE2(a,b,c)
+    #define TRACE_TERSE3(a,b,c,d)
+    #define TRACE_TERSE4(a,b,c,d,e)
+#endif
+
+#if !(CURRENT_TRACE_MASK & TRACE_MASK_GENERAL)
+    #undef  TRACE_GEN0
+    #undef  TRACE_GEN1
+    #undef  TRACE_GEN2
+    #undef  TRACE_GEN3
+    #undef  TRACE_GEN4
+    #define TRACE_GEN0(a)
+    #define TRACE_GEN1(a,b)
+    #define TRACE_GEN2(a,b,c)
+    #define TRACE_GEN3(a,b,c,d)
+    #define TRACE_GEN4(a,b,c,d,e)
+#endif
+
+#if (CURRENT_TRACE_MASK & TRACE_MASK_VERBOSE)
+    // consolidate list of processing strings, indexed by PAF_SOURCE
+    static char *procName[] =
+    {
+        "", //PAF_SOURCE_UNKNOWN
+        "", //PAF_SOURCE_NONE
+        "AS%d: Pass processing ...",   //PAF_SOURCE_PASS
+        "AS%d: SNG processing ...",    //PAF_SOURCE_SNG
+        "AS%d: Auto processing ...",   //PAF_SOURCE_AUTO
+        "AS%d: Auto processing ...",   //PAF_SOURCE_BITSTREAM
+        "AS%d: DTS processing ...",    //PAF_SOURCE_DTSALL
+        "AS%d: PCM processing ...",    //PAF_SOURCE_PCMAUTO
+        "AS%d: PCM processing ...",    //PAF_SOURCE_PCM
+        "AS%d: PCN processing ...",    //PAF_SOURCE_PC8
+        "AS%d: AC3 processing ...",    //PAF_SOURCE_AC3
+        "AS%d: DTS processing ...",    //PAF_SOURCE_DTS
+        "AS%d: AAC processing ...",    //PAF_SOURCE_AAC
+        "AS%d: MPG processing ...",    //PAF_SOURCE_MPEG
+        "AS%d: DTS processing ...",    //PAF_SOURCE_DTS12
+        "AS%d: DTS processing ...",    //PAF_SOURCE_DTS13
+        "AS%d: DTS processing ...",    //PAF_SOURCE_DTS14
+        "AS%d: DTS processing ...",    //PAF_SOURCE_DTS16
+        "AS%d: WMP processing ...",    //PAF_SOURCE_WMA9PRO
+        "AS%d: MP3 processing ...",    //PAF_SOURCE_MP3
+        "AS%d: DSD processing ...",    //PAF_SOURCE_DSD1
+        "AS%d: DSD processing ...",    //PAF_SOURCE_DSD2
+        "AS%d: DSD processing ...",    //PAF_SOURCE_DSD3
+        "AS%d: DDP processing ...",    //PAF_SOURCE_DDP
+        "AS%d: DTSHD processing ...",  //PAF_SOURCE_DTSHD
+        "AS%d: THD processing ...",    //PAF_SOURCE_THD
+        "AS%d: DXP processing ...",    //PAF_SOURCE_DXP
+        "AS%d: WMA processing ...",    //PAF_SOURCE_WMA
+    };
+
+#else
+    #undef  TRACE_VERBOSE0
+    #undef  TRACE_VERBOSE1
+    #undef  TRACE_VERBOSE2
+    #undef  TRACE_VERBOSE3
+    #undef  TRACE_VERBOSE4
+    #define TRACE_VERBOSE0(a)
+    #define TRACE_VERBOSE1(a,b)
+    #define TRACE_VERBOSE2(a,b,c)
+    #define TRACE_VERBOSE3(a,b,c,d)
+    #define TRACE_VERBOSE4(a,b,c,d,e)
+#endif
+
+#if (CURRENT_TRACE_MASK & TRACE_MASK_DATA)
+    #define TRACE_DATA(a) LOG_printf a
+#else
+    #define TRACE_DATA(a)
+#endif
+
+#if (CURRENT_TRACE_MASK & TRACE_MASK_TIME)
+    #define TRACE_TIME(a) LOG_printf a
+    #define TIME_MOD  trace // this could be different
+    static Int dtime()
+    {
+         static Int old_time = 0;
+         Int time = TSK_time();
+         Int delta_time = time - old_time;
+         old_time = time;
+         return( delta_time);
+    }
+
+    static char *stateName[11] =
+    {
+         "INIT",
+         "INFO1",
+         "AGAIN",
+         "INFO2",
+         "CONT",
+         "TIME",
+         "DECODE",
+         "STREAM",
+         "ENCODE",
+         "FINAL",
+         "QUIT"
+    };
+
+#else
+    #define TRACE_TIME(a)
+#endif
+
+#if !(CURRENT_TRACE_MASK & TRACE_MASK_MSG)
+    #undef  TRACE_MSG0
+    #undef  TRACE_MSG1
+    #undef  TRACE_MSG2
+    #undef  TRACE_MSG3
+    #undef  TRACE_MSG4
+    #define TRACE_MSG0(a)
+    #define TRACE_MSG1(a,b)
+    #define TRACE_MSG2(a,b,c)
+    #define TRACE_MSG3(a,b,c,d)
+    #define TRACE_MSG4(a,b,c,d,e)
+#endif
+    
+
+// .............................................................................
+
+#include <pafsio.h>
+#include "paferr.h"
+
+#include <acp_mds.h>
+
+#include <pcm.h>
+
+#include <pce.h>
+
+#include <doberr.h>
+
+#include <diberr.h>
+
+#include <stdasp.h>
+
+#include "as0.h"
+#include "asperr.h"
+
+#include "audioStreamProc_params.h"
+#include "audioStreamProc_patchs.h"
+#include "audioStreamProc_config.h"
+
+//
+// Audio Stream Definitions
+//
+
+// minimum audio frame "length" in samples (must be multiple of PA_MODULO)
+#define MINFRAMELENGTH 24
+#define PA_MODULO       8   // also defined independently in ARC2 code, and may be hard coded other places.
+
+#if 0 // (***) FL: no longer used w/ removal of CONTINUOUS mode
+Int PAF_AST_decodeHandleErrorInput (const PAF_AST_Params *pP, const PAF_AST_Patchs *pQ, PAF_AST_Config *pC, ALG_Handle decAlg[], Int z, Int error);
+#endif
+
+
+//
+// Decoder Definitions
+//
+//#define decLinkInit pQ->i_decLinkInit
+
+//
+// Audio Stream Processing Definitions
+//
+//#define aspLinkInit pQ->i_aspLinkInit
+
+//
+// Encoder Definitions
+//
+#define encLinkInit pQ->i_encLinkInit
+
+//
+// Input, Output Definitions
+//
+#define inpLinkInit pP->i_inpLinkInit
+//#define outLinkInit pP->i_outLinkInit
+
+/* ---------------------------------------------------------------- */
+/*              Parameter macro definitions end here.               */
+/* ---------------------------------------------------------------- */
+
+//
+// Standardized Definitions
+//
+
+//#define DEC_Handle PCM_Handle /* works for all: SNG, PCM, AC3, DTS, AAC */
+//#define ENC_Handle PCE_Handle /* works for all: PCE */
+
+#define __TASK_NAME__  "TaskAsip"
+
+LINNO_DEFN(TaskAsip); /* Line number macros */
+ERRNO_DEFN(TaskAsip); /* Error number macros */
+
+// Global debug counters */
+UInt32 gTaskAsipCnt=0; // debug
+UInt32 gAsipInitCnt     =0;
+UInt32 gAsipInfo1Cnt    =0;
+UInt32 gAsipInfo2Cnt    =0;
+UInt32 gAsipDecodeCnt   =0;
+UInt32 gAsipFinalCnt    =0;
+UInt32 gAsipQuitCnt     =0;
+#include "dbgDib.h"
+
+extern struct {
+    Int size;
+    IALG_Status *pStatus[512];
+} IACP_STD_BETA_TABLE;
+
+
+/*
+ *  ======== taskAsipFxn ========
+ *  Audio Stream Input Processing task function
+ */
+Void taskAsipFxn(
+//    Int betaPrimeValue, // FL: comeback to this
+    const PAF_AST_Params *pP,
+    const PAF_AST_Patchs *pQ
+)
+{
+    // Task data
+    //PAF_AST_Config PAF_AST_config;  /* Local configuration */
+    //PAF_AST_Config *pC;             /* Local configuration pointer */
+    // Local data
+    Int as;                         /* Audio Stream Number (1, 2, etc.) */
+    Int z;                          /* input/encode/stream/decode/output counter */
+    Int i;                          /* phase */
+    Int errno;                      /* error number */
+    Int zMD, zMI, zMS, zX;
+    Int loopCount = 0;  // used to stop trace to see startup behavior.        
+    UInt32 curTime;
+    Int size;
+    // FL: Messaging
+    ASP_Msg *pAspMsg;
+    Int status;
+
+    Log_info0("Enter taskAsipFxn()");
+    
+#ifdef SIMULATE_SIO
+    /* Start simulation */
+    simStart();
+#endif // SIMULATE_SIO
+
+    //
+    // Audio Framework Configuration (*pC):
+    //
+    pC = &gPAF_AST_config;
+
+    TRACE_TERSE1("TaskAsip: Started with betaPrimeValue=%d.", gBetaPrimeValue);
+    as = gBetaPrimeValue + 1;        /* Audio Stream Number (1, 2, etc.) */    
+    pC->as = as;    
+
+    //
+    // Audio Framework Parameters & Patch (*pP, *pQ)
+    //
+    if (!pP) 
+    {
+        TRACE_TERSE1("TaskAsip: AS%d: No Parameters defined. Exiting.", as);
+        LINNO_RPRT(TaskAsip, -1);
+        return;
+    }
+
+    if (!pQ)
+    {
+        TRACE_TERSE1("TaskAsip: AS%d: No Patchs defined. Exiting.", as);
+        LINNO_RPRT(TaskAsip, -1);
+        return;
+    }    
+    
+    //
+    // Initialize message log trace and line number reporting
+    //
+    for (z=STREAM1; z < STREAMN; z++)
+    {
+        TRACE_TERSE1("TaskAsip: AS%d: initiated", as+z);
+    }
+    LINNO_RPRT(TaskAsip, -1);
+    
+    //
+    // Determine decoder and stream indices associated with the master input
+    //
+    zMI = pP->zone.master;
+    pC->masterDec = zMI;
+    pC->masterStr = zMI;
+    for (zX = DECODE1; zX < DECODEN; zX++)
+    {
+        if (pP->inputsFromDecodes[zX] == zMI)
+        {
+            pC->masterDec = zX;
+            pC->masterStr = pP->streamsFromDecodes[zX];
+            break;
+        }
+    }
+    zMD = pC->masterDec;
+    zMS = pC->masterStr;
+
+    // Initialize as per parametrized phases:
+    //
+    //   In standard form these are:
+    //      - Malloc: Memory Allocation
+    //      - Config: Configuration Initialization
+    //      - AcpAlg: ACP Algorithm Initialization and Local Attachment
+    //      - Common: Common Memory Initialization
+    //      - AlgKey: Dec/Enc chain to Array Initialization
+    //      - Device: I/O Device Initialization
+    //      - Unused: (available)
+    //      - Unused: (available)
+    //
+    LINNO_RPRT(TaskAsip, -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(TaskAsip, linno);
+                return;
+            }
+        }
+        else 
+        {
+            TRACE_TERSE1("TaskAsip: AS%d: initialization phase - null", as+zMS);
+        }
+        TRACE_TERSE2("TaskAsip: AS%d: initialization phase - %d completed", as+zMS, i);
+        LINNO_RPRT(TaskAsip, -i-3);
+    }
+
+    //
+    // End of Initialization -- display memory usage report.
+    //
+    if (pP->fxns->memStatusPrint)
+    {
+        pP->fxns->memStatusPrint(HEAP_INTERNAL, HEAP_INTERNAL1, HEAP_EXTERNAL, HEAP_INTERNAL1_SHM);
+    }
+    
+    // (***) FL: hackin'
+    // write back configuration
+    Cache_wb(&gPAF_AST_config, sizeof(gPAF_AST_config), Cache_Type_ALLD, 0);
+    Cache_wb(&pC, sizeof(pC), Cache_Type_ALLD, 0);
+    Cache_wait();
+
+    // (***) FL: hackin'
+    // write Dec configuration
+    Cache_wb(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+    Cache_wait();
+
+    // (***) FL: hackin'
+    // write back entire beta table
+    Cache_wb((Ptr)(&IACP_STD_BETA_TABLE.pStatus[0]), 512*sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wait();
+    
+    // FL: send start initialization message to slave
+    pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
+    MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
+    pAspMsg->cmd = ASP_SLAVE_START;                                                     /* fill in message payload */
+    pAspMsg->procId = hAspMsgMaster->masterProcId;
+    pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+    pAspMsg->expectResp = TRUE;
+    TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+    status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
+    if (status != MessageQ_S_SUCCESS)
+    {
+        SW_BREAKPOINT;
+    }
+    // wait for initialization complete message from slave
+    do {
+        //status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+        status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, 0); // FL: no other thread is allowed to run until Slave finished startup
+    } while ((status != MessageQ_S_SUCCESS) || (pAspMsg->cmd != ASP_MASTER_START_DONE));
+    if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
+        (pAspMsg->cmd != ASP_MASTER_START_DONE) || 
+        (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+    {
+        TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+        SW_BREAKPOINT;
+    }
+    hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
+    TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+    status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
+    if (status != MessageQ_S_SUCCESS)
+    {
+        SW_BREAKPOINT;
+    }
+
+    // (***) FL: hackin'
+    // invalidate Status structure addresses for Beta Units initialized on Slave
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(&IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(IALG_Status *), Cache_Type_ALLD, 0);
+    Cache_wait();
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]) Log_info0("ERROR: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]) Log_info0("ERROR: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]) Log_info0("ERROR: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]) Log_info0("ERROR: beta unit for Dec==NULL");
+    if (!IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]) Log_info0("ERROR: beta unit for Dec==NULL");
+    
+    // (***) FL: hackin'
+    // invalidate Status structures for Beta Units initialized on Slave
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]), sizeof(Int), Cache_Type_ALLD, 0);
+    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);
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), sizeof(Int), 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_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), sizeof(Int), Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM2]), size, Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), sizeof(Int), Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), sizeof(Int), Cache_Type_ALLD, 0);
+    size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]->size;
+    Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP2]), size, Cache_Type_ALLD, 0);
+    Cache_wait();
+    
+    // (***) FL: hackin'
+    // invalidate Dec configuration
+    Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+    Cache_wait();
+    
+    //
+    // Main processing loop
+    //   
+    for (z=STREAM1; z < STREAMN; z++)
+    {
+        TRACE_VERBOSE1("TaskAsip: AS%d: running", as+z);
+    }
+
+    TRACE_TERSE0("TaskAsip: Entering Main Loop.");
+    
+    errno = 0;
+    for (;;)
+    {
+        Int sourceSelect;
+        XDAS_Int8 sourceProgram;
+
+        loopCount++;
+
+#if 0   // enable and tune to see startup behavior.
+        // this is an alternative to fixed/circular setting in pa.cfg.
+        // If you are searching for a memory allocation failure, disable on first round.
+        // All allocation has already happened.
+        // This is the outer loop.  This loop count goes up when the stream resets.
+        // If the stream is running without problems, this does not increment.
+        // If the stream is repeatedly resetting, this loop count will go up rapidly.
+        if (loopCount > 10)  // see traces for a few of the passes through the main loop.
+        {
+             TRACE_TERSE1("TaskAsip: Trace stopped at loop %d.", loopCount);
+             LOG_disable(&TR_MOD);  // stop tracing
+        }
+#endif
+
+        TRACE_GEN2("TaskAsip (begin Main loop %d) (errno 0x%x)", loopCount, errno);
+        TRACE_TIME((&TIME_MOD, "as1_f2... + %d = %d (begin Main loop)", dtime(), TSK_time()));
+        
+        // since not decoding indicate such
+        pP->fxns->sourceDecode(pP, pQ, pC, PAF_SOURCE_NONE);
+
+        // any error forces idling of input
+        if (errno) 
+        {
+            for (z=INPUT1; z < INPUTN; z++)
+            {
+                if (pC->xInp[z].hRxSio)
+                {
+                    SIO_idle(pC->xInp[z].hRxSio);
+                }
+            }
+        
+            TRACE_TERSE1("TaskAsip: Trace stopped at loop %d.", loopCount);
+            ERRNO_RPRT(TaskAsip, errno);
+        }
+        
+        // Execute a TSK_sleep to ensure that any non-blocking code paths are broken
+        // up to allow lower priority tasks to run. This may seem odd to be at the top
+        // of the state machine but provides for a cleaner flow even though the very
+        // first time we enter we do a sleep which is non-intuitive.
+        TRACE_VERBOSE1("TaskAsip: AS%d: ... sleeping ...", as+zMS);
+        TRACE_TIME((&TIME_MOD, "as1-f2... + %d = %d (begin SLEEP)", dtime(), TSK_time()));
+        Task_sleep(1);
+
+        TRACE_GEN1("TaskAsip: AS%d: Input device selection ...", as+zMS);
+        if (errno = pP->fxns->selectDevices(pP, pQ, pC))
+        {
+            TRACE_TERSE2("TaskAsip: selectDevices returned errno = 0x%04x at line %d. AS%d", errno, as+zMS);
+            continue;
+        }
+
+        // if no master input selected then we don't know what may be at the input
+        // so set to unknown and skip any remaining processing
+        if (!pC->xInp[zMI].hRxSio)
+        {
+            pC->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_UNKNOWN;
+            TRACE_VERBOSE1("TaskAsip: AS%d: No input selected...", as+zMS);
+            continue;
+        }
+        
+        // if here then we have a valid input so query its status
+        if (errno = pP->fxns->updateInputStatus(pC->xInp[zMI].hRxSio, &pC->xInp[zMI].inpBufStatus, &pC->xInp[zMI].inpBufConfig))
+        {
+            TRACE_VERBOSE1("TaskAsip: continue as updateInputStatus returns 0x%x", errno);
+            continue;
+        }
+        
+        // If master decoder is not enabled, or the input is unlocked, then do nothing
+        if (!pC->xDec[zMD].decodeStatus.mode || !pC->xInp[zMI].inpBufStatus.lock)
+        {
+            TRACE_VERBOSE0("TaskAsip: Not locked, continue");
+            continue;
+        }
+        
+        // If no source selected then do nothing
+        if (pC->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_NONE) 
+        {
+            pC->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_NONE;
+            TRACE_VERBOSE1("TaskAsip: AS%d: no source selected, continue", as+zMS);
+            continue;
+        }
+
+        // If we want pass processing then proceed directly
+        if (pC->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_PASS) 
+        {
+            TRACE_VERBOSE1("TaskAsip: AS%d: Pass processing ...", as+zMS);
+            pC->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_PASS;
+            pP->fxns->sourceDecode(pP, pQ, pC, PAF_SOURCE_PASS);
+            if (pP->fxns->passProcessing)
+            {
+                errno = pP->fxns->passProcessing(pP, pQ, pC, NULL);                
+            }
+            else 
+            {
+                TRACE_TERSE2("TaskAsip: AS%d: Pass Processing not supported, errno 0x%x", as+zMS, ASPERR_PASS);
+                errno = ASPERR_PASS;
+            }
+            TRACE_VERBOSE0("TaskAsip: continue");
+            continue;
+        }
+
+        // .....................................................................
+        // At this point we have an enabled input and want to decode something.
+        // If no decoder selected then do nothing. Need to reset the sourceProgram, since
+        // when no decoder is selected there are no calls to IB
+        //if (errno = pP->fxns->autoProcessing(pP, pQ, pC, pC->xDec[zMD].decodeStatus.sourceSelect, pC->xDec[zMD].decAlg[PAF_SOURCE_PCM]))
+        if (errno = pP->fxns->autoProcessing(pP, pQ, pC, pC->xDec[zMD].decodeStatus.sourceSelect, NULL)) // (***) FL: hard-coded to use PCM framelength inside function
+        {
+            TRACE_VERBOSE1("TaskAsip: autoProcessing returns 0x%x, continue", errno);
+            continue;
+        }
+        
+        // query for input type
+        if (errno = SIO_ctrl(pC->xInp[zMI].hRxSio, PAF_SIO_CONTROL_GET_SOURCEPROGRAM, (Arg )&sourceProgram))
+        {
+            TRACE_TERSE2("TaskAsip: SIO_ctrl returns 0x%x, then 0x%x, continue", errno, ASPERR_AUTO_PROGRAM);
+            errno = ASPERR_AUTO_PROGRAM;
+            continue;
+        }
+        pC->xDec[zMD].decodeStatus.sourceProgram = sourceProgram;
+
+        // if input is unclassifiable then do nothing
+        if (sourceProgram == PAF_SOURCE_UNKNOWN)
+        {
+            TRACE_VERBOSE0("TaskAsip: Source program unknown. continue");
+            continue;
+        }
+
+        // now that we have some input classification, and possibly an outstanding
+        // input frame, we determine whether or not to call decodeProcessing and with
+        // what decAlg.
+        sourceSelect = PAF_SOURCE_NONE;
+        switch (pC->xDec[zMD].decodeStatus.sourceSelect) 
+        {
+            // If autodetecting, decoding everything, and input is something
+            // (i.e. bitstream or PCM) then decode.
+            case PAF_SOURCE_AUTO:
+                if (sourceProgram >= PAF_SOURCE_PCM)
+                {
+                    sourceSelect = sourceProgram;                    
+                }
+                break;
+
+            // If autodetecting, decoding only PCM, and input is PCM then decode.
+            case PAF_SOURCE_PCMAUTO:
+                if (sourceProgram == PAF_SOURCE_PCM)
+                {
+                    sourceSelect = sourceProgram;                    
+                }
+                break;
+
+            // If autodetecting, decoding only bitstreams, and input is a bitstream then decode.
+            case PAF_SOURCE_BITSTREAM:
+                if (sourceProgram >= PAF_SOURCE_AC3)
+                {
+                    sourceSelect = sourceProgram;                    
+                }
+                break;
+
+            // If autodetecting, decoding only DTS, and input is DTS then decode.
+            case PAF_SOURCE_DTSALL:
+                switch (sourceProgram) 
+                {
+                    case PAF_SOURCE_DTS11:
+                    case PAF_SOURCE_DTS12:
+                    case PAF_SOURCE_DTS13:
+                    case PAF_SOURCE_DTS14:
+                    case PAF_SOURCE_DTS16:
+                    case PAF_SOURCE_DTSHD:
+                        sourceSelect = sourceProgram;
+                        break;
+                }
+                break;
+
+            // All others, e.g., force modes, fall through to here.
+            // If user made specific selection then program must match select.
+            // (NB: this compare relies on ordering of PAF_SOURCE)
+            default:
+                sourceSelect = pC->xDec[zMD].decodeStatus.sourceSelect;
+                if ((sourceSelect >= PAF_SOURCE_PCM) && (sourceSelect <= PAF_SOURCE_N))
+                {
+                    if (sourceProgram != sourceSelect)
+                    {
+                        sourceSelect = PAF_SOURCE_NONE;                        
+                    }
+                }
+                break;
+        }
+
+        // if we didn't find any matches then skip
+        if (sourceSelect == PAF_SOURCE_NONE)
+        {
+            TRACE_VERBOSE0("TaskAsip: no matching source type, continue");
+            continue;
+        }
+
+        // FL: debug, reset IB capture buffer
+        capIbReset();
+        Log_info0("capIbReset()");
+        
+        // FL: send source select message to slave
+        pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
+        MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
+        pAspMsg->cmd = ASP_SLAVE_DEC_SOURCE_SELECT;                                         /* fill in message payload */
+        pAspMsg->procId = hAspMsgMaster->masterProcId;
+        pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+        pAspMsg->expectResp = TRUE;
+        *(Int32 *)&pAspMsg->buf[0] = sourceSelect;
+        TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+        TRACE_MSG1("sourceSelect=%d", pAspMsg->buf[0]);
+        status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
+        if (status != MessageQ_S_SUCCESS)
+        {
+            SW_BREAKPOINT;
+        }
+        // wait for source select complete message from slave
+        //do {
+        //    status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+        //} while (status != MessageQ_S_SUCCESS);
+        status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+        if (status != MessageQ_S_SUCCESS)
+        {
+            TRACE_TERSE0("MessageQ_get() failure.");
+            SW_BREAKPOINT; // temporary
+        }
+        if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
+            (pAspMsg->cmd != ASP_MASTER_DEC_SOURCE_SELECT_DONE) ||
+            (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+        {
+            TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            SW_BREAKPOINT;
+        }
+        hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
+        TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+        status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
+        if (status != MessageQ_S_SUCCESS)
+        {
+            SW_BREAKPOINT;
+        }
+        
+        // set to unknown so that we can ensure, for IOS purposes, that sourceDecode = NONE
+        // iff we are in this top level state machine and specifically not in decodeProcessing
+        pP->fxns->sourceDecode(pP, pQ, pC, PAF_SOURCE_UNKNOWN);
+        
+        TRACE_VERBOSE1(procName[sourceProgram], as+zMS);
+
+        TRACE_VERBOSE0("TaskAsip: calling decodeProcessing.");
+        //errno = pP->fxns->decodeProcessing(pP, pQ, pC, pC->xDec[zMD].decAlg[sourceSelect]);
+        //errno = pP->fxns->decodeProcessing(pP, pQ, pC, NULL); // (***) FL: dec handle doesn't exist on Master (DSP)
+        //errno = pP->fxns->decodeProcessing(pP, pQ, pC, NULL, sourceSelect);
+        errno = pP->fxns->decodeProcessing(pP, pQ, pC, sourceSelect);
+        if (errno) 
+        {
+            TRACE_TERSE1("TaskAsip: decodeProcessing returns 0x%x, continue", errno);
+        }
+        else
+        {
+            TRACE_VERBOSE0("TaskAsip: decodeProcessing complete with no error.");
+        }        
+
+        // FL: send dec exit message to slave
+        pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
+        MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
+        pAspMsg->cmd = ASP_SLAVE_DEC_EXIT;                                                  /* fill in message payload */
+        pAspMsg->procId = hAspMsgMaster->masterProcId;
+        pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+        pAspMsg->expectResp = TRUE;
+        TRACE_MSG2("Tx ASP message: procId=%d, cmd=%d.", pAspMsg->procId, pAspMsg->cmd);
+        status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
+        if (status != MessageQ_S_SUCCESS)
+        {
+            SW_BREAKPOINT;
+        }
+        // wait for dec exit complete message from slave
+        //do {
+        //    status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+        //} while ((status < 0) || (pAspMsg->cmd != ASP_MASTER_DEC_EXIT_DONE));
+        status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+        if (status != MessageQ_S_SUCCESS)
+        {
+            TRACE_TERSE0("MessageQ_get() failure.");
+            SW_BREAKPOINT; // temporary
+        }
+        if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) || 
+            (pAspMsg->cmd != ASP_MASTER_DEC_EXIT_DONE) ||
+            (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+        {
+            TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            SW_BREAKPOINT;
+        }
+        hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
+        TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+        // free the message
+        status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
+        if (status != MessageQ_S_SUCCESS)
+        {
+            SW_BREAKPOINT;
+        }
+    } // End of main processing loop for (;;)
+    
+    Log_info0("Exit taskAsipFxn()");
+}
+
+// -----------------------------------------------------------------------------
+// ASIT Initialization Function - Memory Allocation
+//
+//   Name:      PAF_ASIT_initPhaseMalloc
+//   Purpose:   Audio Stream Input 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_ASIT_initPhaseMalloc(
+    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;
+    Int i;
+
+    TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: initialization phase - memory allocation", as+zMS);
+
+    // Initialize error block
+    Error_init(&eb); 
+
+    /* Input memory */
+    if (!(pC->xInp = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, INPUTN * sizeof (*pC->xInp), 4, &eb)))
+    {
+        TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+        SW_BREAKPOINT;
+        return __LINE__;
+    }
+    TRACE_TERSE3("PAF_AST_initPhaseMalloc. (pC->xInp) %d bytes from space %d at 0x%x.",
+            INPUTN * sizeof (*pC->xInp),
+            HEAP_ID_INTERNAL1_SHM, (IArg)pC->xInp);
+
+    /* Decode memory */
+    if (!(pC->xDec = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, DECODEN * sizeof (*pC->xDec), 4, &eb)))
+    {
+        TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+        SW_BREAKPOINT;
+        return __LINE__;
+    }
+    TRACE_TERSE3("PAF_AST_initPhaseMalloc. (pC->xDec) %d bytes from space %d at 0x%x.",
+            DECODEN * sizeof (*pC->xDec),
+            HEAP_ID_INTERNAL1_SHM, (IArg)pC->xDec);
+            
+    {   
+        // FL: added for decode output circular buffer
+        // FL: (***)hackin'
+        Int z; /* decode counter */
+        
+        for (z=DECODE1; z < DECODEN; z++)
+        {
+            // allocate audio frame circular buffer
+            if (!(pC->xDec[z].decOpCb.afCb = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, PAF_DECOP_CB_MAX_NUM_AF * sizeof(PAF_AudioFrame), 4, &eb)))
+            {
+                TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+                SW_BREAKPOINT;
+            }
+            // allocate audio frame PCM sample pointer array
+            for (i = 0; i<PAF_DECOP_CB_MAX_NUM_AF; i++)
+            {
+                if (!(pC->xDec[z].decOpCb.afCb[i].data.sample = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, PAF_DECOP_CB_MAX_NUM_PCM_CH * sizeof(PAF_AudioData *), 4, &eb)))
+                {
+                    TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+                    SW_BREAKPOINT;
+                }
+                if (!(pC->xDec[z].decOpCb.afCb[i].data.samsiz = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, PAF_DECOP_CB_MAX_NUM_PCM_CH * sizeof(PAF_AudioSize), 4, &eb)))
+                {
+                    TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+                    SW_BREAKPOINT;
+                }                
+            }
+            // allocate PCM sample buffer
+            if (!(pC->xDec[z].decOpCb.pcmBuf = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, PAF_DECOP_CB_PCM_BUF_SZ * sizeof(PAF_AudioData), 4, &eb)))
+            {
+                TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
+                SW_BREAKPOINT;
+            }
+        }
+    }
+    
+    TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: initialization phase - memory allocation complete.", as+zMS);
+    return 0;
+} //PAF_ASIT_initPhaseMalloc
+
+// -----------------------------------------------------------------------------
+// ASIT Initialization Function - Memory Initialization from Configuration
+//
+//   Name:      PAF_ASIT_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_ASIT_initPhaseConfig(
+    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 zMS = pC->masterStr;
+    Int errno;                      /* error number */
+    PAF_DecodeOpCircBuf *pCb; // FL: decoder output circular buffer
+
+    TRACE_TERSE1("PAF_ASIT_initPhaseConfig: AS%d: initialization phase - configuration", as+zMS);
+
+    //
+    // Unspecified elements have been initialized to zero during alloc
+    //
+    
+    for (z=INPUT1; z < INPUTN; z++) 
+    {
+        pC->xInp[z].inpBufStatus = *pP->pInpBufStatus;
+        pC->xInp[z].inpBufConfig.pBufStatus = &pC->xInp[z].inpBufStatus;
+    }
+
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        Int zI = pP->inputsFromDecodes[z];
+        pC->xDec[z].decodeControl.size = sizeof(pC->xDec[z].decodeControl);
+        pC->xDec[z].decodeControl.pInpBufConfig = (const PAF_InpBufConfig *)&pC->xInp[zI].inpBufConfig;
+        pC->xDec[z].decodeStatus = *pP->z_pDecodeStatus[z];
+
+        // Initialize decoder output circular buffer
+        // (***) FL: Ugly, here PCM is hard-coded for 256 sample dec op frame length        
+        pCb = &pC->xDec[z].decOpCb;
+        errno = cbInit(PAF_SOURCE_PCM, 256, FRAMELENGTH, pCb);
+        if (errno)
+        {
+            return errno;
+        }
+    }
+
+    TRACE_TERSE1("PAF_ASIT_initPhaseConfig: AS%d: initialization phase - configuration complete.", as+zMS);
+    return 0;
+} //PAF_ASIT_initPhaseConfig
+
+// -----------------------------------------------------------------------------
+// ASIT Initialization Function - ACP Algorithm Instantiation
+//
+//   Name:      PAF_ASIT_initPhaseAcpAlg
+//   Purpose:   Audio Stream Input 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_ASIT_initPhaseAcpAlg(
+    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_ASIT_initPhaseAcpAlg: AS%d: initialization phase - ACP Algorithm", as+zMS);
+
+    ACP_MDS_init();
+
+    if (!(acp = (ACP_Handle )ACP_MDS_create(NULL))) 
+    {
+        TRACE_TERSE1("PAF_AST_initPhaseAcpAlg: AS%d: ACP algorithm instance creation failed", as+zMS);
+        return __LINE__;
+    }
+    pC->acp = acp;
+
+    ((ALG_Handle)acp)->fxns->algControl((ALG_Handle) acp,
+        ACP_GETBETAPRIMEOFFSET, (IALG_Status *)&betaPrimeOffset);
+
+    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. */
+    }
+
+#if 0 // FL: slave
+    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. */
+    }
+#endif
+
+    TRACE_TERSE1("PAF_ASIT_initPhaseAcpAlg: AS%d: initialization phase - ACP Algorithm complete.", as+zMS);
+
+    return 0;
+} //PAF_ASIT_initPhaseAcpAlg
+
+// -----------------------------------------------------------------------------
+// ASIT Initialization Function - Common Memory
+//
+//   Name:      PAF_ASIT_initPhaseCommon
+//   Purpose:   Audio Stream Input Task Function for allocation of common memory.
+//   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.
+//
+Int
+PAF_ASIT_initPhaseCommon(
+    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->acp;
+    PAF_IALG_Config pafAlgConfig;
+    IALG_MemRec common[3][PAF_IALG_COMMON_MEMN+1];
+   
+    TRACE_TERSE0("PAF_ASIT_initPhaseCommon: initialization phase - Common Memory");
+
+    //
+    // Determine memory needs and instantiate algorithms across audio streams
+    //
+    TRACE_TERSE0("PAF_ASIT_initPhaseCommon: 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;
+
+        TRACE_TERSE1("PAF_ASIT_initPhaseCommon: AS%d: initialization phase - Common Memory", as+z);
+
+        //
+        // Determine common memory for:
+        //  (1) Logical Input drivers
+        //
+        // Decode Algorithms common memory determined in ASP Slave.
+        //
+        PAF_ALG_init(common[z], lengthof(common[z]), COMMONSPACE);
+
+#if 0 // FL: slave
+        zD = -1;
+        for (zX = DECODE1; zX < DECODEN; zX++) 
+        {
+            if (pP->streamsFromDecodes[zX] == z) 
+            {
+                zD = zX;
+                break;
+            }
+        }
+#endif
+
+#if 0 // FL: slave
+        if (zD >= 0) 
+        {
+            TRACE_TERSE3("%s.%d: calling PAF_ALG_ALLOC for decoder common[%d].", (IArg)__FUNCTION__, __LINE__, 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);                
+            }
+        }
+#endif
+
+        //
+        // Determine common memory needs of Logical Input driver
+        //
+
+        // 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_TERSE2("AS%d: PAF_ASIT_initPhaseCommon: alloc inpLinkInit common[%d]", as+z, z);
+            if (PAF_ALG_ALLOC(inpLinkInit[z-INPUT1], common[z]))
+            {
+                TRACE_TERSE1("PAF_AST_initPhaseMalloc: AS%d: PAF_ALG_alloc failed", as+z);
+                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);
+            }
+        }
+    }
+    {
+        // 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;            
+        }
+    }
+        
+    //
+    // Allocate common memory for:
+    //  (1) Logical Input drivers
+    //
+    for (z = STREAM1; z < STREAMN; z++) 
+    {
+        //Int zD, zE, zX;
+
+        TRACE_TERSE0("PAF_ASIT_initPhaseCommon: calling PAF_ALG_mallocMemory for common space.");
+        if (PAF_ALG_mallocMemory(common[z], &pafAlgConfig)) 
+        {
+            TRACE_TERSE1("AS%d: PAF_ALG_mallocMemory failed", as+z);
+            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);
+        }
+
+#if 0 // FL: slave
+        zD = -1;
+        for (zX = DECODE1; zX < DECODEN; zX++) 
+        {
+            if (pP->streamsFromDecodes[zX] == z) 
+            {
+                zD = zX;
+                break;
+            }
+        }
+#endif
+
+#if 0 // FL: slave
+        if (zD >= 0) 
+        {
+            PAF_ASP_Chain *chain;
+            TRACE_TERSE2("PAF_ASIT_initPhaseCommon: 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__;
+            }
+        }
+#endif
+
+        //
+        // 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_TERSE2("PAF_AST_initPhaseMalloc: AS%d: non-common input chain init for %d",
+                           as+z, 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__;
+            }
+        }
+    }
+    TRACE_TERSE1("AS%d: PAF_ASIT_initPhaseCommon: Returning complete.", as+z);
+
+    return 0;
+} //PAF_ASIT_initPhaseCommon
+
+// -----------------------------------------------------------------------------
+// ASIT Initialization Function - Algorithm Keys
+//
+//   Name:      PAF_ASIT_initPhaseAlgKey
+//   Purpose:   Audio Stream Input 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_ASIT_initPhaseAlgKey(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+#if 0
+    Int z;                              /* decode/encode counter */
+    Int s;                              /* key number */
+    PAF_ASP_Link *that;
+#endif
+
+    (void)as;  // clear compiler warning in case not used with tracing disabled
+
+    TRACE_VERBOSE1("PAF_ASIT_initPhaseAlgKey: AS%d: initialization phase - Algorithm Keys", as);
+
+#if 0 // FL: slave    
+    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;
+            }
+        }
+    }
+#endif
+
+    return 0;
+} //PAF_ASIT_initPhaseAlgKey
+
+// -----------------------------------------------------------------------------
+// ASIT Initialization Function - I/O Devices
+//
+//   Name:      PAF_ASIT_initPhaseDevice
+//   Purpose:   Audio Stream Input Task Function for initialization of I/O Devices.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    0 on success.
+//              Source code line number on device allocation failure.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//              * Memory allocation errors.
+//
+Int
+PAF_ASIT_initPhaseDevice(
+    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/output counter */
+    PAF_SIO_IALG_Obj    *pObj;
+    PAF_SIO_IALG_Config *pAlgConfig;
+    PAF_IALG_Config pafAlgConfig;
+
+    (void)as; // clear compiler warning in case not used with tracing disabled
+
+    TRACE_TERSE1("PAF_ASIT_initPhaseDevice: AS%d: initialization phase - I/O Devices", as);
+
+    if(pP->fxns->bufMemPrint)
+    {
+        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);
+        TRACE_TERSE2("PAF_ASIT_initPhaseDevice: AS%d: calling PAF_ALG_setup with clear at %d.", as, HEAP_CLEAR);
+    }
+
+    for (z=INPUT1; z < INPUTN; z++) 
+    {
+        PAF_InpBufConfig *pConfig = &pC->xInp[z].inpBufConfig;
+
+        pObj = (PAF_SIO_IALG_Obj *)pC->xInp[z].inpChainData.head->alg;
+        pAlgConfig = &pObj->config;
+
+        pC->xInp[z].hRxSio = NULL;
+
+        pConfig->base.pVoid       = pAlgConfig->pMemRec[0].base;
+        pConfig->pntr.pVoid       = pAlgConfig->pMemRec[0].base;
+        pConfig->head.pVoid       = pAlgConfig->pMemRec[0].base;
+        pConfig->futureHead.pVoid = pAlgConfig->pMemRec[0].base;
+        pConfig->allocation       = pAlgConfig->pMemRec[0].size;
+        pConfig->sizeofElement    = 2;
+        pConfig->precision        = 16;
+
+        if(pP->fxns->bufMemPrint)
+        {
+            pP->fxns->bufMemPrint(z,pAlgConfig->pMemRec[0].size,PAF_ALG_memSpaceToHeapId(&pafAlgConfig,pAlgConfig->pMemRec[0].space),0);            
+        }
+    }
+    TRACE_TERSE1("PAF_ASIT_initPhaseDevice: AS%d: initialization phase - I/O Devices complete.", as);
+
+    return 0;
+} //PAF_ASIT_initPhaseDevice
+
+#if 0
+// -----------------------------------------------------------------------------
+// AST Processing Function - Pass-Through Processing
+//
+//   Name:      PAF_AST_passProcessing
+//   Purpose:   Audio Stream Task Function for processing audio data as a
+//              pass-through from the input driver to the output driver
+//              for development and testing.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information on initialization.
+//              * State information on processing.
+//
+
+#pragma CODE_SECTION(PAF_AST_passProcessing,".text:_PAF_AST_passProcessing")
+/* Pass Processing is often omitted from builds to save memory, */
+/* and CODE_SECTION/clink constructs facilitate this omission.  */
+
+Int
+PAF_AST_passProcessing (const PAF_AST_Params *pP, const PAF_AST_Patchs *pQ, PAF_AST_Config *pC, Int hack)
+{
+    Int z;                              /* input/output counter */
+    Int errno = 0;                      /* error number */
+    Int getVal;
+    Int rxNumChan, txNumChan;
+    Int first;
+    Int zMD = pC->masterDec;
+    Int zMI = pP->zone.master;
+
+
+#ifndef __TI_EABI__
+    asm (" .clink"); /* See comment above regarding CODE_SECTION/clink. */
+#endif    
+
+    TRACE_VERBOSE0("PAF_AST_passProcessing: initializing");
+
+    //
+    // Determine that receive/transmit channels are compatible
+    //
+
+    // Can handle handle only master input
+    for (z=INPUT1; z < INPUTN; z++) {
+        if (z != zMI && pC->xInp[z].hRxSio)
+            return (ASPERR_PASS + 0x01);
+    }
+
+    /* Number of receive/transmit channels */
+
+    if (! pC->xInp[zMI].hRxSio)
+        return (ASPERR_PASS + 0x11);
+    if (SIO_ctrl (pC->xInp[zMI].hRxSio, PAF_SIO_CONTROL_GET_NUMCHANNELS, (Arg) &rxNumChan))
+        return (ASPERR_PASS + 0x12);
+    if (rxNumChan > NUM_TX_CHAN(zMI))
+        return (ASPERR_PASS + 0x13);
+
+    for (z=OUTPUT1; z < OUTPUTN; z++) {
+        if (! pC->xOut[zMI].hTxSio)
+            return (ASPERR_PASS + 0x10*(z+2) + 0x01);
+        if (SIO_ctrl (pC->xOut[z].hTxSio, PAF_SIO_CONTROL_GET_NUMCHANNELS, (Arg) &txNumChan))
+            return (ASPERR_PASS + 0x10*(z+2) + 0x02);
+        if (txNumChan > NUM_TX_CHAN(zMI))
+            return (ASPERR_PASS + 0x10*(z+2) + 0x03);
+    }
+
+    //
+    // Set up receive/transmit
+    //
+
+    SIO_idle (pC->xInp[zMI].hRxSio);
+    for (z=OUTPUT1; z < OUTPUTN; z++) {
+        if(SIO_idle (pC->xOut[z].hTxSio))
+            return ASPERR_IDLE;
+    }
+
+    if (SIO_ctrl (pC->xInp[zMI].hRxSio, PAF_SIO_CONTROL_SET_SOURCESELECT, PAF_SOURCE_PCM))
+        return (ASPERR_PASS + 0x14);
+
+    if (SIO_ctrl (pC->xInp[zMI].hRxSio, PAF_SIO_CONTROL_SET_PCMFRAMELENGTH, FRAMELENGTH))
+        return (ASPERR_PASS + 0x15);
+
+    for (z=OUTPUT1; z < OUTPUTN; z++)
+        pC->xOut[z].outBufConfig.lengthofFrame = FRAMELENGTH;
+
+    if (SIO_issue (pC->xInp[zMI].hRxSio, &pC->xInp[zMI].inpBufConfig, sizeof (pC->xInp[zMI].inpBufConfig), PAF_SIO_REQUEST_SYNC))
+        return ASPERR_PASS + 0x16;
+
+    if (SIO_reclaim (pC->xInp[zMI].hRxSio, (Ptr)&pC->xInp[zMI].pInpBuf, NULL) != sizeof (PAF_InpBufConfig))
+        return ASPERR_PASS + 0x17;
+
+    //
+    // Receive and transmit the data in single-frame buffers
+    //
+
+    first = 1;
+    while (pC->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_PASS) {
+        PAF_OutBufConfig *pOutBuf;
+        PAF_InpBufConfig *pInpBuf;
+
+        if (first) {
+            first = 0;
+
+            TRACE_VERBOSE0("PAF_AST_passProcessing: starting output");
+
+            for (z=OUTPUT1; z < OUTPUTN; z++) {
+                getVal = SIO_issue (pC->xOut[z].hTxSio, &pC->xOut[z].outBufConfig, sizeof(pC->xOut[z].outBufConfig), 0);
+                if (getVal > 0) {
+                    errno = ASPERR_ISSUE;
+                    break;
+                }
+                else if (getVal < 0) {
+                    errno = -getVal;
+                    break;
+                }
+
+                if (getVal = SIO_ctrl (pC->xOut[z].hTxSio, PAF_SIO_CONTROL_UNMUTE, 0))
+                    return (getVal & 0xff) | ASPERR_MUTE;
+            }
+            if (errno)
+                break;
+
+        }
+
+        getVal = SIO_issue (pC->xInp[zMI].hRxSio, &pC->xInp[zMI].inpBufConfig, sizeof (pC->xInp[zMI].inpBufConfig), PAF_SIO_REQUEST_NEWFRAME);
+        if (getVal > 0) {
+            errno = ASPERR_ISSUE;
+            break;
+        }
+
+        TRACE_VERBOSE1("PAF_AST_passProcessing: awaiting frame -- input size %d", rxNumChan * FRAMELENGTH);
+
+        getVal = SIO_reclaim (pC->xInp[zMI].hRxSio, (Ptr) &pInpBuf, NULL);
+        if (getVal < 0) {
+            errno = -getVal;
+            break;
+        }
+
+        for (z=OUTPUT1; z < OUTPUTN; z++) {
+            getVal = SIO_reclaim (pC->xOut[z].hTxSio, (Ptr) &pOutBuf, NULL);
+            if (getVal < 0) {
+                errno = -getVal;
+                break;
+            }
+        }
+        if( errno )
+            break;
+
+        TRACE_VERBOSE0("PAF_AST_passProcessing: copying frame");
+
+        if (errno = pP->fxns->passProcessingCopy (pP, pQ, pC))
+            break;
+
+        for (z=OUTPUT1; z < OUTPUTN; z++) {
+            getVal = SIO_issue (pC->xOut[z].hTxSio, &pC->xOut[z].outBufConfig, sizeof(pC->xOut[z].outBufConfig), 0);
+            if (getVal > 0) {
+                errno = ASPERR_ISSUE;
+                break;
+            }
+            else if (getVal < 0) {
+                errno = -getVal;
+                break;
+            }
+        }
+        if( errno )
+            break;
+    }
+
+    //
+    // Close down receive/transmit
+    //
+
+    TRACE_TERSE0("PAF_AST_passProcessing: finalizing"));
+
+    for (z=OUTPUT1; z < OUTPUTN; z++) {
+        if (getVal = SIO_ctrl (pC->xOut[z].hTxSio, PAF_SIO_CONTROL_MUTE, 0)) {
+            if (! errno)
+                errno = (getVal & 0xff) | ASPERR_MUTE;
+            /* convert to sensical errno */
+        }
+    }
+
+    SIO_idle (pC->xInp[zMI].hRxSio);
+    for (z=OUTPUT1; z < OUTPUTN; z++)
+        SIO_idle (pC->xOut[z].hTxSio);
+
+    return errno;
+
+} //PAF_AST_passProcessing
+#endif
+
+#if 0
+// -----------------------------------------------------------------------------
+// AST Processing Function Helper - Pass-Through Processing Patch Point
+//
+//   Name:      PAF_AST_passProcessingCopy
+//   Purpose:   Pass-Through Processing Function for copying audio data
+//              from the input buffer to the output buffer.
+//   From:      AST Parameter Function -> passProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              x
+//
+
+#pragma CODE_SECTION(PAF_AST_passProcessingCopy,".text:_PAF_AST_passProcessingCopy")
+/* Pass Processing is often omitted from builds to save memory, */
+/* and CODE_SECTION/clink constructs facilitate this omission.  */
+
+Int
+PAF_AST_passProcessingCopy (const PAF_AST_Params *pP, const PAF_AST_Patchs *pQ, PAF_AST_Config *pC)
+{
+    Int z;                              /* output counter */
+    Int errno;                          /* error number */
+    Int i;
+    Int rxNumChan, txNumChan;
+    Int zMI = pP->zone.master;
+
+
+    asm (" .clink"); /* See comment above regarding CODE_SECTION/clink. */
+
+    // Copy data from input channels to output channels one of two ways:
+
+    if (SIO_ctrl (pC->xInp[zMI].hRxSio, PAF_SIO_CONTROL_GET_NUMCHANNELS, (Arg) &rxNumChan))
+        return (ASPERR_PASS + 0x12);
+
+    for (z=OUTPUT1; z < OUTPUTN; z++) {
+        if (SIO_ctrl (pC->xOut[z].hTxSio, PAF_SIO_CONTROL_GET_NUMCHANNELS, (Arg) &txNumChan))
+            return (ASPERR_PASS + 0x22);
+
+        if( txNumChan <= rxNumChan ) {
+
+            // Copy one to one, ignoring later rx channels as needed.
+
+            for( i=0; i < txNumChan; i++ ) {
+                errno = pP->fxns->copy( i, &pC->xInp[zMI].inpBufConfig, i, &pC->xOut[z].outBufConfig );
+                if( errno )
+                    return errno;
+            }
+        }
+        else {
+
+            // Copy one to many, repeating earlier rx channels as needed.
+
+            Int from, to;
+
+            from = 0;
+            to   = 0;
+            while( to < txNumChan ) {
+                errno = pP->fxns->copy( from, &pC->xInp[zMI].inpBufConfig, to, &pC->xOut[z].outBufConfig );
+                if( errno )
+                    return errno;
+
+                from++;
+                to++;
+                if( from == rxNumChan )
+                    from = 0;
+            }
+        }
+    }
+
+    return 0;
+} //PAF_AST_passProcessingCopy
+#endif
+
+// -----------------------------------------------------------------------------
+// ASIT Processing Function - Auto Processing
+//
+//   Name:      PAF_ASIT_autoProcessing
+//   Purpose:   Audio Stream Input Task Function for processing audio data to
+//              determine the input type without output.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard or SIO form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information on initialization.
+//
+
+#define DECSIOMAP(X)                                                \
+    pP->pDecSioMap->map[(X) >= pP->pDecSioMap->length ? 0 : (X)]
+
+Int
+PAF_ASIT_autoProcessing(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int inputTypeSelect, 
+    ALG_Handle pcmAlgMaster
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int errno = 0;                      /* error number */
+    Int nbytes;
+    Int frameLength;
+    Int zMD = pC->masterDec;
+    Int zMI = pP->zone.master;
+    Int zMS = pC->masterStr;
+
+    TRACE_VERBOSE1("PAF_AST_autoProcessing: AS%d: PAF_AST_autoProcessing", as+zMS);
+
+    if (errno = SIO_ctrl (pC->xInp[zMI].hRxSio,
+                          PAF_SIO_CONTROL_SET_SOURCESELECT,
+                          DECSIOMAP (pC->xDec[zMD].decodeStatus.sourceSelect)))
+    {
+        TRACE_VERBOSE2("PAF_AST_autoProcessing: AS%d: source select returns 0x%x", as+zMS, errno);
+        return errno;
+    }
+    //frameLength = pP->fxns->computeFrameLength (pcmAlgMaster, FRAMELENGTH,
+    //                                            pC->xDec[zMD].decodeStatus.bufferRatio);
+    frameLength = FRAMELENGTH; // FL: fix PCM frameLength, hack for demo.
+
+    if (errno = SIO_ctrl (pC->xInp[zMI].hRxSio,
+                          PAF_SIO_CONTROL_SET_PCMFRAMELENGTH, frameLength))
+    {
+        TRACE_VERBOSE2("PAF_AST_autoProcessing: SET_PCMFRAMELENGTH returns 0x%x, returning ASPERR_AUTO_LENGTH, 0x%x",
+            errno, ASPERR_AUTO_LENGTH);
+        return ASPERR_AUTO_LENGTH;
+    }
+
+    if (errno = SIO_issue (pC->xInp[zMI].hRxSio,
+                           &pC->xInp[zMI].inpBufConfig, sizeof (pC->xInp[zMI].inpBufConfig),
+                           PAF_SIO_REQUEST_SYNC))
+    {
+        TRACE_VERBOSE2("PAF_AST_autoProcessing: REQUEST_SYNC returns 0x%x, returning ASPERR_ISSUE, 0x%x",
+            errno, ASPERR_ISSUE);
+        return ASPERR_ISSUE;
+    }
+
+    TRACE_VERBOSE1("PAF_AST_autoProcessing: AS%d: awaiting sync", as+zMS);
+
+    // all of the sync scan work is done in this call. If the error returned
+    // is DIBERR_SYNC then that just means we didn't find a sync, not a real I/O
+    // error so we mask it off.
+    nbytes = SIO_reclaim (pC->xInp[zMI].hRxSio, (Ptr)&pC->xInp[zMI].pInpBuf, NULL);
+    if (nbytes == -DIBERR_SYNC)
+    {
+        TRACE_TERSE2("PAF_AST_autoProcessing: AS%d: SIO_reclaim returned 0x%x, ignoring", as+zMS, nbytes);
+        return 0;
+    }
+    if (nbytes != sizeof (PAF_InpBufConfig))
+    {
+        TRACE_TERSE3("PAF_AST_autoProcessing. SIO_reclaim returned %d, not %d, returning ASPERR_RECLAIM (0x%x)",
+                     nbytes, sizeof (PAF_InpBufConfig), ASPERR_RECLAIM);
+        return ASPERR_RECLAIM;
+    }
+    if (errno)
+    {
+        TRACE_TERSE2("PAF_AST_autoProcessing: AS%d: returning errno 0x%x", as+zMS, errno);
+    }
+    return errno;
+} //PAF_ASIT_autoProcessing
+
+// -----------------------------------------------------------------------------
+// ASIT Processing Function - Decode Processing
+//
+//   Name:      PAF_ASIT_decodeProcessing
+//   Purpose:   Audio Stream Input Task Function for processing audio data.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information on initialization (via children).
+//              * State information on processing (via children).
+//              * Decode warnings.
+//
+// When "writeDECModeContinuous" is used for zMI input/decode:
+// PAF_AST_decodeProcessing() loop may be (is designed to be) exited:
+// (a) if "writeDECCommandRestart" is used
+//    (or "writeDECCommandAbort", but this performs no cleanup whatsoever, and so its use is discouraged)
+// (b) if "writeDECSourceSelectNone" is used
+// [ the latter events lead to QUIT state, simply for exiting (errme = errno = ASPERR_QUIT)
+// (c) if an error occurs in
+//     INIT
+//     CONT ("subsequent block state", which "Establish[es] secondary timing")
+//         -> PAF_AST_decodeCont(): "Await slave inputs"
+//     STREAM (errno |= PAF_COMPONENT_ASP)
+//     ENCODE (errno |= PAF_COMPONENT_ENCODE)
+// [ the latter errors lead to "switch_break:"
+//         -> PAF_AST_decodeComplete(), which always returns 0 (no error) ]
+//
+// [ Notably, in FINAL ("frame-finalization state")
+//         -> PAF_AST_decodeFinalTest() is *not* called,
+//   and so any other (asynchronous) changes in pC->xDec[zMD].decodeStatus.sourceSelect are ignored. ]
+// [ For completeness, note also: "default" state, internal check (errme = errno = ASPERR_UNKNOWNSTATE) ]
+//
+// States in which error can't occur:
+//     AGAIN ("subsequent initial state")
+//
+// States in which (some) errors must be handled:
+//     INFO1 ("first frame state")
+//         -> PAF_AST_decodeInfo(): pass on ASPERR_INFO_RATECHANGE, ASPERR_INFO_PROGRAM ("bad" internal error)
+//            -> *DONE* must "catch" ASPERR_RECLAIM from SIO_reclaim (pC->xInp[zMI].hRxSio) -- note zMI only **
+//               ?*? but what about ASPERR_RESYNC from same call ?*?
+//            -> *for now, at least, pass on error from pP->fxns->updateInputStatus ()*
+//            -> *DONE* must "catch" error from (zMI) dec->fxns->info() **
+//         -> PAF_AST_decodeInfo1(): pass on any errors which occur here:
+//            - pP->fxns->streamChainFunction (... PAF_ASP_CHAINFRAMEFXNS_RESET)
+//            - enc->fxns->info()
+//            - pP->fxns->setCheckRateX()
+//            - pP->fxns->startOutput()
+//            - "Start slave inputs if necessary"
+//     INFO2 ("subsequent frame state")
+//         -> PAF_AST_decodeInfo(): (see above)
+//         -> PAF_AST_decodeInfo2(): pass on any errors which occur here:
+//            - pP->fxns->setCheckRateX()
+//     TIME ("timing state")
+//         -> PAF_AST_decodeTime(): "Special timing consideations for AC-3"
+//         -> performs SIO_issue (... PAF_SIO_REQUEST_FULLFRAME) & SIO_reclaim() *for zMI only*
+//         -> now, DIB_issue [PAF_SIO_REQUEST_FULLFRAME] would only return SYS_EINVAL for "bad" internal error
+//            (*OK* don't try to recover from this*)
+//         -> much more likely would be SIO_reclaim() error (ASPERR_RECLAIM)
+//         -> *DONE* must "catch" (just) ASPERR_RECLAIM error -- note zMI only,
+//            possibly in PAF_AST_decodeProcessing() itself **
+//     DECODE ("decode state")
+//         -> PAF_AST_decodeDecode(): pass on error from
+//            - PAF_SIO_CONTROL_GET_NUM_REMAINING ("bad" internal error)
+//            - dec->fxns->reset()
+//            - PAF_SIO_CONTROL_SET_PCMFRAMELENGTH
+//         -> *DONE* must catch error from (zMI) dec->fxns->decode()
+//         -> *?* must catch ASPERR_ISSUE from (zMI) SIO_issue()
+Int
+PAF_ASIT_decodeProcessing(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int sourceSelect
+)
+{
+    //Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                              /* decode counter */
+    Int errno;                          /* error number */
+    Int getVal;
+    enum { INIT, INFO1, INFO2, DECODE, FINAL, QUIT } state;
+    ALG_Handle alg[DECODEN_MAX];
+    Int zMD = pC->masterDec;
+    Int zMS = pC->masterStr;
+    Int size;
+    //PAF_InpBufConfig *pIpBufConfig;
+    Int frame; // decoder input frame count
+    Int block; // (***) FL: formerly  -- decoder output block count / input frame
+
+
+    for (z=DECODE1; z < DECODEN; z++)
+        alg[z] = pC->xDec[z].decAlg[PAF_SOURCE_PCM];
+    alg[zMD] = NULL; // decAlgMaster; // FL: alg[] init is on slave
+
+    //
+    // Receive and process the data in single-frame buffers
+    //
+
+    state = INIT;
+    errno = 0; /* error number */
+
+    TRACE_TERSE1("PAF_AST_decodeProcessing: sourceSelect is %d", pC->xDec[zMD].decodeStatus.sourceSelect);
+
+    for (;;) 
+    {
+        if (pC->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_NONE)
+        {
+            TRACE_VERBOSE0("PAF_AST_decodeProcessing: sourceSelect == PAF_SOURCE_NONE");
+            state = QUIT;
+        }
+
+        // Process commands (decode)
+        if (getVal = pP->fxns->decodeCommand(pP, pQ, pC)) 
+        {
+            if (state != INIT)   // no need to restart/abort if not yet started
+            {
+                if (getVal == ASPERR_QUIT)
+                {
+                    state = QUIT;
+                    TRACE_VERBOSE0("PAF_AST_decodeProcessing. %d: state = QUIT");
+                }
+                else if (getVal == ASPERR_ABORT)
+                {
+                    TRACE_VERBOSE0("PAF_AST_decodeProcessing. %d: return getVal");
+                    return getVal;
+                }
+                else
+                {
+                    /* ignore */;
+                }
+            }
+            TRACE_VERBOSE0("PAF_AST_decodeProcessing: state == INIT");
+        }
+
+        TRACE_TIME((&TIME_MOD,         "... + %d = %d ->", dtime(), TSK_time()));
+        TRACE_TIME((&TIME_MOD,         "                 state = %s", stateName[state]));
+
+        // Process state (decode)
+        switch (state) 
+        {
+            case INIT: // initial state
+                gAsipInitCnt++;
+                Log_info0("TaskAsip: state=INIT");
+
+                // (***) FL: hackin'
+#if 0 // status for shared beta units can change (e.g. at-boot or alpha)
+                // 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);
+                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);
+                Cache_wait();
+#endif                
+                size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DECODE]->size;
+                Cache_wbInv((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_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_PCM]), size, Cache_Type_ALLD, 0);
+                size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
+                Cache_wbInv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+                Cache_wait();                
+                
+                //if (errno = pP->fxns->decodeInit (pP, pQ, pC, alg))
+                //if (errno = pP->fxns->decodeInit(pP, pQ, pC, alg, sourceSelect))
+                if (errno = pP->fxns->decodeInit(pP, pQ, pC, sourceSelect))
+                {
+                    TRACE_VERBOSE1("AF_AST_decodeProcessing: INIT, errno 0x%x.  break after decodeInit", errno);
+                    break;
+                }
+                
+#if 0
+                    // (***) 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);
+                size = IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]->size;
+                Cache_inv((Ptr)(IACP_STD_BETA_TABLE.pStatus[STD_BETA_DDP]), size, Cache_Type_ALLD, 0);
+                Cache_wait();
+#endif
+                
+                frame = 0;
+                block = 0;
+
+                TRACE_VERBOSE0("AF_AST_decodeProcessing: state: INIT->INFO1");
+                state = INFO1;
+                continue;
+
+            case INFO1: // first frame state
+                gAsipInfo1Cnt++;
+                Log_info0("TaskAsip: state=INFO1");
+                
+#if 0
+                // (***) FL: hackin'
+                // write back Inp configuration
+                Cache_wb(&gPAF_AST_config.xInp[0], INPUTN*sizeof(PAF_AST_InpBuf), Cache_Type_ALLD, 0);
+                // write back input data
+                pIpBufConfig = &gPAF_AST_config.xInp[0].inpBufConfig;
+                size = pIpBufConfig->frameLength * pIpBufConfig->sizeofElement;
+                Cache_wb(pIpBufConfig->pntr.pLgInt, size, Cache_Type_ALLD, 0);
+                // write back Dec configuration
+                Cache_wb(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                Cache_wait();            
+#endif                
+
+                // Establish primary timing
+                if (errno = pP->fxns->decodeInfo(pP, pQ, pC, frame, block))
+                {
+                    TRACE_TERSE1("INFO1: errno 0x%x after decodeInfo, primary timing", errno);
+                    break;
+                }
+                
+#if 0
+                // (***) FL: hackin'
+                // invalidate Dec configuration
+                Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                Cache_wait();                            
+#endif                
+
+                // Don't start decode until major access unit is found.
+                if (((pC->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_THD)    ||
+                     (pC->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_DXP)    ||
+                     (pC->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_DTSHD)) &&
+                     (pC->xStr[zMS].pAudioFrame->sampleRate == PAF_SAMPLERATE_UNKNOWN)) 
+                {
+                    Int z;
+                    for (z=DECODE1; z < DECODEN; z++) 
+                    {
+                        Int zI = pP->inputsFromDecodes[z];
+                        if (pC->xInp[zI].hRxSio && pC->xDec[z].decodeStatus.mode)
+                        {
+                            TRACE_VERBOSE0("TaskAsip: PAF_AST_decodeProcessing: INFO1, SIO_issue");
+                            if (SIO_issue (pC->xInp[zI].hRxSio, &pC->xInp[zI].inpBufConfig,
+                                sizeof (pC->xInp[zI].inpBufConfig), PAF_SIO_REQUEST_NEWFRAME))
+                            {
+                                TRACE_TERSE0("PAF_AST_decodeProcessing. %d: INFO1, return (ASPERR_ISSUE)");
+                                return (ASPERR_ISSUE);
+                            }
+                        }
+                    }
+                    TRACE_VERBOSE1("PAF_AST_decodeProcessing: INFO1: frame %d, not major access unit", frame);
+                    frame++;
+                    state = INFO1;
+                    continue;
+                }
+                TRACE_VERBOSE1("PAF_AST_decodeProcessing: INFO1: frame %d, major access unit found", frame);
+
+                // Establish secondary timing
+                if (errno = pP->fxns->decodeInfo1(pP, pQ, pC, frame, block))
+                {
+                    TRACE_VERBOSE1("PAF_AST_decodeProcessing: INFO1, errno 0x%x.  break after decodeInfo1", errno);
+                    break;
+                }
+
+                TRACE_VERBOSE0("PAF_AST_decodeProcessing: state: INFO1->DECODE");
+                state = DECODE;
+                continue;
+
+            case INFO2: // subsequent frame state
+                gAsipInfo2Cnt++;
+                Log_info0("TaskAsip: state=INFO2");
+
+#if 0            
+                // (***) FL: hackin'
+                // write back Inp configuration
+                Cache_wb(&gPAF_AST_config.xInp[0], INPUTN*sizeof(PAF_AST_InpBuf), Cache_Type_ALLD, 0);
+                // write back input data
+                pIpBufConfig = &gPAF_AST_config.xInp[0].inpBufConfig;
+                size = pIpBufConfig->frameLength * pIpBufConfig->sizeofElement;
+                Cache_wb(pIpBufConfig->pntr.pLgInt, size, Cache_Type_ALLD, 0);
+                // write back Dec configuration
+                Cache_wb(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                Cache_wait();
+#endif                
+
+                // Establish primary timing
+                if (errno = pP->fxns->decodeInfo(pP, pQ, pC, frame, block))
+                {
+                    TRACE_TERSE1("PAF_AST_decodeProcessing: INFO2 break on decodeInfo. errno 0x%x", errno);
+                    break;
+                }
+
+#if 0            
+                // (***) FL: hackin'
+                // invalidate Dec configuration
+                Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                Cache_wait();                                            
+#endif                
+                
+                if (errno = pP->fxns->decodeInfo2(pP, pQ, pC, frame, block))
+                {
+                    TRACE_TERSE1("PAF_AST_decodeProcessing. %d: INFO2 break on decodeInfo2. errno 0x%x", errno);
+                    break;
+                }
+
+                TRACE_VERBOSE0("PAF_AST_decodeProcessing: state: INFO2->DECODE");
+                state = DECODE;
+                continue;
+
+            case DECODE: // decode state
+                gAsipDecodeCnt++;
+                Log_info0("TaskAsip: state=DECODE");
+
+#if 0
+                // (***) FL: hackin'
+                // write back Dec configuration
+                Cache_wb(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                Cache_wait();                        
+#endif
+            
+                if (errno = pP->fxns->decodeDecode(pP, pQ, pC, sourceSelect, frame, block))
+                {
+                    TRACE_TERSE1("PAF_AST_decodeProcessing: state: DECODE.  decodeDecode err 0x%04x", errno);
+                    break;
+                }
+      
+#if 0      
+                // (***) FL: hackin'
+                // invalidate Dec configuration
+                Cache_inv(&gPAF_AST_config.xDec[0], DECODEN*sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+                Cache_wait();                                            
+#endif                
+                
+                TRACE_VERBOSE0("PAF_AST_decodeProcessing: state: DECODE->FINAL");
+                state = FINAL;
+                continue;
+
+            case FINAL: // frame-finalization state
+                gAsipFinalCnt++;
+                Log_info0("TaskAsip: state=FINAL");
+
+                // Check for final frame, and if indicated:
+                // - Exit state machine to "complete" processing.
+                if (pP->fxns->decodeFinalTest(pP, pQ, pC, frame, block)) 
+                {
+                    break;
+                }
+
+                frame++;
+                TRACE_VERBOSE0("PAF_AST_decodeProcessing: state: FINAL->AGAIN");
+                state = INFO2;
+                continue;
+
+            case QUIT: // exit state
+                gAsipQuitCnt++;
+                Log_info0("TaskAsip: state=QUIT");
+
+                // Quit:
+                // - Set error number registers.
+                // - Exit state machine to "decode complete" processing.
+                TRACE_VERBOSE0("PAF_AST_decodeProcessing: state: QUIT");
+                errno = ASPERR_QUIT;
+                break;
+
+            default: // unknown state
+
+                // Unknown:
+                // - Set error number registers.
+                // - Exit state machine to "decode complete" processing.
+
+                TRACE_TERSE1("PAF_AST_decodeProcessing: state: unknown, 0x%x", state);
+                errno = ASPERR_UNKNOWNSTATE;
+                break;
+
+        }  // End of switch (state).
+
+        TRACE_VERBOSE0("PAF_AST_decodeProcessing: Calling decode complete");
+        if (pP->fxns->decodeComplete(pP, pQ, pC, alg, frame, block))
+        {
+            /* ignored? */;
+        }
+
+        TRACE_TIME((&TIME_MOD, "as1-f2: ... + %d = ?? (final? %d)", dtime(), state == FINAL));
+
+        return errno;
+    }  // End of for (;;) to Receive, process, and transmit the data.
+} //PAF_ASIT_decodeProcessing
+
+// -----------------------------------------------------------------------------
+// ASIT Decoding Function - Decode Command Processing
+//
+//   Name:      PAF_ASIT_decodeCommand
+//   Purpose:   Decoding Function for processing Decode Commands.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * Command execution.
+//
+
+Int
+PAF_ASIT_decodeCommand(
+    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 counter */
+    Int zS;
+
+
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        zS = pP->streamsFromDecodes[z];
+        if (!(pC->xDec[z].decodeStatus.command2 & 0x80)) 
+        {
+            switch (pC->xDec[z].decodeStatus.command2) 
+            {
+                case 0: // command none - process
+                    pC->xDec[z].decodeStatus.command2 |= 0x80;
+                    break;
+                case 1: // command abort - leave now
+                    TRACE_TERSE2("AS%d: PAF_AST_decodeCommand: decode command abort (0x%02x)", as+zS, 1);
+                    pC->xDec[z].decodeStatus.command2 |= 0x80;
+                    return (ASPERR_ABORT);
+                case 2: // command restart - leave later
+                    TRACE_TERSE2("AS%d: PAF_AST_decodeCommand: decode command quit (0x%02x)", as+zS, 2);
+                    pC->xDec[z].decodeStatus.command2 |= 0x80;
+                    return (ASPERR_QUIT);
+                default: // command unknown - ignore
+                    break;
+            }
+        }
+    }
+
+    return 0;
+} //PAF_ASIT_decodeCommand
+
+// -----------------------------------------------------------------------------
+// ASIT Decoding Function - Reinitialization of Decode
+//
+//   Name:      PAF_ASIT_decodeInit
+//   Purpose:   Decoding Function for reinitializing the decoding process.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard or SIO form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+Int
+PAF_ASIT_decodeInit(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int sourceSelect
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                              /* decode/encode counter */
+    Int errno;                          /* error number */
+    Int zI, zS;
+    Int zMD = pC->masterDec;
+    Int zMI = pP->zone.master;
+    // FL: messaging
+    ASP_Msg* pAspMsg;
+    Int argIdx;
+    Int decErrno;
+    Int status;
+    PAF_DecodeOpCircBuf *pCb; // FL: decoder output circular buffer
+    
+    (void)as;  // clear compiler warning in case not used with tracing disabled
+
+    // reset frameCount
+    for (z=DECODE1; z < DECODEN; z++)
+    {
+        if (pC->xDec[z].decodeStatus.mode)
+        {
+            pC->xDec[z].decodeStatus.frameCount = 0;
+        }
+    }
+
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        zI = pP->inputsFromDecodes[z];
+        zS = pP->streamsFromDecodes[z];
+        (void)zS; // clear compiler warning in case not used with tracing disabled
+        if (pC->xInp[zI].hRxSio && pC->xDec[z].decodeStatus.mode) 
+        {
+            Uns gear;
+            Int frameLength;
+            TRACE_VERBOSE1("AS%d: PAF_AST_decodeInit: initializing decode", as+zS);
+
+            // FL: send dec activate message to slave
+            pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize);  /* allocate message */
+            if (pAspMsg == NULL)
+            {
+                TRACE_TERSE0("MessageQ_alloc() failure.");
+                SW_BREAKPOINT; // temporary
+                return -1; // temporary
+            }
+            MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
+            pAspMsg->cmd = ASP_SLAVE_DEC_ACTIVATE;                                              /* fill in message payload */
+            pAspMsg->procId = hAspMsgMaster->masterProcId;
+            pAspMsg->expectResp = TRUE;
+            pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+            argIdx = 0; // set decIdx (zone index)
+            *(Int32 *)&pAspMsg->buf[argIdx] = z;
+            TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
+            status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);                       /* send message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+            // wait for dec activate complete message from slave
+            status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+            if (status != MessageQ_S_SUCCESS)
+            {
+                TRACE_TERSE0("MessageQ_get() failure.");
+                SW_BREAKPOINT; // temporary
+                return -1; // temporary
+            }
+            if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) || 
+                (pAspMsg->cmd != ASP_MASTER_DEC_ACTIVATE_DONE) ||
+                (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+            {
+                TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                SW_BREAKPOINT; // temporary
+                return -1; // temporary
+            }      
+            hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
+            TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            // free the message
+            status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+            
+#if 0 // FL: decoder activate call, slave
+            if (decAlg[z]->fxns->algActivate)
+                decAlg[z]->fxns->algActivate (decAlg[z]);
+#endif
+
+            // (***) FL: hackin'
+            // write back Dec configuration
+            Cache_wb(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+            Cache_wait();
+
+            // FL: send dec reset message to slave
+            pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize);  /* allocate message */
+            if (pAspMsg == NULL)
+            {
+                TRACE_TERSE0("MessageQ_alloc() failure.");
+                SW_BREAKPOINT; // temporary
+                return -1; // temporary
+            }
+            MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
+            pAspMsg->cmd = ASP_SLAVE_DEC_RESET;                                                 /* fill in message payload */
+            pAspMsg->procId = hAspMsgMaster->masterProcId;
+            pAspMsg->expectResp = TRUE;
+            pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+            argIdx = 0; // set decIdx
+            *(Int32 *)&pAspMsg->buf[argIdx] = z;
+            TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
+            // wait for dec reset complete message from slave
+            status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+            status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+            if (status != MessageQ_S_SUCCESS)
+            {
+                TRACE_TERSE0("MessageQ_get() failure.");
+                SW_BREAKPOINT; // temporary
+                return -1; // temporary
+            }
+            if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) &&
+                (pAspMsg->cmd == ASP_MASTER_DEC_RESET_DONE) && 
+                (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+            {
+                hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
+                TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                TRACE_MSG1("decErrno=%d", pAspMsg->buf[0]);
+
+                argIdx = 0; // get decErrno
+                decErrno = *(Int32 *)&pAspMsg->buf[argIdx];
+                if (decErrno != 0)
+                {
+                    return decErrno;
+                }
+            }
+            else
+            {
+                TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                SW_BREAKPOINT; // temporary
+                return -1; // temporary
+            }
+            // free the message
+            status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+
+            // (***) FL: hackin'
+            // invalidate Dec configuration
+            Cache_inv(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+            Cache_wait();                            
+            
+#if 0 // FL: decoder reset call, slave
+            if (dec->fxns->reset
+                && (errno = dec->fxns->reset (dec, NULL,
+                                              &pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus)))
+                return errno;
+#endif
+            
+            gear = pC->xDec[z].decodeStatus.aspGearControl;
+            pC->xDec[z].decodeStatus.aspGearStatus = gear < GEARS ? gear : 0;
+            
+#if 0 // FL: change handle to decIdx (zone index)
+            frameLength = pP->fxns->computeFrameLength(decAlg[z], 
+                FRAMELENGTH,
+                pC->xDec[z].decodeStatus.bufferRatio);
+#endif
+#if 0 // (***) FL: hackin'. Bypass computeFrameLength().
+            frameLength = pP->fxns->computeFrameLength(z, 
+                FRAMELENGTH, 
+                pC->xDec[z].decodeStatus.bufferRatio);
+#else
+            if (sourceSelect == PAF_SOURCE_PCM)
+            {
+                frameLength = 256;
+            }
+            else if (sourceSelect == PAF_SOURCE_DDP)
+            {
+                frameLength = 1536;
+            }
+            else
+            {
+                frameLength = 256;
+            }
+#endif    
+            
+            pC->xDec[z].decodeControl.frameLength = frameLength;
+            pC->xDec[z].decodeInStruct.sampleCount = frameLength;
+            pC->xDec[z].decodeControl.sampleRate = PAF_SAMPLERATE_UNKNOWN;
+            
+            // (***) FL: hackin'. Count samples for DDP.
+            // Add framework frame length and running sample count to decoder control.
+            //pC->xDec[z].decodeControl.pafFrameLength = FRAMELENGTH;
+            //pC->xDec[z].decodeControl.rdSampleCount = 0;
+
+            // Start decoder output circular buffer writes
+            pCb = &pC->xDec[z].decOpCb;
+            errno = cbInit(sourceSelect, frameLength, FRAMELENGTH, pCb);
+            if (errno)
+            {
+                return errno;
+            }
+            // FL: debug
+            cbLog(pCb, 1);
+            
+            if (z != zMD) 
+            {
+                if (errno = SIO_idle(pC->xInp[zI].hRxSio))
+                {
+                    return errno;
+                }
+            }
+
+            if (errno = SIO_ctrl(pC->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_SOURCESELECT,
+                DECSIOMAP(pC->xDec[z].decodeStatus.sourceSelect)))
+            {
+                return errno;
+            }
+            if (errno = SIO_ctrl(pC->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_PCMFRAMELENGTH, 
+                frameLength))
+            {
+                return errno;
+            }
+            if (errno = pP->fxns->updateInputStatus(pC->xInp[zI].hRxSio, &pC->xInp[zI].inpBufStatus, 
+                &pC->xInp[zI].inpBufConfig))
+            {
+                return errno;
+            }
+        }
+    }
+
+    if (pC->xInp[zMI].hRxSio) 
+    {
+        errno = SIO_issue(pC->xInp[zMI].hRxSio, &pC->xInp[zMI].inpBufConfig,
+            sizeof(pC->xInp[zMI].inpBufConfig), PAF_SIO_REQUEST_NEWFRAME);
+        if (errno)
+        {
+            return errno;
+        }
+    }
+
+    return 0;
+} //PAF_AST_decodeInit
+
+// -----------------------------------------------------------------------------
+// ASIT Decoding Function - Info Processing, Common
+//
+//   Name:      PAF_ASIT_decodeInfo
+//   Purpose:   Decoding Function for processing information in a manner that
+//              is common for both initial and subsequent frames of input data.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+Int
+PAF_ASIT_decodeInfo(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int frame, 
+    Int block
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                              /* input/decode/stream counter */
+    Int errno;                          /* error number */
+    Int sioErr;                         /* error number, SIO */
+    Int zD, zI, zS, zX;
+    Int zMD = pC->masterDec;
+    Int zMI = pP->zone.master;
+    Int zMS = pC->masterStr;
+    UInt32 curTime;
+    // FL: Messaging
+    ASP_Msg *pAspMsg;
+    Int argIdx;
+    Int status;
+    // FL: hackin'
+    //Int size;
+    //PAF_InpBufConfig *pIpBufConfig;
+
+    (void)zMS;  (void)as;  // clear compiler warning in case not used with tracing disabled
+
+    // Set decode control: sample rate, emphasis
+    for (z=INPUT1; z < INPUTN; z++)
+    {
+        zD = z;
+        for (zX = DECODE1; zX < DECODEN; zX++) 
+        {
+            if (pP->inputsFromDecodes[zX] == z) 
+            {
+                zD = zX;
+                break;
+            }
+        }
+
+        if (pC->xInp[z].hRxSio) 
+        {
+            //determine associated decoder
+            if (pC->xInp[z].inpBufStatus.sampleRateStatus != 
+                pC->xDec[zD].decodeControl.sampleRate) 
+            {
+                if (pC->xDec[zD].decodeControl.sampleRate == PAF_SAMPLERATE_UNKNOWN) 
+                {
+                    pC->xDec[zD].decodeControl.sampleRate = 
+                        pC->xInp[z].inpBufStatus.sampleRateStatus;
+                }
+                else
+                {
+                    TRACE_TERSE1("AS%d: return error ASPERR_INFO_RATECHANGE", as+pC->masterStr);
+                    TRACE_TERSE2("inpBufStatus.sampleRateStatus: 0x%x, decodeControl.sampleRate: 0x%x",
+                        pC->xInp[z].inpBufStatus.sampleRateStatus, 
+                        pC->xDec[zD].decodeControl.sampleRate);
+                    // return (ASPERR_INFO_RATECHANGE);
+                }
+            }
+            pC->xDec[zD].decodeControl.emphasis = 
+                pC->xDec[zD].decodeStatus.sourceDecode != PAF_SOURCE_PCM
+                ? PAF_IEC_PREEMPHASIS_NO // fix for Mantis ID #119
+                : pC->xInp[z].inpBufStatus.emphasisStatus;
+        }
+        else 
+        {
+            pC->xDec[zD].decodeControl.sampleRate = PAF_SAMPLERATE_UNKNOWN;
+            pC->xDec[zD].decodeControl.emphasis = PAF_IEC_PREEMPHASIS_UNKNOWN;
+        }
+    }
+
+    // Wait for info input
+    TRACE_VERBOSE2("PAF_ASIT_decodeInfo: AS%d: awaiting frame %d -- sync+info+data", as+zMS, frame);
+    if (pC->xInp[zMI].hRxSio) 
+    {
+        TRACE_VERBOSE0("PAF_ASIT_decodeInfo: call SIO_reclaim to get input buffer.");
+        sioErr = SIO_reclaim(pC->xInp[zMI].hRxSio, (Ptr)&pC->xInp[zMI].pInpBuf, NULL);
+        if (sioErr != sizeof(pC->xInp[zMI].inpBufConfig))
+        {
+            TRACE_TERSE1("SIO_reclaim on input returned error ASPERR_RECLAIM.  sioErr: 0x%x", sioErr);
+            return ASPERR_RECLAIM;
+        }
+        
+        // FL: debug, capture input buffer
+        capIb(pC->xInp[zMI].pInpBuf);
+        
+        //
+        // Simulate Rx SIO_reclaim() pend
+        //
+        //Semaphore_pend(semaphoreRxAudio, BIOS_WAIT_FOREVER); 
+        gTaskAsipCnt++;
+        curTime = Clock_getTicks();
+        //System_printf("System time in TaskAsipFxn Rx audio = %lu\n", (ULong)curTime);        
+        //Log_info1("System time in TaskAsipFxn Rx audio = %u", curTime);
+        //Log_info1("decodeInfo():Rx SIO reclaim(), system time = %u", curTime);
+    } //pC->xInp[zMI].hRxSio
+
+    // Decode info
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        zI = pP->inputsFromDecodes[z];
+        zS = pP->streamsFromDecodes[z];
+        (void)zS; // clear compiler warning in case not used with tracing disabled
+        if (pC->xInp[zI].hRxSio && pC->xDec[z].decodeStatus.mode) 
+        {
+            TRACE_GEN2("PAF_ASIT_decodeInfo: AS%d: processing frame %d -- info", as+zS, frame);
+
+            if (errno = pP->fxns->updateInputStatus(pC->xInp[zI].hRxSio,
+                &pC->xInp[zI].inpBufStatus, &pC->xInp[zI].inpBufConfig))
+            {
+                TRACE_TERSE1("return error errno 0x%x.", errno);
+                return errno;
+            }
+
+#if 1
+            // (***) FL: hackin'
+            // write back Inp configuration
+            Cache_wb(&gPAF_AST_config.xInp[zI], sizeof(PAF_AST_InpBuf), Cache_Type_ALLD, 0);
+            // write back input data //  (***) GJ: don't need this for 1xI2S HDMI/SPDIF. Maybe need this for 4xI2S HDMI.
+            //pIpBufConfig = &gPAF_AST_config.xInp[zI].inpBufConfig;
+            //size = pIpBufConfig->frameLength * pIpBufConfig->sizeofElement;
+            //Cache_wb((Ptr)pIpBufConfig->pntr.pSmInt, size, Cache_Type_ALLD, 0);
+            // write back Dec configuration
+            Cache_wb(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+            Cache_wait();
+#endif
+            
+            // FL: send info message to slave
+            pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
+            if (pAspMsg == NULL)
+            {
+                TRACE_TERSE0("MessageQ_alloc() failure.");
+                SW_BREAKPOINT; // temporary
+                return -1;  // temporary
+            }
+            MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
+            pAspMsg->cmd = ASP_SLAVE_DEC_INFO;                                                  /* fill in message payload */
+            pAspMsg->procId = hAspMsgMaster->masterProcId;
+            pAspMsg->expectResp = TRUE;
+            pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+            argIdx = 0; // set decIdx
+            *(Int32 *)&pAspMsg->buf[argIdx] = z;
+            TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
+            status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message to slave */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+            // wait for dec info complete message from slave -- temporary
+            status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+            if (status != MessageQ_S_SUCCESS)
+            {
+                TRACE_TERSE0("MessageQ_get() failure.");
+                SW_BREAKPOINT;
+                return -1; // temporary
+            }
+            if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) || 
+                (pAspMsg->cmd != ASP_MASTER_DEC_INFO_DONE) || 
+                (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+            {
+                TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                SW_BREAKPOINT; // temporary
+            }           
+            hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
+            TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            // free the message
+            status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+
+#if 1
+            // (***) FL: hackin'
+            // invalidate Dec configuration
+            Cache_inv(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+            Cache_wait();                            
+#endif            
+            
+#if 0 // FL: decoder info call, slave
+            if (dec->fxns->info
+                && (errno = dec->fxns->info (dec, NULL,
+                                             &pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus))) 
+#endif
+            if (errno)
+            {
+                TRACE_TERSE1("return error errno 0x%x.", errno);
+                return errno;
+            }
+            // increment decoded frame count
+            pC->xDec[z].decodeStatus.frameCount += 1;
+        }
+    } // z=DECODE1 to DECODEN
+
+    // query IB for latest sourceProgram (needed if we started decoding due to a force mode)
+    if (pC->xDec[zMD].decodeStatus.mode) 
+    {
+        XDAS_Int8 sourceProgram;
+        if (errno = SIO_ctrl(pC->xInp[zMI].hRxSio, PAF_SIO_CONTROL_GET_SOURCEPROGRAM,
+            (Arg)&sourceProgram))
+        {
+            TRACE_TERSE1("return error ASPERR_AUTO_PROGRAM. errno 0x%x.", errno);
+            return ASPERR_AUTO_PROGRAM;
+        }
+        pC->xDec[zMD].decodeStatus.sourceProgram = sourceProgram;
+
+#if 0
+        // (***) FL: hackin'
+        Cache_wb((Ptr)&pC->xDec[zMD].decodeStatus.sourceProgram,
+            sizeof(pC->xDec[zMD].decodeStatus.sourceProgram), Cache_Type_ALLD, 0);
+        Cache_wait();
+#endif        
+    }
+
+    // since now decoding update decode status for all enabled decoders
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        if (pC->xDec[z].decodeStatus.mode) 
+        {
+            pC->xDec[z].decodeStatus.sourceDecode = pC->xDec[z].decodeStatus.sourceProgram;
+            if (pC->xDec[z].decodeStatus.sourceSelect == PAF_SOURCE_SNG)
+            {
+                pC->xDec[z].decodeStatus.sourceDecode = PAF_SOURCE_SNG;
+            }
+            
+#if 0
+            // (***) FL: hackin'
+            Cache_wb((Ptr)&pC->xDec[z].decodeStatus.sourceDecode,
+                sizeof(pC->xDec[z].decodeStatus.sourceDecode), Cache_Type_ALLD, 0);
+            Cache_wait();
+#endif            
+        }
+    }
+
+#if 0 // FL: ASDT (slave)
+    // TODO: move this to start of this function so that it doesn't affect IO timing
+    // Initialize audio frame(s)
+    //    Re-initialize audio frame if there is an associated decode and
+    //    that decode doesn't have a valid input or is turned off
+    for (z=STREAM1; z < STREAMN; z++) 
+    {
+        Int reset = 0;
+        for (zX = DECODE1; zX < DECODEN; zX++) 
+        {
+            if (pP->streamsFromDecodes[zX] == z) 
+            {
+                zI = pP->inputsFromDecodes[zX];
+                if (!pC->xDec[zX].decodeStatus.mode || !pC->xInp[zI].hRxSio)
+                {
+                    reset = 1;
+                }
+            }
+        }
+        if (reset) 
+        {
+            TRACE_VERBOSE2("PAF_ASIT_decodeInfo: AS%d: initializing block %d -- info", as+z, frame);
+            pP->fxns->initFrame1 (pP, pQ, pC, z, 0);
+        }
+        else
+        {
+            TRACE_VERBOSE2("PAF_ASIT_decodeInfo: AS%d: initializing block %d -- info <ignored>", as+z, frame);
+        }
+    }
+#endif    
+
+    return 0;
+} //PAF_ASIT_decodeInfo
+
+// -----------------------------------------------------------------------------
+// ASIT Decoding Function - Info Processing, Initial
+//
+//   Name:      PAF_ASIT_decodeInfo1
+//   Purpose:   Decoding Function for processing information in a manner that
+//              is unique to initial frames of input data.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard or SIO form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+Int
+PAF_ASIT_decodeInfo1(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int frame, 
+    Int block
+)
+{
+    return 0;
+} //PAF_ASIT_decodeInfo1
+
+// -----------------------------------------------------------------------------
+// AST Decoding Function - Info Processing, Subsequent
+//
+//   Name:      PAF_AST_decodeInfo2
+//   Purpose:   Decoding Function for processing information in a manner that
+//              is unique to frames of input data other than the initial one.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     None.
+//
+Int
+PAF_ASIT_decodeInfo2(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int frame, 
+    Int block
+)
+{
+    return 0;
+} //PAF_ASIT_decodeInfo2
+
+// -----------------------------------------------------------------------------
+// AST Decoding Function - Continuation Processing
+//
+//   Name:      PAF_AST_decodeCont
+//   Purpose:   Decoding Function for processing that occurs subsequent to
+//              information processing but antecedent to timing processing
+//              for frames of input data other than the initial one.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+
+Int
+PAF_AST_decodeCont (const PAF_AST_Params *pP, const PAF_AST_Patchs *pQ, PAF_AST_Config *pC, ALG_Handle decAlg[], Int frame, Int block)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                              /* decode counter */
+    Int zI, zS;
+    Int zMD = pC->masterDec;
+
+    (void)as;  // clear compiler warning in case not used with tracing disabled
+
+    // Await slave inputs
+    for (z=DECODE1; z < DECODEN; z++) {
+        zI = pP->inputsFromDecodes[z];
+        zS = pP->streamsFromDecodes[z];
+        (void)zS;
+        if (z == zMD
+            || ! pC->xInp[zI].hRxSio
+            || ! pC->xDec[z].decodeStatus.mode)
+            continue;
+        TRACE_VERBOSE2("as1-f2: PAF_AST_decodeCont: AS%d: awaiting frame %d -- data", as+zS, frame);
+        if (SIO_reclaim (pC->xInp[zI].hRxSio, (Ptr)&pC->xInp[zI].pInpBuf, NULL)
+            != sizeof (pC->xInp[zI].inpBufConfig))
+            return (ASPERR_RECLAIM);
+    }
+
+    return 0;
+} //PAF_AST_decodeCont
+
+// -----------------------------------------------------------------------------
+// ASIT Decoding Function - Decode Processing
+//
+//   Name:      PAF_ASIT_decodeDecode
+//   Purpose:   Decoding Function for processing of input data by the
+//              Decode Algorithm.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+Int
+PAF_ASIT_decodeDecode(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int sourceSelect, 
+    Int frame, 
+    Int block
+)
+{
+    Int as = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                              /* decode/stream counter */
+    Int errno;                          /* error number */
+    //Int ch;
+    // FL: Messaging
+    ASP_Msg *pAspMsg;
+    Int argIdx;
+    Int status;
+    Int cbErrno;
+    Int frameLength;    
+
+    (void)as; // clear compiler warning in case not used with tracing disabled
+
+#if 0 // FL: slave
+    // Clear samsiz for all channels - MID 208.
+    for (z=STREAM1; z < STREAMN; z++) 
+    {
+        for (ch=0; ch < PAF_MAXNUMCHAN_AF; ch++) 
+        {
+            pC->xStr[z].pAudioFrame->data.samsiz[ch] = 0;
+        }
+    }
+#endif    
+
+    // Decode data
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+        Int zI = pP->inputsFromDecodes[z];
+        Int zS = pP->streamsFromDecodes[z];
+        (void)zS; // clear compiler warning in case not used with tracing disabled
+        if (pC->xInp[zI].hRxSio && pC->xDec[z].decodeStatus.mode)
+        {
+            TRACE_GEN2("AS%d: decodeDecode: processing block %d -- decode", as+zS, block);
+
+            TRACE_VERBOSE3("as1-f2: AS%d: decodeDecode: decoding from 0x%x (base) 0x%x (ptr)",
+                    as+zS,
+                    (IArg)pC->xInp[z].pInpBuf->base.pVoid,
+                    (IArg)pC->xInp[z].pInpBuf->head.pVoid);
+
+            // FL: debug, capture input buffer
+            //capIbPcm(pC->xInp[z].pInpBuf);
+            
+            // (***) FL: hackin'
+            // write back Dec configuration
+            Cache_wb(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+            Cache_wait();                        
+
+            // FL: send decode message to slave
+            pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize);  /* allocate message */
+            if (pAspMsg == NULL)
+            {
+                TRACE_TERSE0("MessageQ_alloc() failure.");
+                SW_BREAKPOINT; // temporary
+                return -1; // temporary
+            }
+            MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
+            pAspMsg->cmd = ASP_SLAVE_DEC_DECODE;                                                /* fill in message payload */
+            pAspMsg->procId = hAspMsgMaster->masterProcId;
+            pAspMsg->expectResp = TRUE;
+            pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+            argIdx = 0; // set decIdx
+            *(Int32 *)&pAspMsg->buf[argIdx] = z;
+            TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            TRACE_MSG1("decIdx=%d", pAspMsg->buf[argIdx]);
+            status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+            // wait for decode complete message from slave -- temporary
+            status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+            if (status != MessageQ_S_SUCCESS)
+            {
+                TRACE_TERSE0("MessageQ_get() failure.");
+                SW_BREAKPOINT; // temporary
+                return -1; // temporary
+            }
+            if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) && 
+                (pAspMsg->cmd == ASP_MASTER_DEC_DECODE_DONE) &&
+                (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+            {
+                hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
+                TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                
+                argIdx = 0;
+                errno = *(Int32 *)&pAspMsg->buf[argIdx];
+                argIdx += sizeof(Int32);
+                cbErrno = *(Int32 *)&pAspMsg->buf[argIdx];
+                if (cbErrno != 0)
+                {
+                    TRACE_TERSE1("CB write error=%d", cbErrno);
+                    SW_BREAKPOINT; // temporary
+                }
+            }
+            else
+            {
+                TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                SW_BREAKPOINT; // temporary
+            }
+            // free the message
+            status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+
+            // (***) FL: hackin'
+            // invalidate Dec configuration
+            Cache_inv(&gPAF_AST_config.xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
+            Cache_wait();
+
+#if 0 // FL: decoder decode call, slave
+            if (dec->fxns->decode
+                && (errno = dec->fxns->decode (dec, NULL,
+                                               &pC->xDec[z].decodeInStruct, &pC->xDec[z].decodeOutStruct))) 
+#endif
+            if (errno)
+            {
+                TRACE_VERBOSE1("PAF_ASIT_decodeDecode: fxns->decode returns 0x%x", errno);
+                return errno;
+            }
+
+#if (CURRENT_TRACE_MASK & TRACE_MASK_DATA)
+            as_traceChannels(pC, z);
+#endif
+
+#if 0 // FL: change handle to decIdx (zone index)  
+            frameLength = pP->fxns->computeFrameLength(decAlg[z],
+                FRAMELENGTH, 
+                pC->xDec[z].decodeStatus.bufferRatio);
+#endif
+#if 0 // (***) FL: hackin'. Bypass computeFrameLength().
+            frameLength = pP->fxns->computeFrameLength(z, 
+                FRAMELENGTH, 
+                pC->xDec[z].decodeStatus.bufferRatio);
+#else
+            if (sourceSelect == PAF_SOURCE_PCM)
+                frameLength = 256;
+            else if (sourceSelect == PAF_SOURCE_DDP)
+                frameLength = 1536;
+            else
+                frameLength = 256;
+#endif                    
+
+// ............................................................................
+
+            pC->xDec[z].decodeControl.frameLength = frameLength;
+            pC->xDec[z].decodeInStruct.sampleCount = frameLength;
+            if (errno = SIO_ctrl(pC->xInp[zI].hRxSio,
+                PAF_SIO_CONTROL_SET_PCMFRAMELENGTH, frameLength))
+            {
+                TRACE_VERBOSE1("PAF_ASIT_decodeDecode: SIO SET_PCMFRAMELENGTH returns 0x%x", errno);
+                return errno;
+            }
+                
+            TRACE_VERBOSE1("PAF_ASIT_decodeDecode: calling SIO_issue[%d]", zI);
+            if (errno = SIO_issue(pC->xInp[zI].hRxSio, &pC->xInp[zI].inpBufConfig,
+                sizeof(pC->xInp[zI].inpBufConfig),
+                PAF_SIO_REQUEST_NEWFRAME))
+            {
+                TRACE_VERBOSE2("PAF_ASIT_decodeDecode: SIO_issue returns 0x%x, we return ASPERR_ISSUE (0x%x)", errno, ASPERR_ISSUE);
+                return (ASPERR_ISSUE);
+            }
+        } // hRxSio && decodeStatus.mode
+        else
+        {
+            TRACE_VERBOSE2("AS%d: PAF_ASIT_decodeDecode: processing block %d -- decode <ignored>", as+zS, block);
+        }
+    } // z=DECODE1 to DECODEN
+
+#if 0 // FL: ASDT (slave)
+    // Set up audio frames not decoded into
+    //    Re-initialize audio frame if there is an assocatiated decode and
+    //    that decode doesn't have a valid input or is turned off
+    for (z=STREAM1; z < STREAMN; z++) 
+    {
+        Int zX;
+        Int reset = 0;
+        for (zX = DECODE1; zX < DECODEN; zX++) 
+        {
+            if (pP->streamsFromDecodes[zX] == z) 
+            {
+                Int zI = pP->inputsFromDecodes[zX];
+                if (!pC->xDec[zX].decodeStatus.mode || !pC->xInp[zI].hRxSio)
+                    reset = 1;
+            }
+        }
+        if (reset) 
+        {
+            TRACE_VERBOSE2("PAF_ASIT_decodeDecode: AS%d: initializing block %d -- decode", as+z, frame);
+            pP->fxns->initFrame1 (pP, pQ, pC, z, 0);
+        }
+        else
+            TRACE_VERBOSE2("PAF_ASIT_decodeDecode: AS%d: initializing block %d -- decode <ignored>", as+z, frame);
+    }
+#endif
+    
+    return 0;
+} //PAF_ASIT_decodeDecode
+
+// -----------------------------------------------------------------------------
+// ASIT Decoding Function - Frame-Final Processing
+//
+//   Name:      PAF_ASIT_decodeFinalTest
+//   Purpose:   Decoding Function for determining whether processing of the
+//              current frame is complete.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    0 if incomplete, and 1 if complete.
+//   Trace:     None.
+//
+
+Int
+PAF_ASIT_decodeFinalTest(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int frame, 
+    Int block
+)
+{
+    Int zMD = pC->masterDec;
+    Int sourceSelect;
+    Int sourceProgram;
+
+
+    sourceSelect  = pC->xDec[zMD].decodeStatus.sourceSelect;
+    sourceProgram = pC->xDec[zMD].decodeStatus.sourceProgram;
+
+    if ((sourceSelect == PAF_SOURCE_NONE) || (sourceSelect == PAF_SOURCE_PASS))
+    {
+        return 1;
+    }
+
+    // The following allows for Force modes to switch without command deferral. This might
+    // be better suited for inclusion in DIB_requestFrame, but for now will reside here.
+    if ((sourceSelect == PAF_SOURCE_SNG) || (sourceSelect > PAF_SOURCE_BITSTREAM)) 
+    {
+        if (sourceSelect == PAF_SOURCE_DTSALL)
+        {
+            if (sourceProgram != PAF_SOURCE_DTS11 &&
+                sourceProgram != PAF_SOURCE_DTS12 &&
+                sourceProgram != PAF_SOURCE_DTS13 &&
+                sourceProgram != PAF_SOURCE_DTS14 &&
+                sourceProgram != PAF_SOURCE_DTS16 &&
+                sourceProgram != PAF_SOURCE_DTSHD)
+            {
+                return 1;
+            }
+        }
+        else if (sourceSelect == PAF_SOURCE_PCMAUTO) 
+        {
+            if (sourceProgram != PAF_SOURCE_PCM)
+            {
+                return 1;
+            }
+        }
+        else 
+        {
+            if (pC->xDec[zMD].decodeStatus.sourceSelect != pC->xDec[zMD].decodeStatus.sourceDecode)
+            {
+                return 1;
+            }
+        }
+    }
+
+    return 0;
+} //PAF_ASIT_decodeFinalTest
+
+// -----------------------------------------------------------------------------
+// ASIT Decoding Function - Stream-Final Processing
+//
+//   Name:      PAF_ASIT_decodeComplete
+//   Purpose:   Decoding Function for terminating the decoding process.
+//   From:      AST Parameter Function -> decodeProcessing
+//   Uses:      See code.
+//   States:    x
+//   Return:    0.
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+Int
+PAF_ASIT_decodeComplete(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    ALG_Handle decAlg[], 
+    Int frame, 
+    Int block
+)
+{
+    Int as  = pC->as;                    /* Audio Stream Number (1, 2, etc.) */
+    Int z;                               /* decode/encode counter */
+    ASP_Msg* pAspMsg;
+    Int argIdx;
+    Int errno;                           /* error number */
+    Int status;
+    PAF_DecodeOpCircBuf *pCb; // FL: decoder output circular buffer
+
+    (void)as;  // clear compiler warning in case not used with tracing disabled
+
+#ifdef PAF_ASP_FINAL
+    /* This material is currently not utilized */
+#endif /* PAF_ASP_FINAL */
+    for (z=DECODE1; z < DECODEN; z++) 
+    {
+#ifdef PAF_ASP_FINAL
+        DEC_Handle dec = (DEC_Handle )decAlg[z];
+#endif /* PAF_ASP_FINAL */
+        Int zI = pP->inputsFromDecodes[z];
+        if (pC->xInp[zI].hRxSio && pC->xDec[z].decodeStatus.mode) 
+        {
+            TRACE_VERBOSE1("PAF_AST_decodeComplete: AS%d: finalizing decode", as+z);
+#ifdef PAF_ASP_FINAL
+            if (dec->fxns->final)
+                dec->fxns->final(dec, NULL, &pC->xDec[z].decodeControl,
+                                 &pC->xDec[z].decodeStatus);
+#endif /* PAF_ASP_FINAL */
+            // FL: send dec deactivate message to slave
+            pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize);  /* allocate message */
+            if (pAspMsg == NULL)
+            {
+                TRACE_TERSE0("MessageQ_alloc() failure.");
+                errno = -1; // temporary
+                return errno;
+            }
+            MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);              /* set the return address in the message header */
+            pAspMsg->cmd = ASP_SLAVE_DEC_DEACTIVATE;                                              /* fill in message payload */
+            pAspMsg->procId = hAspMsgMaster->masterProcId;
+            pAspMsg->expectResp = TRUE;
+            pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
+            argIdx = 0; // set decIdx
+            *(Int32 *)&pAspMsg->buf[argIdx] = z;
+            TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
+            status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);                /* send message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+            // wait for dec deactivate complete message from slave
+            status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
+            if (status != MessageQ_S_SUCCESS)
+            {
+                TRACE_TERSE0("MessageQ_get() failure.");
+                return errno;
+            }
+            if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
+                (pAspMsg->cmd != ASP_MASTER_DEC_DEACTIVATE_DONE) ||
+                (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+            {
+                TRACE_MSG3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                SW_BREAKPOINT; // temporary
+            }          
+            hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);            
+            TRACE_TERSE3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+            // free the message
+            status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
+            if (status != MessageQ_S_SUCCESS)
+            {
+                SW_BREAKPOINT;
+            }
+
+#if 0 // FL: decoder deactivate call, slave
+            if (decAlg[z]->fxns->algDeactivate)
+                decAlg[z]->fxns->algDeactivate (decAlg[z]);
+#endif
+
+            // Stop decoder output circular buffer writes
+            pCb = &pC->xDec[z].decOpCb;
+            errno = cbWriteStop(pCb);
+            if (errno)
+            {
+                return errno;
+            }
+        }
+        else 
+        {
+            TRACE_VERBOSE1("PAF_AST_decodeComplete: AS%d: processing decode <ignored>", as+z);
+        }
+    }
+    return 0;
+} //PAF_ASIT_decodeComplete
+
+// -----------------------------------------------------------------------------
+// ASIT Selection Function - Input Device Selection
+//
+//   Name:      PAF_ASIT_selectDevices
+//   Purpose:   Audio Stream Input Task Function for selecting the devices used
+//              for input.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    Error number in standard form (0 on success).
+//   Trace:     Message Log "trace" in Debug Project Configuration reports:
+//              * State information as per parent.
+//
+Int
+PAF_ASIT_selectDevices(
+    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/output counter */
+    Int errno = 0;                      /* error number */
+    Int errme;                          /* error number, local */
+    Int device;
+    Int zMD = pC->masterDec;
+
+    (void)as;  // clear compiler warning in case not used with tracing disabled
+
+    // Select input devices
+    for (z=INPUT1; z < INPUTN; z++) 
+    {
+        if ((device = pC->xInp[z].inpBufStatus.sioSelect) >= 0) 
+        {
+            TRACE_VERBOSE2("PAF_ASIT_selectDevices: AS%d: input device %d selecting ...", as+z, device);
+
+            // check for valid index into device array
+            if (device >= pQ->devinp->n)
+            {
+                device = 0; /* treat as device None */
+            }
+
+            errme = pP->fxns->deviceSelect(&pC->xInp[z].hRxSio, SIO_INPUT,
+                HEAP_ID_INPBUF, (Ptr)pQ->devinp->x[device]);
+
+            if (errme)
+            {
+                TRACE_VERBOSE2("PAF_ASIT_selectDevices: errme 0x%x, errno 0x%x", errme, errno);
+                if (!errno)
+                {
+                    errno = ASPERR_DEVINP + errme;
+                }
+                pC->xInp[z].inpBufStatus.sioSelect = 0x80;
+            }
+            else 
+            {
+                pC->xInp[z].inpBufStatus.sioSelect = device | 0x80;
+                // register decodeStatus pointer with input devices
+                // This allows, e.g., autoProcessing to exit when sourceSelect = none
+                // Use zMIs decodeStatus for all inputs
+                if (pC->xInp[z].hRxSio) 
+                {
+                    // register PAF_SIO_IALG object address
+                    SIO_ctrl(pC->xInp[z].hRxSio, PAF_SIO_CONTROL_SET_IALGADDR, 
+                        (Arg)pC->xInp[z].inpChainData.head->alg);
+                    SIO_ctrl(pC->xInp[z].hRxSio, PAF_SIO_CONTROL_SET_DECSTATUSADDR, 
+                        (Arg)&pC->xDec[zMD].decodeStatus);
+                }
+            }
+        }
+    }
+
+    return errno;
+} //PAF_ASIT_selectDevices
+
+// -----------------------------------------------------------------------------
+// ASIT Selection Function - Source Selection
+//
+//   Name:      PAF_ASIT_sourceDecode
+//   Purpose:   Audio Input Stream Task Function for selecting the sources used
+//              for decoding of input to output.
+//   From:      audioStream1Task or equivalent
+//   Uses:      See code.
+//   States:    x
+//   Return:    0.
+//   Trace:     None.
+//
+Int
+PAF_ASIT_sourceDecode(
+    const PAF_AST_Params *pP, 
+    const PAF_AST_Patchs *pQ, 
+    PAF_AST_Config *pC, 
+    Int x
+)
+{
+    Int z;                              /* decode counter */
+
+    for (z=DECODE1; z < DECODEN; z++)
+    {
+        if (pC->xDec[z].decodeStatus.mode) 
+        {
+            pC->xDec[z].decodeStatus.sourceDecode = x;
+        }
+    }
+    
+    return 0;
+} //PAF_ASIT_sourceDecode
+
+// -----------------------------------------------------------------------------
+
+#if 0 // (***) FL: no longer used w/ removal of CONTINUOUS mode
+Int
+PAF_AST_decodeHandleErrorInput (const PAF_AST_Params *pP, const PAF_AST_Patchs *pQ, PAF_AST_Config *pC, ALG_Handle decAlg[], Int z, Int error)
+{
+    Int errno = 0;
+    Int zMD = pC->masterDec;
+    Int zI = pP->inputsFromDecodes[z];
+
+    // only handle real errors, on primary input, for writeDECModeContinuous
+    if ( !( error &&
+            z == zMD ))
+        return error;
+
+    TRACE_TIME((&TIME_MOD, "AS%d: PAF_AST_decodeHandleErrorInput: (primary) input error caught = %d", pC->as+z, error));
+    TRACE_TIME((&TIME_MOD, "AS%d: PAF_AST_decodeHandleErrorInput: old sourceProgram = %d", pC->as+z, pC->xDec[z].decodeStatus.sourceProgram));
+
+    if (pC->xInp[zI].hRxSio) {
+        DEC_Handle dec;
+
+        if (errno = SIO_idle (pC->xInp[zI].hRxSio))
+            return errno;
+
+        // indicates (primary) input not running
+        pC->xDec[z].decodeStatus.sourceDecode = PAF_SOURCE_NONE;
+
+        pC->xInp[zI].inpBufConfig.deliverZeros = 1;
+
+        // will be changed after next reclaim, to PAF_SOURCE_UNKNOWN or other
+        pC->xDec[z].decodeStatus.sourceProgram = PAF_SOURCE_NONE;
+
+        if (decAlg[z]->fxns->algDeactivate)
+            decAlg[z]->fxns->algDeactivate (decAlg[z]);
+
+        decAlg[z] = pC->xDec[z].decAlg[PAF_SOURCE_PCM];
+        dec = (DEC_Handle )decAlg[z];
+
+        TRACE_TIME((&TIME_MOD, "AS%d: PAF_AST_decodeHandleErrorInput: resetting to PCM decoder",
+                    pC->as+z));
+
+        if (decAlg[z]->fxns->algActivate)
+            decAlg[z]->fxns->algActivate (decAlg[z]);
+
+        if (dec->fxns->reset
+            && (errno = dec->fxns->reset (dec, NULL,
+                                          &pC->xDec[z].decodeControl, &pC->xDec[z].decodeStatus)))
+            return errno;
+    }
+
+    return errno;
+} //PAF_AST_decodeHandleErrorInput
+#endif
+
+#if (CURRENT_TRACE_MASK & TRACE_MASK_DATA)
+
+//------------------------------------------------------------------------------
+static int sSkipCount = 0;
+int gReportBuffers = 0;
+void as_traceChannels(PAF_AST_Config *pC, int z)
+{
+    PAF_AudioFrame *pAudioFrame = pC->xDec[z].decodeInStruct.pAudioFrame;
+    int i;
+         
+// #ifdef THIS_IS_DSPA
+    sSkipCount++;
+    if (sSkipCount<1)
+        return;
+    sSkipCount = 0;
+// #endif
+
+#ifdef THIS_IS_DSPB
+    if (!gReportBuffers)
+        return;
+    gReportBuffers = 0;
+#endif
+
+    dp(NULL, "\n");
+    for (i=0; i<PAF_MAXNUMCHAN; i++)
+    {
+        if (pAudioFrame->data.sample[i] != 0)
+        {
+            float *wp = (float*)pAudioFrame->data.sample[i];
+               dp(NULL, "i: %d.  p: 0x%x.  %f, %f, %f, %f\n",
+                       i, pAudioFrame->data.sample[i], wp[0], wp[1], wp[2], wp[3]);
+        }
+    }
+}
+#endif
similarity index 51%
rename from procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamProc.h
rename to procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc.h
index f2cbd834b1739798efcf27574ed603be617c5810..e4dc1f56cdf8f58484f59c0c7d0c30a46c3e402d 100644 (file)
@@ -1,75 +1,81 @@
 /*
- *  ======== audioStreamProc.h ========
+ *  ======== audioStreamInpProc.h ========
  */
 
-#ifndef _ASP_H_
-#define _ASP_H_
+#ifndef _ASIP_H_
+#define _ASIP_H_
  
 #include <xdc/std.h>
 
-#include "as1-f2-params.h"
-#include "as1-f2-patchs.h"
-#include "as1-f2-config.h"
+#include "audioStreamProc_params.h"
+#include "audioStreamProc_patchs.h"
+#include "audioStreamProc_config.h"
 
 // Global debug counter */
-extern Uint32 gTaskAspCnt; // debug counter for ASP task
+extern Uint32 gTaskAsipCnt; // debug counter for ASP task
 
-//   Purpose:   Audio Stream Task Function for initialization of data pointers
+//   Purpose:   Audio Stream Input Task Function for initialization of data pointers
 //              by allocation of memory.
 Int 
-PAF_AST_initPhaseMalloc(
+PAF_ASIT_initPhaseMalloc(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
+    PAF_AST_Config *pC
+);
 
-//   Purpose:   Audio Stream Task Function for initialization of data values
+//   Purpose:   Audio Stream Input Task Function for initialization of data values
 //              from parameters.
 Int
-PAF_AST_initPhaseConfig(
+PAF_ASIT_initPhaseConfig(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
+    PAF_AST_Config *pC
+);
 
-//   Purpose:   Audio Stream Task Function for initialization of ACP by
+//   Purpose:   Audio Stream Input Task Function for initialization of ACP by
 //              instantiation of the algorithm.
 Int
-PAF_AST_initPhaseAcpAlg(
+PAF_ASIT_initPhaseAcpAlg(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
+    PAF_AST_Config *pC
+);
 
-//   Purpose:   Audio Stream Task Function for initialization of data pointers
-//              by allocation for common memory and by instantiation for
-//              algorithms.
+//   (***) FL: ASIT/ASOT currently consider common memory independently.
+//             Should simultaneously consider all algs in ASIT/ASOT.
+//   Purpose:   Audio Stream Input Task Function for allocation of common memory.
 Int
-PAF_AST_initPhaseCommon(
+PAF_ASIT_initPhaseCommon(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
+    PAF_AST_Config *pC
+);
 
-//   Purpose:   Audio Stream Task Function for initialization of data values
-//              from parameters for Algorithm Keys.
+//   Purpose:   Audio Stream Input Task Function for initialization of ASP algorithms.
 Int
-PAF_AST_initPhaseAlgKey(
+PAF_ASIT_initPhaseAspAlg(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
+    PAF_AST_Config *pC
+);
+
 
-//   Purpose:   Audio Stream Task Function for initialization of I/O Devices.
+//   Purpose:   Audio Stream Input Task Function for initialization of data values
+//              from parameters for Algorithm Keys.
 Int
-PAF_AST_initPhaseDevice(
+PAF_ASIT_initPhaseAlgKey(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
+    PAF_AST_Config *pC
+);
 
-//   Purpose:   Audio Stream Task Function for initialization of the Audio
-//              Frame(s) by memory allocation and loading of data pointers
-//              and values.
+//   Purpose:   Audio Stream Input Task Function for initialization of Input Devices.
 Int
-PAF_AST_initFrame0(
+PAF_ASIT_initPhaseDevice(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC, Int z);
+    PAF_AST_Config *pC
+);
 
 //   Purpose:   Audio Stream Task Function for initialization or reinitiali-
 //              zation of the Audio Frame(s) by loading of data values of a
@@ -78,100 +84,80 @@ Int
 PAF_AST_initFrame1(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC, Int z, Int apply);
+    PAF_AST_Config *pC, 
+    Int z, 
+    Int apply
+);
 
 //   Purpose:   Audio Stream Task Function for processing audio data to
 //              determine the input type without output.
 Int
-PAF_AST_autoProcessing(
+PAF_ASIT_autoProcessing(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
     Int inputTypeSelect, 
     ALG_Handle pcmAlgMaster);
 
-//   Purpose:   Audio Stream Task Function for processing audio data for
-//              output on a continuous basis, including detection of the
-//              input type.
-//Int
-//PAF_AST_decodeProcessing(
-//    const PAF_AST_Params *pP, 
-//    const PAF_AST_Patchs *pQ, 
-//    PAF_AST_Config *pC, 
-//    ALG_Handle decAlgMaster
-//);
+//   Purpose:   Audio Stream Input Task Function for processing audio data.
+//
 Int
-PAF_AST_decodeProcessing(
+PAF_ASIT_decodeProcessing(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
-    ALG_Handle decAlgMaster, 
     Int sourceSelect
 );
 
 //   Purpose:   Decoding Function for processing Decode Commands.
 Int
-PAF_AST_decodeCommand(
-    const PAF_AST_Params *pP, 
-    const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
-
-//   Purpose:   Decoding Function for processing Encode Commands.
-Int
-PAF_AST_encodeCommand(
+PAF_ASIT_decodeCommand(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
+    PAF_AST_Config *pC
+);
 
 //   Purpose:   Decoding Function for reinitializing the decoding process.
-//Int
-//PAF_AST_decodeInit(
-//    const PAF_AST_Params *pP, 
-//    const PAF_AST_Patchs *pQ, 
-//    PAF_AST_Config *pC, 
-//    ALG_Handle decAlg[]
-//);
 Int
-PAF_AST_decodeInit(
+PAF_ASIT_decodeInit(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
-    ALG_Handle decAlg[], 
     Int sourceSelect
 );
 
 //   Purpose:   Decoding Function for processing information in a manner that
 //              is common for both initial and subsequent frames of input data.
 Int
-PAF_AST_decodeInfo(
+PAF_ASIT_decodeInfo(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
-    ALG_Handle decAlg[], 
     Int frame, 
-    Int block);
+    Int block
+);
 
 //   Purpose:   Decoding Function for processing information in a manner that
 //              is unique to initial frames of input data.
 Int
-PAF_AST_decodeInfo1(
+PAF_ASIT_decodeInfo1(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
-    ALG_Handle decAlg[], 
     Int frame, 
-    Int block);
+    Int block
+);
 
 //   Purpose:   Decoding Function for processing information in a manner that
 //              is unique to frames of input data other than the initial one.
 Int
-PAF_AST_decodeInfo2(
+PAF_ASIT_decodeInfo2(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
-    ALG_Handle decAlg[], 
     Int frame, 
-    Int block);
+    Int block
+);
 
 //   Purpose:   Decoding Function for processing that occurs subsequent to
 //              information processing but antecedent to timing processing
@@ -183,113 +169,69 @@ PAF_AST_decodeCont(
     PAF_AST_Config *pC, 
     ALG_Handle decAlg[], 
     Int frame, 
-    Int block);
+    Int block
+);
 
 //   Purpose:   Decoding Function for processing of input data by the
 //              Decode Algorithm.
-//Int
-//PAF_AST_decodeDecode(
-//    const PAF_AST_Params *pP, 
-//    const PAF_AST_Patchs *pQ, 
-//    PAF_AST_Config *pC, 
-//    ALG_Handle decAlg[], 
-//    Int frame, 
-//    Int block);
 Int
-PAF_AST_decodeDecode(
+PAF_ASIT_decodeDecode(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
-    ALG_Handle decAlg[], 
     Int sourceSelect, 
     Int frame, 
     Int block
 );
 
-
-
-//   Purpose:   Decoding Function for processing of audio frame data by the
-//              ASP Algorithms.
-Int
-PAF_AST_decodeStream(
-    const PAF_AST_Params *pP, 
-    const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC, 
-    ALG_Handle decAlg[], 
-    Int frame, 
-    Int block);
-
-//   Purpose:   Decoding Function for processing of audio frame data by the
-//              Encode Algorithm.
-Int
-PAF_AST_decodeEncode(
-    const PAF_AST_Params *pP, 
-    const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC, 
-    ALG_Handle decAlg[], 
-    Int frame, 
-    Int block);
-
 //   Purpose:   Decoding Function for determining whether processing of the
 //              current frame is complete.
 Int
-PAF_AST_decodeFinalTest(
+PAF_ASIT_decodeFinalTest(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
-    ALG_Handle decAlg[], 
     Int frame, 
-    Int block);
+    Int block
+);
 
 //   Purpose:   Decoding Function for terminating the decoding process.
 Int
-PAF_AST_decodeComplete(
+PAF_ASIT_decodeComplete(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
     ALG_Handle decAlg[], 
     Int frame, 
-    Int block);
+    Int block
+);
 
-//   Purpose:   Audio Stream Task Function for selecting the devices used
-//              for input and output.
+//   Purpose:   Audio Stream Input Task Function for selecting the devices used
+//              for input.
 Int
-PAF_AST_selectDevices(
+PAF_ASIT_selectDevices(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
+    PAF_AST_Config *pC
+);
 
-//   Purpose:   Audio Stream Task Function for selecting the sources used
+//   Purpose:   Audio Stream Input Task Function for selecting the sources used
 //              for decoding of input to output.
 Int
-PAF_AST_sourceDecode(
-    const PAF_AST_Params *pP, 
-    const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC, 
-    Int x);
-
-//   Purpose:   Decoding Function for initiating output.
-Int
-PAF_AST_startOutput(
+PAF_ASIT_sourceDecode(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
     PAF_AST_Config *pC, 
-    double arcRatio) ;
+    Int x
+);
 
 //   Purpose:   Decoding Function for terminating output.
 Int
 PAF_AST_stopOutput(
     const PAF_AST_Params *pP, 
     const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC);
-
-//   Purpose:   Decoding Function for reinitiating output.
-Int
-PAF_AST_setCheckRateX(
-    const PAF_AST_Params *pP, 
-    const PAF_AST_Patchs *pQ, 
-    PAF_AST_Config *pC, 
-    Int check);
+    PAF_AST_Config *pC
+);
 
 //   Purpose:   Common Function for processing algorithm chains.
 Int
@@ -299,7 +241,8 @@ PAF_AST_streamChainFunction(
     PAF_AST_Config *pC, 
     Int iChainFrameFxns, 
     Int abortOnError, 
-    Int logArg);
+    Int logArg
+);
 
     
-#endif /* _ASP_H_ */
+#endif /* _ASIP_H_ */
diff --git a/procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc_paramsFxns.c b/procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamInpProc_paramsFxns.c
new file mode 100644 (file)
index 0000000..42e8c34
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ *  ======== audioStreamInpProc_paramsFxns.c ========
+ */
+
+#include <xdc/std.h>
+#include "as0.h"
+#include "audioStreamInpProc.h"
+// .............................................................................
+// Audio Stream Input Task Parameter Functions
+//
+//   Name:      PAF_ASIT_params_fxns
+//   Purpose:   ASIT jump table.
+//   From:      PAF_AST_Params
+//   Uses:      See contents.
+//   States:    N.A.
+//   Return:    N.A.
+//   Trace:     None.
+//
+const PAF_AST_Fxns PAF_ASIT_params_fxns =
+{
+    {   // initPhase[8]
+        PAF_ASIT_initPhaseMalloc,
+        PAF_ASIT_initPhaseConfig,
+        PAF_ASIT_initPhaseAcpAlg,
+        PAF_ASIT_initPhaseCommon,
+        PAF_ASIT_initPhaseAlgKey,
+        PAF_ASIT_initPhaseDevice,
+        NULL,
+        NULL
+    },
+    NULL, //PAF_AST_initFrame0,             // initFrame0
+    NULL, //PAF_AST_initFrame1,             // initFrame1
+    NULL, //PAF_AST_passProcessing,         // passProcessing        
+    NULL, //PAF_AST_passProcessingCopy,     // passProcessingCopy    
+    PAF_ASIT_autoProcessing,                // autoProcessing
+    PAF_ASIT_decodeProcessing,              // decodeProcessing
+    PAF_ASIT_decodeCommand,                 // decodeCommand
+    NULL, //PAF_AST_encodeCommand,          // encodeCommand
+    PAF_ASIT_decodeInit,                    // decodeInit
+    PAF_ASIT_decodeInfo,                    // decodeInfo
+    PAF_ASIT_decodeInfo1,                   // decodeInfo1
+    PAF_ASIT_decodeInfo2,                   // decodeInfo2
+    NULL, //PAF_AST_decodeCont,             // decodeCont
+    PAF_ASIT_decodeDecode,                  // decodeDecode
+    NULL, //PAF_AST_decodeStream,           // decodeStream
+    NULL, //PAF_AST_decodeEncode,           // decodeEncode
+    PAF_ASIT_decodeFinalTest,               // decodeFinalTest
+    PAF_ASIT_decodeComplete,                // decodeComplete
+    PAF_ASIT_selectDevices,                 // selectDevices
+    PAF_ASIT_sourceDecode,                  // sourceDecode
+    NULL, //PAF_AST_startOutput,            // startOutput
+    NULL, //PAF_AST_stopOutput,             // stopOutput
+    NULL, //PAF_AST_setCheckRateX,          // setCheckRateX
+    NULL, //PAF_AST_streamChainFunction,    // streamChainFunction
+    PAF_DEC_deviceAllocate,                 // deviceAllocate
+    PAF_DEC_deviceSelect,                   // deviceSelect
+    PAF_DEC_computeFrameLength,             // computeFrameLength
+    PAF_DEC_updateInputStatus,              // updateInputStatus
+    NULL, //PAF_BUF_copy,                   // copy
+    NULL, /*headerPrint*/                   // headerPrint
+    NULL, /*allocPrint*/                    // allocPrint
+    NULL, /*commonPrint*/                   // commonPrint
+    NULL, /*bufMemPrint*/                   // bufMemPrint
+    NULL /*memStatusPrint*/                 // memStatusPrint
+};
diff --git a/procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamOutProc.c b/procsdk_audio_x_xx_xx_xx/test_dsp/framework/audioStreamOutProc.c
new file mode 100644 (file)
index 0000000..e9e190a
--- /dev/null
@@ -0,0 +1,2501 @@
+/*
+ *  ======== audioStreamOutProc.c ========
+ */
+
+#include <string.h> // for memset
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Memory.h>
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include "paferr.h"
+#include <acp_mds.h>
+#include <pcm.h>
+#include <pce.h>
+#include <pafsio_ialg.h>
+#include <stdasp.h>
+#include <doberr.h>
+#include "asperr.h"
+
+#include "common.h"
+#include "aspMsg_common.h"
+#include "aspMsg_master.h"
+#include "audioStreamProc_common.h"
+#include "audioStreamOutProc.h"
+
+#define TRACE_TIME(a)
+
+//
+// Audio Stream Definitions
+//
+
+//
+// Audio Stream Processing Definitions
+//
+#define aspLinkInit pQ->i_aspLinkInit
+
+//
+// Encoder Definitions
+//
+#define encLinkInit pQ->i_encLinkInit
+
+//
+// Output Definitions
+//
+#define outLinkInit pP->i_outLinkInit
+
+/* ---------------------------------------------------------------- */
+/*              Parameter macro definitions end here.               */
+/* ---------------------------------------------------------------- */