| 1 | /************************************************************************* |
|---|
| 2 | * (c)2005-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 | * $brcm_Workfile: btnr_3x7x.c $ |
|---|
| 15 | * $brcm_Revision: 30 $ |
|---|
| 16 | * $brcm_Date: 5/20/11 6:41a $ |
|---|
| 17 | * |
|---|
| 18 | * [File Description:] |
|---|
| 19 | * |
|---|
| 20 | * Revision History: |
|---|
| 21 | * |
|---|
| 22 | * $brcm_Log: /magnum/portinginterface/tnr/7552/btnr_3x7x.c $ |
|---|
| 23 | * |
|---|
| 24 | ***************************************************************************/ |
|---|
| 25 | #include "bstd.h" |
|---|
| 26 | #include "bkni.h" |
|---|
| 27 | #include "btnr.h" |
|---|
| 28 | #include "bdbg.h" |
|---|
| 29 | #include "bmem.h" |
|---|
| 30 | #include "btnr_priv.h" |
|---|
| 31 | #include "btmr.h" |
|---|
| 32 | #include "btnr_3x7x.h" |
|---|
| 33 | #include "btnr_3x7x_priv.h" |
|---|
| 34 | #include "bchp_ufe.h" |
|---|
| 35 | #include "bchp_ufe_afe.h" |
|---|
| 36 | #include "bchp_sdadc.h" |
|---|
| 37 | #include "bchp_ufe_misc2.h" |
|---|
| 38 | #include "btnr_tune.h" |
|---|
| 39 | #include "btnr_struct.h" |
|---|
| 40 | #include "btnr_callback.h" |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | BDBG_MODULE(btnr_3x7x); |
|---|
| 44 | |
|---|
| 45 | #define DEV_MAGIC_ID ((BERR_TNR_ID<<16) | 0xFACE) |
|---|
| 46 | |
|---|
| 47 | /****************************************************************************** |
|---|
| 48 | * BTNR_3x7x_Open() |
|---|
| 49 | ******************************************************************************/ |
|---|
| 50 | BERR_Code BTNR_3x7x_Open( |
|---|
| 51 | BTNR_Handle *phDev, /* [output] Returns handle */ |
|---|
| 52 | BTNR_3x7x_Settings *pSettings, /* [Input] settings structure */ |
|---|
| 53 | BREG_Handle hRegister |
|---|
| 54 | ) |
|---|
| 55 | { |
|---|
| 56 | BERR_Code retCode = BERR_SUCCESS; |
|---|
| 57 | BTNR_3x7x_Handle h3x7xDev; |
|---|
| 58 | BTMR_Settings sTimerSettings; |
|---|
| 59 | BTNR_Handle hDev; |
|---|
| 60 | uint32_t BufSrc; |
|---|
| 61 | |
|---|
| 62 | BDBG_ENTER(BTNR_3x7x_Open); |
|---|
| 63 | BSTD_UNUSED( pSettings ); |
|---|
| 64 | |
|---|
| 65 | BDBG_MSG(("BTNR_3x7x_Open")); |
|---|
| 66 | |
|---|
| 67 | hDev = NULL; |
|---|
| 68 | /* Alloc memory from the system heap */ |
|---|
| 69 | h3x7xDev = (BTNR_3x7x_Handle) BKNI_Malloc( sizeof( BTNR_P_3x7x_Handle ) ); |
|---|
| 70 | if( h3x7xDev == NULL ) |
|---|
| 71 | { |
|---|
| 72 | retCode = BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY); |
|---|
| 73 | BDBG_ERR(("BTNR_3x7x_Open: BKNI_malloc() failed\n")); |
|---|
| 74 | goto done; |
|---|
| 75 | } |
|---|
| 76 | BKNI_Memset( h3x7xDev, 0x00, sizeof( BTNR_P_3x7x_Handle ) ); |
|---|
| 77 | |
|---|
| 78 | hDev = (BTNR_Handle) BKNI_Malloc( sizeof( BTNR_P_Handle ) ); |
|---|
| 79 | if( hDev == NULL ) |
|---|
| 80 | { |
|---|
| 81 | retCode = BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY); |
|---|
| 82 | BDBG_ERR(("BTNR_3x7x_Open: BKNI_malloc() failed\n")); |
|---|
| 83 | BKNI_Free( h3x7xDev ); |
|---|
| 84 | goto done; |
|---|
| 85 | } |
|---|
| 86 | BKNI_Memset( hDev, 0x00, sizeof( BTNR_P_Handle ) ); |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | h3x7xDev->pTunerParams = (BTNR_3x7x_TuneParams_t *)BMEM_AllocAligned(pSettings->hHeap, sizeof(BTNR_3x7x_TuneParams_t), 0, 0 ); |
|---|
| 90 | if (! h3x7xDev->pTunerParams ) |
|---|
| 91 | { |
|---|
| 92 | BDBG_ERR(("BTNR_Open: BKNI_malloc() failed")); |
|---|
| 93 | goto done; |
|---|
| 94 | } |
|---|
| 95 | BMEM_ConvertAddressToOffset(pSettings->hHeap, h3x7xDev->pTunerParams, &BufSrc ); |
|---|
| 96 | BKNI_Memset( h3x7xDev->pTunerParams, 0x00, sizeof( BTNR_3x7x_TuneParams_t ) ); |
|---|
| 97 | h3x7xDev->pTunerParams->BTNR_Local_Params.TunerBBSaddress = BufSrc; |
|---|
| 98 | h3x7xDev->pTunerParams->BTNR_Local_Params.TunerApplication = 0xf; |
|---|
| 99 | h3x7xDev->pTunerParams->BTNR_Local_Params.RfInputMode = 0xf; |
|---|
| 100 | h3x7xDev->pTunerStatus = (BTNR_3x7x_TuneStatus_t *)BMEM_AllocAligned(pSettings->hHeap, sizeof(BTNR_3x7x_TuneStatus_t), 0, 0 ); |
|---|
| 101 | if (! h3x7xDev->pTunerStatus ) |
|---|
| 102 | { |
|---|
| 103 | BDBG_ERR(("BTNR_Open: BKNI_malloc() failed")); |
|---|
| 104 | goto done; |
|---|
| 105 | } |
|---|
| 106 | BKNI_Memset( h3x7xDev->pTunerStatus, 0x00, sizeof( BTNR_3x7x_TuneStatus_t ) ); |
|---|
| 107 | BMEM_ConvertAddressToOffset(pSettings->hHeap, h3x7xDev->pTunerStatus , &BufSrc ); |
|---|
| 108 | h3x7xDev->pTunerParams->BTNR_BBS_Params.StartSturctureAddress = BufSrc; |
|---|
| 109 | h3x7xDev->magicId = DEV_MAGIC_ID; |
|---|
| 110 | h3x7xDev->hHeap = pSettings->hHeap; |
|---|
| 111 | h3x7xDev->hRegister = hRegister; |
|---|
| 112 | |
|---|
| 113 | #if BCHP_TNR_CORE_V_1_1 |
|---|
| 114 | h3x7xDev->pTunerParams->BTNR_Local_Params.RevId = BCHP_VER_B0; |
|---|
| 115 | #endif |
|---|
| 116 | |
|---|
| 117 | hDev->hDevImpl = (void *) h3x7xDev; |
|---|
| 118 | hDev->magicId = DEV_MAGIC_ID; |
|---|
| 119 | hDev->pSetRfFreq = (BTNR_SetRfFreqFunc) BTNR_3x7x_SetRfFreq; |
|---|
| 120 | hDev->pGetRfFreq = (BTNR_GetRfFreqFunc) BTNR_3x7x_GetRfFreq; |
|---|
| 121 | hDev->pGetAgcRegVal = (BTNR_GetAgcRegValFunc) NULL; |
|---|
| 122 | hDev->pSetAgcRegVal = (BTNR_SetAgcRegValFunc) NULL; |
|---|
| 123 | hDev->pGetInfo = (BTNR_GetInfoFunc) BTNR_3x7x_GetInfo; |
|---|
| 124 | hDev->pClose = (BTNR_CloseFunc) BTNR_3x7x_Close; |
|---|
| 125 | hDev->pGetPowerSaver = (BTNR_GetPowerSaverFunc) BTNR_3x7x_GetPowerSaver; |
|---|
| 126 | hDev->pSetPowerSaver = (BTNR_SetPowerSaverFunc) BTNR_3x7x_SetPowerSaver; |
|---|
| 127 | hDev->pGetSettings = (BTNR_GetSettingsFunc) BTNR_3x7x_GetSettings; |
|---|
| 128 | hDev->pSetSettings = (BTNR_SetSettingsFunc) BTNR_3x7x_SetSettings; |
|---|
| 129 | |
|---|
| 130 | BKNI_CreateEvent(&(h3x7xDev->hInterruptEvent)); |
|---|
| 131 | |
|---|
| 132 | /* Create timer for status lock check */ |
|---|
| 133 | BTMR_GetDefaultTimerSettings(&sTimerSettings); |
|---|
| 134 | sTimerSettings.type = BTMR_Type_ePeriodic; |
|---|
| 135 | sTimerSettings.cb_isr = (BTMR_CallbackFunc)BTNR_3x7x_P_TimerFunc; |
|---|
| 136 | sTimerSettings.pParm1 = (void*)hDev; |
|---|
| 137 | sTimerSettings.parm2 = 0; |
|---|
| 138 | sTimerSettings.exclusive = false; |
|---|
| 139 | |
|---|
| 140 | retCode = BTMR_CreateTimer (pSettings->hTmr, &h3x7xDev->hTimer, &sTimerSettings); |
|---|
| 141 | if ( retCode != BERR_SUCCESS ) |
|---|
| 142 | { |
|---|
| 143 | BDBG_ERR(("BTHD_Open: Create Timer Failed")); |
|---|
| 144 | retCode = BERR_TRACE(retCode); |
|---|
| 145 | goto done; |
|---|
| 146 | } |
|---|
| 147 | #if 0 |
|---|
| 148 | BREG_Write32(h3x7xDev->hRegister, BCHP_SUN_TOP_CTRL_SW_INIT_1_SET, 0x00000080); |
|---|
| 149 | BREG_Write32(h3x7xDev->hRegister, BCHP_SUN_TOP_CTRL_SW_INIT_1_CLEAR, 0x00000080); |
|---|
| 150 | |
|---|
| 151 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_PWRUP_01, i_pwrup_BIAS, 1); |
|---|
| 152 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_PWRUP_01, i_pwrup_SDADC_REG1p0, 0x1); |
|---|
| 153 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_PWRUP_02, PHY_PLL_master_PWRUP, 0x1); |
|---|
| 154 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_PWRUP_02, i_pwrup_PHYPLL_ch, 0x20); |
|---|
| 155 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_RESET_01, PHYPLL_dreset, 0x0); |
|---|
| 156 | BREG_Write32(hRegister, BCHP_UFE_MISC2_CLK_RESET, 0x0); |
|---|
| 157 | BREG_Write32(hRegister, BCHP_SDADC_CTRL_PWRUP, 0x3); |
|---|
| 158 | BREG_Write32(hRegister, BCHP_SDADC_CTRL_RESET, 0x0); |
|---|
| 159 | |
|---|
| 160 | |
|---|
| 161 | /* power down the UFE reg */ |
|---|
| 162 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_PWRUP_01, i_pwrup_SDADC_REG1p0, 0x0); |
|---|
| 163 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_PWRUP_02, PHY_PLL_master_PWRUP, 0x0); |
|---|
| 164 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_PWRUP_02, i_pwrup_PHYPLL_ch, 0x0); |
|---|
| 165 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_RESET_01, PHYPLL_dreset, 0x01); |
|---|
| 166 | BREG_Write32(hRegister, BCHP_UFE_MISC2_CLK_RESET, 0x7); |
|---|
| 167 | BREG_Write32(hRegister, BCHP_SDADC_CTRL_PWRUP, 0x0); |
|---|
| 168 | BREG_Write32(hRegister, BCHP_SDADC_CTRL_RESET, 0x3); |
|---|
| 169 | BREG_WriteField(h3x7xDev->hRegister, UFE_AFE_TNR0_PWRUP_01, i_pwrup_BIAS, 0x0); |
|---|
| 170 | #endif |
|---|
| 171 | |
|---|
| 172 | h3x7xDev->pTunerStatus->PowerStatus = BTNR_ePower_Off; |
|---|
| 173 | done: |
|---|
| 174 | *phDev = hDev; |
|---|
| 175 | BDBG_LEAVE(BTNR_3x7x_Open); |
|---|
| 176 | return( retCode ); |
|---|
| 177 | } |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | /****************************************************************************** |
|---|
| 181 | * BTNR_3x7x_GetDefaultSettings |
|---|
| 182 | ******************************************************************************/ |
|---|
| 183 | BERR_Code BTNR_3x7x_GetDefaultSettings( |
|---|
| 184 | BTNR_3x7x_Settings *pDefSettings /* [out] Returns default setting */ |
|---|
| 185 | ) |
|---|
| 186 | { |
|---|
| 187 | BDBG_ASSERT(NULL != pDefSettings); |
|---|
| 188 | return BERR_SUCCESS; |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | /****************************************************************************** |
|---|
| 193 | BTNR_3x7x_P_TimerFunc() |
|---|
| 194 | ******************************************************************************/ |
|---|
| 195 | BERR_Code BTNR_3x7x_P_TimerFunc(void *myParam1, int myParam2) |
|---|
| 196 | { |
|---|
| 197 | BTNR_Handle hDev = (BTNR_Handle)myParam1; |
|---|
| 198 | BTNR_P_3x7x_Handle *p3x7x = (BTNR_P_3x7x_Handle *)(hDev->hDevImpl); |
|---|
| 199 | BSTD_UNUSED(myParam2); |
|---|
| 200 | BKNI_SetEvent(p3x7x->hInterruptEvent); |
|---|
| 201 | return BERR_SUCCESS; |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | /****************************************************************************** |
|---|
| 205 | BTNR_3x7x_GetInterruptEventHandle() |
|---|
| 206 | ******************************************************************************/ |
|---|
| 207 | BERR_Code BTNR_3x7x_GetInterruptEventHandle(BTNR_Handle h, BKNI_EventHandle* hEvent) |
|---|
| 208 | { |
|---|
| 209 | *hEvent = ((BTNR_P_3x7x_Handle *)(h->hDevImpl))->hInterruptEvent; |
|---|
| 210 | return BERR_SUCCESS; |
|---|
| 211 | } |
|---|
| 212 | |
|---|
| 213 | /****************************************************************************** |
|---|
| 214 | BTNR_3x7x_ProcessInterruptEvent() |
|---|
| 215 | ******************************************************************************/ |
|---|
| 216 | BERR_Code BTNR_3x7x_ProcessInterruptEvent(BTNR_Handle hTnrDev) |
|---|
| 217 | { |
|---|
| 218 | BTNR_Settings pInitSettings; |
|---|
| 219 | uint32_t RF_Freq; |
|---|
| 220 | BTNR_P_3x7x_Handle *hDev = (BTNR_P_3x7x_Handle *)(hTnrDev->hDevImpl); |
|---|
| 221 | |
|---|
| 222 | if (hDev->pTunerStatus->PowerStatus != BTNR_ePower_On) |
|---|
| 223 | { |
|---|
| 224 | BDBG_MSG(("BTNR_3x7x_ProcessInterruptEvent: power is still off ")); |
|---|
| 225 | return BERR_NOT_INITIALIZED; |
|---|
| 226 | } |
|---|
| 227 | |
|---|
| 228 | BTNR_P_TunerStatus(hDev); /* to make sure tuner fileds ar up to date since they rely on status for twiking */ |
|---|
| 229 | BDBG_MSG(("BTNR_3x7x_P_TimerFunc %0x ", hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode )); |
|---|
| 230 | if (hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode & BTNR_BBSConnectMode_EnableStatus) |
|---|
| 231 | { |
|---|
| 232 | BDBG_MSG(("BTNR_3x7x_P_TimerFunc: BTNR_BBSConnectMode_EnableStatus")); |
|---|
| 233 | |
|---|
| 234 | hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode &= (~BTNR_BBSConnectMode_EnableStatus); |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | if (hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode & BTNR_BBSConnectMode_Tune) |
|---|
| 238 | { |
|---|
| 239 | hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode &= (~BTNR_BBSConnectMode_Tune); |
|---|
| 240 | BDBG_MSG(("1. BTNR_3x7x_P_TimerFunc: BTNR_BBSConnectMode_Tune %d %d %d ",hDev->pTunerParams->BTNR_BBS_Params.LPF_Bandwidth, hDev->pTunerParams->BTNR_BBS_Params.Application, hDev->pTunerParams->BTNR_BBS_Params.BTNR_RF_Input_Mode)); |
|---|
| 241 | pInitSettings.rfInputMode = hDev->pTunerParams->BTNR_BBS_Params.BTNR_RF_Input_Mode; |
|---|
| 242 | |
|---|
| 243 | switch (hDev->pTunerParams->BTNR_BBS_Params.Standard) |
|---|
| 244 | { |
|---|
| 245 | case BTNR_Standard_eDVBT: |
|---|
| 246 | pInitSettings.std = BTNR_Standard_eDvbt; |
|---|
| 247 | break; |
|---|
| 248 | case BTNR_Standard_eISDBT: |
|---|
| 249 | pInitSettings.std = BTNR_Standard_eIsdbt; |
|---|
| 250 | break; |
|---|
| 251 | case BTNR_Standard_eQAM: |
|---|
| 252 | pInitSettings.std = BTNR_Standard_eQam; |
|---|
| 253 | break; |
|---|
| 254 | case BTNR_Standard_eT2: |
|---|
| 255 | pInitSettings.std = BTNR_Standard_eDvbt2; |
|---|
| 256 | break; |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | switch (hDev->pTunerParams->BTNR_BBS_Params.LPF_Bandwidth) |
|---|
| 260 | { |
|---|
| 261 | case 1: |
|---|
| 262 | pInitSettings.bandwidth = 8000000; |
|---|
| 263 | break; |
|---|
| 264 | case 2: |
|---|
| 265 | pInitSettings.bandwidth = 7000000; |
|---|
| 266 | break; |
|---|
| 267 | case 3: |
|---|
| 268 | pInitSettings.bandwidth = 6000000; |
|---|
| 269 | break; |
|---|
| 270 | case 4: |
|---|
| 271 | pInitSettings.bandwidth = 5000000; |
|---|
| 272 | break; |
|---|
| 273 | case 5: |
|---|
| 274 | pInitSettings.bandwidth = 1700000; |
|---|
| 275 | break; |
|---|
| 276 | case 6: |
|---|
| 277 | pInitSettings.bandwidth = hDev->pTunerParams->BTNR_Acquire_Params.LPF_Variable_Bandwidth; |
|---|
| 278 | break; |
|---|
| 279 | } |
|---|
| 280 | switch (hDev->pTunerParams->BTNR_BBS_Params.Application) |
|---|
| 281 | { |
|---|
| 282 | case BTNR_TunerApplicationMode_eCable: |
|---|
| 283 | pInitSettings.tnrApplication = BTNR_TunerApplication_eCable; |
|---|
| 284 | break; |
|---|
| 285 | case BTNR_TunerApplicationMode_eTerrestrial: |
|---|
| 286 | pInitSettings.tnrApplication = BTNR_TunerApplication_eTerrestrial; |
|---|
| 287 | break; |
|---|
| 288 | } |
|---|
| 289 | BTNR_3x7x_SetSettings(hDev, &pInitSettings); |
|---|
| 290 | RF_Freq = hDev->pTunerParams->BTNR_Acquire_Params.RF_Freq ; |
|---|
| 291 | BDBG_MSG(("BTNR_3x7x_P_TimerFunc: BTNR_BBSConnectMode_Tune %d %d ", pInitSettings.bandwidth ,pInitSettings.tnrApplication)); |
|---|
| 292 | BTNR_3x7x_SetRfFreq(hDev,RF_Freq, BTNR_TunerMode_eDigital); |
|---|
| 293 | } |
|---|
| 294 | |
|---|
| 295 | if (hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode & BTNR_BBSConnectMode_RfMode) |
|---|
| 296 | { |
|---|
| 297 | hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode &= (~BTNR_BBSConnectMode_RfMode); |
|---|
| 298 | } |
|---|
| 299 | if (hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode & BTNR_BBSConnectMode_EnableLoop) |
|---|
| 300 | { |
|---|
| 301 | hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode &= (~BTNR_BBSConnectMode_EnableLoop); |
|---|
| 302 | BDBG_MSG(("BTNR_3x7x_P_TimerFunc: BTNR_BBSConnectMode_EnableLoop = %d", hDev->pTunerParams->BTNR_BBS_Params.BTNR_LoopThru_Params.LoopThru_Enable )); |
|---|
| 303 | hDev->pTunerParams->BTNR_LoopThru_Params.LoopThru_Source = hDev->pTunerParams->BTNR_BBS_Params.BTNR_LoopThru_Params.LoopThru_Source; |
|---|
| 304 | BTNR_3x7x_Set_RF_LoopThrough(hTnrDev, hDev->pTunerParams->BTNR_BBS_Params.BTNR_LoopThru_Params.LoopThru_Enable); |
|---|
| 305 | } |
|---|
| 306 | if (hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode & BTNR_BBSConnectMode_EnableDaisy) |
|---|
| 307 | { |
|---|
| 308 | hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode &= (~BTNR_BBSConnectMode_EnableDaisy); |
|---|
| 309 | BDBG_MSG(("BTNR_3x7x_P_TimerFunc: BTNR_BBSConnectMode_EnableDaisy = %d", hDev->pTunerParams->BTNR_BBS_Params.BTNR_Daisy_Params.Daisy_Enable )); |
|---|
| 310 | hDev->pTunerParams->BTNR_Daisy_Params.Daisy_Source = hDev->pTunerParams->BTNR_BBS_Params.BTNR_Daisy_Params.Daisy_Source; |
|---|
| 311 | hDev->pTunerParams->BTNR_Daisy_Params.Daisy_Enable = hDev->pTunerParams->BTNR_BBS_Params.BTNR_Daisy_Params.Daisy_Enable; |
|---|
| 312 | BTNR_P_Daisy_Control(hDev); |
|---|
| 313 | } |
|---|
| 314 | |
|---|
| 315 | if (hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode & BTNR_BBSConnectMode_EnableDPM) |
|---|
| 316 | { |
|---|
| 317 | hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode &= (~BTNR_BBSConnectMode_EnableDPM); |
|---|
| 318 | BDBG_MSG(("BTNR_3x7x_P_TimerFunc: BTNR_BBSConnectMode_EnableDPM = %d", hDev->pTunerParams->BTNR_BBS_Params.BTNR_DPM_Params.DPM_Enable)); |
|---|
| 319 | hDev->pTunerParams->BTNR_DPM_Params.DPM_Enable = hDev->pTunerParams->BTNR_BBS_Params.BTNR_DPM_Params.DPM_Enable; |
|---|
| 320 | hDev->pTunerParams->BTNR_DPM_Params.DPM_Target = hDev->pTunerParams->BTNR_BBS_Params.BTNR_DPM_Params.DPM_Target; |
|---|
| 321 | hDev->pTunerParams->BTNR_DPM_Params.DPM_Freq = hDev->pTunerParams->BTNR_BBS_Params.BTNR_DPM_Params.DPM_Freq; |
|---|
| 322 | BTNR_P_DPM_Control(hDev); |
|---|
| 323 | } |
|---|
| 324 | |
|---|
| 325 | if (hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode & BTNR_BBSConnectMode_ResetStatus) |
|---|
| 326 | { |
|---|
| 327 | BDBG_MSG(("BTNR_3x7x_P_TimerFunc: BTNR_BBSConnectMode_ResetStatus")); |
|---|
| 328 | hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode &= (~BTNR_BBSConnectMode_ResetStatus); |
|---|
| 329 | BTNR_P_TunerStatusReset(hDev); |
|---|
| 330 | } |
|---|
| 331 | /*BDBG_MSG(("End BTNR_3x7x_P_TimerFunc %0x s= %0x", hDev->pTunerParams->BTNR_BBS_Params.BBSConnectMode, hDev->pTunerStatus->Lock ));*/ |
|---|
| 332 | |
|---|
| 333 | return BERR_SUCCESS; |
|---|
| 334 | |
|---|
| 335 | } |
|---|
| 336 | |
|---|
| 337 | /****************************************************************************** |
|---|
| 338 | BTNR_3x7x_Set_RF_Offset() |
|---|
| 339 | ******************************************************************************/ |
|---|
| 340 | BERR_Code BTNR_3x7x_Set_RF_Offset(BTNR_Handle hTnrDev, int32_t RF_Offset, uint32_t Symbol_Rate) |
|---|
| 341 | { |
|---|
| 342 | BTNR_P_3x7x_Handle *hDev = (BTNR_P_3x7x_Handle *)(hTnrDev->hDevImpl); |
|---|
| 343 | if (hDev->pTunerStatus->PowerStatus != BTNR_ePower_On) |
|---|
| 344 | { |
|---|
| 345 | BDBG_ERR(("BTNR_3x7x_Set_RF_Offset: power is still off ")); |
|---|
| 346 | return BERR_NOT_INITIALIZED; |
|---|
| 347 | } |
|---|
| 348 | BTNR_P_Set_RF_Offset(hDev, RF_Offset, Symbol_Rate); |
|---|
| 349 | return BERR_SUCCESS; |
|---|
| 350 | } |
|---|
| 351 | |
|---|
| 352 | /****************************************************************************** |
|---|
| 353 | BTNR_3x7x_Get_RF_Status() |
|---|
| 354 | ******************************************************************************/ |
|---|
| 355 | BERR_Code BTNR_3x7x_Get_RF_Status(BTNR_Handle hTnrDev, BTNR_3x7x_RfStatus_t *RfCallbackStatus) |
|---|
| 356 | { |
|---|
| 357 | BTNR_P_3x7x_Handle *hTnr = (BTNR_P_3x7x_Handle *)(hTnrDev->hDevImpl); |
|---|
| 358 | if (hTnr->pTunerStatus->PowerStatus != BTNR_ePower_On) |
|---|
| 359 | { |
|---|
| 360 | BDBG_ERR(("BTNR_3x7x_ProcessInterruptEvent: power is still off ")); |
|---|
| 361 | return BERR_NOT_INITIALIZED; |
|---|
| 362 | } |
|---|
| 363 | BTNR_P_Get_RF_Status(hTnr); |
|---|
| 364 | RfCallbackStatus->RF_Freq = hTnr->pTunerStatus->Tuner_RF_Freq; |
|---|
| 365 | RfCallbackStatus->Total_Mix_After_ADC = hTnr->pTunerParams->BTNR_Local_Params.Total_Mix_After_ADC; |
|---|
| 366 | RfCallbackStatus->PreADC_Gain_x256db = hTnr->pTunerStatus->Tuner_PreADC_Gain_x256db; |
|---|
| 367 | RfCallbackStatus->PostADC_Gain_x256db = hTnr->pTunerParams->BTNR_Local_Params.PostADC_Gain_x256db; |
|---|
| 368 | RfCallbackStatus->External_Gain_x256db = hTnr->pTunerStatus->External_Gain_x256db; |
|---|
| 369 | |
|---|
| 370 | RfCallbackStatus->RF_Offset = hTnr->pTunerParams->BTNR_Local_Params.RF_Offset; |
|---|
| 371 | RfCallbackStatus->Symbol_Rate = hTnr->pTunerParams->BTNR_Local_Params.Symbol_Rate ; |
|---|
| 372 | |
|---|
| 373 | return BERR_SUCCESS; |
|---|
| 374 | } |
|---|
| 375 | |
|---|
| 376 | /****************************************************************************** |
|---|
| 377 | BTNR_3x7x_Set_RF_LoopThrough() |
|---|
| 378 | ******************************************************************************/ |
|---|
| 379 | BERR_Code BTNR_3x7x_Set_RF_LoopThrough(BTNR_Handle hTnrDev, bool EnableRfLoopThrough) |
|---|
| 380 | { |
|---|
| 381 | BTNR_P_3x7x_Handle *hTnr = (BTNR_P_3x7x_Handle *)(hTnrDev->hDevImpl); |
|---|
| 382 | |
|---|
| 383 | if (EnableRfLoopThrough) |
|---|
| 384 | hTnr->pTunerParams->BTNR_LoopThru_Params.LoopThru_Enable = BTNR_LoopThru_Params_eEnable; |
|---|
| 385 | else |
|---|
| 386 | hTnr->pTunerParams->BTNR_LoopThru_Params.LoopThru_Enable = BTNR_LoopThru_Params_eDisable; |
|---|
| 387 | |
|---|
| 388 | BTNR_P_LoopThru_Control(hTnr); |
|---|
| 389 | return BERR_SUCCESS; |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | /****************************************************************************** |
|---|
| 394 | BTNR_3x7x_Get_RF_LoopThrough() |
|---|
| 395 | ******************************************************************************/ |
|---|
| 396 | BERR_Code BTNR_3x7x_Get_RF_LoopThrough(BTNR_Handle hTnrDev, bool EnableRfLoopThrough) |
|---|
| 397 | { |
|---|
| 398 | BTNR_P_3x7x_Handle *hTnr = (BTNR_P_3x7x_Handle *)(hTnrDev->hDevImpl); |
|---|
| 399 | |
|---|
| 400 | if (hTnr->pTunerParams->BTNR_LoopThru_Params.LoopThru_Enable == BTNR_LoopThru_Params_eEnable) |
|---|
| 401 | EnableRfLoopThrough = true; |
|---|
| 402 | else |
|---|
| 403 | EnableRfLoopThrough = false; |
|---|
| 404 | |
|---|
| 405 | return BERR_SUCCESS; |
|---|
| 406 | } |
|---|
| 407 | |
|---|
| 408 | |
|---|
| 409 | |
|---|