| 1 | /******************************************************************************* |
|---|
| 2 | * |
|---|
| 3 | * FILE NAME : MxL601_TunerCfg.h |
|---|
| 4 | * |
|---|
| 5 | * AUTHOR : Dong Liu |
|---|
| 6 | * |
|---|
| 7 | * DATE CREATED : 11/16/2011 |
|---|
| 8 | * |
|---|
| 9 | * DESCRIPTION : This file contains MxL601 common control register |
|---|
| 10 | * definitions |
|---|
| 11 | * |
|---|
| 12 | ******************************************************************************* |
|---|
| 13 | * Copyright (c) 2011, MaxLinear, Inc. |
|---|
| 14 | ******************************************************************************/ |
|---|
| 15 | |
|---|
| 16 | #ifndef __MXL601_TUNER_CFG_H__ |
|---|
| 17 | #define __MXL601_TUNER_CFG_H__ |
|---|
| 18 | |
|---|
| 19 | /****************************************************************************** |
|---|
| 20 | Include Header Files |
|---|
| 21 | (No absolute paths - paths handled by make file) |
|---|
| 22 | ******************************************************************************/ |
|---|
| 23 | |
|---|
| 24 | #include "MxL601_OEM_Drv.h" |
|---|
| 25 | #include "MxL601_TunerSpurTable.h" |
|---|
| 26 | |
|---|
| 27 | /****************************************************************************** |
|---|
| 28 | Macros |
|---|
| 29 | ******************************************************************************/ |
|---|
| 30 | |
|---|
| 31 | //#define CUSTOMER_SPECIFIC_SETTING_1 |
|---|
| 32 | |
|---|
| 33 | #define AIC_RESET_REG 0xFF // For MxL601 Tuner |
|---|
| 34 | |
|---|
| 35 | #define PAGE_CHANGE_REG 0x00 // Page change, can configured as page 0 or page 1 |
|---|
| 36 | #define XTAL_CAP_CTRL_REG 0x01 // Xtal frequency and CAP register |
|---|
| 37 | #define XTAL_ENABLE_DIV_REG 0x02 // Xtal enable and frequency div 4 register |
|---|
| 38 | #define XTAL_CALI_SET_REG 0x03 // Xtal calibration enable register enable register |
|---|
| 39 | #define IF_FREQ_SEL_REG 0x04 // IF frequency selection and manual set bypass register |
|---|
| 40 | #define IF_PATH_GAIN_REG 0x05 // IF gain level and path selection register |
|---|
| 41 | #define IF_FCW_LOW_REG 0x06 // Low register of IF FCW set when manual program IF frequency |
|---|
| 42 | #define IF_FCW_HIGH_REG 0x07 // High register of IF FCW set when manual program IF frequency |
|---|
| 43 | #define AGC_CONFIG_REG 0x08 // AGC configuration, include AGC select and AGC type |
|---|
| 44 | #define AGC_SET_POINT_REG 0x09 |
|---|
| 45 | #define AGC_FLIP_REG 0x5E |
|---|
| 46 | #define AGC_SLOPE_REG 0xB5 |
|---|
| 47 | #define AGC_OFFSET_REG 0xB4 |
|---|
| 48 | #define GPO_SETTING_REG 0x0A // GPO set and inquiring register |
|---|
| 49 | #define TUNER_ENABLE_REG 0x0B // Power up register, bit<0> |
|---|
| 50 | #define TUNE_MODE_REG 0x0D |
|---|
| 51 | #define MAIN_REG_AMP 0x0E |
|---|
| 52 | #define CHAN_TUNE_BW_REG 0x0F // Band width register |
|---|
| 53 | #define CHAN_TUNE_LOW_REG 0x10 // Tune frequency set low byte |
|---|
| 54 | #define CHAN_TUNE_HI_REG 0x11 // Tune frequency set high byte |
|---|
| 55 | #define START_TUNE_REG 0x12 // sequencer setting register |
|---|
| 56 | #define FINE_TUNE_SET_REG 0x13 // Fine tune operation register |
|---|
| 57 | #define FINE_TUNE_CTRL_REG_0 0x13 // Fine tune operation register |
|---|
| 58 | #define FINE_TUNE_CTRL_REG_1 0x14 // Fine tune operation register |
|---|
| 59 | |
|---|
| 60 | #define FINE_TUNE_OFFSET_LOW_REG 0x14 // Fine tune frequency offset low byte |
|---|
| 61 | #define FINE_TUNE_OFFSET_HIGH_REG 0x15 // Fine tune frequency offset high byte |
|---|
| 62 | #define CHIP_ID_REQ_REG 0x18 // Tuner Chip ID register |
|---|
| 63 | #define CHIP_VERSION_REQ_REG 0x1A // Tuner Chip Revision register |
|---|
| 64 | |
|---|
| 65 | #define RFPIN_RB_LOW_REG 0x1D // RF power low 8 bit register |
|---|
| 66 | #define RFPIN_RB_HIGH_REG 0x1E // RF power high 8 bit register |
|---|
| 67 | #define SIGNAL_TYPE_REG 0x1E // Signal type |
|---|
| 68 | |
|---|
| 69 | #define DFE_CTRL_ACCUM_LOW_REG 0x24 // Bit<7:0> |
|---|
| 70 | #define DFE_CTRL_ACCUM_MID_REG 0x25 // Bit<7:0> |
|---|
| 71 | #define DFE_CTRL_ACCUM_HI_REG 0x26 // Bit<1:0> |
|---|
| 72 | |
|---|
| 73 | #define DFE_CTRL_TRIG_REG 0xA0 // Bit<3> |
|---|
| 74 | #define DFE_CTRL_RB_HI_REG 0x7B // Bit<7:0> |
|---|
| 75 | #define DFE_CTRL_RB_LOW_REG 0x7A // Bit<1:0> |
|---|
| 76 | |
|---|
| 77 | #define RF_REF_STATUS_REG 0x2B // RF/REF lock status register |
|---|
| 78 | |
|---|
| 79 | #define AGC_SAGCLOCK_STATUS_REG 0x2C |
|---|
| 80 | |
|---|
| 81 | #define DFE_DACIF_BYP_GAIN_REG 0x43 |
|---|
| 82 | #define DIG_ANA_RFRSSI_REG 0x57 |
|---|
| 83 | |
|---|
| 84 | #define RSSI_RESET_REG 0x78 |
|---|
| 85 | |
|---|
| 86 | #define FINE_TUNE_INIT1_REG 0xA9 |
|---|
| 87 | #define FINE_TUNE_INIT2_REG 0xAA |
|---|
| 88 | |
|---|
| 89 | #define DFE_AGC_CEIL1_REG 0xB0 |
|---|
| 90 | |
|---|
| 91 | #define DFE_RFLUT_BYP_REG 0xDB // Dec: 220, bit<7> |
|---|
| 92 | //#define DFE_RFLUT_DIV_IN_BYP_REG 0xDB // Dec: 220, bit<6> |
|---|
| 93 | #define DFE_RFLUT_DIV_MOD_REG 0xDB // Dec: 221 |
|---|
| 94 | //#define DFE_RFSX_INT_MOD_REG 0xDB // Dec: 222 |
|---|
| 95 | |
|---|
| 96 | #define DFE_RFLUT_SWP1_REG 0x49 |
|---|
| 97 | |
|---|
| 98 | #define DFE_RFSX_FRAC_MOD1_REG 0xDF |
|---|
| 99 | #define DFE_RFSX_FRAC_MOD2_REG 0xE0 |
|---|
| 100 | #define DFE_RFSX_FRAC_MOD3_REG 0xE1 |
|---|
| 101 | #define DFE_RFSX_FRAC_MOD4_REG 0xE2 |
|---|
| 102 | |
|---|
| 103 | #define DFE_REFLUT_BYP_REG 0xEA // Dec: 240, bit<6> |
|---|
| 104 | #define DFE_REFSX_INT_MOD_REG 0xEB // Dec: 241 |
|---|
| 105 | |
|---|
| 106 | #define APP_MODE_FREQ_HZ_THRESHOLD_1 358000000 |
|---|
| 107 | #define APP_MODE_FREQ_HZ_THRESHOLD_2 625000000 |
|---|
| 108 | |
|---|
| 109 | #define SPUR_SHIFT_FREQ_WINDOW 500000 // +- 0.5MHz |
|---|
| 110 | |
|---|
| 111 | #define IF_GAIN_SET_POINT1 10 |
|---|
| 112 | #define IF_GAIN_SET_POINT2 11 |
|---|
| 113 | #define IF_GAIN_SET_POINT3 12 |
|---|
| 114 | |
|---|
| 115 | #define SPUR_SHIFT_CLOCK_ADJUST_MIN 205 |
|---|
| 116 | #define SPUR_SHIFT_CLOCK_ADJUST_MAX 227 |
|---|
| 117 | |
|---|
| 118 | #define DIG_ANA_IF_CFG_0 0x5A |
|---|
| 119 | #define DIG_ANA_IF_CFG_1 0x5B |
|---|
| 120 | #define DIG_ANA_IF_PWR 0x5C |
|---|
| 121 | |
|---|
| 122 | #define DFE_CSF_SS_SEL 0xEA |
|---|
| 123 | #define DFE_DACIF_GAIN 0xDC |
|---|
| 124 | |
|---|
| 125 | #define FINE_TUNE_FREQ_DECREASE 0x01 |
|---|
| 126 | #define FINE_TUNE_FREQ_INCREASE 0x02 |
|---|
| 127 | |
|---|
| 128 | #define RF_SX_FRAC_N_RANGE 0xDD |
|---|
| 129 | |
|---|
| 130 | #define HIGH_IF_35250_KHZ 35250 |
|---|
| 131 | |
|---|
| 132 | #define DFE_FDC_OFFSET_I_LSB 0xAF // Page 1 |
|---|
| 133 | #define DFE_FDC_OFFSET_I_MSB 0xB0 // Page 1 |
|---|
| 134 | |
|---|
| 135 | #define DFE_FDC_OFFSET_Q_LSB 0xB1 // Page 1 |
|---|
| 136 | #define DFE_FDC_OFFSET_Q_MSB 0xB2 // Page 1 |
|---|
| 137 | |
|---|
| 138 | #define DFE_REFINTMOD_RB 0x3B // <8 bits> |
|---|
| 139 | #define DFE_RFLUT_DIV_IN_RB 0xB8 // Page 1 <5 bits> |
|---|
| 140 | #define DFE_RFINITMOD_RB 0xB9 // Page 1 <7 bits> |
|---|
| 141 | #define DFE_RFFRACMOD_RB 0xBA // Page 1 <26 bits> |
|---|
| 142 | #define DFE_RFLUT_BYP 0x32 // Page 1 <1 bit> |
|---|
| 143 | #define DFE_RFINITMOD_W 0x33 // Page 1 <7 bits> |
|---|
| 144 | #define DFE_RFFRACMOD_W 0x34 // Page 1 <26 bits> |
|---|
| 145 | |
|---|
| 146 | #define DFE_SEQ_RFSX_MOD_VALID_BYP 0x58 // Page 1 <bit 1> dfe_seq_digana_rfsx_mod_valid_byp |
|---|
| 147 | #define DFE_SEQ_RFSX_MOD_VALID 0x58 // Page 1 <bit 0> dfe_seq_digana_rfsx_mod_valid |
|---|
| 148 | |
|---|
| 149 | #define MAX_LUT_SIZE 8 |
|---|
| 150 | #define MAX_DC_CAL_SAMPLES 50 |
|---|
| 151 | |
|---|
| 152 | #define DFE_FDC_IIR0_1 0x87 |
|---|
| 153 | #define DFE_FDC_IIR2_3 0x88 |
|---|
| 154 | |
|---|
| 155 | /****************************************************************************** |
|---|
| 156 | User-Defined Types (Typedefs) |
|---|
| 157 | ******************************************************************************/ |
|---|
| 158 | |
|---|
| 159 | typedef struct |
|---|
| 160 | { |
|---|
| 161 | UINT8 regAddr; |
|---|
| 162 | UINT8 mask; |
|---|
| 163 | UINT8 data; |
|---|
| 164 | } REG_CTRL_INFO_T, *PREG_CTRL_INFO_T; |
|---|
| 165 | |
|---|
| 166 | typedef struct |
|---|
| 167 | { |
|---|
| 168 | UINT8 i2cAddr; |
|---|
| 169 | UINT8 xtalAmp_Rb; |
|---|
| 170 | UINT8 xtalAmp_LinRb; |
|---|
| 171 | UINT8 appMode; |
|---|
| 172 | } XTAL_SPUR_CFG_T; |
|---|
| 173 | |
|---|
| 174 | typedef struct |
|---|
| 175 | { |
|---|
| 176 | UINT16 if_fcw_invert; |
|---|
| 177 | UINT16 if_fcw_noninvert; |
|---|
| 178 | } IF_FCW_LUT_T; |
|---|
| 179 | |
|---|
| 180 | typedef struct |
|---|
| 181 | { |
|---|
| 182 | UINT8 i2cAddr; |
|---|
| 183 | UINT8 if_sel; |
|---|
| 184 | UINT8 if_fcw_byp; |
|---|
| 185 | UINT8 if_invert; |
|---|
| 186 | UINT32 manualIFOutFreqInKHz; |
|---|
| 187 | } IF_FCW_CFG_T; |
|---|
| 188 | |
|---|
| 189 | /****************************************************************************** |
|---|
| 190 | Global Variable Declarations |
|---|
| 191 | ******************************************************************************/ |
|---|
| 192 | |
|---|
| 193 | extern REG_CTRL_INFO_T MxL_OverwriteDefaults[]; |
|---|
| 194 | extern REG_CTRL_INFO_T AnalogNtsc[]; |
|---|
| 195 | extern REG_CTRL_INFO_T AnalogPal[]; |
|---|
| 196 | extern REG_CTRL_INFO_T AnalogSecam[]; |
|---|
| 197 | extern REG_CTRL_INFO_T DigitalDvbc[]; |
|---|
| 198 | extern REG_CTRL_INFO_T DigitalIsdbtAtsc[]; |
|---|
| 199 | extern REG_CTRL_INFO_T DigitalDvbt[]; |
|---|
| 200 | |
|---|
| 201 | extern REG_CTRL_INFO_T Ntsc_RfLutSwpHIF[]; |
|---|
| 202 | extern REG_CTRL_INFO_T Ntsc_16MHzRfLutSwpLIF[]; |
|---|
| 203 | extern REG_CTRL_INFO_T Ntsc_24MHzRfLutSwpLIF[]; |
|---|
| 204 | |
|---|
| 205 | extern REG_CTRL_INFO_T Pal_RfLutSwpLIF[]; |
|---|
| 206 | extern REG_CTRL_INFO_T PalD_RfLutSwpHIF[]; |
|---|
| 207 | extern REG_CTRL_INFO_T PalI_RfLutSwpHIF[]; |
|---|
| 208 | extern REG_CTRL_INFO_T PalBG_8MHzBW_RfLutSwpHIF[]; |
|---|
| 209 | extern REG_CTRL_INFO_T PalBG_7MHzBW_RfLutSwpHIF[]; |
|---|
| 210 | extern REG_CTRL_INFO_T Ntsc_HRCRfLutSwpLIF[]; |
|---|
| 211 | |
|---|
| 212 | /****************************************************************************** |
|---|
| 213 | Prototypes |
|---|
| 214 | ******************************************************************************/ |
|---|
| 215 | |
|---|
| 216 | // Functions for register write operation |
|---|
| 217 | MXL_STATUS Ctrl_ProgramRegisters(UINT8 I2cAddr, PREG_CTRL_INFO_T ctrlRegInfoPtr); |
|---|
| 218 | MXL_STATUS Ctrl_WriteRegField(UINT8 I2cAddr, PREG_CTRL_INFO_T ctrlRegInfoPtr); |
|---|
| 219 | |
|---|
| 220 | // Functions called by MxLWare API |
|---|
| 221 | MXL_STATUS Ctrl_SetRfFreqLutReg(UINT8 i2cAddress, UINT32 FreqInHz, PCHAN_DEPENDENT_FREQ_TABLE_T freqLutPtr); |
|---|
| 222 | |
|---|
| 223 | REAL32 MxL_GetTunerSignedBits(UINT32 bits, UINT8 signedUnsigned, UINT8 numBits, UINT8 fractionBit); |
|---|
| 224 | REAL64 MxL_CalculateVariance(REAL32 *dataPtr, UINT8 numOfItems); |
|---|
| 225 | #endif /* __MXL601_TUNER_CFG_H__*/ |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | |
|---|