2 /*
3 Copyright (c) 2017, 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 meta data buffers
88 Int alignment; // Buffer alignment
89 Int *pHeapIdMdbuf; // Meta data buffer heap ID
90 } PAF_MetadataBufStatus;
92 typedef struct PAF_AudioFrameBufStatus {
93 IALG_MemSpace space[PAF_MAXNUMCHAN];
94 }PAF_AudioFrameBufStatus;
96 #if 0
97 //
98 // Audio Framework Functions
99 //
101 struct PAF_AST_Params;
102 struct PAF_AST_Patchs;
103 struct PAF_AST_Config;
105 typedef struct PAF_AST_Fxns {
106 Int (*initPhase[8]) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
107 Int (*initFrame0) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
108 Int (*initFrame1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
109 Int (*passProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
110 Int (*passProcessingCopy) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
111 Int (*autoProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, ALG_Handle);
113 // FL: Source select index takes place of ALG_Handle.
114 //Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle);
115 //Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle, Int);
116 Int (*decodeProcessing) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
118 Int (*decodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
119 Int (*encodeCommand) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
121 // FL: Source select index takes place of ALG_Handle.
122 //Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *);
123 //Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int);
124 Int (*decodeInit) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
126 // FL: Source select index takes place of ALG_Handle.
127 //Int (*decodeInfo) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
128 Int (*decodeInfo) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
130 // FL: Source select index takes place of ALG_Handle.
131 //Int (*decodeInfo1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
132 Int (*decodeInfo1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
134 // FL: Source select index takes place of ALG_Handle.
135 //Int (*decodeInfo2) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
136 Int (*decodeInfo2) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
138 Int (*decodeCont) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
140 // FL: Source select index takes place of ALG_Handle.
141 //Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
142 //Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int, Int);
143 Int (*decodeDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
145 // FL: Source select index takes place of ALG_Handle.
146 //Int (*decodeStream) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
147 Int (*decodeStream) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
149 // FL: Source select index takes place of ALG_Handle.
150 //Int (*decodeEncode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
151 Int (*decodeEncode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
153 // FL: Source select index takes place of ALG_Handle.
154 //Int (*decodeFinalTest) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
155 Int (*decodeFinalTest) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
157 Int (*decodeComplete) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
158 Int (*selectDevices) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
159 Int (*sourceDecode) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
161 Int (*startOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
162 //Int (*startOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, double);
164 Int (*stopOutput) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
165 Int (*setCheckRateX) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
166 Int (*streamChainFunction) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int, Int);
167 Int (*deviceAllocate) (SIO_Handle *, int, int, int, Ptr);
168 Int (*deviceSelect) (SIO_Handle *, int, int, Ptr);
170 // FL: change ALG_Handle to zone index
171 //Int (*computeFrameLength) (ALG_Handle, Int, Int);
172 Int (*computeFrameLength) (Int, Int, Int);
174 Int (*updateInputStatus) (SIO_Handle, PAF_InpBufStatus *, PAF_InpBufConfig *);
175 Int (*copy) (Uns, PAF_InpBufConfig *, Uns, PAF_OutBufConfig *);
177 #ifdef HSE
178 Int (*setPri) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
179 #endif
181 // For RAM_report
182 Void (*headerPrint)();
183 Int (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
184 Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
185 Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
186 //Void (*memStatusPrint)(Int internal, Int external, Int internal1);
187 Void (*memStatusPrint)(HeapMem_Handle hInternalHeap, HeapMem_Handle hInternal1Heap, HeapMem_Handle hExternalHeap, HeapMem_Handle hInternal1HeapShm);
189 // For ARC
190 //Int (*controlRate) (SIO_Handle, SIO_Handle, ACP_Handle);
191 //Int (*controlRate) (SIO_Handle, SIO_Handle, ACP_Handle, double);
193 } PAF_AST_Fxns;
195 //
196 // Audio Framework Parameters
197 //
199 typedef struct PAF_AST_Params {
200 const PAF_AST_Fxns *fxns;
201 struct {
202 SmInt master;
203 SmInt inputs;
204 SmInt input1;
205 SmInt inputN;
206 SmInt decodes;
207 SmInt decode1;
208 SmInt decodeN;
209 SmInt streams;
210 SmInt stream1; /* unused */
211 SmInt streamN; /* unused */
212 SmInt encodes;
213 SmInt encode1;
214 SmInt encodeN;
215 SmInt outputs;
216 SmInt output1;
217 SmInt outputN;
218 } zone;
219 const SmInt *inputsFromDecodes;
220 const SmInt *outputsFromEncodes;
221 struct {
222 int *pHeapIdIntern; //int *pIntern;
223 int *pHeapIdExtern; //int *pExtern;
224 int *pHeapIdInpbuf; //int *pInpbuf;
225 int *pHeapIdOutbuf; //int *pOutbuf;
226 int *pHeapIdFrmbuf; //int *pFrmbuf;
227 int *pHeapIdIntern1; //int *pIntern1;
228 int clear;
229 } heap;
230 struct {
231 const IALG_MemSpace *space;
232 } common;
233 const LgInt *z_rx_bufsiz;
234 const LgInt *z_tx_bufsiz;
235 const SmInt *z_numchan;
236 MdInt framelength;
237 const PAF_AudioFunctions *pAudioFrameFunctions;
238 const struct PAF_ASP_ChainFxns *pChainFxns;
239 const PAF_InpBufStatus *pInpBufStatus;
240 const PAF_DecodeStatus * const *z_pDecodeStatus;
241 const PAF_OutBufStatus *pOutBufStatus;
242 const PAF_EncodeStatus * const *z_pEncodeStatus;
243 const PAF_VolumeStatus *pVolumeStatus;
244 const PAF_ASP_AlgKey *pDecAlgKey;
245 const PAF_ASP_AlgKey *pEncAlgKey;
246 const PAF_ASP_SioMap *pDecSioMap;
247 const SmInt *streamsFromDecodes;
248 const SmInt *streamsFromEncodes;
249 const MdInt maxFramelength;
250 const SmInt *streamOrder;
251 const PAF_ASP_LinkInit * const (*i_inpLinkInit);
252 const PAF_ASP_LinkInit * const (*i_outLinkInit);
253 const PAF_ASP_outNumBufMap * const (*poutNumBufMap);
254 const PAF_MetadataBufStatus *pMetadataBufStatus;
255 const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
256 } PAF_AST_Params;
257 #endif // #if 0
259 #endif /* _ASP_PARAMS_H_ */