| 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_i2s_input.h $ |
|---|
| 39 | * $brcm_Revision: 11 $ |
|---|
| 40 | * $brcm_Date: 4/22/11 10:43a $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: I2sInput |
|---|
| 44 | * Specific APIs related to I2S audio inputs. |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /nexus/modules/audio/7400/include/nexus_i2s_input.h $ |
|---|
| 49 | * |
|---|
| 50 | * 11 4/22/11 10:43a erickson |
|---|
| 51 | * SW7420-1148: remove attr{shutdown=NEXUS_AudioInput_Shutdown} |
|---|
| 52 | * |
|---|
| 53 | * 10 12/14/10 3:18p erickson |
|---|
| 54 | * SW7420-1285: add null_allowed attribute |
|---|
| 55 | * |
|---|
| 56 | * 9 7/17/08 11:52a jgarrett |
|---|
| 57 | * PR 44502: Adding bits per sample option, renaming settings to match |
|---|
| 58 | * output |
|---|
| 59 | * |
|---|
| 60 | * 8 7/17/08 11:29a jgarrett |
|---|
| 61 | * PR 44502: Adding additional I2S configuration parameters |
|---|
| 62 | * |
|---|
| 63 | * 7 6/19/08 3:17p jgarrett |
|---|
| 64 | * PR 42243: Moving input volume control to specific inputs and out of |
|---|
| 65 | * mixer |
|---|
| 66 | * |
|---|
| 67 | * 6 4/22/08 10:56a jgarrett |
|---|
| 68 | * PR 41880: Changing return type for stop routines |
|---|
| 69 | * |
|---|
| 70 | * 5 2/7/08 12:11p vsilyaev |
|---|
| 71 | * PR 38692: Added attributes for shutdown functions |
|---|
| 72 | * |
|---|
| 73 | * 4 2/6/08 4:28p vsilyaev |
|---|
| 74 | * PR 38682: Added attributes for the linux kernel/user proxy mode |
|---|
| 75 | * |
|---|
| 76 | * 3 1/23/08 9:22p vobadm |
|---|
| 77 | * PR35457: update docs |
|---|
| 78 | * |
|---|
| 79 | * 2 1/23/08 2:39p erickson |
|---|
| 80 | * PR35457: update docs |
|---|
| 81 | * |
|---|
| 82 | * 1 1/18/08 2:18p jgarrett |
|---|
| 83 | * PR 38808: Merging to main branch |
|---|
| 84 | * |
|---|
| 85 | * Nexus_Devel/3 11/29/07 2:24p erickson |
|---|
| 86 | * PR35457: doc update for 0.5 release |
|---|
| 87 | * |
|---|
| 88 | * Nexus_Devel/2 11/27/07 5:25p jgarrett |
|---|
| 89 | * PR 37471: Adding I2sInput and SpdifInput |
|---|
| 90 | * |
|---|
| 91 | * Nexus_Devel/1 9/17/07 1:32p jgarrett |
|---|
| 92 | * PR 34954: Splitting I2S, SPDIF, and PCM inputs and outputs |
|---|
| 93 | * |
|---|
| 94 | ***************************************************************************/ |
|---|
| 95 | #ifndef NEXUS_I2S_INPUT_H__ |
|---|
| 96 | #define NEXUS_I2S_INPUT_H__ |
|---|
| 97 | |
|---|
| 98 | #include "nexus_types.h" |
|---|
| 99 | #include "nexus_audio_types.h" |
|---|
| 100 | #include "nexus_timebase.h" |
|---|
| 101 | |
|---|
| 102 | #ifdef __cplusplus |
|---|
| 103 | extern "C" { |
|---|
| 104 | #endif |
|---|
| 105 | |
|---|
| 106 | /*=************************************ |
|---|
| 107 | Interface: I2sInput |
|---|
| 108 | |
|---|
| 109 | Header file: nexus_i2s_input.h |
|---|
| 110 | |
|---|
| 111 | Module: Audio |
|---|
| 112 | |
|---|
| 113 | Description: Route incoming I2S audio data |
|---|
| 114 | |
|---|
| 115 | **************************************/ |
|---|
| 116 | |
|---|
| 117 | /** |
|---|
| 118 | Summary: |
|---|
| 119 | Handle for I2S input |
|---|
| 120 | **/ |
|---|
| 121 | typedef struct NEXUS_I2sInput *NEXUS_I2sInputHandle; |
|---|
| 122 | |
|---|
| 123 | /*************************************************************************** |
|---|
| 124 | Summary: |
|---|
| 125 | I2S Input Settings |
|---|
| 126 | ***************************************************************************/ |
|---|
| 127 | typedef struct NEXUS_I2sInputSettings |
|---|
| 128 | { |
|---|
| 129 | unsigned sampleRate; /* In Hz - can only be changed while stopped */ |
|---|
| 130 | unsigned bitsPerSample; /* Supports 16, 18, 20, and 24 - can only be changed while stopped. */ |
|---|
| 131 | NEXUS_Timebase timebase; /* Timebase to use while capturing - can only be changed while stopped */ |
|---|
| 132 | bool lsbAtLRClock; /* Data Justification. If true, LSB is at LR clock transition else MSB. - can only be changed while stopped */ |
|---|
| 133 | bool alignedToLRClock; /* If true, data is aligned with LR clock. If false, data is delayed by one SCLK period. - can only be changed while stopped */ |
|---|
| 134 | bool lrClkPolarity; /* If true, a high edge of LR clock indicates left channel data. Else, a low edge does. - can only be changed while stopped */ |
|---|
| 135 | |
|---|
| 136 | int32_t leftVolume; /* Linear volume level of left channel output */ |
|---|
| 137 | int32_t rightVolume; /* Linear volume level of right channel output */ |
|---|
| 138 | bool muted; |
|---|
| 139 | } NEXUS_I2sInputSettings; |
|---|
| 140 | |
|---|
| 141 | /*************************************************************************** |
|---|
| 142 | Summary: |
|---|
| 143 | Get default settings for an I2S Input |
|---|
| 144 | ***************************************************************************/ |
|---|
| 145 | void NEXUS_I2sInput_GetDefaultSettings( |
|---|
| 146 | NEXUS_I2sInputSettings *pSettings /* [out] default settings */ |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | /*************************************************************************** |
|---|
| 150 | Summary: |
|---|
| 151 | Open an I2S input. |
|---|
| 152 | ***************************************************************************/ |
|---|
| 153 | NEXUS_I2sInputHandle NEXUS_I2sInput_Open( /* attr{destructor=NEXUS_I2sInput_Close} */ |
|---|
| 154 | unsigned index, |
|---|
| 155 | const NEXUS_I2sInputSettings *pSettings /* attr{null_allowed=y} */ |
|---|
| 156 | ); |
|---|
| 157 | |
|---|
| 158 | /*************************************************************************** |
|---|
| 159 | Summary: |
|---|
| 160 | Close an I2S Input |
|---|
| 161 | ***************************************************************************/ |
|---|
| 162 | void NEXUS_I2sInput_Close( |
|---|
| 163 | NEXUS_I2sInputHandle handle |
|---|
| 164 | ); |
|---|
| 165 | |
|---|
| 166 | /*************************************************************************** |
|---|
| 167 | Summary: |
|---|
| 168 | Get settings for an I2S input |
|---|
| 169 | ***************************************************************************/ |
|---|
| 170 | void NEXUS_I2sInput_GetSettings( |
|---|
| 171 | NEXUS_I2sInputHandle handle, |
|---|
| 172 | NEXUS_I2sInputSettings *pSettings /* [out] Settings */ |
|---|
| 173 | ); |
|---|
| 174 | |
|---|
| 175 | /*************************************************************************** |
|---|
| 176 | Summary: |
|---|
| 177 | Set settings for an I2S input |
|---|
| 178 | ***************************************************************************/ |
|---|
| 179 | NEXUS_Error NEXUS_I2sInput_SetSettings( |
|---|
| 180 | NEXUS_I2sInputHandle handle, |
|---|
| 181 | const NEXUS_I2sInputSettings *pSettings /* [in] Settings */ |
|---|
| 182 | ); |
|---|
| 183 | |
|---|
| 184 | /*************************************************************************** |
|---|
| 185 | Summary: |
|---|
| 186 | Start capturing data from an I2S Input |
|---|
| 187 | ***************************************************************************/ |
|---|
| 188 | NEXUS_Error NEXUS_I2sInput_Start( |
|---|
| 189 | NEXUS_I2sInputHandle handle |
|---|
| 190 | ); |
|---|
| 191 | |
|---|
| 192 | /*************************************************************************** |
|---|
| 193 | Summary: |
|---|
| 194 | Stop capturing data from an I2S Input |
|---|
| 195 | ***************************************************************************/ |
|---|
| 196 | void NEXUS_I2sInput_Stop( |
|---|
| 197 | NEXUS_I2sInputHandle handle |
|---|
| 198 | ); |
|---|
| 199 | |
|---|
| 200 | /*************************************************************************** |
|---|
| 201 | Summary: |
|---|
| 202 | Get an audio connector for use with downstream components |
|---|
| 203 | **************************************************************************/ |
|---|
| 204 | NEXUS_AudioInput NEXUS_I2sInput_GetConnector( |
|---|
| 205 | NEXUS_I2sInputHandle handle |
|---|
| 206 | ); |
|---|
| 207 | |
|---|
| 208 | #ifdef __cplusplus |
|---|
| 209 | } |
|---|
| 210 | #endif |
|---|
| 211 | |
|---|
| 212 | #endif /* #ifndef NEXUS_I2S_INPUT_H__ */ |
|---|
| 213 | |
|---|