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 * ======== audioStreamDecodeProc.h ========
38 */
40 #ifndef _ASDP_H_
41 #define _ASDP_H_
43 #include <xdc/std.h>
44 #include <ti/sysbios/knl/Task.h>
46 #include "audioStreamProc_params.h"
47 #include "audioStreamProc_patchs.h"
48 #include "audioStreamProc_config.h"
49 #include "aspDecOpCircBuf_common.h"
51 struct PAF_ASDT_Params;
52 struct PAF_ASDT_Patchs;
53 struct PAF_ASDT_Config;
55 // Audio Stream Decode Task (ASDT) parameters, functions
56 typedef struct PAF_ASDT_Fxns {
57 Int (*initPhase[8]) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *);
58 Int (*initFrame0) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *, Int);
59 Int (*initFrame1) (const struct PAF_ASDT_Params *, const struct PAF_ASDT_Patchs *, struct PAF_ASDT_Config *, Int, Int);
61 // For RAM_report
62 Void (*headerPrint)();
63 Int (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
64 Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
65 Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
66 Void (*memStatusPrint)(
67 CString header,
68 HeapMem_Handle hInternalHeap,
69 HeapMem_Handle hInternal1Heap,
70 HeapMem_Handle hExternalHeap,
71 HeapMem_Handle hInternal1HeapShm,
72 HeapMem_Handle hExternalHeapShm,
73 HeapMem_Handle hExternalNonCachedHeapShm);
74 } PAF_ASDT_Fxns;
76 // Audio Stream Decode Task (ASDT) parameters
77 typedef struct PAF_ASDT_Params {
78 const PAF_ASDT_Fxns *fxns;
79 struct {
80 SmInt master;
81 SmInt decodes;
82 SmInt decode1;
83 SmInt decodeN;
84 SmInt streams;
85 } zone;
86 const SmInt *inputsFromDecodes;
87 struct {
88 int *pHeapIdIntern; // INT memory heap ID
89 int *pHeapIdExtern; // EXT memory heap ID
90 int *pHeapIdFrmbuf; // Frame buffer heap ID
91 int *pHeapIdIntern1; // INT1 memory heap ID
92 int *pHeapIdInt1Shm; // INT1 SHared Memory heap ID
93 int *pHeapIdExtShm; // EXT SHared Memory heap ID
94 int *pHeapIdExtNonCachedShm; // EXT Non-Cached SHared Memory heap ID
95 int clear;
96 } heap;
97 struct {
98 const IALG_MemSpace *space;
99 } common;
100 const SmInt *z_numchan;
101 MdInt framelength;
102 const PAF_AudioFunctions *pAudioFrameFunctions;
103 const struct PAF_ASP_ChainFxns *pChainFxns;
104 const PAF_DecodeStatus * const *z_pDecodeStatus;
105 const PAF_ASP_AlgKey *pDecAlgKey;
106 const SmInt *streamsFromDecodes;
107 const MdInt maxFramelength;
108 const PAF_MetadataBufStatus *pMetadataBufStatus;
109 const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
110 } PAF_ASDT_Params;
112 // Audio Stream Decode Task (ASDT) patchs
113 typedef struct PAF_ASDT_Patchs {
114 const PAF_ASP_LinkInit * const (*i_decLinkInit);
115 //const PAF_ASP_LinkInit * const (*i_aspLinkInit)[GEARS];
116 } PAF_ASDT_Patchs;
118 // Audio Stream Decode Task (ASDT) configuration
119 typedef struct PAF_ASDT_Config
120 {
121 Task_Handle taskHandle; // ASDT handle
122 ACP_Handle acp; // ASDT local ACP handle
123 PAF_AST_DecOpCircBufCtl decOpCircBufCtl; // decoder output circular buffer control
124 PAF_AST_OutInitSyncCtl outIsCtl; // output init-sync control
125 PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
126 } PAF_ASDT_Config;
129 // Purpose: Audio Stream Decode Task Function for initialization of data pointers
130 // by allocation of memory.
131 Int
132 PAF_ASDT_initPhaseMalloc(
133 const PAF_ASDT_Params *pP,
134 const PAF_ASDT_Patchs *pQ,
135 PAF_ASDT_Config *pAsdtCfg
136 );
138 // Purpose: Audio Stream Decode Task Function for initialization of data values
139 // from parameters.
140 Int
141 PAF_ASDT_initPhaseConfig(
142 const PAF_ASDT_Params *pP,
143 const PAF_ASDT_Patchs *pQ,
144 PAF_ASDT_Config *pAsdtCfg
145 );
147 // Purpose: Audio Stream Decode Task Function for initialization of ACP by
148 // instantiation of the algorithm.
149 Int
150 PAF_ASDT_initPhaseAcpAlg(
151 const PAF_ASDT_Params *pP,
152 const PAF_ASDT_Patchs *pQ,
153 PAF_ASDT_Config *pAsdtCfg
154 );
156 // Purpose: Audio Stream Decode Task Function for initialization of data pointers
157 // by allocation for common memory and by instantiation for
158 // algorithms.
159 Int
160 PAF_ASDT_initPhaseCommon(
161 const PAF_ASDT_Params *pP,
162 const PAF_ASDT_Patchs *pQ,
163 PAF_ASDT_Config *pAsdtCfg
164 );
166 // Purpose: Audio Stream Decode Task Function for initialization of data values
167 // from parameters for Algorithm Keys.
168 Int
169 PAF_ASDT_initPhaseAlgKey(
170 const PAF_ASDT_Params *pP,
171 const PAF_ASDT_Patchs *pQ,
172 PAF_ASDT_Config *pAsdtCfg
173 );
175 // Purpose: Audio Stream Decode Task Function for initialization of the Audio
176 // Frame(s) by memory allocation and loading of data pointers
177 // and values.
178 Int
179 PAF_ASDT_initFrame0(
180 const PAF_ASDT_Params *pP,
181 const PAF_ASDT_Patchs *pQ,
182 PAF_ASDT_Config *pAsdtCfg,
183 Int z
184 );
186 // Purpose: Audio Stream Task Function for initialization or reinitialization
187 // of the Audio Frame(s) by loading of data values of a
188 // time-varying nature.
189 Int
190 PAF_ASDT_initFrame1(
191 const PAF_ASDT_Params *pP,
192 const PAF_ASDT_Patchs *pQ,
193 PAF_ASDT_Config *pAsdtCfg,
194 Int z,
195 Int sourceSelect
196 );
198 // Reset AF, invoked during activate (INIT stage from Master)
199 Int resetAf(
200 const PAF_ASDT_Params *pP,
201 Int z,
202 Int sourceSelect
203 );
205 // Reset AF samsiz, invoked during DECODE
206 Int resetAfSamsiz(
207 Int z
208 );
210 extern PAF_ASDT_Config gPAF_ASDT_config;
212 #endif /* _ASDP_H_ */