2 /*
3 Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
4 All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
36 //
37 // Framework Parameter Declarations
38 //
40 #ifndef _ASP_PARAMS_H_
41 #define _ASP_PARAMS_H_
43 //#include <ti/procsdk_audio/procsdk_audio_typ.h>
44 #include <procsdk_audio_typ.h>
45 #include <ti/sysbios/heaps/HeapMem.h>
47 #include <xdc/std.h>
48 #include <ti/xdais/ialg.h>
49 #include <sio.h>
51 #include <acp.h>
53 #include "alg.h"
54 #include "asp0.h"
56 #include <paftyp.h>
57 #include <inpbuf.h>
58 #include <pafdec.h>
59 #include <pafenc.h>
60 #include <pafvol.h>
61 #include <outbuf.h>
63 #include <as1-f2.h>
65 //
66 // Source Select Arrays -- algorithm keys & sio map
67 //
69 typedef struct PAF_ASP_AlgKey {
70 Int length;
71 PAF_ASP_AlphaCode code[PAF_SOURCE_N /* ostensibly */];
72 } PAF_ASP_AlgKey;
74 typedef struct PAF_ASP_SioMap {
75 Int length;
76 SmInt map[PAF_SOURCE_N /* ostensibly */];
77 } PAF_ASP_SioMap;
79 typedef struct PAF_ASP_outNumBufMap {
80 Int maxNumBuf;
81 Int length;
82 SmInt map[PAF_SOURCE_N];
83 } PAF_ASP_outNumBufMap;
85 typedef struct PAF_MetadataBufStatus {
86 Int bufSize; //Meta data buffer size
87 Int NumBuf; //Number of metadata buffers
88 Int alignment; //Buffer alignment
89 Int *pHeadIdSpace; //Int *pSpace; //Internal/external memory
90 } PAF_MetadataBufStatus;
92 typedef struct PAF_AudioFrameBufStatus {
93 IALG_MemSpace space[PAF_MAXNUMCHAN];
94 }PAF_AudioFrameBufStatus;
96 //
97 // Audio Framework Functions
98 //
100 struct PAF_AST_Params;
101 struct PAF_AST_Patchs;
102 struct PAF_AST_Config;
104 typedef struct PAF_AST_Fxns {
105 Int (*initPhase[8]) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
106 Int (*initFrame0) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
107 Int (*initFrame1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
108 Int (*passProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
109 Int (*passProcessingCopy) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
110 Int (*autoProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, ALG_Handle);
112 // FL: Source select index takes place of ALG_Handle.
113 //Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle);
114 //Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle, Int);
115 Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
117 Int (*decodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
118 Int (*encodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
120 // FL: Source select index takes place of ALG_Handle.
121 //Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *);
122 //Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int);
123 Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
125 // FL: Source select index takes place of ALG_Handle.
126 //Int (*decodeInfo) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
127 Int (*decodeInfo) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
129 // FL: Source select index takes place of ALG_Handle.
130 //Int (*decodeInfo1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
131 Int (*decodeInfo1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
133 // FL: Source select index takes place of ALG_Handle.
134 //Int (*decodeInfo2) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
135 Int (*decodeInfo2) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
137 Int (*decodeCont) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
139 // FL: Source select index takes place of ALG_Handle.
140 //Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
141 //Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int, Int);
142 Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
144 // FL: Source select index takes place of ALG_Handle.
145 //Int (*decodeStream) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
146 Int (*decodeStream) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
148 // FL: Source select index takes place of ALG_Handle.
149 //Int (*decodeEncode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
150 Int (*decodeEncode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
152 // FL: Source select index takes place of ALG_Handle.
153 //Int (*decodeFinalTest) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
154 Int (*decodeFinalTest) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
156 Int (*decodeComplete) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
157 Int (*selectDevices) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
158 Int (*sourceDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
160 Int (*startOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
161 //Int (*startOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, double);
163 Int (*stopOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
164 Int (*setCheckRateX) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
165 Int (*streamChainFunction) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
166 Int (*deviceAllocate) (SIO_Handle *, int, int, int, Ptr);
167 Int (*deviceSelect) (SIO_Handle *, int, int, Ptr);
169 // FL: change ALG_Handle to zone index
170 //Int (*computeFrameLength) (ALG_Handle, Int, Int);
171 Int (*computeFrameLength) (Int, Int, Int);
173 Int (*updateInputStatus) (SIO_Handle, PAF_InpBufStatus *, PAF_InpBufConfig *);
174 Int (*copy) (Uns, PAF_InpBufConfig *, Uns, PAF_OutBufConfig *);
176 #ifdef HSE
177 Int (*setPri) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
178 #endif
180 // For RAM_report
181 Void (*headerPrint)();
182 Int (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
183 Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
184 Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
185 //Void (*memStatusPrint)(Int internal, Int external, Int internal1);
186 Void (*memStatusPrint)(HeapMem_Handle hInternalHeap, HeapMem_Handle hInternal1Heap, HeapMem_Handle hExternalHeap, HeapMem_Handle hInternal1HeapShm);
188 // For ARC
189 //Int (*controlRate) (SIO_Handle, SIO_Handle, ACP_Handle);
190 //Int (*controlRate) (SIO_Handle, SIO_Handle, ACP_Handle, double);
192 } PAF_AST_Fxns;
194 //
195 // Audio Framework Parameters
196 //
198 typedef struct PAF_AST_Params {
199 const PAF_AST_Fxns *fxns;
200 struct {
201 SmInt master;
202 SmInt inputs;
203 SmInt input1;
204 SmInt inputN;
205 SmInt decodes;
206 SmInt decode1;
207 SmInt decodeN;
208 SmInt streams;
209 SmInt stream1; /* unused */
210 SmInt streamN; /* unused */
211 SmInt encodes;
212 SmInt encode1;
213 SmInt encodeN;
214 SmInt outputs;
215 SmInt output1;
216 SmInt outputN;
217 } zone;
218 const SmInt *inputsFromDecodes;
219 const SmInt *outputsFromEncodes;
220 struct {
221 int *pHeapIdIntern; //int *pIntern;
222 int *pHeapIdExtern; //int *pExtern;
223 int *pHeapIdInpbuf; //int *pInpbuf;
224 int *pHeapIdOutbuf; //int *pOutbuf;
225 int *pHeapIdFrmbuf; //int *pFrmbuf;
226 int *pHeapIdIntern1; //int *pIntern1;
227 int clear;
228 } heap;
229 struct {
230 const IALG_MemSpace *space;
231 } common;
232 const LgInt *z_rx_bufsiz;
233 const LgInt *z_tx_bufsiz;
234 const SmInt *z_numchan;
235 MdInt framelength;
236 const PAF_AudioFunctions *pAudioFrameFunctions;
237 const struct PAF_ASP_ChainFxns *pChainFxns;
238 const PAF_InpBufStatus *pInpBufStatus;
239 const PAF_DecodeStatus * const *z_pDecodeStatus;
240 const PAF_OutBufStatus *pOutBufStatus;
241 const PAF_EncodeStatus * const *z_pEncodeStatus;
242 const PAF_VolumeStatus *pVolumeStatus;
243 const PAF_ASP_AlgKey *pDecAlgKey;
244 const PAF_ASP_AlgKey *pEncAlgKey;
245 const PAF_ASP_SioMap *pDecSioMap;
246 const SmInt *streamsFromDecodes;
247 const SmInt *streamsFromEncodes;
248 const MdInt maxFramelength;
249 const SmInt *streamOrder;
250 const PAF_ASP_LinkInit * const (*i_inpLinkInit);
251 const PAF_ASP_LinkInit * const (*i_outLinkInit);
252 const PAF_ASP_outNumBufMap * const (*poutNumBufMap);
253 const PAF_MetadataBufStatus *pMetadataBufStatus;
254 const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
255 } PAF_AST_Params;
257 #endif /* _ASP_PARAMS_H_ */