| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2004-2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: nexus_audio_output.h $ |
|---|
| 39 | * $brcm_Revision: 10 $ |
|---|
| 40 | * $brcm_Date: 7/7/11 5:29p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: AudioOutput |
|---|
| 44 | * Generic APIs for audio outputs from an audio mixer. |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /nexus/modules/audio/7400/include/nexus_audio_output.h $ |
|---|
| 49 | * |
|---|
| 50 | * 10 7/7/11 5:29p jgarrett |
|---|
| 51 | * SW7552-72: Adding nco option |
|---|
| 52 | * |
|---|
| 53 | * 9 2/19/09 10:36a jgarrett |
|---|
| 54 | * PR 51964: Adding options for default sampling rate and PLL |
|---|
| 55 | * |
|---|
| 56 | * 8 9/25/08 5:07p jgarrett |
|---|
| 57 | * PR 46055: Revising equalizer API |
|---|
| 58 | * |
|---|
| 59 | * 7 5/28/08 7:03p jgarrett |
|---|
| 60 | * PR 42027: Adding custom equalizer mode |
|---|
| 61 | * |
|---|
| 62 | * 6 3/11/08 3:08p erickson |
|---|
| 63 | * PR40222: added independent audio output delay for both the user and |
|---|
| 64 | * SyncChannel |
|---|
| 65 | * |
|---|
| 66 | * 5 2/7/08 11:57a vsilyaev |
|---|
| 67 | * PR 38682: Changed return type of XXX_Shutdown routines to void |
|---|
| 68 | * |
|---|
| 69 | * 4 1/31/08 9:47a erickson |
|---|
| 70 | * PR36808: remove unnecessary includes |
|---|
| 71 | * |
|---|
| 72 | * 3 1/23/08 9:22p vobadm |
|---|
| 73 | * PR35457: update docs |
|---|
| 74 | * |
|---|
| 75 | * 2 1/23/08 2:39p erickson |
|---|
| 76 | * PR35457: update docs |
|---|
| 77 | * |
|---|
| 78 | * 1 1/18/08 2:15p jgarrett |
|---|
| 79 | * PR 38808: Merging to main branch |
|---|
| 80 | * |
|---|
| 81 | * Nexus_Devel/12 1/9/08 2:52p erickson |
|---|
| 82 | * PR38535: added comments |
|---|
| 83 | * |
|---|
| 84 | * Nexus_Devel/11 1/8/08 7:00p jgarrett |
|---|
| 85 | * PR 38535: Changing volume control, adding equalizer and channel order |
|---|
| 86 | * control |
|---|
| 87 | * |
|---|
| 88 | * Nexus_Devel/10 12/28/07 2:11p erickson |
|---|
| 89 | * PR35457: added units |
|---|
| 90 | * |
|---|
| 91 | * Nexus_Devel/9 11/29/07 2:24p erickson |
|---|
| 92 | * PR35457: doc update for 0.5 release |
|---|
| 93 | * |
|---|
| 94 | * Nexus_Devel/8 11/19/07 1:20p erickson |
|---|
| 95 | * PR34925: split demux.h into separate interface files |
|---|
| 96 | * |
|---|
| 97 | * Nexus_Devel/7 11/6/07 4:22p jgarrett |
|---|
| 98 | * PR 34954: Migrating to audio connector model |
|---|
| 99 | * |
|---|
| 100 | * Nexus_Devel/6 10/4/07 2:25p erickson |
|---|
| 101 | * PR34594: removed audio descriptors |
|---|
| 102 | * |
|---|
| 103 | * Nexus_Devel/5 9/27/07 7:51p jgarrett |
|---|
| 104 | * PR 34954: Adding return type for close |
|---|
| 105 | * |
|---|
| 106 | * Nexus_Devel/4 9/24/07 5:04p jgarrett |
|---|
| 107 | * PR 34954: Adding dummy structure member |
|---|
| 108 | * |
|---|
| 109 | * Nexus_Devel/3 9/17/07 1:32p jgarrett |
|---|
| 110 | * PR 34954: Implementing naming convention changes |
|---|
| 111 | * |
|---|
| 112 | * Nexus_Devel/2 9/10/07 11:30a jgarrett |
|---|
| 113 | * PR 34254: Adding multiple inclusion protection |
|---|
| 114 | * |
|---|
| 115 | * Nexus_Devel/2 8/24/07 11:57a jgarrett |
|---|
| 116 | * PR 34254: Implementing Source -> Input name changes |
|---|
| 117 | * |
|---|
| 118 | ***************************************************************************/ |
|---|
| 119 | #ifndef NEXUS_AUDIO_OUTPUT_H__ |
|---|
| 120 | #define NEXUS_AUDIO_OUTPUT_H__ |
|---|
| 121 | |
|---|
| 122 | #include "nexus_types.h" |
|---|
| 123 | #include "nexus_audio_types.h" |
|---|
| 124 | |
|---|
| 125 | #ifdef __cplusplus |
|---|
| 126 | extern "C" { |
|---|
| 127 | #endif |
|---|
| 128 | |
|---|
| 129 | /*=************************************ |
|---|
| 130 | Interface: AudioOutput |
|---|
| 131 | |
|---|
| 132 | Header file: nexus_audio_output.h |
|---|
| 133 | |
|---|
| 134 | Module: Audio |
|---|
| 135 | |
|---|
| 136 | Description: Abstract connector for routing audio to an output |
|---|
| 137 | |
|---|
| 138 | **************************************/ |
|---|
| 139 | |
|---|
| 140 | /*************************************************************************** |
|---|
| 141 | Summary: |
|---|
| 142 | Audio PLL Selection |
|---|
| 143 | |
|---|
| 144 | Description: |
|---|
| 145 | Many audio outputs require a PLL to generate their clock. By default, |
|---|
| 146 | all outputs will use the PLL0, unless 1) a different "defaultPll" has been |
|---|
| 147 | specified in the NEXUS_AudioModuleSettings.defaultPll during the call to |
|---|
| 148 | NEXUS_AudioModule_Init(), or 2) the PLL used by an output has been |
|---|
| 149 | specifed in the NEXUS_AudioOutputSettings for that output. You |
|---|
| 150 | will need to use multiple PLLs if you have outputs that require different |
|---|
| 151 | sampling rates from one another. For example, if you have a decoder |
|---|
| 152 | outputting 48kHz on I2S and another decoder outputting 44.1kHz on SPDIF, |
|---|
| 153 | you must use separate PLLs for the two outputs. If both use the same |
|---|
| 154 | sampling rate, they can share the PLL. There are also cases where sampling |
|---|
| 155 | rates that are multiples of one another can share a PLL (e.g. Dolby Digital |
|---|
| 156 | Plus passthrough with simultaneous AC3 conversion). |
|---|
| 157 | |
|---|
| 158 | All outputs connected to the same source must share the same PLL. You can |
|---|
| 159 | not use multiple PLLs with a single source. |
|---|
| 160 | |
|---|
| 161 | Currently, DACs and RFM do not require a PLL. I2S and SPDIF do |
|---|
| 162 | require one. HDMI, DummyOutput, and OutputCapture outputs may use either |
|---|
| 163 | a PLL or an NCO clock source. |
|---|
| 164 | ***************************************************************************/ |
|---|
| 165 | typedef enum |
|---|
| 166 | { |
|---|
| 167 | NEXUS_AudioOutputPll_e0, |
|---|
| 168 | NEXUS_AudioOutputPll_e1, |
|---|
| 169 | NEXUS_AudioOutputPll_e2, |
|---|
| 170 | NEXUS_AudioOutputPll_e3, |
|---|
| 171 | NEXUS_AudioOutputPll_eMax |
|---|
| 172 | } NEXUS_AudioOutputPll; |
|---|
| 173 | |
|---|
| 174 | /*************************************************************************** |
|---|
| 175 | Summary: |
|---|
| 176 | Audio NCO Selection |
|---|
| 177 | |
|---|
| 178 | Description: |
|---|
| 179 | Some audio outputs (that do not require a PLL) can use an NCO (Mclkgen) |
|---|
| 180 | oscillator to generate their clock. By default, audio outputs will never |
|---|
| 181 | use an NCO, but an NCO can be explicitly assigned to one or more outputs. |
|---|
| 182 | As with PLLs, you will need to use multiple NCOs if you have outputs that |
|---|
| 183 | require different sampling rates from one another. |
|---|
| 184 | |
|---|
| 185 | If any output uses an NCO, then all other outputs connected to the same |
|---|
| 186 | source must share the same NCO. You can not use multiple NCOs (or mix NCOs |
|---|
| 187 | and PLLs) with a single source. |
|---|
| 188 | |
|---|
| 189 | Currently, NCOs should only be used for HDMI, DummyOutput, and |
|---|
| 190 | OutputCapture outputs. NCO clocks are not adequate for I2S, and SPDIF |
|---|
| 191 | outputs, which require a PLL clock source. DACs and RFM outputs will |
|---|
| 192 | always use the DAC's internal rate manager as their clock source. |
|---|
| 193 | |
|---|
| 194 | Note: Not all chips have an NCO (Mclkgen) clock source available. |
|---|
| 195 | ***************************************************************************/ |
|---|
| 196 | typedef enum |
|---|
| 197 | { |
|---|
| 198 | NEXUS_AudioOutputNco_e0, |
|---|
| 199 | NEXUS_AudioOutputNco_e1, |
|---|
| 200 | NEXUS_AudioOutputNco_e2, |
|---|
| 201 | NEXUS_AudioOutputNco_e3, |
|---|
| 202 | NEXUS_AudioOutputNco_eMax |
|---|
| 203 | } NEXUS_AudioOutputNco; |
|---|
| 204 | |
|---|
| 205 | /*************************************************************************** |
|---|
| 206 | Summary: |
|---|
| 207 | Generic audio output settings |
|---|
| 208 | ***************************************************************************/ |
|---|
| 209 | typedef struct NEXUS_AudioOutputSettings |
|---|
| 210 | { |
|---|
| 211 | NEXUS_Timebase timebase; |
|---|
| 212 | |
|---|
| 213 | NEXUS_AudioChannelMode channelMode; |
|---|
| 214 | |
|---|
| 215 | NEXUS_AudioVolumeType volumeType; /* specifies the units for leftVolume and rightVolume. */ |
|---|
| 216 | int32_t leftVolume; /* the units depend on the value of volumeType. See docs for NEXUS_AudioVolumeType. */ |
|---|
| 217 | int32_t rightVolume; /* the units depend on the value of volumeType. See docs for NEXUS_AudioVolumeType. */ |
|---|
| 218 | |
|---|
| 219 | bool muted; |
|---|
| 220 | |
|---|
| 221 | unsigned additionalDelay; /* Delay to add to this path. If you are using SyncChannel, this additionalDelay will |
|---|
| 222 | be added to whatever delay SyncChannel assigns. In milliseconds. */ |
|---|
| 223 | |
|---|
| 224 | NEXUS_AudioOutputPll pll; /* PLL Selection. May not apply to all outputs, see NEXUS_AudioOutputPll for details. */ |
|---|
| 225 | |
|---|
| 226 | NEXUS_AudioOutputNco nco; /* NCO Selection. May not apply to all outputs, see NEXUS_AudioOutputNco for details. */ |
|---|
| 227 | |
|---|
| 228 | unsigned defaultSampleRate; /* This is the default sample rate for an output in Hz (default=48000). |
|---|
| 229 | Outputs connected to an AudioDecoder will automatically switch to the |
|---|
| 230 | decoded sample rate. Outputs connected to other inputs such as AudioPlayback |
|---|
| 231 | or I2sInput will sample rate convert the input data to this rate. Adjusting |
|---|
| 232 | this rate to match the source rate can avoid a sample rate conversion. |
|---|
| 233 | Supported values are 48000, 44100, and 32000. */ |
|---|
| 234 | } NEXUS_AudioOutputSettings; |
|---|
| 235 | |
|---|
| 236 | /*************************************************************************** |
|---|
| 237 | Summary: |
|---|
| 238 | Get settings of an audio output |
|---|
| 239 | ***************************************************************************/ |
|---|
| 240 | void NEXUS_AudioOutput_GetSettings( |
|---|
| 241 | NEXUS_AudioOutput output, |
|---|
| 242 | NEXUS_AudioOutputSettings *pSettings /* [out] Current Settings */ |
|---|
| 243 | ); |
|---|
| 244 | |
|---|
| 245 | /*************************************************************************** |
|---|
| 246 | Summary: |
|---|
| 247 | Set settings of an audio output |
|---|
| 248 | ***************************************************************************/ |
|---|
| 249 | NEXUS_Error NEXUS_AudioOutput_SetSettings( |
|---|
| 250 | NEXUS_AudioOutput output, |
|---|
| 251 | const NEXUS_AudioOutputSettings *pSettings |
|---|
| 252 | ); |
|---|
| 253 | |
|---|
| 254 | /*************************************************************************** |
|---|
| 255 | Summary: |
|---|
| 256 | Status of the audio output |
|---|
| 257 | ***************************************************************************/ |
|---|
| 258 | typedef struct NEXUS_AudioOutputStatus |
|---|
| 259 | { |
|---|
| 260 | unsigned delay; /* Delay on this path, in milliseconds. This reports the total delay including SyncChannel's delay and NEXUS_AudioOutputSettings.additionalDelay. */ |
|---|
| 261 | } NEXUS_AudioOutputStatus; |
|---|
| 262 | |
|---|
| 263 | /*************************************************************************** |
|---|
| 264 | Summary: |
|---|
| 265 | Get status of an audio output |
|---|
| 266 | ***************************************************************************/ |
|---|
| 267 | NEXUS_Error NEXUS_AudioOutput_GetStatus( |
|---|
| 268 | NEXUS_AudioOutput output, |
|---|
| 269 | NEXUS_AudioOutputStatus *pStatus /* [out] */ |
|---|
| 270 | ); |
|---|
| 271 | |
|---|
| 272 | /*************************************************************************** |
|---|
| 273 | Summary: |
|---|
| 274 | Add an input to this output |
|---|
| 275 | ***************************************************************************/ |
|---|
| 276 | NEXUS_Error NEXUS_AudioOutput_AddInput( |
|---|
| 277 | NEXUS_AudioOutput output, |
|---|
| 278 | NEXUS_AudioInput input |
|---|
| 279 | ); |
|---|
| 280 | |
|---|
| 281 | /*************************************************************************** |
|---|
| 282 | Summary: |
|---|
| 283 | Add an input to this output |
|---|
| 284 | ***************************************************************************/ |
|---|
| 285 | NEXUS_Error NEXUS_AudioOutput_RemoveInput( |
|---|
| 286 | NEXUS_AudioOutput output, |
|---|
| 287 | NEXUS_AudioInput input |
|---|
| 288 | ); |
|---|
| 289 | |
|---|
| 290 | /*************************************************************************** |
|---|
| 291 | Summary: |
|---|
| 292 | Add an input to this output |
|---|
| 293 | ***************************************************************************/ |
|---|
| 294 | NEXUS_Error NEXUS_AudioOutput_RemoveAllInputs( |
|---|
| 295 | NEXUS_AudioOutput output |
|---|
| 296 | ); |
|---|
| 297 | |
|---|
| 298 | /*************************************************************************** |
|---|
| 299 | Summary: |
|---|
| 300 | Shutdown this output handle |
|---|
| 301 | |
|---|
| 302 | Description: |
|---|
| 303 | This routine should be called before the specific output object |
|---|
| 304 | (e.g. AudioDac) is closed. |
|---|
| 305 | ***************************************************************************/ |
|---|
| 306 | void NEXUS_AudioOutput_Shutdown( |
|---|
| 307 | NEXUS_AudioOutput output |
|---|
| 308 | ); |
|---|
| 309 | |
|---|
| 310 | #ifdef __cplusplus |
|---|
| 311 | } |
|---|
| 312 | #endif |
|---|
| 313 | |
|---|
| 314 | #endif /* #ifndef NEXUS_AUDIO_OUTPUT_H__ */ |
|---|
| 315 | |
|---|