| 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_ofdm.c $ |
|---|
| 39 | * $brcm_Revision: 12 $ |
|---|
| 40 | * $brcm_Date: 9/26/11 2:03p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: Frontend OFDM |
|---|
| 44 | * Generic APIs for OFDM (Orthogonal Frequency-Division Multiplexing) tuning. |
|---|
| 45 | * This is used in DVB-H and DVB-T environments. |
|---|
| 46 | * |
|---|
| 47 | * Revision History: |
|---|
| 48 | * |
|---|
| 49 | * $brcm_Log: X:/win_views/97231_SW3461_36/nexus/modules/frontend/common/src/nexus_frontend_ofdm.c $ |
|---|
| 50 | * |
|---|
| 51 | * 12 9/26/11 2:03p vishk |
|---|
| 52 | * SW3461-53: 3461 interrupt line 'stuck low' after multiple tune events. |
|---|
| 53 | * Merge to mainline. |
|---|
| 54 | * |
|---|
| 55 | * 11 9/7/11 6:10p vishk |
|---|
| 56 | * SW3461-36: add DVB T2 status API. Merge to the mainline. |
|---|
| 57 | * |
|---|
| 58 | * 10 9/7/11 6:01p vishk |
|---|
| 59 | * SW3461-36: add DVB T2 status API. Fix compilation error. |
|---|
| 60 | * |
|---|
| 61 | * SW3461-36/2 9/7/11 5:41p vishk |
|---|
| 62 | * SW3461-36: add DVB T2 status API. |
|---|
| 63 | * |
|---|
| 64 | * SW3461-36/1 8/18/11 4:38p vishk |
|---|
| 65 | * SW3461-36: SW3461-27: SW3461-28: SW3461-26: SW3461-24: SW3461-25: |
|---|
| 66 | * SW3461-18: Expose DVBT and DVBT2 status. |
|---|
| 67 | * |
|---|
| 68 | * 9 6/6/11 2:47p vishk |
|---|
| 69 | * SW7231-32: Implement the Nexus code to support the 3461 frontend chip. |
|---|
| 70 | * Set the right defaults. |
|---|
| 71 | * |
|---|
| 72 | * 8 5/24/11 7:07p vishk |
|---|
| 73 | * SW7231-32: Implement the Nexus code to support the 3461 frontend chip |
|---|
| 74 | * |
|---|
| 75 | * 7 5/18/10 6:05p jgarrett |
|---|
| 76 | * SW7550-399: Adding option for cable/terrestrial setup in OFDM |
|---|
| 77 | * |
|---|
| 78 | * 6 12/22/09 2:06p maivu |
|---|
| 79 | * SW3556-941: Enable CCI mode by default |
|---|
| 80 | * |
|---|
| 81 | * 5 1/23/09 3:32p jgarrett |
|---|
| 82 | * PR 51457: Adding frontend extension hooks for tuners and |
|---|
| 83 | * frontends/demods |
|---|
| 84 | * |
|---|
| 85 | * 4 7/30/08 12:50p jgarrett |
|---|
| 86 | * PR 45002: Adding TPS settings |
|---|
| 87 | * |
|---|
| 88 | * 3 7/11/08 5:06p jtna |
|---|
| 89 | * PR42924: Add channel change measurements functionality |
|---|
| 90 | * |
|---|
| 91 | * 2 2/8/08 6:37p jgarrett |
|---|
| 92 | * PR 39100: Adding OFDM support |
|---|
| 93 | * |
|---|
| 94 | * 1 1/18/08 2:19p jgarrett |
|---|
| 95 | * PR 38808: Merging to main branch |
|---|
| 96 | * |
|---|
| 97 | * Nexus_Devel/1 1/10/08 2:33p jgarrett |
|---|
| 98 | * PR 38653: Initial version |
|---|
| 99 | * |
|---|
| 100 | ***************************************************************************/ |
|---|
| 101 | |
|---|
| 102 | #include "nexus_frontend_module.h" |
|---|
| 103 | |
|---|
| 104 | BDBG_MODULE(nexus_frontend_ofdm); |
|---|
| 105 | |
|---|
| 106 | BTRC_MODULE_DECLARE(ChnChange_Tune); |
|---|
| 107 | |
|---|
| 108 | /*************************************************************************** |
|---|
| 109 | Summary: |
|---|
| 110 | Initialize a OFDM settings structure to defaults |
|---|
| 111 | See Also: |
|---|
| 112 | NEXUS_Frontend_TuneOfdm |
|---|
| 113 | ***************************************************************************/ |
|---|
| 114 | void NEXUS_Frontend_GetDefaultOfdmSettings( |
|---|
| 115 | NEXUS_FrontendOfdmSettings *pSettings /* [out] */ |
|---|
| 116 | ) |
|---|
| 117 | { |
|---|
| 118 | BKNI_Memset(pSettings, 0, sizeof(NEXUS_FrontendOfdmSettings)); |
|---|
| 119 | pSettings->bandwidth = NEXUS_FrontendOfdmBandwidth_e8Mhz; |
|---|
| 120 | pSettings->pullInRange = NEXUS_FrontendOfdmPullInRange_eWide; |
|---|
| 121 | pSettings->cciMode = NEXUS_FrontendOfdmCciMode_eAuto; |
|---|
| 122 | pSettings->terrestrial = true; |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | /*************************************************************************** |
|---|
| 126 | Summary: |
|---|
| 127 | Tune to a OFDM channel |
|---|
| 128 | See Also: |
|---|
| 129 | NEXUS_Frontend_InitOfdmSettings |
|---|
| 130 | ***************************************************************************/ |
|---|
| 131 | NEXUS_Error NEXUS_Frontend_TuneOfdm( |
|---|
| 132 | NEXUS_FrontendHandle handle, |
|---|
| 133 | const NEXUS_FrontendOfdmSettings *pSettings |
|---|
| 134 | ) |
|---|
| 135 | { |
|---|
| 136 | BDBG_ASSERT(NULL != handle); |
|---|
| 137 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 138 | BTRC_TRACE(ChnChange_Tune, START); |
|---|
| 139 | if ( handle->tuneOfdm ) |
|---|
| 140 | { |
|---|
| 141 | return handle->tuneOfdm(handle->pDeviceHandle, pSettings); |
|---|
| 142 | } |
|---|
| 143 | else |
|---|
| 144 | { |
|---|
| 145 | if ( handle->pParentFrontend ) |
|---|
| 146 | { |
|---|
| 147 | return NEXUS_Frontend_TuneOfdm(handle->pParentFrontend, pSettings); |
|---|
| 148 | } |
|---|
| 149 | else |
|---|
| 150 | { |
|---|
| 151 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 152 | } |
|---|
| 153 | } |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | /*************************************************************************** |
|---|
| 157 | Summary: |
|---|
| 158 | Get the status of a OFDM tuner |
|---|
| 159 | See Also: |
|---|
| 160 | NEXUS_Frontend_TuneOfdm |
|---|
| 161 | ***************************************************************************/ |
|---|
| 162 | NEXUS_Error NEXUS_Frontend_GetOfdmStatus( |
|---|
| 163 | NEXUS_FrontendHandle handle, |
|---|
| 164 | NEXUS_FrontendOfdmStatus *pStatus /* [out] */ |
|---|
| 165 | ) |
|---|
| 166 | { |
|---|
| 167 | BSTD_UNUSED(handle); |
|---|
| 168 | BSTD_UNUSED(pStatus); |
|---|
| 169 | if ( handle->getOfdmStatus ) |
|---|
| 170 | { |
|---|
| 171 | return handle->getOfdmStatus(handle->pDeviceHandle, pStatus); |
|---|
| 172 | } |
|---|
| 173 | else |
|---|
| 174 | { |
|---|
| 175 | if ( handle->pParentFrontend ) |
|---|
| 176 | { |
|---|
| 177 | return NEXUS_Frontend_GetOfdmStatus(handle->pParentFrontend, pStatus); |
|---|
| 178 | } |
|---|
| 179 | else |
|---|
| 180 | { |
|---|
| 181 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 182 | } |
|---|
| 183 | } |
|---|
| 184 | } |
|---|
| 185 | |
|---|
| 186 | /*************************************************************************** |
|---|
| 187 | Summary: |
|---|
| 188 | Get the status asynchronously of a Ofdm tuner |
|---|
| 189 | See Also: |
|---|
| 190 | NEXUS_Frontend_TuneOfdm |
|---|
| 191 | NEXUS_Frontend_RequestOfdmStatus |
|---|
| 192 | ***************************************************************************/ |
|---|
| 193 | NEXUS_Error NEXUS_Frontend_GetOfdmAsyncStatus( |
|---|
| 194 | NEXUS_FrontendHandle handle, |
|---|
| 195 | NEXUS_FrontendOfdmStatus *pStatus /* [out] */ |
|---|
| 196 | ) |
|---|
| 197 | { |
|---|
| 198 | BDBG_ASSERT(NULL != handle); |
|---|
| 199 | BDBG_ASSERT(NULL != pStatus); |
|---|
| 200 | |
|---|
| 201 | if ( NULL == handle->getOfdmAsyncStatus ) |
|---|
| 202 | { |
|---|
| 203 | if ( handle->pParentFrontend ) |
|---|
| 204 | { |
|---|
| 205 | return NEXUS_Frontend_GetOfdmAsyncStatus(handle->pParentFrontend, pStatus); |
|---|
| 206 | } |
|---|
| 207 | else |
|---|
| 208 | { |
|---|
| 209 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 210 | } |
|---|
| 211 | } |
|---|
| 212 | else |
|---|
| 213 | { |
|---|
| 214 | return handle->getOfdmAsyncStatus(handle->pDeviceHandle, pStatus); |
|---|
| 215 | } |
|---|
| 216 | } |
|---|
| 217 | |
|---|
| 218 | /*************************************************************************** |
|---|
| 219 | Summary: |
|---|
| 220 | Request the status asynchronously of a Ofdm tuner |
|---|
| 221 | See Also: |
|---|
| 222 | NEXUS_Frontend_GetOfdmAsyncStatus |
|---|
| 223 | ***************************************************************************/ |
|---|
| 224 | NEXUS_Error NEXUS_Frontend_RequestOfdmAsyncStatus( |
|---|
| 225 | NEXUS_FrontendHandle handle |
|---|
| 226 | ) |
|---|
| 227 | { |
|---|
| 228 | BDBG_ASSERT(NULL != handle); |
|---|
| 229 | |
|---|
| 230 | if ( NULL == handle->requestOfdmAsyncStatus ) |
|---|
| 231 | { |
|---|
| 232 | if ( handle->pParentFrontend ) |
|---|
| 233 | { |
|---|
| 234 | return NEXUS_Frontend_RequestOfdmAsyncStatus(handle->pParentFrontend); |
|---|
| 235 | } |
|---|
| 236 | else |
|---|
| 237 | { |
|---|
| 238 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 239 | } |
|---|
| 240 | } |
|---|
| 241 | else |
|---|
| 242 | { |
|---|
| 243 | return handle->requestOfdmAsyncStatus(handle->pDeviceHandle); |
|---|
| 244 | } |
|---|
| 245 | } |
|---|
| 246 | |
|---|
| 247 | |
|---|