| 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_ast.h $ |
|---|
| 39 | * $brcm_Revision: 19 $ |
|---|
| 40 | * $brcm_Date: 6/27/11 10:54a $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: Frontend AST |
|---|
| 44 | * Generic routines to control any AST satellite frontend |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /nexus/modules/frontend/common/src/nexus_frontend_ast.h $ |
|---|
| 49 | * |
|---|
| 50 | * 19 6/27/11 10:54a vishk |
|---|
| 51 | * SW7346-165: NEXUS Frontend changes for multi-tuner board are not |
|---|
| 52 | * platform independent. Add support to include both 4501 and 4506 at the |
|---|
| 53 | * same time. |
|---|
| 54 | * |
|---|
| 55 | * 18 6/23/11 7:49p vishk |
|---|
| 56 | * SW7422-272: Add nexus gpio support for 4506 tuners |
|---|
| 57 | * |
|---|
| 58 | * 17 6/23/11 3:09p vishk |
|---|
| 59 | * SW7346-165: NEXUS Frontend changes for multi-tuner board are not |
|---|
| 60 | * platform independent |
|---|
| 61 | * |
|---|
| 62 | * 16 4/28/11 9:23a randyjew |
|---|
| 63 | * SW7344-47: For 7344/7346 we should not be using TEST_NETWORK_TUNER |
|---|
| 64 | * code. |
|---|
| 65 | * |
|---|
| 66 | * 15 1/19/11 3:47p xhuang |
|---|
| 67 | * SW7358-24: Add 7358 support |
|---|
| 68 | * |
|---|
| 69 | * 14 12/8/10 9:48a jrubio |
|---|
| 70 | * SW7344-9: add G3 Support |
|---|
| 71 | * |
|---|
| 72 | * 13 9/1/10 4:11p erickson |
|---|
| 73 | * SW7325-800: add NEXUS_FrontendCapabilities.diseqc and use for internal |
|---|
| 74 | * configuration as wel |
|---|
| 75 | * |
|---|
| 76 | * 12 4/16/10 10:24a erickson |
|---|
| 77 | * SW3556-1092: added frontend master I2C (MI2c) interface for 4501/4506 |
|---|
| 78 | * |
|---|
| 79 | * 11 9/23/09 1:27p erickson |
|---|
| 80 | * SW7335-561: create FTM task callback per AST core |
|---|
| 81 | * |
|---|
| 82 | * 10 9/16/09 12:08p erickson |
|---|
| 83 | * SW7405-2980: support more variables in NEXUS_Frontend_SetDiseqcSettings |
|---|
| 84 | * on 4501/4506 |
|---|
| 85 | * |
|---|
| 86 | * 9 8/20/09 4:48p erickson |
|---|
| 87 | * PR57770: convert FTM extension into more generic customer extension |
|---|
| 88 | * |
|---|
| 89 | * 8 7/31/09 3:40p erickson |
|---|
| 90 | * PR57239: move NEXUS_Frontend_P_GetAstDevice and related functions into |
|---|
| 91 | * nexus_frontend_ast.c |
|---|
| 92 | * |
|---|
| 93 | * 7 7/30/09 3:59p jtna |
|---|
| 94 | * PR42924: remove unneeded code |
|---|
| 95 | * |
|---|
| 96 | * 6 7/21/09 9:01a erickson |
|---|
| 97 | * PR56765: add ftm state and uninit |
|---|
| 98 | * |
|---|
| 99 | * 5 6/30/09 6:54p jtna |
|---|
| 100 | * PR56368: support NEXUS_MAX_FRONTENDS < num AST channels |
|---|
| 101 | * |
|---|
| 102 | * 4 6/9/09 2:25p erickson |
|---|
| 103 | * PR55699: move NEXUS_AstDevice definition to private header file to |
|---|
| 104 | * enable AST extension |
|---|
| 105 | * |
|---|
| 106 | * 3 1/8/09 8:21p agin |
|---|
| 107 | * PR50937: Support BCM97335 V10 board. |
|---|
| 108 | * |
|---|
| 109 | * 2 5/22/08 5:55p jrubio |
|---|
| 110 | * PR42593: add multiple tuner support for 7325/7335 -external tuner does |
|---|
| 111 | * not control the diseqc |
|---|
| 112 | * |
|---|
| 113 | * 1 3/13/08 7:42p jgarrett |
|---|
| 114 | * PR 39985: Adding AST support |
|---|
| 115 | * |
|---|
| 116 | * 2 2/7/08 5:34p jgarrett |
|---|
| 117 | * PR 39407: Converting to common close functions |
|---|
| 118 | * |
|---|
| 119 | * 1 1/18/08 2:19p jgarrett |
|---|
| 120 | * PR 38808: Merging to main branch |
|---|
| 121 | * |
|---|
| 122 | * Nexus_Devel/1 10/4/07 2:41p jgarrett |
|---|
| 123 | * PR 35551: Adding initial version |
|---|
| 124 | * |
|---|
| 125 | ***************************************************************************/ |
|---|
| 126 | #ifndef NEXUS_FRONTEND_AST_H__ |
|---|
| 127 | #define NEXUS_FRONTEND_AST_H__ |
|---|
| 128 | |
|---|
| 129 | #include "nexus_frontend_module.h" |
|---|
| 130 | #include "bast.h" |
|---|
| 131 | |
|---|
| 132 | #if BCHP_CHIP==7346 |
|---|
| 133 | #include "bast_g3.h" |
|---|
| 134 | #endif |
|---|
| 135 | |
|---|
| 136 | #ifdef NEXUS_FRONTEND_73XX |
|---|
| 137 | #if BCHP_CHIP==7344 || BCHP_CHIP==7358 |
|---|
| 138 | #include "bast_g3.h" |
|---|
| 139 | #else |
|---|
| 140 | #include "bast_73xx.h" |
|---|
| 141 | #endif |
|---|
| 142 | #if BCHP_CHIP!=7344 && BCHP_CHIP!=7346 |
|---|
| 143 | #define TEST_NETWORK_TUNER 1 |
|---|
| 144 | #endif |
|---|
| 145 | #endif |
|---|
| 146 | |
|---|
| 147 | #if defined NEXUS_FRONTEND_4506 |
|---|
| 148 | #include "bast_4506.h" |
|---|
| 149 | #endif |
|---|
| 150 | #if defined NEXUS_FRONTEND_4501 |
|---|
| 151 | #include "bast_4501.h" |
|---|
| 152 | #endif |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | /* AST requires that we open all channels, but NEXUS_MAX_FRONTENDS may be |
|---|
| 156 | less than the total number of channels. This handles the mismatch */ |
|---|
| 157 | #if BCHP_CHIP==7325 |
|---|
| 158 | #define NEXUS_P_MAX_AST_CHANNELS 2 |
|---|
| 159 | #elif BCHP_CHIP==7335 |
|---|
| 160 | #define NEXUS_P_MAX_AST_CHANNELS 3 |
|---|
| 161 | #else |
|---|
| 162 | #define NEXUS_P_MAX_AST_CHANNELS NEXUS_MAX_FRONTENDS |
|---|
| 163 | #endif |
|---|
| 164 | |
|---|
| 165 | /*************************************************************************** |
|---|
| 166 | Summary: |
|---|
| 167 | AST Devices |
|---|
| 168 | ***************************************************************************/ |
|---|
| 169 | typedef struct NEXUS_FrontendAstDevices |
|---|
| 170 | { |
|---|
| 171 | NEXUS_TunerHandle tuner; /* Optional tuner -- used on 97335 and 97325 boards */ |
|---|
| 172 | } NEXUS_FrontendAstDevices; |
|---|
| 173 | |
|---|
| 174 | /*************************************************************************** |
|---|
| 175 | Summary: |
|---|
| 176 | AST Channel Settings |
|---|
| 177 | ***************************************************************************/ |
|---|
| 178 | typedef struct NEXUS_FrontendAstSettings |
|---|
| 179 | { |
|---|
| 180 | BAST_Handle astHandle; |
|---|
| 181 | BAST_ChannelHandle astChannel; |
|---|
| 182 | unsigned astChip; /* unused */ |
|---|
| 183 | NEXUS_FrontendAstDevices devices; |
|---|
| 184 | unsigned channelIndex; |
|---|
| 185 | unsigned boardRev; |
|---|
| 186 | void (*closeFunction)(NEXUS_FrontendHandle handle, void *pParam); /* Called after handle is closed */ |
|---|
| 187 | void *pCloseParam; |
|---|
| 188 | NEXUS_FrontendCapabilities capabilities; |
|---|
| 189 | } NEXUS_FrontendAstSettings; |
|---|
| 190 | |
|---|
| 191 | /*************************************************************************** |
|---|
| 192 | Summary: |
|---|
| 193 | Get Default AST Channel Settings |
|---|
| 194 | ***************************************************************************/ |
|---|
| 195 | void NEXUS_Frontend_P_Ast_GetDefaultSettings( |
|---|
| 196 | NEXUS_FrontendAstSettings *pSettings /* [out] */ |
|---|
| 197 | ); |
|---|
| 198 | |
|---|
| 199 | /*************************************************************************** |
|---|
| 200 | Summary: |
|---|
| 201 | Create an AST frontend handle |
|---|
| 202 | ***************************************************************************/ |
|---|
| 203 | NEXUS_FrontendHandle NEXUS_Frontend_P_Ast_Create( |
|---|
| 204 | const NEXUS_FrontendAstSettings *pSettings |
|---|
| 205 | ); |
|---|
| 206 | |
|---|
| 207 | /*************************************************************************** |
|---|
| 208 | Summary: |
|---|
| 209 | Set devices for an AST channel. |
|---|
| 210 | Description: |
|---|
| 211 | May be needed if devices are connected to an on-chip I2C master to |
|---|
| 212 | avoid a chicken and egg problem connecting devices. |
|---|
| 213 | ***************************************************************************/ |
|---|
| 214 | NEXUS_Error NEXUS_Frontend_P_Ast_SetDevices( |
|---|
| 215 | NEXUS_FrontendHandle handle, |
|---|
| 216 | const NEXUS_FrontendAstDevices *pDevices |
|---|
| 217 | ); |
|---|
| 218 | |
|---|
| 219 | /*************************************************************************** |
|---|
| 220 | Summary: |
|---|
| 221 | Get the AST channel handle from a frontend handle |
|---|
| 222 | ***************************************************************************/ |
|---|
| 223 | BAST_ChannelHandle NEXUS_Frontend_P_Ast_GetChannel( |
|---|
| 224 | NEXUS_FrontendHandle handle |
|---|
| 225 | ); |
|---|
| 226 | |
|---|
| 227 | /*************************************************************************** |
|---|
| 228 | Summary: |
|---|
| 229 | Internal structure for peakscan |
|---|
| 230 | ***************************************************************************/ |
|---|
| 231 | typedef struct NEXUS_SatellitePeakscanStatus { |
|---|
| 232 | unsigned symRateCount; /* consecutive scans with same symbol rate */ |
|---|
| 233 | uint32_t lastSymRate; /* symbol rate from last scan */ |
|---|
| 234 | uint32_t maxPeakPower; /* maximum of peakPower from scans with same symbol rate */ |
|---|
| 235 | uint32_t maxPeakFreq; /* tuner frequency corresponding to maxPeakPower */ |
|---|
| 236 | |
|---|
| 237 | /* for-loop book-keeping */ |
|---|
| 238 | uint32_t curFreq; |
|---|
| 239 | uint32_t endFreq; |
|---|
| 240 | uint32_t stepFreq; |
|---|
| 241 | bool singleScan; |
|---|
| 242 | |
|---|
| 243 | bool scanFinished; |
|---|
| 244 | } NEXUS_SatellitePeakscanStatus; |
|---|
| 245 | |
|---|
| 246 | BDBG_OBJECT_ID_DECLARE(NEXUS_AstDevice); |
|---|
| 247 | |
|---|
| 248 | /*************************************************************************** |
|---|
| 249 | Summary: |
|---|
| 250 | Internal structure for AST channels |
|---|
| 251 | Be aware that each NEXUS_AstDevice corresponds to one BAST_ChannelHandle, not one BAST_Handle. |
|---|
| 252 | There is a one-to-one mapping of astChannel to frontendHandle. |
|---|
| 253 | There is a one-to-many mapping of astHandle to astChannel. |
|---|
| 254 | ***************************************************************************/ |
|---|
| 255 | typedef struct NEXUS_AstDevice |
|---|
| 256 | { |
|---|
| 257 | BDBG_OBJECT(NEXUS_AstDevice) |
|---|
| 258 | |
|---|
| 259 | NEXUS_FrontendAstSettings settings; |
|---|
| 260 | |
|---|
| 261 | BAST_Handle astHandle; /* copied for each BAST_ChannelHandle */ |
|---|
| 262 | BAST_ChannelHandle astChannel; |
|---|
| 263 | NEXUS_I2cHandle deviceI2cHandle; /* For a possible master I2C controller */ |
|---|
| 264 | NEXUS_FrontendHandle frontendHandle; |
|---|
| 265 | |
|---|
| 266 | NEXUS_FrontendSatelliteSettings lastSettings; /* Last tune settings, returned in status */ |
|---|
| 267 | NEXUS_FrontendDiseqcSettings diseqcSettings; |
|---|
| 268 | |
|---|
| 269 | BKNI_EventHandle lockEvent; |
|---|
| 270 | NEXUS_EventCallbackHandle lockEventCallback; |
|---|
| 271 | NEXUS_TaskCallbackHandle lockAppCallback; |
|---|
| 272 | |
|---|
| 273 | BKNI_EventHandle diseqcEvent; |
|---|
| 274 | NEXUS_EventCallbackHandle diseqcEventCallback; |
|---|
| 275 | NEXUS_TaskCallbackHandle diseqcAppCallback; |
|---|
| 276 | |
|---|
| 277 | BKNI_EventHandle peakscanEvent; |
|---|
| 278 | NEXUS_EventCallbackHandle peakscanEventCallback; |
|---|
| 279 | NEXUS_TaskCallbackHandle peakscanAppCallback; |
|---|
| 280 | NEXUS_SatellitePeakscanStatus peakscanStatus; |
|---|
| 281 | |
|---|
| 282 | NEXUS_TaskCallbackHandle ftmCallback; /* optionally set by customer extension. must be created here because it's |
|---|
| 283 | based on a BAST_Handle event. */ |
|---|
| 284 | |
|---|
| 285 | #ifdef NEXUS_FRONTEND_CUSTOMER_EXTENSION |
|---|
| 286 | void *customerData; |
|---|
| 287 | #endif |
|---|
| 288 | |
|---|
| 289 | NEXUS_FrontendCapabilities capabilities; /* copy of capabilites for use in nexus_frontend_ast.c */ |
|---|
| 290 | unsigned astChip; |
|---|
| 291 | } NEXUS_AstDevice; |
|---|
| 292 | |
|---|
| 293 | NEXUS_AstDevice *NEXUS_Frontend_P_GetAstDevice( |
|---|
| 294 | NEXUS_FrontendHandle handle |
|---|
| 295 | ); |
|---|
| 296 | |
|---|
| 297 | #endif /* #ifndef NEXUS_FRONTEND_AST_H__ */ |
|---|
| 298 | |
|---|