| 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_frontend_analog.h $ |
|---|
| 39 | * $brcm_Revision: 11 $ |
|---|
| 40 | * $brcm_Date: 2/3/11 12:28p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: Frontend Analog |
|---|
| 44 | * Generic APIs for Analog tuning. |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /nexus/modules/frontend/common/include/nexus_frontend_analog.h $ |
|---|
| 49 | * |
|---|
| 50 | * 11 2/3/11 12:28p jhaberf |
|---|
| 51 | * SW35230-2732: Merge of changes from SW35230-2372 branch |
|---|
| 52 | * |
|---|
| 53 | * SW35230-2372/1 2/2/11 7:28p shyi |
|---|
| 54 | * SW35230-2372: Added RF input power report |
|---|
| 55 | * |
|---|
| 56 | * 10 12/12/08 2:33p jgarrett |
|---|
| 57 | * PR 50038: Adding AGC delay setting |
|---|
| 58 | * |
|---|
| 59 | * 9 12/12/08 2:21p jgarrett |
|---|
| 60 | * PR 50326: Adding IFD audio and video standard to status |
|---|
| 61 | * |
|---|
| 62 | * 8 7/31/08 11:04a jrubio |
|---|
| 63 | * PR44999: fix comma at end of list |
|---|
| 64 | * |
|---|
| 65 | * 7 7/30/08 6:37p jgarrett |
|---|
| 66 | * PR 44999: PR 45170: Adding NICAM and AV Ratio information |
|---|
| 67 | * |
|---|
| 68 | * 6 3/27/08 11:33a jgarrett |
|---|
| 69 | * PR 40111: Adding fixed IF agc when frozen |
|---|
| 70 | * |
|---|
| 71 | * 5 3/14/08 1:31p jgarrett |
|---|
| 72 | * PR 40111: Adding Analog AGC Settings |
|---|
| 73 | * |
|---|
| 74 | * 4 2/12/08 2:33p jgarrett |
|---|
| 75 | * PR 39009: Unifying status |
|---|
| 76 | * |
|---|
| 77 | * 3 1/23/08 8:37p vobadm |
|---|
| 78 | * PR35457: update docs |
|---|
| 79 | * |
|---|
| 80 | * 2 1/23/08 5:16p erickson |
|---|
| 81 | * PR35457: update docs |
|---|
| 82 | * |
|---|
| 83 | * 1 1/18/08 2:19p jgarrett |
|---|
| 84 | * PR 38808: Merging to main branch |
|---|
| 85 | * |
|---|
| 86 | * Nexus_Devel/2 12/20/07 2:30p jgarrett |
|---|
| 87 | * PR 38019: Adding status and audio connector |
|---|
| 88 | * |
|---|
| 89 | * Nexus_Devel/1 10/4/07 2:41p jgarrett |
|---|
| 90 | * PR 35551: Adding initial version |
|---|
| 91 | * |
|---|
| 92 | ***************************************************************************/ |
|---|
| 93 | #include "nexus_ifd.h" |
|---|
| 94 | |
|---|
| 95 | #ifndef NEXUS_FRONTEND_ANALOG_H__ |
|---|
| 96 | #define NEXUS_FRONTEND_ANALOG_H__ |
|---|
| 97 | |
|---|
| 98 | #ifdef __cplusplus |
|---|
| 99 | extern "C" { |
|---|
| 100 | #endif |
|---|
| 101 | |
|---|
| 102 | /*************************************************************************** |
|---|
| 103 | Summary: |
|---|
| 104 | Analog Tuning Parameters |
|---|
| 105 | ***************************************************************************/ |
|---|
| 106 | typedef struct NEXUS_FrontendAnalogSettings |
|---|
| 107 | { |
|---|
| 108 | unsigned frequency; /* Analog Frequency, in Hz */ |
|---|
| 109 | |
|---|
| 110 | bool fastAcquisition; /* true = fast acquisition mode, false = default */ |
|---|
| 111 | bool terrestrial; /* Receiver mode: true=terrestrial, false=cable */ |
|---|
| 112 | |
|---|
| 113 | NEXUS_IfdSettings ifdSettings; /* IFD settings -- Requires an onboard IFD or one bound to this frontend */ |
|---|
| 114 | } NEXUS_FrontendAnalogSettings; |
|---|
| 115 | |
|---|
| 116 | /*************************************************************************** |
|---|
| 117 | Summary: |
|---|
| 118 | Initialize an analog settings structure to defaults |
|---|
| 119 | ***************************************************************************/ |
|---|
| 120 | void NEXUS_Frontend_GetDefaultAnalogSettings( |
|---|
| 121 | NEXUS_FrontendAnalogSettings *pSettings |
|---|
| 122 | ); |
|---|
| 123 | |
|---|
| 124 | /*************************************************************************** |
|---|
| 125 | Summary: |
|---|
| 126 | Tune a frontend to an analog channel |
|---|
| 127 | ***************************************************************************/ |
|---|
| 128 | NEXUS_Error NEXUS_Frontend_TuneAnalog( |
|---|
| 129 | NEXUS_FrontendHandle handle, |
|---|
| 130 | const NEXUS_FrontendAnalogSettings *pSettings |
|---|
| 131 | ); |
|---|
| 132 | |
|---|
| 133 | /*********************************************************************** |
|---|
| 134 | Summary: |
|---|
| 135 | RF Audio NICAM encoder mode |
|---|
| 136 | ***********************************************************************/ |
|---|
| 137 | typedef enum NEXUS_FrontendNicamEncoding |
|---|
| 138 | { |
|---|
| 139 | NEXUS_FrontendNicamEncoding_eUnknown, |
|---|
| 140 | NEXUS_FrontendNicamEncoding_eStereo_BackupFm, |
|---|
| 141 | NEXUS_FrontendNicamEncoding_eDualMono_BackupFm, |
|---|
| 142 | NEXUS_FrontendNicamEncoding_eStereo_NoBackup, |
|---|
| 143 | NEXUS_FrontendNicamEncoding_eDualMono_NoBackup, |
|---|
| 144 | NEXUS_FrontendNicamEncoding_eMonoData_BackupFm, |
|---|
| 145 | NEXUS_FrontendNicamEncoding_eMonoData_NoBackup, |
|---|
| 146 | NEXUS_FrontendNicamEncoding_eData_BackupFm, |
|---|
| 147 | NEXUS_FrontendNicamEncoding_eData_NoBackup, |
|---|
| 148 | NEXUS_FrontendNicamEncoding_eMax |
|---|
| 149 | } NEXUS_FrontendNicamEncoding; |
|---|
| 150 | |
|---|
| 151 | /*************************************************************************** |
|---|
| 152 | Summary: |
|---|
| 153 | Analog Tuning Status Values -- Only valid if an IFD is integrated with |
|---|
| 154 | or bound to this frontend |
|---|
| 155 | ***************************************************************************/ |
|---|
| 156 | typedef struct NEXUS_FrontendAnalogStatus |
|---|
| 157 | { |
|---|
| 158 | NEXUS_FrontendAnalogSettings settings; /* Settings provided at last call to NEXUS_Frontend_TuneAnalog */ |
|---|
| 159 | |
|---|
| 160 | bool locked; /* lock=true, unlocked=false */ |
|---|
| 161 | int carrierOffset; /* Carrier Frequency Offset, in Hertz */ |
|---|
| 162 | int rfAgcLevel; /* RF AGC level, in 1/10 percent of reference voltage. if 3.3v, 333 is 1.1v */ |
|---|
| 163 | int ifAgcLevel; /* IF AGC level, in 1/10 percent of reference voltage. if 3.3v, 333 is 1.1v */ |
|---|
| 164 | int rfInputPower; /* in units of 1/10 dBuV of the desired signal, supported by not all platforms */ |
|---|
| 165 | bool sapDetected; /* true if SAP is detected */ |
|---|
| 166 | bool stereoDetected;/* true if stereo is detected */ |
|---|
| 167 | bool nicamLocked; /* true if NICAM is detected and locked */ |
|---|
| 168 | NEXUS_FrontendNicamEncoding nicamEncoding; /* NICAM encoder mode */ |
|---|
| 169 | uint32_t nicamParityError; /* Number of parity errors in the current frame */ |
|---|
| 170 | uint32_t nicamErrorCount; /* Number of bit errors in the last 128 frames */ |
|---|
| 171 | uint64_t avRatio1; /* AV Ratio for primary audio carrier in linear units */ |
|---|
| 172 | uint64_t avRatio2; /* AV Ratio for primary audio carrier in linear units */ |
|---|
| 173 | NEXUS_VideoFormat ifdVideoFormat; /* Current IFD video format. */ |
|---|
| 174 | NEXUS_IfdAudioMode ifdAudioMode; /* Current IFD audio mode. */ |
|---|
| 175 | } NEXUS_FrontendAnalogStatus; |
|---|
| 176 | |
|---|
| 177 | /*************************************************************************** |
|---|
| 178 | Summary: |
|---|
| 179 | Get the analog status of a frontend |
|---|
| 180 | ***************************************************************************/ |
|---|
| 181 | NEXUS_Error NEXUS_Frontend_GetAnalogStatus( |
|---|
| 182 | NEXUS_FrontendHandle handle, |
|---|
| 183 | NEXUS_FrontendAnalogStatus *pStatus /* [out] */ |
|---|
| 184 | ); |
|---|
| 185 | |
|---|
| 186 | /*************************************************************************** |
|---|
| 187 | Summary: |
|---|
| 188 | Get the analog video connector from a frontend |
|---|
| 189 | |
|---|
| 190 | Description: |
|---|
| 191 | This function is valid only for internal IF demodulators, and allows |
|---|
| 192 | the decoded video output to be routed directly to the VDEC. |
|---|
| 193 | This routine will return NULL if no direct connection exists between |
|---|
| 194 | the IFD and the audio hardware, in which case an external connection |
|---|
| 195 | such as Ccir656Input will be needed. |
|---|
| 196 | See Also: |
|---|
| 197 | NEXUS_AudioInput_Shutdown |
|---|
| 198 | ***************************************************************************/ |
|---|
| 199 | NEXUS_VideoInput NEXUS_Frontend_GetAnalogVideoConnector( |
|---|
| 200 | NEXUS_FrontendHandle handle |
|---|
| 201 | ); |
|---|
| 202 | |
|---|
| 203 | /*************************************************************************** |
|---|
| 204 | Summary: |
|---|
| 205 | Get the analog audio connector from a frontend |
|---|
| 206 | |
|---|
| 207 | Description: |
|---|
| 208 | This function is valid only for internal IF demodulators, and allows |
|---|
| 209 | the decoded audio output to be routed directly to the audio module. |
|---|
| 210 | This routine will return NULL if no direct connection exists between |
|---|
| 211 | the IFD and the audio hardware, in which case an external connection |
|---|
| 212 | such as I2sInput will be needed. |
|---|
| 213 | See Also: |
|---|
| 214 | NEXUS_AudioInput_Shutdown |
|---|
| 215 | ***************************************************************************/ |
|---|
| 216 | NEXUS_AudioInput NEXUS_Frontend_GetAnalogAudioConnector( |
|---|
| 217 | NEXUS_FrontendHandle handle |
|---|
| 218 | ); |
|---|
| 219 | |
|---|
| 220 | /*************************************************************************** |
|---|
| 221 | Summary: |
|---|
| 222 | Analog AGC Settings |
|---|
| 223 | ***************************************************************************/ |
|---|
| 224 | typedef struct NEXUS_FrontendAnalogAgcSettings |
|---|
| 225 | { |
|---|
| 226 | uint16_t top; /* tuner TOP point */ |
|---|
| 227 | uint8_t rfBandwidth; /* RF AGC band width */ |
|---|
| 228 | uint8_t ifBandwidth; /* IF AGC band width */ |
|---|
| 229 | uint8_t delay; /* Delay in ms that the acquisition script will wait for the AGC hardware to settle */ |
|---|
| 230 | |
|---|
| 231 | bool agcFreeze; /* If true, the AGC will be frozen. */ |
|---|
| 232 | uint16_t ifAgcValue; /* The IF AGC value used when frozen. */ |
|---|
| 233 | } NEXUS_FrontendAnalogAgcSettings; |
|---|
| 234 | |
|---|
| 235 | /*************************************************************************** |
|---|
| 236 | Summary: |
|---|
| 237 | Get Analog AGC Settings |
|---|
| 238 | ***************************************************************************/ |
|---|
| 239 | void NEXUS_Frontend_GetAnalogAgcSettings( |
|---|
| 240 | NEXUS_FrontendHandle handle, |
|---|
| 241 | NEXUS_FrontendAnalogAgcSettings *pSettings /* [out] */ |
|---|
| 242 | ); |
|---|
| 243 | |
|---|
| 244 | /*************************************************************************** |
|---|
| 245 | Summary: |
|---|
| 246 | Set Analog AGC Settings |
|---|
| 247 | ***************************************************************************/ |
|---|
| 248 | NEXUS_Error NEXUS_Frontend_SetAnalogAgcSettings( |
|---|
| 249 | NEXUS_FrontendHandle handle, |
|---|
| 250 | const NEXUS_FrontendAnalogAgcSettings *pSettings |
|---|
| 251 | ); |
|---|
| 252 | |
|---|
| 253 | #ifdef __cplusplus |
|---|
| 254 | } |
|---|
| 255 | #endif |
|---|
| 256 | |
|---|
| 257 | #endif /* #ifndef NEXUS_FRONTEND_ANALOG_H__ */ |
|---|
| 258 | |
|---|