int tuner_set_freq(HANDLE hDevice, u32 freq) { int res = BBM_NOK; u16 tone = 2048; u8 tmp; // check whether tuner is selected or not if(tuner == NULL) { PRINTF(hDevice, "TUNER NULL ERROR \n"); return BBM_NOK; } // set frequency & sw reset res = tuner->set_freq(hDevice, tuner_band, freq); if(res != BBM_OK) { PRINTF(hDevice, "TUNER res ERROR \n"); return BBM_NOK; } #if (FC8050_FREQ_XTAL == 19200) || (FC8050_FREQ_XTAL == 27000) || (FC8050_FREQ_XTAL == 27120) || (FC8050_FREQ_XTAL == 38400) tmp = (u8)(33554432/freq); bbm_write(hDevice, 0xf1, tmp); #endif fc8050_reset(hDevice); return res; }
int BBM_RESET(HANDLE hDevice) { int res; res = fc8050_reset(hDevice); return res; }
int bbm_com_reset(HANDLE hDevice) { int res; res = fc8050_reset(hDevice); return res; }
int tuner_set_freq(HANDLE hDevice, fci_u32 freq) { int res = BBM_NOK; // check whether tuner is selected or not if(tuner == NULL) { PRINTF(hDevice, "TUNER NULL ERROR \r\n"); return BBM_NOK; } // set frequency & sw reset res = tuner->set_freq(hDevice, tuner_band, freq); if(res != BBM_OK) { PRINTF(hDevice, "TUNER res ERROR \r\n"); return BBM_NOK; } fc8050_reset(hDevice); return res; }
int fc8050_init(HANDLE hDevice) { u8 intMask; fc8050_reset(hDevice); fc8050_set_xtal(hDevice); bbm_write(hDevice, BBM_BUF_MISC_CTRL, 0x19); //bbm_write(hDevice, BBM_24M_CLK_EN, 0xff); bbm_write(hDevice, BBM_VT_CONTROL, 0x03); bbm_word_write(hDevice, BBM_SYNC_CNTRL, 0x0020); bbm_write(hDevice, BBM_FIC_CRC_CONTROL, 0x03); bbm_write(hDevice, BBM_BUF_TEST_MODE, 0x08); bbm_write(hDevice, 0x33c, 0x03); bbm_write(hDevice, BBM_FFT_MODEM_STSH, 0x03); bbm_write(hDevice, BBM_DIDP_MODE, 0x01); bbm_write(hDevice, BBM_SYNC_DET_CNTRL, 0x01); bbm_word_write(hDevice, BBM_SYNC_DET_MAX_THRL, 0x0A00); bbm_write(hDevice, BBM_SYNC_DET_MODE_ENABLE, 0x01); bbm_write(hDevice, BBM_BUF_CLOCK_EN, 0xff); bbm_write(hDevice, BBM_FFT_SCALEV_IFFT, 0xea); bbm_write(hDevice, BBM_SYNC_FT_RANGE, 0x20); bbm_write(hDevice, BBM_QDD_AGC530_EN, 0x53); bbm_write(hDevice, BBM_QDD_BLOCK_AVG_SIZE, 0x48); bbm_write(hDevice, BBM_QDD_BLOCK_AVG_SIZE_LOCK, 0x49); bbm_word_write(hDevice, BBM_QDD_GAIN_CONSTANT, 0x0303); bbm_write(hDevice, BBM_QDD_DET_CNT_BOUND, 0x60); bbm_write(hDevice, BBM_QDD_REF_AMPL, 0x00); bbm_write(hDevice, BBM_QDD_BW_CTRL_LOCK, 0x50); bbm_write(hDevice, BBM_QDD_DC_CTRL, 0x3f); bbm_write(hDevice, BBM_RS_CONTROL, 0x01); bbm_word_write(hDevice, BBM_RS_BER_PERIOD, 0x14e); #if defined(POWER_SAVE_MODE) bbm_write(hDevice, BBM_DIDP_POWER_OPT0, 0x06); bbm_write(hDevice, BBM_DIDP_ADD_N_SHIFT0, 0x41); bbm_write(hDevice, BBM_DIDP_POWER_OPT1, 0x06); bbm_write(hDevice, BBM_DIDP_ADD_N_SHIFT1, 0xf1); bbm_write(hDevice, BBM_DIDP_POWER_OPT2, 0x07); bbm_write(hDevice, BBM_FFT_ADC_CONTROL, 0x1c); #else bbm_write(hDevice, BBM_DIDP_POWER_OPT0, 0x04); bbm_write(hDevice, BBM_DIDP_ADD_N_SHIFT0, 0x21); bbm_write(hDevice, BBM_DIDP_POWER_OPT1, 0x05); bbm_write(hDevice, BBM_DIDP_ADD_N_SHIFT1, 0x21); bbm_write(hDevice, BBM_DIDP_POWER_OPT2, 0x05); bbm_write(hDevice, BBM_FFT_ADC_CONTROL, 0x9c); #endif bbm_word_write(hDevice, BBM_BUF_FIC_START, FIC_BUF_START); bbm_word_write(hDevice, BBM_BUF_FIC_END, FIC_BUF_END); bbm_word_write(hDevice, BBM_BUF_FIC_THR, FIC_BUF_THR); bbm_word_write(hDevice, BBM_BUF_CH0_START, CH0_BUF_START); bbm_word_write(hDevice, BBM_BUF_CH0_END, CH0_BUF_END); bbm_word_write(hDevice, BBM_BUF_CH0_THR, CH0_BUF_THR); bbm_word_write(hDevice, BBM_BUF_CH1_START, CH1_BUF_START); bbm_word_write(hDevice, BBM_BUF_CH1_END, CH1_BUF_END); bbm_word_write(hDevice, BBM_BUF_CH1_THR, CH1_BUF_THR); bbm_word_write(hDevice, BBM_BUF_CH2_START, CH2_BUF_START); bbm_word_write(hDevice, BBM_BUF_CH2_END, CH2_BUF_END); bbm_word_write(hDevice, BBM_BUF_CH2_THR, CH2_BUF_THR); bbm_word_write(hDevice, BBM_BUF_CH3_START, CH3_BUF_START); bbm_word_write(hDevice, BBM_BUF_CH3_END, CH3_BUF_END); bbm_word_write(hDevice, BBM_BUF_CH3_THR, CH3_BUF_THR); bbm_word_write(hDevice, BBM_BUF_INT, 0x01ff); bbm_word_write(hDevice, BBM_BUF_ENABLE, 0x01ff); intMask = BBM_MF_INT; bbm_write(hDevice, BBM_COM_INT_ENABLE, intMask); bbm_write(hDevice, BBM_COM_STATUS_ENABLE, intMask); return BBM_OK; }