source: svn/newcon3bcm2_21bu/magnum/portinginterface/ape/7552/bape_mixer.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 21.4 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2006-2012, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bape_mixer.h $
11 * $brcm_Revision: Hydra_Software_Devel/12 $
12 * $brcm_Date: 3/7/12 4:35p $
13 *
14 * Module Description: Audio Mixer Interface
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/ape/7422/bape_mixer.h $
19 *
20 * Hydra_Software_Devel/12   3/7/12 4:35p jgarrett
21 * SW7435-24: Adding DSP index for decode and dsp mixer
22 *
23 * Hydra_Software_Devel/11   12/2/11 3:18p jgarrett
24 * SW7346-578: Adding ability to change some mixer settings without
25 * destroying and re-creating the mixer
26 *
27 * Hydra_Software_Devel/10   8/25/11 1:48p gskerl
28 * SW7425-1119: Removed obsolete prototype for
29 * BAPE_Mixer_GetLoopbackInputPort
30 *
31 * Hydra_Software_Devel/9   8/17/11 3:37p gskerl
32 * SW7425-1119: Added prototypes for BAPE_Mixer_Start() and
33 * BAPE_Mixer_Stop()
34 *
35 * Hydra_Software_Devel/8   7/8/11 4:24p gskerl
36 * SW7552-72: Added support for NCO/Mclkgen audio clock sources
37 *
38 * Hydra_Software_Devel/7   6/3/11 6:41p jgarrett
39 * SW7425-406: Adding BAPE_Mixer_GetConnector routines
40 *
41 * Hydra_Software_Devel/6   2/22/11 5:43p jgarrett
42 * SW7422-146: Implemented type renaming based on filter graph review
43 * comments
44 *
45 * Hydra_Software_Devel/5   1/10/11 5:19p jgarrett
46 * SW7422-146: Adding ramp step APIs
47 *
48 * Hydra_Software_Devel/4   12/17/10 3:58p jgarrett
49 * SW7422-146: Nexus APE integration on 7422
50 *
51 * Hydra_Software_Devel/3   12/16/10 4:04p jgarrett
52 * SW7422-146: Initial compilable APE for 7422
53 *
54 * Hydra_Software_Devel/2   12/14/10 2:39p jgarrett
55 * SW7422-146: Renaming MixerOutput to OutputPort
56 *
57 * Hydra_Software_Devel/1   12/14/10 2:16p jgarrett
58 * SW7422-146: Adding initial API for APE/DSP
59 *
60 ***************************************************************************/
61
62#ifndef BAPE_MIXER_H_
63#define BAPE_MIXER_H_
64
65#include "bavc.h"
66
67/***************************************************************************
68Summary:
69Mixer Handle
70***************************************************************************/
71typedef struct BAPE_Mixer *BAPE_MixerHandle;
72
73
74/***************************************************************************
75Summary:
76Mixer Types
77***************************************************************************/
78typedef enum BAPE_MixerType
79{
80    BAPE_MixerType_eStandard,   /* Mixing and sample rate conversion are permitted */
81    BAPE_MixerType_eDsp,        /* Mix using the DSP/Firmware and not the FMM */
82    BAPE_MixerType_eMax
83} BAPE_MixerType;
84
85/***************************************************************************
86Summary:
87Mixer Settings
88***************************************************************************/
89typedef struct BAPE_MixerSettings
90{
91    BAPE_MixerType type;                /* Type of mixer.  This can only be set while creating
92                                           a mixer and not changed afterward. */
93
94    unsigned mixerSampleRate;           /* Output rate of this mixer if it is fixed. 
95                                           Default = 0, which will slave to the master input
96                                           sample rate */ 
97
98    unsigned defaultSampleRate;         /* If there is no master input or the
99                                           master input is not started, the
100                                           sample rate specified here will be
101                                           applied to all outputs.  Ignored if mixerSampleRate
102                                           has been set. */
103
104    unsigned dspIndex;                  /* Index of the DSP you would like to use.  Default = 0.
105                                           Applies to DSP mixers only. */
106
107    BAPE_Pll outputPll;                 /* Which output PLL will be used with this mixer. 
108                                           It's usage depends on the type of outputs
109                                           connected to the mixer.  If the mixer has
110                                           only DAC outputs, then outputPll is not used.
111                                           Otherwise, if the mixer has any I2S or Spdif
112                                           outputs, then outputPll specifies the PLL to
113                                           be used as the mixer's timing source. 
114                                           Otherwise (no DACS, I2S, or Spdif outputs),
115                                           outputPll specifies the PLL to use when:
116                                           1) there is not another mixer with matching inputs
117                                           and settings that has a DAC output whose
118                                           clock can be used for the timing source,
119                                           and 2) a valid outputNco has not been
120                                           specified.
121
122                                           Strongly recommended for I2S and SPDIF outputs. 
123                                           Independent PLLs should be used if their
124                                           input clock (VCXO) is different or if their
125                                           sample rate is not an integer multiple of
126                                           other rates driven by the PLL. This cannot
127                                           be changed while inputs are running.
128
129                                           Setting this field to BAPE_Pll_eMax will
130                                           prevent this mixer from using a PLL as a
131                                           timing source.   */
132
133    BAPE_Nco outputNco;                 /* Which output NCO will be used with this mixer.
134                                           It's usage depends on the type of outputs
135                                           connected to the mixer.  If the mixer has
136                                           only DAC outputs, then outputNco is not used.
137                                           Otherwise, if the mixer has any I2S or Spdif
138                                           outputs, then outputNco specifies the NCO to
139                                           be used as the mixer's timing source unless
140                                           outputPll specifies a valid PLL.  Otherwise
141                                           (no DACS, I2S, or Spdif outputs), then
142                                           outputNco specifies the NCO to use for the
143                                           timing source.
144
145                                           Recommended for use when a mixer only has MAI,
146                                           DummyOutput, and/or OutputCapture outputs
147                                           (if the current chip has an audio NCO).
148
149                                           Independent NCOs should be used if their
150                                           input clock (timebase) is different.  This
151                                           cannot be changed while inputs are running.
152
153                                           This field's default value is BAPE_Nco_eMax,
154                                           which prevents the mixer from using an
155                                           NCO for a timing source.  */
156
157    BAVC_Timebase outputTimebase;       /* What timebase will be used to drive
158                                           any DAC outputs connected to this mixer. 
159                                           Timebase input to the VCXO Rate Manager
160                                           must be programmed externally by the
161                                           application.  This cannot be changed while
162                                           inputs are running. */
163
164    unsigned outputDelay;               /* Delay for connected outputs (in ms).  Currently, applies to decoder
165                                           inputs only. */
166
167} BAPE_MixerSettings;
168
169/***************************************************************************
170Summary:
171Get Default Mixer Settings
172***************************************************************************/
173void BAPE_Mixer_GetDefaultSettings(
174    BAPE_MixerSettings *pSettings   /* [out] */
175    );
176
177/***************************************************************************
178Summary:
179Open a mixer
180***************************************************************************/
181BERR_Code BAPE_Mixer_Create(
182    BAPE_Handle deviceHandle,
183    const BAPE_MixerSettings *pSettings,
184    BAPE_MixerHandle *pHandle               /* [out] */
185    );
186
187/***************************************************************************
188Summary:
189Close a mixer
190***************************************************************************/
191void BAPE_Mixer_Destroy(
192    BAPE_MixerHandle handle
193    );
194
195/***************************************************************************
196Summary:
197Get Current Mixer Settings
198***************************************************************************/
199void BAPE_Mixer_GetSettings(
200    BAPE_MixerHandle hMixer,
201    BAPE_MixerSettings *pSettings   /* [out] */
202    );
203
204/***************************************************************************
205Summary:
206Set Mixer Settings
207 
208Description:
209This call can only be made while all inputs to a mixer are stopped and
210the mixer itself is stopped (meaning BAPE_Mixer_Start has not been called).
211Attempts to change on the fly will return an error and the new settings will
212not be saved.
213 
214See Also:
215BAPE_Mixer_GetSettings
216***************************************************************************/
217BERR_Code BAPE_Mixer_SetSettings(
218    BAPE_MixerHandle hMixer,
219    const BAPE_MixerSettings *pSettings
220    );
221
222/***************************************************************************
223Summary:
224Start a mixer
225
226Description:
227This call is optional.  By default, mixers will automatically start when
228The first input starts, but if you want to explicitly enable the mixer
229earlier call this function prior to starting any inputs.
230***************************************************************************/
231BERR_Code BAPE_Mixer_Start(
232    BAPE_MixerHandle handle
233    );
234
235/***************************************************************************
236Summary:
237Stop a mixer
238
239Description:
240This call is required only if you call BAPE_Mixer_Start().  By default,
241mixers will automatically stop when the last input stops, but if you
242have explicitly started the mixer via BAPE_Mixer_Start() you must call
243this routine to stop it after all inputs have stopped.
244***************************************************************************/
245void BAPE_Mixer_Stop(
246    BAPE_MixerHandle handle
247    );
248
249/***************************************************************************
250Summary:
251Get a data path connector to cascade a mixer to other audio components
252***************************************************************************/
253void BAPE_Mixer_GetConnector(
254    BAPE_MixerHandle handle,
255    BAPE_Connector *pConnector /* [out] */
256    );
257
258/***************************************************************************
259Summary:
260Mixer Input Settings
261***************************************************************************/
262typedef struct BAPE_MixerAddInputSettings
263{
264    bool sampleRateMaster;      /* If true, this will be the master input for sample rate purposes */
265    bool convertSampleRate;     /* For DSP mixers, this input must be sample-rate converted to
266                                   match the mixed sample rate.  Ignored on other mixer types.  */
267} BAPE_MixerAddInputSettings;
268
269/***************************************************************************
270Summary:
271Get Default Mixer Input Settings
272***************************************************************************/
273void BAPE_Mixer_GetDefaultAddInputSettings(
274    BAPE_MixerAddInputSettings *pSettings   /* [out] */
275    );
276
277/***************************************************************************
278Summary:
279Add Mixer Input
280 
281Description:
282Inputs to a mixer can not be modified while any previously connected
283inputs are running.
284***************************************************************************/
285BERR_Code BAPE_Mixer_AddInput(
286    BAPE_MixerHandle handle,
287    BAPE_Connector input,
288    const BAPE_MixerAddInputSettings *pSettings     /* Optional, pass NULL for default settings */
289    );
290
291/***************************************************************************
292Summary:
293Remove Mixer Input
294 
295Description:
296Inputs to a mixer can not be modified while any previously connected
297inputs are running.
298***************************************************************************/
299BERR_Code BAPE_Mixer_RemoveInput(
300    BAPE_MixerHandle handle,
301    BAPE_Connector input
302    );
303
304/***************************************************************************
305Summary:
306Remove All Mixer Inputs
307 
308Description:
309Inputs to a mixer can not be modified while any previously connected
310inputs are running.
311***************************************************************************/
312BERR_Code BAPE_Mixer_RemoveAllInputs(
313    BAPE_MixerHandle handle
314    );
315
316/***************************************************************************
317Summary:
318Add Mixer Output
319 
320Description:
321Outputs from a mixer can not be modified while any previously connected
322inputs are running.
323***************************************************************************/
324BERR_Code BAPE_Mixer_AddOutput(
325    BAPE_MixerHandle handle,
326    BAPE_OutputPort output
327    );
328
329/***************************************************************************
330Summary:
331Remove Mixer Output
332 
333Description:
334Outputs from a mixer can not be modified while any previously connected
335inputs are running.
336***************************************************************************/
337BERR_Code BAPE_Mixer_RemoveOutput(
338    BAPE_MixerHandle handle,
339    BAPE_OutputPort output
340    );
341
342/***************************************************************************
343Summary:
344Remove All Mixer Outputs
345 
346Description:
347Outputs from a mixer can not be modified while any previously connected
348inputs are running.
349***************************************************************************/
350BERR_Code BAPE_Mixer_RemoveAllOutputs(
351    BAPE_MixerHandle handle
352    );
353
354/***************************************************************************
355Summary:
356Input Volume Settings
357***************************************************************************/
358typedef struct BAPE_MixerInputVolume
359{
360    int32_t coefficients[BAPE_Channel_eMax][BAPE_Channel_eMax];     /* Entries in this table reflect scaling from the input channel to the output channel.
361                                                                       The first index is the input channel and the second index is the output channel.
362                                                                       Default is to have BAPE_VOLUME_NORMAL for each [n][n] coefficient and
363                                                                       BAPE_VOLUME_MIN for all others.  This maps input channels to the same output channel
364                                                                       with no scaling.  You can achieve effects such as a mono mix with these coefficients
365                                                                       if desired by setting [Left][Left] to BAPE_VOLUME_NORMAL/2 and [Left][Right] to
366                                                                       BAPE_VOLUME_NORMAL/2, etc.  Mixing is only permitted between channels in the
367                                                                       same channel pair, so for example you can blend left and right, but not left and
368                                                                       center.  Values are specified in 5.23 2' complement integers.  These settings
369                                                                       are ignored for compressed inputs. */
370    uint32_t coefficientRamp;     /* The 23 LSB of this field is the fractional part and the bit[26:23] MSB is the integer part.
371                                     e.g. 0x800000 = 1, 0x400000 = 0.5 */
372    bool muted;                   /* Mute input data if true */
373} BAPE_MixerInputVolume;
374
375/***************************************************************************
376Summary:
377Get Input Volume Settings
378***************************************************************************/
379BERR_Code BAPE_Mixer_GetInputVolume(
380    BAPE_MixerHandle mixer,
381    BAPE_Connector input,
382    BAPE_MixerInputVolume *pVolume      /* [out] */
383    );
384
385/***************************************************************************
386Summary:
387Set Input Volume Settings
388 
389Description:
390Because inputs can be connected to more than one mixer, input volume is not
391persistent after an input is removed from a mixer.
392***************************************************************************/
393BERR_Code BAPE_Mixer_SetInputVolume(
394    BAPE_MixerHandle mixer,
395    BAPE_Connector input,
396    const BAPE_MixerInputVolume *pVolume
397    );
398
399/***************************************************************************
400Summary:
401Output Volume Settings
402***************************************************************************/
403typedef struct BAPE_OutputVolume
404{
405    uint32_t volume[BAPE_Channel_eMax];         /* Output volume scaling per output channel.  Default is BAPE_VOLUME_NORMAL for all channels. 
406                                                   Ignored for compressed data.  Values are specified in 5.23 integers, so 0x800000 corresponds
407                                                   to unity (BAPE_VOLUME_NORMAL). */
408    bool muted;                                 /* Mute all output channels if true. */
409} BAPE_OutputVolume;
410
411/***************************************************************************
412Summary:
413Get Output Volume Settings
414***************************************************************************/
415BERR_Code BAPE_GetOutputVolume(
416    BAPE_OutputPort output,
417    BAPE_OutputVolume *pVolume      /* [out] */
418    );
419
420/***************************************************************************
421Summary:
422Set Output Volume Settings
423 
424Description:
425Output volume settings are persistent and will remain set even when
426outputs are added/removed from mixers.
427***************************************************************************/
428BERR_Code BAPE_SetOutputVolume(
429    BAPE_OutputPort output,
430    const BAPE_OutputVolume *pVolume
431    );
432   
433/***************************************************************************
434Summary:
435Output Delay Status
436***************************************************************************/
437typedef struct BAPE_OutputDelayStatus
438{
439    unsigned pathDelay;         /* Path delay of all inputs to this output (in ms) */
440    unsigned additionalDelay;   /* Delay added in BAPE_MixerSettings (in ms) */
441} BAPE_OutputDelayStatus;
442
443/***************************************************************************
444Summary:
445Get Output Delay Status for lipsync purposes
446***************************************************************************/
447void BAPE_GetOutputDelayStatus(
448    BAPE_OutputPort output,
449    BAPE_OutputDelayStatus *pStatus     /* [out] */
450    );
451     
452/***************************************************************************
453Summary:
454Get Output Volume Ramp Step
455***************************************************************************/
456void BAPE_GetOutputVolumeRampStep(
457    BAPE_Handle deviceHandle,
458    uint32_t *pRampStep                 /* All mixers output volume is changed by this amount
459                                           every Fs while ramping.  Specified in 4.23 format.
460                                           Ignored for compressed data. */
461    );
462   
463/***************************************************************************
464Summary:
465Set Output Volume Ramp Step
466***************************************************************************/
467BERR_Code BAPE_SetOutputVolumeRampStep(
468    BAPE_Handle deviceHandle,
469    uint32_t rampStep                   /* All mixers output volume is changed by this amount
470                                           every Fs while ramping.  Specified in 4.23 format.
471                                           Ignored for compressed data. */
472    );
473   
474/***************************************************************************
475Summary:
476Get Sample Rate Converter Volume Ramp Step
477***************************************************************************/
478void BAPE_GetSampleRateConverterRampStep(
479    BAPE_Handle deviceHandle,
480    uint32_t *pRampStep                 /* All sample rate converters volume is changed by this amount
481                                           every Fs while ramping.  Specified in 4.23 format.
482                                           Ignored for compressed data. */
483    );
484   
485/***************************************************************************
486Summary:
487Set Sample Rate Converter Volume Ramp Step
488***************************************************************************/
489BERR_Code BAPE_SetSampleRateConverterRampStep(
490    BAPE_Handle deviceHandle,
491    uint32_t rampStep                   /* All sample rate converters volume is changed by this amount
492                                           every Fs while ramping.  Specified in 4.23 format.
493                                           Ignored for compressed data. */
494    );
495
496#endif /* #ifndef BAPE_MIXER_H_ */
497
Note: See TracBrowser for help on using the repository browser.