| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2005-2012 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: btnr_tune.h $ |
|---|
| 39 | * $brcm_Revision: 22 $ |
|---|
| 40 | * $brcm_Date: 3/23/12 2:48p $ |
|---|
| 41 | * |
|---|
| 42 | * [File Description:] |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /AP/ctfe/core/tnr/btnr_tune.h $ |
|---|
| 47 | * |
|---|
| 48 | * 22 3/23/12 2:48p farshidf |
|---|
| 49 | * SW3128-125: FW version 4.6 |
|---|
| 50 | * |
|---|
| 51 | * Fw_Integration_Devel/6 3/23/12 2:46p farshidf |
|---|
| 52 | * SW3128-125: FW version 4.6 |
|---|
| 53 | * |
|---|
| 54 | * Fw_Integration_Devel/AP_V4_0_TNR_DEV/1 3/12/12 6:27p farshidf |
|---|
| 55 | * SW3462-6: merge to dev |
|---|
| 56 | * |
|---|
| 57 | * Fw_Integration_Devel/AP_V4_0_TNR_DEV/SW3462-6/1 2/29/12 5:34p farshidf |
|---|
| 58 | * Sw3461-165: clean up |
|---|
| 59 | * |
|---|
| 60 | * Fw_Integration_Devel/5 10/14/11 12:58a farshidf |
|---|
| 61 | * SW3461-64: fix warning |
|---|
| 62 | * |
|---|
| 63 | * 20 10/10/11 3:21p farshidf |
|---|
| 64 | * SW7552-134: compile fix |
|---|
| 65 | * |
|---|
| 66 | * 19 9/16/11 10:06a farshidf |
|---|
| 67 | * SW3461-1: merge to main |
|---|
| 68 | * |
|---|
| 69 | * Fw_Integration_Devel/4 9/16/11 9:57a farshidf |
|---|
| 70 | * SW3461-1: merge to integ |
|---|
| 71 | * |
|---|
| 72 | * Fw_Integration_Devel/AP_V2_0_TNR_DEV/1 9/14/11 5:21p shchang |
|---|
| 73 | * SW3461-1: change frequency plan |
|---|
| 74 | * |
|---|
| 75 | * 18 7/20/11 11:37a farshidf |
|---|
| 76 | * SW7552-60: mereg the latest tuner code |
|---|
| 77 | * |
|---|
| 78 | * Fw_Integration_Devel/2 7/19/11 7:02p farshidf |
|---|
| 79 | * SW3461-28: merge to main |
|---|
| 80 | * |
|---|
| 81 | * Fw_Integration_Devel/Tnr_Fw_Devel_Rc05/3 7/19/11 7:01p farshidf |
|---|
| 82 | * SW3461-28: compile fix |
|---|
| 83 | * |
|---|
| 84 | * Fw_Integration_Devel/1 6/29/11 12:38p farshidf |
|---|
| 85 | * SW3461-13: merge to integ V0.5_rc0 |
|---|
| 86 | * |
|---|
| 87 | * Fw_Integration_Devel/Tnr_Fw_Devel_Rc05/2 6/29/11 12:32p shchang |
|---|
| 88 | * SW3461-1: replace 6-phase with 8-phase mixer |
|---|
| 89 | * |
|---|
| 90 | * Fw_Integration_Devel/Tnr_Fw_Devel_Rc05/1 6/16/11 6:05p shchang |
|---|
| 91 | * SW3461-1: add DPM feature |
|---|
| 92 | * |
|---|
| 93 | * 17 6/9/11 7:03p farshidf |
|---|
| 94 | * SW3461-1: merge to main |
|---|
| 95 | * |
|---|
| 96 | * SW_System_4_Integ_Test/3 6/9/11 7:02p farshidf |
|---|
| 97 | * SW3461-1: changes from Dave |
|---|
| 98 | * |
|---|
| 99 | * 15 5/20/11 6:44a mpovich |
|---|
| 100 | * SW3461-1: rename UFE (BUFE) module to TNR (BTNR). |
|---|
| 101 | * |
|---|
| 102 | * TNR_3461_1/1 5/19/11 5:17p mpovich |
|---|
| 103 | * SW3461-1: Change BUFE module prefix to BTNR |
|---|
| 104 | * |
|---|
| 105 | * 14 3/25/11 6:32p mpovich |
|---|
| 106 | * SW3128-1: Merge latest from TNR branch to main branch. |
|---|
| 107 | * |
|---|
| 108 | * TNR_3461_1/5 3/18/11 4:12p farshidf |
|---|
| 109 | * SW3461-1: merge main |
|---|
| 110 | * |
|---|
| 111 | * 13 3/16/11 10:22a farshidf |
|---|
| 112 | * SW3461-1: merge internal LNA code |
|---|
| 113 | * |
|---|
| 114 | * TNR_3461_1/4 3/16/11 8:13a jputnam |
|---|
| 115 | * SW3461-1: Change default to internal LNA |
|---|
| 116 | * |
|---|
| 117 | * TNR_3461_1/3 3/15/11 5:56p mbsingh |
|---|
| 118 | * SW3461-1: Fixed the frequency tables. Now all frequencies above 143.16 |
|---|
| 119 | * work |
|---|
| 120 | * |
|---|
| 121 | * TNR_3461_1/2 3/14/11 8:16p lukose |
|---|
| 122 | * SW3461-1: fix the freq table |
|---|
| 123 | * |
|---|
| 124 | * TNR_3461_1/1 3/14/11 7:42p lukose |
|---|
| 125 | * SW3461-1: Update freq. table values with correct values |
|---|
| 126 | * |
|---|
| 127 | * 11 3/10/11 5:35p cbrooks |
|---|
| 128 | * sw3461-1: New Code |
|---|
| 129 | * |
|---|
| 130 | * 10 3/9/11 9:02p cbrooks |
|---|
| 131 | * sw3461-1:Added LNA level and RFVGA level to status |
|---|
| 132 | * |
|---|
| 133 | * 9 3/8/11 8:26p cbrooks |
|---|
| 134 | * sw3461-1:new code |
|---|
| 135 | * |
|---|
| 136 | * 7 3/7/11 9:11p cbrooks |
|---|
| 137 | * sw3461-1:New Code |
|---|
| 138 | * |
|---|
| 139 | * 6 3/6/11 6:36p cbrooks |
|---|
| 140 | * sw3461-1:new code |
|---|
| 141 | * |
|---|
| 142 | * 4 3/6/11 5:58p cbrooks |
|---|
| 143 | * SW3461-1:New TNR Code |
|---|
| 144 | * |
|---|
| 145 | * 3 3/2/11 5:28p farshidf |
|---|
| 146 | * SW3461-1: remove the warning |
|---|
| 147 | * |
|---|
| 148 | * 2 3/1/11 12:59p cbrooks |
|---|
| 149 | * sw3461-1:new code |
|---|
| 150 | * |
|---|
| 151 | * 1 2/24/11 11:27a farshidf |
|---|
| 152 | * SW3461-1: add the initial Tuner code from Dave |
|---|
| 153 | * |
|---|
| 154 | ***************************************************************************/ |
|---|
| 155 | |
|---|
| 156 | #ifndef _BTNR_TUNE_H__ |
|---|
| 157 | #define _BTNR_TUNE_H__ |
|---|
| 158 | |
|---|
| 159 | #ifdef __cplusplus |
|---|
| 160 | extern "C" { |
|---|
| 161 | #endif |
|---|
| 162 | |
|---|
| 163 | #define BTNR_ENABLE_HW_AUTO_TUNE 0 /*Enable Software Cap Select*/ |
|---|
| 164 | #define BTNR_ENABLE_SDADC_CAL 0 /*Enable SDADC Calibration*/ |
|---|
| 165 | |
|---|
| 166 | |
|---|
| 167 | #define REF_PLL_LOCK_TIMEOUT_MS 1 /*Ref PLL Lock timeout in ms [0 255]*/ |
|---|
| 168 | #define PHY_PLL_LOCK_TIMEOUT_MS 1 /*Phy PLL Lock timeout in ms*[0 255]*/ |
|---|
| 169 | |
|---|
| 170 | #define MAX_LPF_VARIABLE_BW 10000000 |
|---|
| 171 | #define MIN_LPF_VARIABLE_BW 1000000 |
|---|
| 172 | |
|---|
| 173 | /*Initial Values for the BTNR_Internal_Params structure*/ |
|---|
| 174 | /*Warning!! these can be overwritten by BBS*/ |
|---|
| 175 | #define INIT_BBS_LNA_ENABLE BTNR_Internal_Params_eEnable /*BTNR_Internal_Params_eDisable or BTNR_Internal_Params_eEnable*/ |
|---|
| 176 | #define INIT_BBS_SDADC_INPUT BTNR_Internal_Params_SDADC_Input_eTuner /*BTNR_Internal_Params_SDADC_Input_eTuner, BTNR_Internal_Params_SDADC_Input_eTuner_wTestOut, |
|---|
| 177 | BTNR_Internal_Params_SDADC_Input_eExtReal or BTNR_Internal_Params_SDADC_Input_eExtIQ*/ |
|---|
| 178 | #define INIT_BBS_RFFIL_SELECT BTNR_Internal_Params_TunerRFFIL_eMOCATRAP /*BTNR_Internal_Params_TunerRFFIL_eMOCATRAP or |
|---|
| 179 | BTNR_Internal_Params_TunerRFFIL_eTRKFIL,*/ |
|---|
| 180 | #define INIT_BBS_HRC_ENABLE BTNR_Internal_Params_eDisable /*BTNR_Internal_Params_eDisable or BTNR_Internal_Params_eEnable*/ |
|---|
| 181 | #define INIT_BBS_IF_FREQ 0 /*uint32_t*/ |
|---|
| 182 | /******************************************************************************************************* |
|---|
| 183 | * declare table for LPF parameters ********************* |
|---|
| 184 | ********************************************************************************************************/ |
|---|
| 185 | |
|---|
| 186 | /*This table is in 100 KHz resolution*/ |
|---|
| 187 | /*The BTNR_P_TunerSetRFFIL() function assumes this is 105 elements*/ |
|---|
| 188 | #define LPF_TABLE_SIZE 71 |
|---|
| 189 | static const uint16_t LPF_Selection_Table[LPF_TABLE_SIZE] = |
|---|
| 190 | { |
|---|
| 191 | 33, 35, 37, 38, 41, 42, 45, 47, 50, 52, 55, |
|---|
| 192 | 34, 35, 36, 37, 38, 39, 40, 42, 43, 45, 47, 49, 51, 53, 54, 55, 57, 58, 61, 63, |
|---|
| 193 | 30, 30, 31, 32, 33, 33, 33, 34, 34, 34, 35, 35, 36, 37, 38, 39, 40, 41, 42, 42, |
|---|
| 194 | 43, 44, 44, 44, 44, 45, 46, 46, 46, 46, 48, 49, 50, 51, 51, 54, 54, 58, 58, 62 |
|---|
| 195 | }; |
|---|
| 196 | |
|---|
| 197 | /******************************************************************************************************* |
|---|
| 198 | *declare table to get FGA_RC parameters, both fixed value and variable |
|---|
| 199 | ********************************************************************************************************/ |
|---|
| 200 | #define FGA_RC_CTRL_LOWG_8MHz 0xA7 /*[0 255]*/ |
|---|
| 201 | #define FGA_RC_CTRL_HIGHG_8MHz 0xC9 /*[0 255]*/ |
|---|
| 202 | #define IFLPF_BW_SEL_8MHz 0x13 /*[0 63]*/ |
|---|
| 203 | #define IFLPF_WBW_SEL_8MHz 0 /*0 normal: 1 wideband*/ |
|---|
| 204 | |
|---|
| 205 | #define FGA_RC_CTRL_LOWG_7MHz 0x96 |
|---|
| 206 | #define FGA_RC_CTRL_HIGHG_7MHz 0xBD |
|---|
| 207 | #define IFLPF_BW_SEL_7MHz 0x0F |
|---|
| 208 | #define IFLPF_WBW_SEL_7MHz 0 |
|---|
| 209 | |
|---|
| 210 | #define FGA_RC_CTRL_LOWG_6MHz 0x7F |
|---|
| 211 | #define FGA_RC_CTRL_HIGHG_6MHz 0xAD |
|---|
| 212 | #define IFLPF_BW_SEL_6MHz 0x0C |
|---|
| 213 | #define IFLPF_WBW_SEL_6MHz 0 |
|---|
| 214 | |
|---|
| 215 | #define FGA_RC_CTRL_LOWG_5MHz 0x62 |
|---|
| 216 | #define FGA_RC_CTRL_HIGHG_5MHz 0x97 |
|---|
| 217 | #define IFLPF_BW_SEL_5MHz 0x09 |
|---|
| 218 | #define IFLPF_WBW_SEL_5MHz 0 |
|---|
| 219 | |
|---|
| 220 | #define FGA_RC_CTRL_LOWG_1_7MHz 0x00 |
|---|
| 221 | #define FGA_RC_CTRL_HIGHG_1_7MHz 0x00 |
|---|
| 222 | #define IFLPF_BW_SEL_1_7MHz 0x00 |
|---|
| 223 | #define IFLPF_WBW_SEL_1_7MHz 0 |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | #define FGA_RC_Table_Size 2 |
|---|
| 227 | #define FGA_RC_Num_Tables 11 |
|---|
| 228 | typedef struct FGA_RC_Selection_Elements_s |
|---|
| 229 | { |
|---|
| 230 | uint8_t FGA_RC_CNTL; |
|---|
| 231 | }FGA_RC_Selection_Elements_t; |
|---|
| 232 | |
|---|
| 233 | /* declare table to get FGA_RC parameters */ |
|---|
| 234 | static const FGA_RC_Selection_Elements_t FGA_RC_Selection_Table[FGA_RC_Num_Tables][FGA_RC_Table_Size] = |
|---|
| 235 | { |
|---|
| 236 | {{0},{0}}, /* <2MHz */ |
|---|
| 237 | {{0},{84}}, /* 2MHz */ |
|---|
| 238 | {{95},{150}}, /* 3MHz */ |
|---|
| 239 | {{143},{184}}, /* 4MHz */ |
|---|
| 240 | {{171},{205}}, /* 5MHz */ |
|---|
| 241 | {{190},{217}}, /* 6MHz */ |
|---|
| 242 | {{203},{227}}, /* 7MHz */ |
|---|
| 243 | {{214},{235}}, /* 8MHz */ |
|---|
| 244 | {{221},{240}}, /* 9MHz */ |
|---|
| 245 | {{228},{245}}, /* 10MHz */ |
|---|
| 246 | {{255},{255}} /* >10MHz */ |
|---|
| 247 | }; |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | /******************************************************************************************************* |
|---|
| 251 | *declare tables for tuner LO and DDFS |
|---|
| 252 | ********************************************************************************************************/ |
|---|
| 253 | |
|---|
| 254 | /*The BTNR_P_TunerSetFreq() function assumes this is 14 elements*/ |
|---|
| 255 | #define BTNR_TUNER_LO_TABLE_SIZE 14 |
|---|
| 256 | static const uint32_t Tuner_LO_Freq_Table[BTNR_TUNER_LO_TABLE_SIZE] = |
|---|
| 257 | { |
|---|
| 258 | 44790000UL, |
|---|
| 259 | 67180000UL, |
|---|
| 260 | 89580000UL, |
|---|
| 261 | 91110000UL, |
|---|
| 262 | 119440000UL, |
|---|
| 263 | 143160000UL, |
|---|
| 264 | 179160000UL, |
|---|
| 265 | 200400000UL, |
|---|
| 266 | 238880000UL, |
|---|
| 267 | 334020000UL, |
|---|
| 268 | 358330000UL, |
|---|
| 269 | 537500000UL, |
|---|
| 270 | 716660000UL, |
|---|
| 271 | 1075000000UL |
|---|
| 272 | }; |
|---|
| 273 | |
|---|
| 274 | /* tunerLoDivider used in FCW calculation |
|---|
| 275 | * fb_divn = TNR_AFE_TNR0_03[22:15] |
|---|
| 276 | * i_MXR_SR6p8p12p16p = TNR_AFE_TNR0_MXR_01[15:14] |
|---|
| 277 | * i_MIXER_sel_div_ratio = TNR_AFE_TNR0_MXR_01[13:12] |
|---|
| 278 | * i_MIXER_sel = TNR_AFE_TNR0_MXR_01[5:4] |
|---|
| 279 | * i_MIXER_HRM_mode = TNR_AFE_TNR0_MXR_01[2] |
|---|
| 280 | * i_MIXER_sel_MUX0p6p8p = TNR_AFE_TNR0_MXR_01[1:0] |
|---|
| 281 | * lP_fbdivn_1p0 = TNR_AFE_TNR0_MXRPLL_03[22:15] |
|---|
| 282 | * lP_div23_sel_1p0 = TNR_AFE_TNR0_MXRPLL_03[14]*/ |
|---|
| 283 | |
|---|
| 284 | typedef struct Tuner_LO_Tables_s |
|---|
| 285 | { |
|---|
| 286 | uint8_t M_Factor ; |
|---|
| 287 | uint8_t i_MXR_SR6p8p12p16p ; |
|---|
| 288 | uint8_t i_MIXER_sel_div_ratio ; |
|---|
| 289 | uint8_t i_MIXER_sel ; |
|---|
| 290 | uint8_t i_MIXER_HRM_mode ; |
|---|
| 291 | uint8_t i_MIXER_sel_MUX0p6p8p ; |
|---|
| 292 | uint8_t lP_fbdivn_1p0 ; |
|---|
| 293 | uint8_t lP_div23_sel_1p0 ; |
|---|
| 294 | }Tuner_VCO_Tables_t; |
|---|
| 295 | |
|---|
| 296 | |
|---|
| 297 | static const Tuner_VCO_Tables_t Tuner_LO_Table[BTNR_TUNER_LO_TABLE_SIZE] = |
|---|
| 298 | |
|---|
| 299 | { |
|---|
| 300 | {0x40, 0x3, 0x2, 0x3, 1, 0x0, 0x10, 1}, /* 44790000UL*/ |
|---|
| 301 | {0x40, 0x3, 0x2, 0x3, 1, 0x0, 0x18, 0}, /* 67180000UL*/ |
|---|
| 302 | {0x20, 0x3, 0x1, 0x3, 1, 0x0, 0x10, 1}, /* 89580000UL*/ |
|---|
| 303 | {0x20, 0x3, 0x1, 0x3, 1, 0x0, 0x18, 0}, /* 91110000UL*/ |
|---|
| 304 | {0x18, 0x2, 0x1, 0x2, 1, 0x0, 0x10, 1}, /* 119440000UL*/ |
|---|
| 305 | {0x18, 0x2, 0x1, 0x2, 1, 0x0, 0x18, 0}, /* 143160000UL*/ |
|---|
| 306 | {0x10, 0x1, 0x1, 0x1, 1, 0x3, 0x10, 1}, /* 179160000UL*/ |
|---|
| 307 | {0x10, 0x1, 0x1, 0x1, 1, 0x3, 0x18, 0}, /* 200400000UL*/ |
|---|
| 308 | {0x0C, 0x0, 0x1, 0x1, 1, 0x2, 0x10, 1}, /* 238880000UL*/ |
|---|
| 309 | {0x0C, 0x0, 0x1, 0x1, 1, 0x2, 0x18, 0}, /* 334020000UL*/ |
|---|
| 310 | {0x08, 0x0, 0x3, 0x1, 0, 0x1, 0x10, 1}, /* 358330000UL*/ |
|---|
| 311 | {0x08, 0x0, 0x3, 0x1, 0, 0x1, 0x18, 0}, /* 537500000UL*/ |
|---|
| 312 | {0x04, 0x0, 0x2, 0x1, 0, 0x1, 0x10, 1}, /* 716660000UL*/ |
|---|
| 313 | {0x04, 0x0, 0x2, 0x1, 0, 0x1, 0x18, 0} /*1075000000UL*/ |
|---|
| 314 | }; |
|---|
| 315 | |
|---|
| 316 | /******************************************************************************************************* |
|---|
| 317 | *declare tables for DPM LO and DDFS |
|---|
| 318 | ********************************************************************************************************/ |
|---|
| 319 | |
|---|
| 320 | /*The BTNR_P_TunerSetFreq() function assumes this is 12 elements*/ |
|---|
| 321 | #define BTNR_DPM_LO_TABLE_SIZE 12 |
|---|
| 322 | static const uint32_t DPM_LO_Freq_Table[BTNR_DPM_LO_TABLE_SIZE] = |
|---|
| 323 | { |
|---|
| 324 | 44790000UL, |
|---|
| 325 | 67180000UL, |
|---|
| 326 | 89580000UL, |
|---|
| 327 | 134400000UL, |
|---|
| 328 | 179160000UL, |
|---|
| 329 | 268800000UL, |
|---|
| 330 | 358330000UL, |
|---|
| 331 | 537500000UL, |
|---|
| 332 | 716660000UL, |
|---|
| 333 | 1075000000UL, |
|---|
| 334 | 1433000000UL, |
|---|
| 335 | 2150000000UL |
|---|
| 336 | }; |
|---|
| 337 | |
|---|
| 338 | /* tunerLoDivider used in FCW calculation |
|---|
| 339 | * fb_divn = TNR_AFE_TNR0_03[22:15] |
|---|
| 340 | * i_MXR_SR6p8p12p16p = TNR_AFE_TNR0_MXR_01[15:14] |
|---|
| 341 | * i_MIXER_sel_div_ratio = TNR_AFE_TNR0_MXR_01[13:12] |
|---|
| 342 | * i_MIXER_sel = TNR_AFE_TNR0_MXR_01[5:4] |
|---|
| 343 | * i_MIXER_HRM_mode = TNR_AFE_TNR0_MXR_01[2] |
|---|
| 344 | * i_MIXER_sel_MUX0p6p8p = TNR_AFE_TNR0_MXR_01[1:0] |
|---|
| 345 | * lP_fbdivn_1p0 = TNR_AFE_TNR0_MXRPLL_03[22:15] |
|---|
| 346 | * lP_div23_sel_1p0 = TNR_AFE_TNR0_MXRPLL_03[14] |
|---|
| 347 | * logen_PreSel = TNR_AFE_TNR0_DPM_01[22:20] |
|---|
| 348 | * logen_two = TNR_AFE_TNR0_DPM_01[6] |
|---|
| 349 | * logen_six = TNR_AFE_TNR0_DPM_01[4]*/ |
|---|
| 350 | |
|---|
| 351 | typedef struct DPM_LO_Tables_s |
|---|
| 352 | { |
|---|
| 353 | uint8_t M_Factor ; |
|---|
| 354 | uint8_t i_MXR_SR6p8p12p16p ; |
|---|
| 355 | uint8_t i_MIXER_sel_div_ratio ; |
|---|
| 356 | uint8_t i_MIXER_sel ; |
|---|
| 357 | uint8_t i_MIXER_HRM_mode ; |
|---|
| 358 | uint8_t i_MIXER_sel_MUX0p6p8p ; |
|---|
| 359 | uint8_t lP_fbdivn_1p0 ; |
|---|
| 360 | uint8_t lP_div23_sel_1p0 ; |
|---|
| 361 | }DPM_VCO_Tables_t; |
|---|
| 362 | |
|---|
| 363 | |
|---|
| 364 | static const DPM_VCO_Tables_t DPM_LO_Table[BTNR_DPM_LO_TABLE_SIZE] = |
|---|
| 365 | |
|---|
| 366 | { |
|---|
| 367 | {0x40, 0x3, 0x2, 0x3, 1, 0x0, 0x10, 1}, /* 44790000UL*/ |
|---|
| 368 | {0x40, 0x3, 0x2, 0x3, 1, 0x0, 0x18, 0}, /* 67180000UL*/ |
|---|
| 369 | {0x20, 0x3, 0x1, 0x3, 1, 0x0, 0x10, 1}, /* 89580000UL*/ |
|---|
| 370 | {0x20, 0x2, 0x1, 0x2, 1, 0x0, 0x18, 0}, /* 134400000UL*/ |
|---|
| 371 | {0x10, 0x1, 0x1, 0x1, 1, 0x3, 0x10, 1}, /* 179160000UL*/ |
|---|
| 372 | {0x10, 0x1, 0x1, 0x1, 1, 0x3, 0x18, 0}, /* 268800000UL*/ |
|---|
| 373 | {0x0C, 0x0, 0x1, 0x1, 1, 0x2, 0x18, 0}, /* 358800000UL*/ |
|---|
| 374 | {0x08, 0x0, 0x3, 0x1, 0, 0x1, 0x18, 0}, /* 537500000UL*/ |
|---|
| 375 | {0x06, 0x0, 0x0, 0x1, 1, 0x2, 0x18, 0}, /* 716660000UL*/ |
|---|
| 376 | {0x04, 0x0, 0x2, 0x1, 0, 0x1, 0x18, 0}, /*1075000000UL*/ |
|---|
| 377 | {0x02, 0x0, 0x1, 0x1, 0, 0x1, 0x10, 1}, /*1433000000UL*/ |
|---|
| 378 | {0x02, 0x0, 0x1, 0x1, 0, 0x1, 0x18, 0}, /*2150000000UL*/ |
|---|
| 379 | }; |
|---|
| 380 | /******************************************************************************************************* |
|---|
| 381 | *declare tables for DPM |
|---|
| 382 | ********************************************************************************************************/ |
|---|
| 383 | |
|---|
| 384 | /*The BTNR_P_TunerSetFreq() function assumes this is 12 elements*/ |
|---|
| 385 | #define BTNR_DPM_TABLE_SIZE 12 |
|---|
| 386 | static const uint32_t DPM_Freq_Table[BTNR_DPM_TABLE_SIZE] = |
|---|
| 387 | { |
|---|
| 388 | 44790000UL, |
|---|
| 389 | 67180000UL, |
|---|
| 390 | 89580000UL, |
|---|
| 391 | 134400000UL, |
|---|
| 392 | 179160000UL, |
|---|
| 393 | 268800000UL, |
|---|
| 394 | 358330000UL, |
|---|
| 395 | 537500000UL, |
|---|
| 396 | 716660000UL, |
|---|
| 397 | 1075000000UL, |
|---|
| 398 | 1433000000UL, |
|---|
| 399 | 2150000000UL |
|---|
| 400 | }; |
|---|
| 401 | |
|---|
| 402 | /* logen_PreSel = TNR_AFE_TNR0_DPM_01[22:20] |
|---|
| 403 | * logen_two = TNR_AFE_TNR0_DPM_01[6] |
|---|
| 404 | * logen_six = TNR_AFE_TNR0_DPM_01[4]*/ |
|---|
| 405 | |
|---|
| 406 | typedef struct DPM_Tables_s |
|---|
| 407 | { |
|---|
| 408 | uint8_t logen_PreSel ; |
|---|
| 409 | uint8_t logen_two ; |
|---|
| 410 | uint8_t logen_six ; |
|---|
| 411 | }DPM_Tables_t; |
|---|
| 412 | |
|---|
| 413 | |
|---|
| 414 | static const DPM_Tables_t DPM_Table[BTNR_DPM_TABLE_SIZE] = |
|---|
| 415 | |
|---|
| 416 | { |
|---|
| 417 | {0x3, 0x0, 0x0}, /* 44790000UL*/ |
|---|
| 418 | {0x3, 0x0, 0x0}, /* 67180000UL*/ |
|---|
| 419 | {0x2, 0x0, 0x0}, /* 89580000UL*/ |
|---|
| 420 | {0x2, 0x0, 0x0}, /* 134400000UL*/ |
|---|
| 421 | {0x1, 0x0, 0x0}, /* 179160000UL*/ |
|---|
| 422 | {0x1, 0x0, 0x0}, /* 268800000UL*/ |
|---|
| 423 | {0x4, 0x0, 0x0}, /* 358800000UL*/ |
|---|
| 424 | {0x0, 0x0, 0x0}, /* 537500000UL*/ |
|---|
| 425 | {0x0, 0x0, 0x1}, /* 716660000UL*/ |
|---|
| 426 | {0x1, 0x1, 0x0}, /*1075000000UL*/ |
|---|
| 427 | {0x0, 0x1, 0x0}, /*1433000000UL*/ |
|---|
| 428 | {0x0, 0x1, 0x0}, /*2150000000UL*/ |
|---|
| 429 | }; |
|---|
| 430 | |
|---|
| 431 | /***************************************************************************** |
|---|
| 432 | * TNR Function Prototypes Used by PI or Local |
|---|
| 433 | *****************************************************************************/ |
|---|
| 434 | BERR_Code BTNR_P_Tuner_Power_Control(BTNR_3x7x_Handle h); |
|---|
| 435 | BERR_Code BTNR_P_TunerStatusReset(BTNR_3x7x_Handle h); |
|---|
| 436 | BERR_Code BTNR_P_TunerStatus(BTNR_3x7x_Handle h); |
|---|
| 437 | BERR_Code BTNR_P_TunerInit(BTNR_3x7x_Handle h); |
|---|
| 438 | BERR_Code BTNR_P_TunerTune(BTNR_3x7x_Handle h); |
|---|
| 439 | BERR_Code BTNR_P_DPM_Control(BTNR_3x7x_Handle h); |
|---|
| 440 | BERR_Code BTNR_P_LoopThru_Control(BTNR_3x7x_Handle h); |
|---|
| 441 | BERR_Code BTNR_P_Daisy_Control(BTNR_3x7x_Handle h); |
|---|
| 442 | |
|---|
| 443 | |
|---|
| 444 | /***************************************************************************** |
|---|
| 445 | * TNR Function Prototypes Used Local |
|---|
| 446 | *****************************************************************************/ |
|---|
| 447 | |
|---|
| 448 | void BTNR_P_TunerSetRFFIL(BTNR_3x7x_Handle h); |
|---|
| 449 | void BTNR_P_TunerSetFGA_IFLPF(BTNR_3x7x_Handle h); |
|---|
| 450 | void BTNR_P_TunerSetFreq(BTNR_3x7x_Handle h); |
|---|
| 451 | void BTNR_P_TunerSearchCap(BTNR_3x7x_Handle h); |
|---|
| 452 | void BTNR_P_TunerSetADC6B(BTNR_3x7x_Handle h); |
|---|
| 453 | void BTNR_P_TunerSetLNAAGC(BTNR_3x7x_Handle h); |
|---|
| 454 | void BTNR_P_TunerSetRFAGC(BTNR_3x7x_Handle h); |
|---|
| 455 | void BTNR_P_TunerSetDCO(BTNR_3x7x_Handle h); |
|---|
| 456 | void BTNR_P_CalFlashSDADC(BTNR_3x7x_Handle h); |
|---|
| 457 | void BTNR_P_DPMSetFreq(BTNR_3x7x_Handle h); |
|---|
| 458 | void BTNR_P_TunerBypassRFAGC(BTNR_3x7x_Handle h); |
|---|
| 459 | BERR_Code BTNR_P_LNAAGCCycle(BTNR_3x7x_Handle h); |
|---|
| 460 | BERR_Code BTNR_P_Tuner_PowerUpPLL(BTNR_3x7x_Handle h); |
|---|
| 461 | |
|---|
| 462 | #ifdef BTNR_ENABLE_SOFTWARE_TUNE |
|---|
| 463 | BERR_Code BTNR_P_TunerSearchCap(BTNR_3x7x_Handle h); |
|---|
| 464 | BERR_Code BTNR_P_TunerSetCapCntlLoopParams(BTNR_3x7x_Handle h); |
|---|
| 465 | BERR_Code BTNR_P_TunerSetCapCntl(BTNR_3x7x_Handle h); |
|---|
| 466 | #endif |
|---|
| 467 | |
|---|
| 468 | #ifdef __cplusplus |
|---|
| 469 | } |
|---|
| 470 | #endif |
|---|
| 471 | |
|---|
| 472 | #endif /* _BTNR_TUNE_H__ */ |
|---|
| 473 | |
|---|
| 474 | |
|---|