56501ccc796e761da7526f5b5205cdf8465eb965
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / common / audioStreamProc_common.h
1 /*
2 Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
3 All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
15 * distribution.
16 *
17 * Neither the name of Texas Instruments Incorporated nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
35 /*
36 * ======== audioStreamProc_common.h ========
37 */
39 #ifndef _ASP_COMMON_H_
40 #define _ASP_COMMON_H_
42 #include <xdc/std.h>
43 #include "audioStreamProc_config.h"
44 #include "paf_heapMgr.h"
46 // .............................................................................
48 /* ---------------------------------------------------------------- */
49 /* For historical reasons, macro definitions (#define ...) are used */
50 /* to hide parameter references (pP->...) throughout this file, but */
51 /* only for select quantities and not for all parameter elements. */
52 /* */
53 /* Parameter macro definitions start here. */
54 /* ---------------------------------------------------------------- */
56 //
57 // Audio Topology (Zone) Definitions
58 //
59 // The ZONE, a historical term here, is a letter identifying the Audio
60 // Topology with a single letter or "*" for a variable quantization of
61 // same.
62 //
63 // The Zone Elements listed here indicate the cardinality of the corre-
64 // sponding element:
65 //
66 // INPUTS Number of inputs.
67 // DECODES Number of decodes.
68 // STREAMS Number of streams.
69 // ENCODES Number of encodes.
70 // OUTPUTS Number of outputs.
71 //
72 // The Zone Element Counts listed here indicate the first (1) and after-
73 // last (N) values suitable for use in a loop:
74 //
75 // INPUTS[1N] for inputs.
76 // DECODES[1N] for decodes.
77 // STREAMS[1N] for streams.
78 // ENCODES[1N] for encodes.
79 // OUTPUTS[1N] for outputs.
80 //
81 // The Zone Element Count Limits listed here establish array sizes:
82 //
83 // DECODEN_MAX for decodes.
84 // STREAMN_MAX for streams.
85 // ENCODEN_MAX for encodes.
86 //
87 // The Zone Master is important in multi-input frameworks:
88 //
89 // MASTER In a uni-input zone, the count of the input.
90 // In a multi-input zone, the count of the primary which controls
91 // the secondary or secondaries.
92 //
94 #ifndef ZONE
96 #define ZONE "*" /* 19.53 kB of 38.80 kB FW */
97 //
98 //#define MASTER pP->zone.master
99 //#define INPUTS pP->zone.inputs
100 //#define DECODES pP->zone.decodes
101 #define STREAMS pP->zone.streams
102 //#define ENCODES pP->zone.encodes
103 //#define OUTPUTS pP->zone.outputs
105 #endif /* ZONE */
107 #ifndef ZONE
109 #define ZONE "I" /* ~2.5 kB less than above */
111 #define MASTER 0
112 #define INPUTS 1
113 #define DECODES 1
114 #define STREAMS 1
115 #define ENCODES 1
116 #define OUTPUTS 1
118 #endif /* ZONE */
120 #define INPUT1 pP->zone.input1
121 #define INPUTN pP->zone.inputN
122 //
123 #define DECODE1 pP->zone.decode1
124 #define DECODEN pP->zone.decodeN
125 //#define DECODEN_MAX 3
126 //
127 #define STREAM1 0
128 #define STREAMN STREAMS
129 //#define STREAMN_MAX 5
130 //
131 #define ENCODE1 pP->zone.encode1
132 #define ENCODEN pP->zone.encodeN
133 //#define ENCODEN_MAX 3
134 //
135 #define OUTPUT1 pP->zone.output1
136 #define OUTPUTN pP->zone.outputN
138 //
139 // Audio Data Representation Definitions
140 //
142 /* audio frame "width" in channels */
143 #define numchan pP->z_numchan
145 /* audio frame "length" in samples */
146 #define FRAMELENGTH pP->framelength
148 #define PA_MODULO 8 // also defined independently in ARC2 code, and may be hard coded other places.
151 // .............................................................................
153 //
154 // Heap & Memory Allocation Definitions
155 //
156 #define HEAP_ID_INTERNAL *pP->heap.pHeapIdIntern //*pP->heap.pIntern
157 #define HEAP_ID_INTERNAL1 *pP->heap.pHeapIdIntern1 //*pP->heap.pIntern1
158 #define HEAP_ID_EXTERNAL *pP->heap.pHeapIdExtern //*pP->heap.pExtern
159 #define HEAP_ID_INTERNAL1_SHM gPafHeapIdInt1Shm
160 #define HEAP_ID_EXTERNAL_SHM gPafHeapIdExtShm
161 #define HEAP_INTERNAL (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_INTERNAL)
162 #define HEAP_INTERNAL1 (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_INTERNAL1)
163 #define HEAP_EXTERNAL (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_EXTERNAL)
164 #define HEAP_INTERNAL1_SHM (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_INTERNAL1_SHM)
165 #define HEAP_EXTERNAL_SHM (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_EXTERNAL_SHM)
166 #define HEAP_CLEAR pP->heap.clear
168 #define HEAP_ID_INPBUF *pP->heap.pHeapIdInpbuf //*pP->heap.pInpbuf
169 #define HEAP_ID_OUTBUF *pP->heap.pHeapIdOutbuf //*pP->heap.pOutbuf
170 #define HEAP_ID_FRMBUF *pP->heap.pHeapIdFrmbuf //*pP->heap.pFrmbuf
171 #define HEAP_INPBUF (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_INPBUF)
172 #define HEAP_OUTBUF (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_OUTBUF)
173 #define HEAP_FRMBUF (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_FRMBUF)
175 #define HEAP_ID_MDBUF *pP->pMetadataBufStatus->pHeadIdSpace
176 #define HEAP_MDBUF (HeapMem_Handle)pafHeapMgr_readHeapHandle(HEAP_ID_MDBUF)
178 #define COMMONSPACE pP->common.space
180 // .............................................................................
182 // -----------------------------------------------------------------------------
183 // Debugging Trace Control
184 //#define TRACE_TERSE(a) LOG_printf a
185 #define TRACE_TERSE0(a) Log_info0(a)
186 #define TRACE_TERSE1(a,b) Log_info1(a,b)
187 #define TRACE_TERSE2(a,b,c) Log_info2(a,b,c)
188 #define TRACE_TERSE3(a,b,c,d) Log_info3(a,b,c,d)
189 #define TRACE_TERSE4(a,b,c,d,e) Log_info4(a,b,c,d,e)
191 //#define TRACE_GEN(a) LOG_printf a
192 #define TRACE_GEN0(a) Log_info0(a)
193 #define TRACE_GEN1(a,b) Log_info1(a,b)
194 #define TRACE_GEN2(a,b,c) Log_info2(a,b,c)
195 #define TRACE_GEN3(a,b,c,d) Log_info3(a,b,c,d)
196 #define TRACE_GEN4(a,b,c,d,e) Log_info4(a,b,c,d,e)
198 //#define TRACE_VERBOSE(a) LOG_printf a
199 #define TRACE_VERBOSE0(a) Log_info0(a)
200 #define TRACE_VERBOSE1(a,b) Log_info1(a,b)
201 #define TRACE_VERBOSE2(a,b,c) Log_info2(a,b,c)
202 #define TRACE_VERBOSE3(a,b,c,d) Log_info3(a,b,c,d)
203 #define TRACE_VERBOSE4(a,b,c,d,e) Log_info4(a,b,c,d,e)
205 #define TRACE_MSG0(a) Log_info0(a)
206 #define TRACE_MSG1(a,b) Log_info1(a,b)
207 #define TRACE_MSG2(a,b,c) Log_info2(a,b,c)
208 #define TRACE_MSG3(a,b,c,d) Log_info3(a,b,c,d)
209 #define TRACE_MSG4(a,b,c,d,e) Log_info4(a,b,c,d,e)
212 #define DEC_Handle PCM_Handle /* works for all: SNG, PCM, AC3, DTS, AAC */
215 /* Common (shared) configuration */
216 extern PAF_AST_Config gPAF_AST_config;
217 //extern far PAF_AST_Config *pC;
220 #endif /* _ASP_COMMON_H_ */