2 /*
3 * Copyright (C) 2004-2014 Texas Instruments Incorporated - http://www.ti.com/
4 * All rights reserved.
5 *
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 //
38 // Performance Audio Framework General Constant Declarations
39 //
40 //
41 //
43 #ifndef PAFTYP_A_
44 #define PAFTYP_A_
46 // Basic system parameters:
48 #ifndef PAF_MAXNUMCHAN
49 #define PAF_MAXNUMCHAN 32
50 #endif /* PAF_MAXNUMCHAN */
52 #ifndef ATMOS
53 #define ATMOS
54 #endif
56 #ifndef FULL_SPEAKER
57 #define FULL_SPEAKER
58 #endif
59 // PA/F Extended channels:
61 #define PAF_MAXNUMCHAN_HD 32
63 // Audio frame data types:
65 #ifdef PAF_MAXNUMCHAN_HD
66 #define PAF_MAXNUMCHAN_AF PAF_MAXNUMCHAN_HD
67 #else /* PAF_MAXNUMCHAN_HD */
68 #define PAF_MAXNUMCHAN_AF PAF_MAXNUMCHAN
69 #endif /* PAF_MAXNUMCHAN_HD */
71 // PAF_AudioData is the type of data carried in the stream.
73 #define PAF_AUDIODATATYPE_DOUBLE 0
74 #define PAF_AUDIODATATYPE_FLOAT 1
75 #define PAF_AUDIODATATYPE_INT 2
76 #define PAF_AUDIODATATYPE_INT32 2
77 #define PAF_AUDIODATATYPE_INT16 3
78 #define PAF_AUDIODATATYPE_INT8 4
80 #ifndef PAF_AUDIODATATYPE
81 #ifdef _PATE_
82 #define PAF_AUDIODATATYPE PAF_AUDIODATATYPE_DOUBLE
83 #else /* _PATE_ */
84 #define PAF_AUDIODATATYPE PAF_AUDIODATATYPE_FLOAT
85 #endif /* _PATE_ */
86 #endif /* PAF_AUDIODATATYPE */
88 #define PAF_AUDIODATATYPE_FIXED (PAF_AUDIODATATYPE >= PAF_AUDIODATATYPE_INT)
90 // PAF_ChannelMask indicates which channels in the audio frame data
91 // carry content (1) and which are to be ignored (0).
93 #define PAF_CHANNELMASK ~(~0<<PAF_MAXNUMCHAN-1)
95 //
96 // Channel usage enumeration:
97 //
98 // Channel usage is dependent upon the maximum number of channels.
99 //
100 // PAF_X enumerates that channel. Channels used for singletons are always
101 // the left of the corresponding pair (SURR=LSUR, etc.).
102 //
103 // PAF_Y_0 starts the Y channels, and PAF_Y_N is one past it:
104 // Y = FRoNT, REAR, BASS (subwoofer/lfe), and HEADphone, in that order.
105 //
106 // - Front-channel range: PAF_FRNT_0<=Y<PAF_FRNT_N.
107 // - Rear-channel range: PAF_REAR_0<=Y<PAF_REAR_N.
108 // - Satellite-channel range: PAF_FRNT_0<=Y<PAF_REAR_N.
109 // - Bass-channel range: PAF_BASS_0<=Y<PAF_BASS_N.
110 // - Headphone-channel range: PAF_HEAD_0<=Y<PAF_HEAD_N.
111 //
113 #if PAF_MAXNUMCHAN == 2
114 #define PAF_LEFT 0
115 #define PAF_RGHT 1
116 #define PAF_FRNT_0 0
117 #define PAF_FRNT_N 2
118 #define PAF_REAR_0 2
119 #define PAF_REAR_N 2
120 #define PAF_BASS_0 2
121 #define PAF_BASS_N 2
122 #define PAF_HEAD_0 2
123 #define PAF_HEAD_N 2
124 #elif PAF_MAXNUMCHAN == 4
125 #define PAF_LEFT 0
126 #define PAF_RGHT 1
127 #define PAF_CNTR 2
128 #define PAF_SURR 3
129 #define PAF_FRNT_0 0
130 #define PAF_FRNT_N 3
131 #define PAF_REAR_0 3
132 #define PAF_REAR_N 4
133 #define PAF_BASS_0 4
134 #define PAF_BASS_N 4
135 #define PAF_HEAD_0 4
136 #define PAF_HEAD_N 4
137 #elif PAF_MAXNUMCHAN == 6
138 #define PAF_LEFT 0
139 #define PAF_RGHT 1
140 #define PAF_CNTR 2
141 #define PAF_SURR 3
142 #define PAF_LSUR 3
143 #define PAF_RSUR 4
144 #define PAF_SUBW 5
145 #define PAF_FRNT_0 0
146 #define PAF_FRNT_N 3
147 #define PAF_REAR_0 3
148 #define PAF_REAR_N 5
149 #define PAF_BASS_0 5
150 #define PAF_BASS_N 6
151 #define PAF_HEAD_0 6
152 #define PAF_HEAD_N 6
153 #elif PAF_MAXNUMCHAN == 8
154 #define PAF_LEFT 0
155 #define PAF_RGHT 1
156 #define PAF_CNTR 2
157 #define PAF_SURR 3
158 #define PAF_LSUR 3
159 #define PAF_RSUR 4
160 #define PAF_BACK 5
161 #define PAF_LBAK 5
162 #define PAF_RBAK 6
163 #define PAF_SUBW 7
164 #define PAF_FRNT_0 0
165 #define PAF_FRNT_N 3
166 #define PAF_REAR_0 3
167 #define PAF_REAR_N 7
168 #define PAF_BASS_0 7
169 #define PAF_BASS_N 8
170 #define PAF_HEAD_0 8
171 #define PAF_HEAD_N 8
172 #elif PAF_MAXNUMCHAN == 16
173 #ifdef ATMOS
174 #define PAF_LEFT 0
175 #define PAF_RGHT 1
176 #define PAF_CNTR 2
177 #define PAF_LCTR 2
178 #define PAF_RCTR 3
179 #define PAF_WIDE 4
180 #define PAF_LWID 4
181 #define PAF_RWID 5
183 #ifdef FULL_SPEAKER
184 #define PAF_LTRR 18
185 #define PAF_RTRR 19
186 #define PAF_LTRH 20
187 #define PAF_RTRH 21
188 #else
189 #define PAF_LTRR 4
190 #define PAF_RTRR 5
191 #define PAF_LTRH 4
192 #define PAF_RTRH 5
193 #endif
195 #define PAF_OVER 6
196 #define PAF_LOVR 6
197 #define PAF_ROVR 7
198 #define PAF_LTMD 6
199 #define PAF_RTMD 7
200 #define PAF_SURR 8
201 #define PAF_LSUR 8
202 #define PAF_RSUR 9
203 #define PAF_BACK 10
204 #define PAF_LBAK 10
205 #define PAF_RBAK 11
206 #define PAF_SUBW 12
207 #define PAF_LSUB 12
208 #define PAF_RSUB 13
209 #define PAF_HEAD 14
210 #define PAF_LHED 14
211 #define PAF_RHED 15
212 #define PAF_LTFT 14
213 #define PAF_RTFT 15
215 #ifdef FULL_SPEAKER
216 #define PAF_LTFH 16
217 #define PAF_RTFH 17
218 #else
219 #define PAF_LTFH 14
220 #define PAF_RTFH 15
221 #endif
223 #define PAF_FRNT_0 0
224 #define PAF_FRNT_N 8
225 #define PAF_REAR_0 8
226 #define PAF_REAR_N 12
227 #define PAF_BASS_0 12
228 #define PAF_BASS_N 14
229 #define PAF_HEAD_0 14
230 #define PAF_HEAD_N 16
231 #else
232 #define PAF_LEFT 0
233 #define PAF_RGHT 1
234 #define PAF_CNTR 2
235 #define PAF_LCTR 2
236 #define PAF_RCTR 3
237 #define PAF_WIDE 4
238 #define PAF_LWID 4
239 #define PAF_RWID 5
240 #define PAF_OVER 6
241 #define PAF_LOVR 6
242 #define PAF_ROVR 7
243 #define PAF_SURR 8
244 #define PAF_LSUR 8
245 #define PAF_RSUR 9
246 #define PAF_BACK 10
247 #define PAF_LBAK 10
248 #define PAF_RBAK 11
249 #define PAF_SUBW 12
250 #define PAF_LSUB 12
251 #define PAF_RSUB 13
252 #define PAF_HEAD 14
253 #define PAF_LHED 14
254 #define PAF_RHED 15
255 #define PAF_FRNT_0 0
256 #define PAF_FRNT_N 8
257 #define PAF_REAR_0 8
258 #define PAF_REAR_N 12
259 #define PAF_BASS_0 12
260 #define PAF_BASS_N 14
261 #define PAF_HEAD_0 14
262 #define PAF_HEAD_N 16
263 #endif
264 #elif PAF_MAXNUMCHAN == 32
265 #ifdef ATMOS
266 #define PAF_LEFT 0
267 #define PAF_RGHT 1
268 #define PAF_CNTR 2
269 #define PAF_LCTR 2
270 #define PAF_RCTR 3
271 #define PAF_WIDE 4
272 #define PAF_LWID 4
273 #define PAF_RWID 5
275 #ifdef FULL_SPEAKER
276 #define PAF_LTRR 4
277 #define PAF_RTRR 5
278 #define PAF_LTRH 20
279 #define PAF_RTRH 21
280 #else
281 #define PAF_LTRR 4
282 #define PAF_RTRR 5
283 #define PAF_LTRH 4
284 #define PAF_RTRH 5
285 #endif
287 #define PAF_OVER 6
288 #define PAF_LOVR 6
289 #define PAF_ROVR 7
290 #define PAF_LTMD 6
291 #define PAF_RTMD 7
292 #define PAF_SURR 8
293 #define PAF_LSUR 8
294 #define PAF_RSUR 9
295 #define PAF_BACK 10
296 #define PAF_LBAK 10
297 #define PAF_RBAK 11
298 #define PAF_SUBW 12
299 #define PAF_LSUB 12
300 #define PAF_RSUB 13
301 #define PAF_HEAD 14
302 #define PAF_LHED 14
303 #define PAF_RHED 15
304 #define PAF_LTFT 14
305 #define PAF_RTFT 15
307 #ifdef FULL_SPEAKER
308 #define PAF_LTFH 3
309 #define PAF_RTFH 22
310 #else
311 #define PAF_LTFH 14
312 #define PAF_RTFH 15
313 #endif
315 #define PAF_FRNT_0 0
316 #define PAF_FRNT_N 8
317 #define PAF_REAR_0 8
318 #define PAF_REAR_N 12
319 #define PAF_BASS_0 12
320 #define PAF_BASS_N 14
321 #define PAF_HEAD_0 14
322 #define PAF_HEAD_N 16
323 #else /* PAF_MAXNUMCHAN */
324 #error unsupported option
325 #endif /* PAF_MAXNUMCHAN */
326 #endif
328 // ............................................................................
330 #ifdef PAF_MAXNUMCHAN_HD
333 #ifdef ATMOS
334 #define PAF_CHED 6 // = Cvh
335 #define PAF_OVER_HD 7 // = Ts
336 #define PAF_LSD 6 //Newly Added
337 #define PAF_RSD 7 //Newly Added
338 #define PAF_LCTR_HD 6 // = Lc
339 #define PAF_RCTR_HD 7 // = Rc
340 #define PAF_LHSI 6 // = Lts
341 #define PAF_RHSI 7 // = Rts
344 #define PAF_LS1 16 //Left Surround 1
345 #define PAF_RS1 17 //Right surround 1
346 #define PAF_LS2 18 //Left Surround 2
347 #define PAF_RS2 19 //Right surround 2
348 #define PAF_LHBK 20 //Height Left Back for DTS
349 #define PAF_RHBK 21 //Height Right Back for DTS
350 #define PAF_CHBK 22 //Height Center Back for DTS
351 #define PAF_CS 23 //Center Surround
352 #define PAF_LCS 24 //Left CS
353 #define PAF_RCS 25 //Right CS
354 #define PAF_LRS1 26 //Left Surround 1
355 #define PAF_RRS1 27 //Right surround 1
356 #define PAF_LRS2 28 //Left Surround 2
357 #define PAF_RRS2 29 //Right surround 2
358 #define PAF_LSC 30 //Left Screen
359 #define PAF_RSC 31 //Right Screen
362 #else
363 // the following channels are replaced in HD system with PAF_XXXX_HD counterparts
364 #undef PAF_LCTR // 2
365 #undef PAF_RCTR // 3
366 #undef PAF_OVER // 6
367 #define PAF_CHED 16
368 #define PAF_OVER_HD 17
369 #define PAF_LHSI 18
370 #define PAF_RHSI 19
371 #define PAF_LHBK 20
372 #define PAF_RHBK 21
373 #define PAF_CHBK 22
374 #define PAF_LCTR_HD 26
375 #define PAF_RCTR_HD 27
376 #endif
377 #endif /* PAF_MAXNUMCHAN_HD */
379 // ............................................................................
381 #ifdef PAF_SUBW
382 #define PAF_LFE PAF_SUBW
383 #endif /* PAF_SUBW */
385 // Channel form enumeration:
387 #define PAF_FORM_NSSE 0
388 #define PAF_FORM_YSSE 1
389 #define PAF_FORM_NBSE 2
390 #define PAF_FORM_YBSE 3
391 #define PAF_FORM_MONO 4
392 #define PAF_FORM_DUAL 5
394 // Sample rate enumeration:
395 //
396 // A sample rate may be supported, approximated, or recognized by any
397 // particular PA Framework:
398 // Supported sample rates are fully implemented.
399 // Approximated sample rates are implemented but only approximately using
400 // filter coefficients or other of another sample rate.
401 // Recognized sample rates are not implemented. They are typically used
402 // only for indicators.
403 //
404 // In no case should any sample rate value produce an error.
405 //
406 // The values given for sample rates below is universal. The interpretation
407 // of sample rates given below is typical but not universal. Any particular
408 // PA Framework may provide any sample rate interpretation.
410 #define PAF_SAMPLERATE_UNKNOWN 0 /* approximated as 48 kHz */
411 #define PAF_SAMPLERATE_NONE 1 /* recognized */
412 #define PAF_SAMPLERATE_32000HZ 2 /* supported */
413 #define PAF_SAMPLERATE_44100HZ 3 /* supported */
414 #define PAF_SAMPLERATE_48000HZ 4 /* supported */
415 #define PAF_SAMPLERATE_88200HZ 5 /* supported */
416 #define PAF_SAMPLERATE_96000HZ 6 /* supported */
417 #define PAF_SAMPLERATE_192000HZ 7 /* supported */
418 #define PAF_SAMPLERATE_64000HZ 8 /* recognized */
419 #define PAF_SAMPLERATE_128000HZ 9 /* recognized */
420 #define PAF_SAMPLERATE_176400HZ 10 /* recognized */
421 #define PAF_SAMPLERATE_8000HZ 11 /* recognized */
422 #define PAF_SAMPLERATE_11025HZ 12 /* recognized */
423 #define PAF_SAMPLERATE_12000HZ 13 /* recognized */
424 #define PAF_SAMPLERATE_16000HZ 14 /* recognized */
425 #define PAF_SAMPLERATE_22050HZ 15 /* recognized */
426 #define PAF_SAMPLERATE_24000HZ 16 /* recognized */
427 #define PAF_SAMPLERATE_N 17
429 // IEC Channel Status Information
430 #define PAF_IEC_AUDIOMODE_UNKNOWN 0
431 #define PAF_IEC_AUDIOMODE_AUDIO 1
432 #define PAF_IEC_AUDIOMODE_NONAUDIO 2
434 #define PAF_IEC_PREEMPHASIS_UNKNOWN 0
435 #define PAF_IEC_PREEMPHASIS_NO 1
436 #define PAF_IEC_PREEMPHASIS_YES 2
438 // Alpha Types
439 #define ALPHA_READ 0xc0
440 #define ALPHA_WRITE 0xc8
442 #define ALPHA_READ_5_N(N) (((ALPHA_READ+5)<<8)+(N))
443 #define ALPHA_WRITE_5_N(N) (((ALPHA_WRITE+5)<<8)+(N))
445 // prefix for sending alpha code so as to generate no response
446 // 0xcd:0b = alpha:eta (Type 5-11 Write--"Synchronized Write")
447 // 5+N = lambda (subsequent length, in (16-bit) words;
448 // N=no. of words of alpha code to follow)
449 // 0x00:04 = chi (comparison--always true) : phi (delay function--sleep)
450 // 0 = kappa (repeat count)
451 // 0 = tau (delay between comparisons)
452 // 0,0 = delta (compare-to value--arbitrary w/ chi=0)
453 #define writeNoResponseN(N) ALPHA_WRITE_5_N(11),5+(N),0x0004,0,0,0,0
455 #endif /* PAFTYP_A_ */