Advertising
- stfm1000 patch for rockbox
- Saturday, May 26th, 2012 at 3:55:20am MDT
- diff --git a/apps/debug_menu.c b/apps/debug_menu.c
- index e611694..bf37b3a 100644
- --- a/apps/debug_menu.c
- +++ b/apps/debug_menu.c
- @@ -1873,6 +1873,11 @@ static int radio_callback(int btn, struct gui_synclist *lists)
- struct stfm1000_dbg_info nfo;
- stfm1000_dbg_info(&nfo);
- simplelist_addline(SIMPLELIST_ADD_LINE, "STFM1000 regs:");
- + simplelist_addline(SIMPLELIST_ADD_LINE,"tune1: 0x%x", nfo.tune1);
- + simplelist_addline(SIMPLELIST_ADD_LINE,"sdnominal: 0x%x", nfo.sdnominal);
- + simplelist_addline(SIMPLELIST_ADD_LINE,"pilottracking: 0x%x", nfo.pilottracking);
- + simplelist_addline(SIMPLELIST_ADD_LINE,"rssi_tone: 0x%x", nfo.rssi_tone);
- + simplelist_addline(SIMPLELIST_ADD_LINE,"pilotcorrection: 0x%x", nfo.pilotcorrection);
- simplelist_addline(SIMPLELIST_ADD_LINE,"chipid: 0x%x", nfo.chipid);
- }
- #endif /* STFM1000 */
- diff --git a/firmware/drivers/tuner/stfm1000-regs.h b/firmware/drivers/tuner/stfm1000-regs.h
- new file mode 100644
- index 0000000..eab0035
- --- /dev/null
- +++ b/firmware/drivers/tuner/stfm1000-regs.h
- @@ -0,0 +1,165 @@
- +/*
- + * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
- + */
- +
- +/*
- + * The code contained herein is licensed under the GNU General Public
- + * License. You may obtain a copy of the GNU General Public License
- + * Version 2 or later at the following locations:
- + *
- + * http://www.opensource.org/licenses/gpl-license.html
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +#ifndef STFM1000_REGS_H
- +#define STFM1000_REGS_H
- +
- +/* registers */
- +#define STFM1000_TUNE1 0x00
- +#define STFM1000_SDNOMINAL 0x04
- +#define STFM1000_PILOTTRACKING 0x08
- +#define STFM1000_INITIALIZATION1 0x10
- +#define STFM1000_INITIALIZATION2 0x14
- +#define STFM1000_INITIALIZATION3 0x18
- +#define STFM1000_INITIALIZATION4 0x1C
- +#define STFM1000_INITIALIZATION5 0x20
- +#define STFM1000_INITIALIZATION6 0x24
- +#define STFM1000_REF 0x28
- +#define STFM1000_LNA 0x2C
- +#define STFM1000_MIXFILT 0x30
- +#define STFM1000_CLK1 0x34
- +#define STFM1000_CLK2 0x38
- +#define STFM1000_ADC 0x3C
- +#define STFM1000_AGC_CONTROL1 0x44
- +#define STFM1000_AGC_CONTROL2 0x48
- +#define STFM1000_DATAPATH 0x5C
- +#define STFM1000_RMS 0x60
- +#define STFM1000_AGC_STAT 0x64
- +#define STFM1000_SIGNALQUALITY 0x68
- +#define STFM1000_DCEST 0x6C
- +#define STFM1000_RSSI_TONE 0x70
- +#define STFM1000_PILOTCORRECTION 0x74
- +#define STFM1000_ATTENTION 0x78
- +#define STFM1000_CLK3 0x7C
- +#define STFM1000_CHIPID 0x80
- +
- +/* number of registers */
- +#define STFM1000_NUM_REGS ((0x80 + 4) / 4)
- +
- +#define STFM1000_FREQUENCY_100KHZ_MIN 758
- +#define STFM1000_FREQUENCY_100KHZ_RANGE 325
- +#define STFM1000_FREQUENCY_100KHZ_MAX (STFM1000_FREQUENCY_100KHZ_MIN + \
- + STFM1000_FREQUENCY_100KHZ_RANGE)
- +
- +#define STFM1000_TUNE1_B2_MIX 0x001C0000
- +#define STFM1000_TUNE1_CICOSR 0x00007E00
- +#define STFM1000_TUNE1_PLL_DIV 0x000001FF
- +
- +#define STFM1000_CHIP_REV_TA1 0x00000001
- +#define STFM1000_CHIP_REV_TA2 0x00000002
- +#define STFM1000_CHIP_REV_TB1 0x00000011
- +#define STFM1000_CHIP_REV_TB2 0x00000012
- +
- +/* DATAPATH bits we use */
- +#define STFM1000_DP_EN 0x01000000
- +#define STFM1000_DB_ACCEPT 0x00010000
- +#define STFM1000_SAI_CLK_DIV_MASK 0x7c
- +#define STFM1000_SAI_CLK_DIV_SHIFT 2
- +#define STFM1000_SAI_CLK_DIV(x) \
- + (((x) << STFM1000_SAI_CLK_DIV_SHIFT) & STFM1000_SAI_CLK_DIV_MASK)
- +#define STFM1000_SAI_EN 0x00000001
- +
- +/* AGC_CONTROL1 bits we use */
- +#define STFM1000_B2_BYPASS_AGC_CTL 0x00004000
- +#define STFM1000_B2_BYPASS_FILT_MASK 0x0000000C
- +#define STFM1000_B2_BYPASS_FILT_SHIFT 2
- +#define STFM1000_B2_BYPASS_FILT(x) \
- + (((x) << STFM1000_B2_BYPASS_FILT_SHIFT) & STFM1000_B2_BYPASS_FILT_MASK)
- +#define STFM1000_B2_LNATH_MASK 0x001F0000
- +#define STFM1000_B2_LNATH_SHIFT 16
- +#define STFM1000_B2_LNATH(x) \
- + (((x) << STFM1000_B2_LNATH_SHIFT) & STFM1000_B2_LNATH_MASK)
- +
- +/* AGC_STAT bits we use */
- +#define STFM1000_AGCOUT_STAT_MASK 0x1F000000
- +#define STFM1000_AGCOUT_STAT_SHIFT 24
- +#define STFM1000_LNA_RMS_MASK 0x00001F00
- +#define STFM1000_LNA_RMS_SHIFT 8
- +
- +/* PILOTTRACKING bits we use */
- +#define STFM1000_B2_PILOTTRACKING_EN 0x00008000
- +#define STFM1000_B2_PILOTLPF_TIMECONSTANT_MASK 0x00000f00
- +#define STFM1000_B2_PILOTLPF_TIMECONSTANT_SHIFT 8
- +#define STFM1000_B2_PILOTLPF_TIMECONSTANT(x) \
- + (((x) << STFM1000_B2_PILOTLPF_TIMECONSTANT_SHIFT) & \
- + STFM1000_B2_PILOTLPF_TIMECONSTANT_MASK)
- +#define STFM1000_B2_PFDSCALE_MASK 0x000000f0
- +#define STFM1000_B2_PFDSCALE_SHIFT 4
- +#define STFM1000_B2_PFDSCALE(x) \
- + (((x) << STFM1000_B2_PFDSCALE_SHIFT) & STFM1000_B2_PFDSCALE_MASK)
- +#define STFM1000_B2_PFDFILTER_SPEEDUP_MASK 0x0000000f
- +#define STFM1000_B2_PFDFILTER_SPEEDUP_SHIFT 0
- +#define STFM1000_B2_PFDFILTER_SPEEDUP(x) \
- + (((x) << STFM1000_B2_PFDFILTER_SPEEDUP_SHIFT) & \
- + STFM1000_B2_PFDFILTER_SPEEDUP_MASK)
- +
- +/* PILOTCORRECTION bits we use */
- +#define STFM1000_PILOTEST_TA2_MASK 0xff000000
- +#define STFM1000_PILOTEST_TA2_SHIFT 24
- +#define STFM1000_PILOTEST_TB2_MASK 0xfe000000
- +#define STFM1000_PILOTEST_TB2_SHIFT 25
- +
- +/* INITIALIZATION1 bits we use */
- +#define STFM1000_B2_BYPASS_FILT_MASK 0x0000000C
- +#define STFM1000_B2_BYPASS_FILT_SHIFT 2
- +#define STFM1000_B2_BYPASS_FILT(x) \
- + (((x) << STFM1000_B2_BYPASS_FILT_SHIFT) & STFM1000_B2_BYPASS_FILT_MASK)
- +
- +/* INITIALIZATION2 bits we use */
- +#define STFM1000_DRI_CLK_EN 0x80000000
- +#define STFM1000_DEEMPH_50_75B 0x00000100
- +#define STFM1000_RDS_ENABLE 0x00100000
- +#define STFM1000_RDS_MIXOFFSET 0x00200000
- +
- +/* INITIALIZATION3 bits we use */
- +#define STFM1000_B2_NEAR_CHAN_MIX_MASK 0x1c000000
- +#define STFM1000_B2_NEAR_CHAN_MIX_SHIFT 26
- +#define STFM1000_B2_NEAR_CHAN_MIX(x) \
- + (((x) << STFM1000_B2_NEAR_CHAN_MIX_SHIFT) & \
- + STFM1000_B2_NEAR_CHAN_MIX_MASK)
- +
- +/* CLK1 bits we use */
- +#define STFM1000_ENABLE_TAPDELAYFIX 0x00000020
- +
- +/* REF bits we use */
- +#define STFM1000_LNA_AMP1_IMPROVE_DISTORTION 0x08000000
- +
- +/* LNA bits we use */
- +#define STFM1000_AMP2_IMPROVE_DISTORTION 0x08000000
- +#define STFM1000_ANTENNA_TUNECAP_MASK 0x001F0000
- +#define STFM1000_ANTENNA_TUNECAP_SHIFT 16
- +#define STFM1000_ANTENNA_TUNECAP(x) \
- + (((x) << STFM1000_ANTENNA_TUNECAP_SHIFT) & \
- + STFM1000_ANTENNA_TUNECAP_MASK)
- +#define STFM1000_IBIAS2_UP 0x00000008
- +#define STFM1000_IBIAS2_DN 0x00000004
- +#define STFM1000_IBIAS1_UP 0x00000002
- +#define STFM1000_IBIAS1_DN 0x00000001
- +#define STFM1000_USEATTEN_MASK 0x00600000
- +#define STFM1000_USEATTEN_SHIFT 21
- +#define STFM1000_USEATTEN(x) \
- + (((x) << STFM1000_USEATTEN_SHIFT) & STFM1000_USEATTEN_MASK)
- +
- +/* SIGNALQUALITY bits we use */
- +#define STFM1000_NEAR_CHAN_AMPLITUDE_MASK 0x0000007F
- +#define STFM1000_NEAR_CHAN_AMPLITUDE_SHIFT 0
- +#define STFM1000_NEAR_CHAN_AMPLITUDE(x) \
- + (((x) << STFM1000_NEAR_CHAN_AMPLITUDE_SHIFT) & \
- + STFM1000_NEAR_CHAN_AMPLITUDE_MASK)
- +
- +/* precalc tables elements */
- +struct stfm1000_tune1 {
- + unsigned int tune1; /* at least 32 bit */
- + unsigned int sdnom;
- +};
- +
- +#endif
- diff --git a/firmware/drivers/tuner/stfm1000-tunetable.c b/firmware/drivers/tuner/stfm1000-tunetable.c
- new file mode 100644
- index 0000000..6cedf97
- --- /dev/null
- +++ b/firmware/drivers/tuner/stfm1000-tunetable.c
- @@ -0,0 +1,330 @@
- +#include "stfm1000-regs.h"
- +
- +const struct stfm1000_tune1
- +stfm1000_tune1_table[STFM1000_FREQUENCY_100KHZ_RANGE] = {
- + [758 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004038, .sdnom = 0x1bb465cd },
- + [759 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004039, .sdnom = 0x1bbdc11f },
- + [760 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000403a, .sdnom = 0x1bc71c71 },
- + [761 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000403b, .sdnom = 0x1bd077c4 },
- + [762 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000403c, .sdnom = 0x1bd9d316 },
- + [763 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000403d, .sdnom = 0x1be32e68 },
- + [764 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000403e, .sdnom = 0x1bec89bb },
- + [765 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004030, .sdnom = 0x1bf5e50d },
- + [766 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004041, .sdnom = 0x1bff405f },
- + [767 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004042, .sdnom = 0x1c089bb2 },
- + [768 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004043, .sdnom = 0x1c11f704 },
- + [769 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004044, .sdnom = 0x1c1b5256 },
- + [770 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004045, .sdnom = 0x1c24ada9 },
- + [771 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004046, .sdnom = 0x1c2e08fb },
- + [772 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004047, .sdnom = 0x1c37644d },
- + [773 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004048, .sdnom = 0x1c40bfa0 },
- + [774 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004049, .sdnom = 0x1c4a1af2 },
- + [775 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000404a, .sdnom = 0x1c537644 },
- + [776 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000404b, .sdnom = 0x1c5cd197 },
- + [777 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000404c, .sdnom = 0x1c662ce9 },
- + [778 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000404d, .sdnom = 0x1c6f883b },
- + [779 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000404e, .sdnom = 0x1c78e38e },
- + [780 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004240, .sdnom = 0x1ba5162f },
- + [781 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004251, .sdnom = 0x1bae28eb },
- + [782 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004252, .sdnom = 0x1bb73ba7 },
- + [783 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004253, .sdnom = 0x1bc04e64 },
- + [784 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004254, .sdnom = 0x1bc96120 },
- + [785 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004255, .sdnom = 0x1bd273dd },
- + [786 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004256, .sdnom = 0x1bdb8699 },
- + [787 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004257, .sdnom = 0x1be49956 },
- + [788 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004258, .sdnom = 0x1bedac12 },
- + [789 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004259, .sdnom = 0x1bf6becf },
- + [790 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000425a, .sdnom = 0x1bffd18b },
- + [791 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000425b, .sdnom = 0x1c08e448 },
- + [792 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000425c, .sdnom = 0x1c11f704 },
- + [793 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000425d, .sdnom = 0x1c1b09c0 },
- + [794 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000425e, .sdnom = 0x1c241c7d },
- + [795 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004250, .sdnom = 0x1c2d2f39 },
- + [796 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004261, .sdnom = 0x1c3641f6 },
- + [797 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004262, .sdnom = 0x1c3f54b2 },
- + [798 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004263, .sdnom = 0x1c48676f },
- + [799 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004264, .sdnom = 0x1c517a2b },
- + [800 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004265, .sdnom = 0x1c5a8ce8 },
- + [801 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004266, .sdnom = 0x1c639fa4 },
- + [802 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004267, .sdnom = 0x1c6cb260 },
- + [803 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004268, .sdnom = 0x1c75c51d },
- + [804 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004469, .sdnom = 0x1ba849f9 },
- + [805 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000446a, .sdnom = 0x1bb11864 },
- + [806 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000446b, .sdnom = 0x1bb9e6d0 },
- + [807 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000446c, .sdnom = 0x1bc2b53b },
- + [808 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000446d, .sdnom = 0x1bcb83a7 },
- + [809 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000446e, .sdnom = 0x1bd45213 },
- + [810 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004460, .sdnom = 0x1bdd207e },
- + [811 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004471, .sdnom = 0x1be5eeea },
- + [812 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004472, .sdnom = 0x1beebd56 },
- + [813 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004473, .sdnom = 0x1bf78bc1 },
- + [814 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004474, .sdnom = 0x1c005a2d },
- + [815 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004475, .sdnom = 0x1c092898 },
- + [816 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004476, .sdnom = 0x1c11f704 },
- + [817 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004477, .sdnom = 0x1c1ac570 },
- + [818 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004478, .sdnom = 0x1c2393db },
- + [819 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004479, .sdnom = 0x1c2c6247 },
- + [820 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000447a, .sdnom = 0x1c3530b2 },
- + [821 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000447b, .sdnom = 0x1c3dff1e },
- + [822 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000447c, .sdnom = 0x1c46cd8a },
- + [823 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000447d, .sdnom = 0x1c4f9bf5 },
- + [824 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000447e, .sdnom = 0x1c586a61 },
- + [825 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004470, .sdnom = 0x1c6138cd },
- + [826 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004481, .sdnom = 0x1c6a0738 },
- + [827 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004482, .sdnom = 0x1c72d5a4 },
- + [828 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004683, .sdnom = 0x1bab4eea },
- + [829 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004684, .sdnom = 0x1bb3dcec },
- + [830 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004685, .sdnom = 0x1bbc6aef },
- + [831 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004686, .sdnom = 0x1bc4f8f1 },
- + [832 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004687, .sdnom = 0x1bcd86f3 },
- + [833 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004688, .sdnom = 0x1bd614f5 },
- + [834 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004689, .sdnom = 0x1bdea2f7 },
- + [835 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000468a, .sdnom = 0x1be730f9 },
- + [836 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000468b, .sdnom = 0x1befbefb },
- + [837 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000468c, .sdnom = 0x1bf84cfe },
- + [838 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000468d, .sdnom = 0x1c00db00 },
- + [839 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000468e, .sdnom = 0x1c096902 },
- + [840 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004680, .sdnom = 0x1c11f704 },
- + [841 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004691, .sdnom = 0x1c1a8506 },
- + [842 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004692, .sdnom = 0x1c231308 },
- + [843 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004693, .sdnom = 0x1c2ba10a },
- + [844 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004694, .sdnom = 0x1c342f0d },
- + [845 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004695, .sdnom = 0x1c3cbd0f },
- + [846 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004696, .sdnom = 0x1c454b11 },
- + [847 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004697, .sdnom = 0x1c4dd913 },
- + [848 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004698, .sdnom = 0x1c566715 },
- + [849 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004699, .sdnom = 0x1c5ef517 },
- + [850 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000469a, .sdnom = 0x1c678319 },
- + [851 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000469b, .sdnom = 0x1c70111c },
- + [852 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000489c, .sdnom = 0x1bae28eb },
- + [853 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000489d, .sdnom = 0x1bb67a18 },
- + [854 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000489e, .sdnom = 0x1bbecb45 },
- + [855 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004890, .sdnom = 0x1bc71c71 },
- + [856 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a1, .sdnom = 0x1bcf6d9e },
- + [857 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a2, .sdnom = 0x1bd7becb },
- + [858 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a3, .sdnom = 0x1be00ff8 },
- + [859 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a4, .sdnom = 0x1be86124 },
- + [860 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a5, .sdnom = 0x1bf0b251 },
- + [861 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a6, .sdnom = 0x1bf9037e },
- + [862 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a7, .sdnom = 0x1c0154aa },
- + [863 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a8, .sdnom = 0x1c09a5d7 },
- + [864 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a9, .sdnom = 0x1c11f704 },
- + [865 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048aa, .sdnom = 0x1c1a4831 },
- + [866 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048ab, .sdnom = 0x1c22995d },
- + [867 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048ac, .sdnom = 0x1c2aea8a },
- + [868 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048ad, .sdnom = 0x1c333bb7 },
- + [869 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048ae, .sdnom = 0x1c3b8ce4 },
- + [870 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048a0, .sdnom = 0x1c43de10 },
- + [871 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048b1, .sdnom = 0x1c4c2f3d },
- + [872 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048b2, .sdnom = 0x1c54806a },
- + [873 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048b3, .sdnom = 0x1c5cd197 },
- + [874 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048b4, .sdnom = 0x1c6522c3 },
- + [875 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x000048b5, .sdnom = 0x1c6d73f0 },
- + [876 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ab6, .sdnom = 0x1bb0db76 },
- + [877 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ab7, .sdnom = 0x1bb8f317 },
- + [878 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ab8, .sdnom = 0x1bc10ab8 },
- + [879 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ab9, .sdnom = 0x1bc9225a },
- + [880 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004aba, .sdnom = 0x1bd139fb },
- + [881 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004abb, .sdnom = 0x1bd9519c },
- + [882 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004abc, .sdnom = 0x1be1693d },
- + [883 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004abd, .sdnom = 0x1be980de },
- + [884 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004abe, .sdnom = 0x1bf1987f },
- + [885 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ab0, .sdnom = 0x1bf9b021 },
- + [886 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac1, .sdnom = 0x1c01c7c2 },
- + [887 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac2, .sdnom = 0x1c09df63 },
- + [888 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac3, .sdnom = 0x1c11f704 },
- + [889 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac4, .sdnom = 0x1c1a0ea5 },
- + [890 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac5, .sdnom = 0x1c222646 },
- + [891 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac6, .sdnom = 0x1c2a3de7 },
- + [892 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac7, .sdnom = 0x1c325589 },
- + [893 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac8, .sdnom = 0x1c3a6d2a },
- + [894 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ac9, .sdnom = 0x1c4284cb },
- + [895 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004aca, .sdnom = 0x1c4a9c6c },
- + [896 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004acb, .sdnom = 0x1c52b40d },
- + [897 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004acc, .sdnom = 0x1c5acbae },
- + [898 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004acd, .sdnom = 0x1c62e350 },
- + [899 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ace, .sdnom = 0x1c6afaf1 },
- + [900 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cc0, .sdnom = 0x1bb369a9 },
- + [901 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd1, .sdnom = 0x1bbb4ac6 },
- + [902 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd2, .sdnom = 0x1bc32be3 },
- + [903 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd3, .sdnom = 0x1bcb0d00 },
- + [904 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd4, .sdnom = 0x1bd2ee1d },
- + [905 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd5, .sdnom = 0x1bdacf3a },
- + [906 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd6, .sdnom = 0x1be2b056 },
- + [907 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd7, .sdnom = 0x1bea9173 },
- + [908 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd8, .sdnom = 0x1bf27290 },
- + [909 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd9, .sdnom = 0x1bfa53ad },
- + [910 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cda, .sdnom = 0x1c0234ca },
- + [911 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cdb, .sdnom = 0x1c0a15e7 },
- + [912 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cdc, .sdnom = 0x1c11f704 },
- + [913 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cdd, .sdnom = 0x1c19d821 },
- + [914 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cde, .sdnom = 0x1c21b93e },
- + [915 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004cd0, .sdnom = 0x1c299a5b },
- + [916 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ce1, .sdnom = 0x1c317b78 },
- + [917 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ce2, .sdnom = 0x1c395c95 },
- + [918 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ce3, .sdnom = 0x1c413db1 },
- + [919 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ce4, .sdnom = 0x1c491ece },
- + [920 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ce5, .sdnom = 0x1c50ffeb },
- + [921 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ce6, .sdnom = 0x1c58e108 },
- + [922 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ce7, .sdnom = 0x1c60c225 },
- + [923 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ce8, .sdnom = 0x1c68a342 },
- + [924 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ee9, .sdnom = 0x1bb5d64f },
- + [925 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004eea, .sdnom = 0x1bbd83b4 },
- + [926 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004eeb, .sdnom = 0x1bc53118 },
- + [927 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004eec, .sdnom = 0x1bccde7d },
- + [928 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004eed, .sdnom = 0x1bd48be1 },
- + [929 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004eee, .sdnom = 0x1bdc3945 },
- + [930 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ee0, .sdnom = 0x1be3e6aa },
- + [931 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef1, .sdnom = 0x1beb940e },
- + [932 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef2, .sdnom = 0x1bf34172 },
- + [933 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef3, .sdnom = 0x1bfaeed7 },
- + [934 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef4, .sdnom = 0x1c029c3b },
- + [935 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef5, .sdnom = 0x1c0a49a0 },
- + [936 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef6, .sdnom = 0x1c11f704 },
- + [937 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef7, .sdnom = 0x1c19a468 },
- + [938 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef8, .sdnom = 0x1c2151cd },
- + [939 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef9, .sdnom = 0x1c28ff31 },
- + [940 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004efa, .sdnom = 0x1c30ac96 },
- + [941 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004efb, .sdnom = 0x1c3859fa },
- + [942 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004efc, .sdnom = 0x1c40075e },
- + [943 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004efd, .sdnom = 0x1c47b4c3 },
- + [944 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004efe, .sdnom = 0x1c4f6227 },
- + [945 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004ef0, .sdnom = 0x1c570f8b },
- + [946 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004f01, .sdnom = 0x1c5ebcf0 },
- + [947 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00004f02, .sdnom = 0x1c666a54 },
- + [948 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005103, .sdnom = 0x1bb823ee },
- + [949 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005104, .sdnom = 0x1bbfa02f },
- + [950 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005105, .sdnom = 0x1bc71c71 },
- + [951 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005106, .sdnom = 0x1bce98b3 },
- + [952 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005107, .sdnom = 0x1bd614f5 },
- + [953 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005108, .sdnom = 0x1bdd9137 },
- + [954 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005109, .sdnom = 0x1be50d79 },
- + [955 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000510a, .sdnom = 0x1bec89bb },
- + [956 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000510b, .sdnom = 0x1bf405fd },
- + [957 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000510c, .sdnom = 0x1bfb823e },
- + [958 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000510d, .sdnom = 0x1c02fe80 },
- + [959 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000510e, .sdnom = 0x1c0a7ac2 },
- + [960 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005100, .sdnom = 0x1c11f704 },
- + [961 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005111, .sdnom = 0x1c197346 },
- + [962 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005112, .sdnom = 0x1c20ef88 },
- + [963 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005113, .sdnom = 0x1c286bca },
- + [964 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005114, .sdnom = 0x1c2fe80b },
- + [965 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005115, .sdnom = 0x1c37644d },
- + [966 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005116, .sdnom = 0x1c3ee08f },
- + [967 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005117, .sdnom = 0x1c465cd1 },
- + [968 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005118, .sdnom = 0x1c4dd913 },
- + [969 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005119, .sdnom = 0x1c555555 },
- + [970 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000511a, .sdnom = 0x1c5cd197 },
- + [971 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000511b, .sdnom = 0x1c644dd9 },
- + [972 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000531c, .sdnom = 0x1bba54c9 },
- + [973 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000531d, .sdnom = 0x1bc1a24e },
- + [974 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000531e, .sdnom = 0x1bc8efd3 },
- + [975 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005310, .sdnom = 0x1bd03d57 },
- + [976 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005321, .sdnom = 0x1bd78adc },
- + [977 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005322, .sdnom = 0x1bded861 },
- + [978 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005323, .sdnom = 0x1be625e6 },
- + [979 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005324, .sdnom = 0x1bed736b },
- + [980 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005325, .sdnom = 0x1bf4c0f0 },
- + [981 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005326, .sdnom = 0x1bfc0e75 },
- + [982 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005327, .sdnom = 0x1c035bfa },
- + [983 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005328, .sdnom = 0x1c0aa97f },
- + [984 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005329, .sdnom = 0x1c11f704 },
- + [985 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000532a, .sdnom = 0x1c194489 },
- + [986 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000532b, .sdnom = 0x1c20920e },
- + [987 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000532c, .sdnom = 0x1c27df93 },
- + [988 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000532d, .sdnom = 0x1c2f2d18 },
- + [989 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000532e, .sdnom = 0x1c367a9d },
- + [990 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005320, .sdnom = 0x1c3dc822 },
- + [991 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005331, .sdnom = 0x1c4515a7 },
- + [992 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005332, .sdnom = 0x1c4c632c },
- + [993 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005333, .sdnom = 0x1c53b0b1 },
- + [994 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005334, .sdnom = 0x1c5afe35 },
- + [995 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005335, .sdnom = 0x1c624bba },
- + [996 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005536, .sdnom = 0x1bbc6aef },
- + [997 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005537, .sdnom = 0x1bc38bf0 },
- + [998 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005538, .sdnom = 0x1bcaacf2 },
- + [999 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005539, .sdnom = 0x1bd1cdf4 },
- + [1000 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000553a, .sdnom = 0x1bd8eef6 },
- + [1001 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000553b, .sdnom = 0x1be00ff8 },
- + [1002 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000553c, .sdnom = 0x1be730f9 },
- + [1003 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000553d, .sdnom = 0x1bee51fb },
- + [1004 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000553e, .sdnom = 0x1bf572fd },
- + [1005 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005530, .sdnom = 0x1bfc93ff },
- + [1006 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005541, .sdnom = 0x1c03b500 },
- + [1007 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005542, .sdnom = 0x1c0ad602 },
- + [1008 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005543, .sdnom = 0x1c11f704 },
- + [1009 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005544, .sdnom = 0x1c191806 },
- + [1010 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005545, .sdnom = 0x1c203908 },
- + [1011 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005546, .sdnom = 0x1c275a09 },
- + [1012 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005547, .sdnom = 0x1c2e7b0b },
- + [1013 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005548, .sdnom = 0x1c359c0d },
- + [1014 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005549, .sdnom = 0x1c3cbd0f },
- + [1015 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000554a, .sdnom = 0x1c43de10 },
- + [1016 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000554b, .sdnom = 0x1c4aff12 },
- + [1017 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000554c, .sdnom = 0x1c522014 },
- + [1018 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000554d, .sdnom = 0x1c594116 },
- + [1019 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000554e, .sdnom = 0x1c606218 },
- + [1020 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005740, .sdnom = 0x1bbe683c },
- + [1021 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005751, .sdnom = 0x1bc55ecd },
- + [1022 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005752, .sdnom = 0x1bcc555e },
- + [1023 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005753, .sdnom = 0x1bd34bee },
- + [1024 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005754, .sdnom = 0x1bda427f },
- + [1025 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005755, .sdnom = 0x1be13910 },
- + [1026 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005756, .sdnom = 0x1be82fa0 },
- + [1027 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005757, .sdnom = 0x1bef2631 },
- + [1028 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005758, .sdnom = 0x1bf61cc1 },
- + [1029 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005759, .sdnom = 0x1bfd1352 },
- + [1030 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000575a, .sdnom = 0x1c0409e3 },
- + [1031 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000575b, .sdnom = 0x1c0b0073 },
- + [1032 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000575c, .sdnom = 0x1c11f704 },
- + [1033 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000575d, .sdnom = 0x1c18ed95 },
- + [1034 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000575e, .sdnom = 0x1c1fe425 },
- + [1035 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005750, .sdnom = 0x1c26dab6 },
- + [1036 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005761, .sdnom = 0x1c2dd146 },
- + [1037 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005762, .sdnom = 0x1c34c7d7 },
- + [1038 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005763, .sdnom = 0x1c3bbe68 },
- + [1039 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005764, .sdnom = 0x1c42b4f8 },
- + [1040 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005765, .sdnom = 0x1c49ab89 },
- + [1041 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005766, .sdnom = 0x1c50a21a },
- + [1042 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005767, .sdnom = 0x1c5798aa },
- + [1043 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005768, .sdnom = 0x1c5e8f3b },
- + [1044 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005969, .sdnom = 0x1bc04e64 },
- + [1045 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000596a, .sdnom = 0x1bc71c71 },
- + [1046 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000596b, .sdnom = 0x1bcdea7f },
- + [1047 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000596c, .sdnom = 0x1bd4b88c },
- + [1048 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000596d, .sdnom = 0x1bdb8699 },
- + [1049 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000596e, .sdnom = 0x1be254a7 },
- + [1050 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005960, .sdnom = 0x1be922b4 },
- + [1051 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005971, .sdnom = 0x1beff0c1 },
- + [1052 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005972, .sdnom = 0x1bf6becf },
- + [1053 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005973, .sdnom = 0x1bfd8cdc },
- + [1054 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005974, .sdnom = 0x1c045ae9 },
- + [1055 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005975, .sdnom = 0x1c0b28f7 },
- + [1056 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005976, .sdnom = 0x1c11f704 },
- + [1057 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005977, .sdnom = 0x1c18c511 },
- + [1058 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005978, .sdnom = 0x1c1f931f },
- + [1059 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005979, .sdnom = 0x1c26612c },
- + [1060 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000597a, .sdnom = 0x1c2d2f39 },
- + [1061 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000597b, .sdnom = 0x1c33fd47 },
- + [1062 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000597c, .sdnom = 0x1c3acb54 },
- + [1063 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000597d, .sdnom = 0x1c419961 },
- + [1064 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x0000597e, .sdnom = 0x1c48676f },
- + [1065 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005970, .sdnom = 0x1c4f357c },
- + [1066 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005981, .sdnom = 0x1c560389 },
- + [1067 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005982, .sdnom = 0x1c5cd197 },
- + [1068 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b83, .sdnom = 0x1bc21ef0 },
- + [1069 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b84, .sdnom = 0x1bc8c647 },
- + [1070 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b85, .sdnom = 0x1bcf6d9e },
- + [1071 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b86, .sdnom = 0x1bd614f5 },
- + [1072 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b87, .sdnom = 0x1bdcbc4c },
- + [1073 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b88, .sdnom = 0x1be363a3 },
- + [1074 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b89, .sdnom = 0x1bea0afa },
- + [1075 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b8a, .sdnom = 0x1bf0b251 },
- + [1076 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b8b, .sdnom = 0x1bf759a8 },
- + [1077 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b8c, .sdnom = 0x1bfe00ff },
- + [1078 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b8d, .sdnom = 0x1c04a856 },
- + [1079 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b8e, .sdnom = 0x1c0b4fad },
- + [1080 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b80, .sdnom = 0x1c11f704 },
- + [1081 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b91, .sdnom = 0x1c189e5b },
- + [1082 - STFM1000_FREQUENCY_100KHZ_MIN] = { .tune1 = 0x00005b92, .sdnom = 0x1c1f45b2 },
- +};
- diff --git a/firmware/drivers/tuner/stfm1000.c b/firmware/drivers/tuner/stfm1000.c
- index 8626d4e..9c6c81c 100644
- --- a/firmware/drivers/tuner/stfm1000.c
- +++ b/firmware/drivers/tuner/stfm1000.c
- @@ -30,12 +30,17 @@
- #include "fmradio.h"
- #include "fmradio_i2c.h" /* physical interface driver */
- #include "stfm1000.h"
- +#include "stfm1000-regs.h"
- -#define STFM100_I2C_ADDR 0xc0
- +#include "stfm1000-tunetable.c"
- +
- +static int rev_id;
- +static int sdnominal_pivot;
- +static bool tuner_present = false;
- -#define CHIPID 0x80
- +#define STFM100_I2C_ADDR 0xc0
- -static int stfm1000_read_reg(uint8_t reg, uint32_t *val)
- +static int stfm1000_read(uint8_t reg, uint32_t *val)
- {
- uint8_t buf[4];
- buf[0] = reg;
- @@ -46,7 +51,7 @@ static int stfm1000_read_reg(uint8_t reg, uint32_t *val)
- return ret;
- }
- -static int stfm1000_write_reg(uint8_t reg, uint32_t val)
- +static int stfm1000_write(uint8_t reg, uint32_t val)
- {
- uint8_t buf[5];
- buf[0] = reg;
- @@ -55,25 +60,466 @@ static int stfm1000_write_reg(uint8_t reg, uint32_t val)
- return fmradio_i2c_write(STFM100_I2C_ADDR, buf, 5);
- }
- +static int stfm1000_write_masked(int reg, int val, int mask)
- +{
- + uint32_t tmp;
- +
- + stfm1000_read(reg, &tmp);
- + stfm1000_write(reg, (val & mask) | (tmp & ~mask));
- + return 0;
- +}
- +
- +static int stfm1000_set_bits(int reg, uint32_t value)
- +{
- + return stfm1000_write_masked(reg, value, value);
- +}
- +
- +static int stfm1000_clear_bits(int reg, uint32_t value)
- +{
- + return stfm1000_write_masked(reg, ~value, value);
- +}
- +
- +static void stfm1000_set_region(int region)
- +{
- + const struct fm_region_data *rd = &fm_region_data[region];
- +
- + if (rd->deemphasis == 50) {
- + stfm1000_set_bits(STFM1000_INITIALIZATION2, STFM1000_DEEMPH_50_75B);
- + } else {
- + stfm1000_clear_bits(STFM1000_INITIALIZATION2, STFM1000_DEEMPH_50_75B);
- + }
- +}
- +
- +
- +static int stfm1000_set_frequency(int freq)
- +{
- + uint32_t freq100 = freq / 100;
- + int tune_cap;
- + int i2s_clock;
- + int mix_reg;
- + int if_freq, fe_freq;
- + uint32_t tune1, sdnom, agc1;
- + const struct stfm1000_tune1 *tp;
- + int ret;
- +
- + if_freq = 0;
- + mix_reg = 1;
- + switch (mix_reg) {
- + case 0: if_freq = -2; break;
- + case 1: if_freq = -1; break;
- + case 2: if_freq = 0; break;
- + case 3: if_freq = 1; break;
- + case 4: if_freq = 2; break;
- + }
- +
- + fe_freq = freq100 + if_freq;
- +
- + /* clamp into range */
- + if (fe_freq < STFM1000_FREQUENCY_100KHZ_MIN)
- + fe_freq = STFM1000_FREQUENCY_100KHZ_MIN;
- + else if (fe_freq > STFM1000_FREQUENCY_100KHZ_MAX)
- + fe_freq = STFM1000_FREQUENCY_100KHZ_MAX;
- +
- + tp = &stfm1000_tune1_table[fe_freq - STFM1000_FREQUENCY_100KHZ_MIN];
- +
- + /* bits [14:0], [20:18] */
- + tune1 = (tp->tune1 & 0x7fff) | (mix_reg << 18);
- + sdnom = tp->sdnom;
- +
- + agc1 = (rev_id == STFM1000_CHIP_REV_TA2) ? 0x0400 : 0x2200;
- +
- + ret = stfm1000_write_masked(STFM1000_AGC_CONTROL1, agc1, 0x3f00);
- + if (ret != 0)
- + goto err;
- +
- + ret = stfm1000_write_masked(STFM1000_TUNE1, tune1, 0xFFFF7FFF); /* do not set bit-15 */
- + if (ret != 0)
- + goto err;
- +
- + /* keep this around */
- + sdnominal_pivot = sdnom;
- +
- + ret = stfm1000_write(STFM1000_SDNOMINAL, sdnom);
- + if (ret != 0)
- + goto err;
- +
- + /* fix for seek-not-stopping on alternate tunings */
- + ret = stfm1000_set_bits(STFM1000_DATAPATH, STFM1000_DB_ACCEPT);
- + if (ret != 0)
- + goto err;
- +
- + ret = stfm1000_clear_bits(STFM1000_DATAPATH, STFM1000_DB_ACCEPT);
- + if (ret != 0)
- + goto err;
- +
- + ret = stfm1000_set_bits(STFM1000_INITIALIZATION2, STFM1000_DRI_CLK_EN);
- + if (ret != 0)
- + goto err;
- +
- + /* 6MHz spur fix */
- + if ((freq100 >= 778 && freq100 <= 782) ||
- + (freq100 >= 838 && freq100 <= 842) ||
- + (freq100 >= 898 && freq100 <= 902) ||
- + (freq100 >= 958 && freq100 <= 962) ||
- + (freq100 >= 1018 && freq100 <= 1022) ||
- + (freq100 >= 1078 && freq100 <= 1080))
- + i2s_clock = 5; /* 4.8MHz */
- + else
- + i2s_clock = 4;
- +
- + ret = stfm1000_write_masked(STFM1000_DATAPATH,
- + STFM1000_SAI_CLK_DIV(i2s_clock), STFM1000_SAI_CLK_DIV_MASK);
- + if (ret != 0)
- + goto err;
- +
- + ret = stfm1000_set_bits(STFM1000_INITIALIZATION2, STFM1000_DRI_CLK_EN);
- + if (ret != 0)
- + goto err;
- +
- + if (tune1 & 0xf)
- + ret = stfm1000_set_bits(STFM1000_CLK1, STFM1000_ENABLE_TAPDELAYFIX);
- + else
- + ret = stfm1000_clear_bits(STFM1000_CLK1, STFM1000_ENABLE_TAPDELAYFIX);
- +
- + if (ret != 0)
- + goto err;
- +
- + tune_cap = 4744806 - (4587 * freq100);
- + if (tune_cap < 4)
- + tune_cap = 4;
- + ret = stfm1000_write_masked(STFM1000_LNA, STFM1000_ANTENNA_TUNECAP(tune_cap),
- + STFM1000_ANTENNA_TUNECAP_MASK);
- + if (ret != 0)
- + goto err;
- +
- + return 0;
- +err:
- + return -1;
- +}
- +
- void stfm1000_dbg_info(struct stfm1000_dbg_info *nfo)
- {
- memset(nfo, 0, sizeof(struct stfm1000_dbg_info));
- - stfm1000_read_reg(CHIPID, &nfo->chipid);
- + stfm1000_read(STFM1000_TUNE1, &nfo->tune1);
- + stfm1000_read(STFM1000_SDNOMINAL, &nfo->sdnominal);
- + stfm1000_read(STFM1000_PILOTTRACKING, &nfo->pilottracking);
- + stfm1000_read(STFM1000_RSSI_TONE, &nfo->rssi_tone);
- + stfm1000_read(STFM1000_PILOTCORRECTION, &nfo->pilotcorrection);
- + stfm1000_read(STFM1000_CHIPID, &nfo->chipid);
- +}
- +
- +static void stfm1000_dp_enable(bool enable)
- +{
- + if (enable) {
- + stfm1000_set_bits(STFM1000_DATAPATH, STFM1000_DP_EN);
- + sleep(1);
- + stfm1000_set_bits(STFM1000_DATAPATH, STFM1000_DB_ACCEPT);
- + stfm1000_clear_bits(STFM1000_AGC_CONTROL1, STFM1000_B2_BYPASS_AGC_CTL);
- + stfm1000_clear_bits(STFM1000_DATAPATH, STFM1000_DB_ACCEPT);
- + } else {
- + stfm1000_set_bits(STFM1000_DATAPATH, STFM1000_DB_ACCEPT);
- + stfm1000_clear_bits(STFM1000_DATAPATH, STFM1000_DP_EN);
- + stfm1000_set_bits(STFM1000_AGC_CONTROL1, STFM1000_B2_BYPASS_AGC_CTL);
- + stfm1000_clear_bits(STFM1000_PILOTTRACKING, STFM1000_B2_PILOTTRACKING_EN);
- + stfm1000_clear_bits(STFM1000_DATAPATH, STFM1000_DB_ACCEPT);
- + }
- +}
- +
- +static void stfm_dri_enable(bool enable)
- +{
- + if (enable) {
- + stfm1000_set_bits(STFM1000_DATAPATH, STFM1000_SAI_EN);
- + } else {
- + stfm1000_clear_bits(STFM1000_DATAPATH, STFM1000_SAI_EN);
- + }
- +}
- +
- +static int stfm1000_set_channel_filter(void)
- +{
- + int ret;
- + int bypass_setting;
- +
- + /* get near channel amplitude */
- + ret = stfm1000_write_masked(STFM1000_INITIALIZATION3,
- + STFM1000_B2_NEAR_CHAN_MIX(0x01),
- + STFM1000_B2_NEAR_CHAN_MIX_MASK);
- + if (ret != 0)
- + return ret;
- +
- + sleep(10 * HZ / 1000); /* wait for the signal quality to settle */
- +
- + bypass_setting = 0;
- +
- +#if 0
- + ret = stfm1000_read(STFM1000_SIGNALQUALITY, &tmp);
- + if (ret != 0)
- + return ret;
- +
- + sig_qual = (tmp & STFM1000_NEAR_CHAN_AMPLITUDE_MASK) >>
- + STFM1000_NEAR_CHAN_AMPLITUDE_SHIFT;
- +
- + /* check near channel amplitude vs threshold */
- + if (sig_qual < stfm1000->adj_chan_th) {
- + /* get near channel amplitude again */
- + ret = stfm1000_write_masked(stfm1000, STFM1000_INITIALIZATION3,
- + STFM1000_B2_NEAR_CHAN_MIX(0x05),
- + STFM1000_B2_NEAR_CHAN_MIX_MASK);
- + if (ret != 0)
- + return ret;
- +
- + msleep(10); /* wait for the signal quality to settle */
- +
- + ret = stfm1000_read(stfm1000, STFM1000_SIGNALQUALITY, &tmp);
- + if (ret != 0)
- + return ret;
- +
- + sig_qual = (tmp & STFM1000_NEAR_CHAN_AMPLITUDE_MASK) >>
- + STFM1000_NEAR_CHAN_AMPLITUDE_SHIFT;
- +
- + if (sig_qual < stfm1000->adj_chan_th)
- + bypass_setting = 2;
- + }
- +#endif
- + /* set filter settings */
- + ret = stfm1000_write_masked(STFM1000_INITIALIZATION1,
- + STFM1000_B2_BYPASS_FILT(bypass_setting),
- + STFM1000_B2_BYPASS_FILT_MASK);
- + if (ret != 0)
- + return ret;
- +
- + return 0;
- +}
- +
- +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x)))
- +
- +static int stfm1000_track_pilot(void)
- +{
- + static const struct {
- + int delay;
- + uint32_t value;
- + } track_table[] = {
- + { .delay = 10, .value = 0x81b6 },
- + { .delay = 6, .value = 0x82a5 },
- + { .delay = 6, .value = 0x8395 },
- + { .delay = 8, .value = 0x8474 },
- + { .delay = 20, .value = 0x8535 },
- + { .delay = 50, .value = 0x8632 },
- + { .delay = 0, .value = 0x8810 },
- + };
- + int i;
- + int ret;
- +
- + for (i = 0; i < ARRAY_SIZE(track_table); i++) {
- + ret = stfm1000_write(STFM1000_PILOTTRACKING, track_table[i].value);
- + if (ret != 0)
- + return ret;
- +
- + if (i < ARRAY_SIZE(track_table) - 1) /* last one no delay */
- + sleep(track_table[i].delay * HZ / 1000);
- + }
- +
- + return 0;
- +}
- +
- +static int stfm1000_optimise_channel(void)
- +{
- + int ret;
- +
- + ret = stfm1000_set_bits(STFM1000_DATAPATH, STFM1000_DB_ACCEPT);
- + if (ret != 0)
- + return ret;
- +
- + ret = stfm1000_write(STFM1000_PILOTTRACKING,
- + STFM1000_B2_PILOTTRACKING_EN |
- + STFM1000_B2_PILOTLPF_TIMECONSTANT(0x01) |
- + STFM1000_B2_PFDSCALE(0x0B) |
- + STFM1000_B2_PFDFILTER_SPEEDUP(0x06)); /* 0x000081B6 */
- + if (ret != 0)
- + return ret;
- +
- + ret = stfm1000_set_channel_filter();
- + if (ret != 0)
- + return ret;
- +#if 0
- + ret = SD_Look_For_Pilot(stfm1000);
- + if (ret != 0)
- + return ret;
- +#endif
- +// if (stfm1000->pilot_present) {
- + ret = stfm1000_track_pilot();
- + if (ret != 0)
- + return ret;
- +// }
- +
- + ret = stfm1000_clear_bits(STFM1000_DATAPATH, STFM1000_DB_ACCEPT);
- + if (ret != 0)
- + return ret;
- +
- + return 0;
- }
- void stfm1000_init(void)
- {
- + uint32_t val;
- +
- + /* get revision id */
- + stfm1000_read(STFM1000_CHIPID, &val);
- + rev_id = val & 0xFF;
- +
- + /* send TB2 init sequence */
- + stfm1000_write(STFM1000_REF, 0x00200000);
- + sleep(20 * HZ / 1000);
- + stfm1000_write(STFM1000_DATAPATH, 0x00010210);
- + stfm1000_write(STFM1000_TUNE1, 0x0004CF01);
- + stfm1000_write(STFM1000_SDNOMINAL, 0x1C5EBCF0);
- + stfm1000_write(STFM1000_PILOTTRACKING, 0x000001B6);
- + stfm1000_write(STFM1000_INITIALIZATION1, 0x9fb80008);
- + stfm1000_write(STFM1000_INITIALIZATION2, 0x8516e444 | STFM1000_DEEMPH_50_75B);
- + stfm1000_write(STFM1000_INITIALIZATION3, 0x1402190b);
- + stfm1000_write(STFM1000_INITIALIZATION4, 0x525bf052);
- + stfm1000_write(STFM1000_INITIALIZATION5, 0x1000d106);
- + stfm1000_write(STFM1000_INITIALIZATION6, 0x000062cb);
- + stfm1000_write(STFM1000_AGC_CONTROL1, 0x1BCB2202);
- + stfm1000_write(STFM1000_AGC_CONTROL2, 0x000020F0);
- + stfm1000_write(STFM1000_CLK1, 0x10000000);
- + stfm1000_write(STFM1000_CLK1, 0x20000000);
- + stfm1000_write(STFM1000_CLK1, 0x00000000);
- + stfm1000_write(STFM1000_CLK2, 0x7f000000);
- + stfm1000_write(STFM1000_REF, 0x00B8222D);
- + stfm1000_write(STFM1000_CLK1, 0x30000000);
- + stfm1000_write(STFM1000_CLK1, 0x30002000);
- + stfm1000_write(STFM1000_CLK1, 0x10002000);
- + stfm1000_write(STFM1000_LNA, 0x0D080009);
- + sleep(10 * HZ / 1000);
- + stfm1000_write(STFM1000_MIXFILT, 0x00008000);
- + stfm1000_write(STFM1000_MIXFILT, 0x00000000);
- + stfm1000_write(STFM1000_MIXFILT, 0x00007205);
- + stfm1000_write(STFM1000_ADC, 0x001B3282);
- + stfm1000_write(STFM1000_ATTENTION, 0x0000003F);
- +
- + stfm1000_dp_enable(true);
- + stfm_dri_enable(true);
- +}
- +
- +static void stfm1000_sleep(bool sleep)
- +{
- + (void)sleep;
- + /* no implementation yet */
- +}
- +
- +static int stfm1000_rssi(void)
- +{
- + uint32_t rssi_dc_est;
- + int rssi_mantissa, rssi_exponent, rssi_decoded;
- + int prssi;
- + int rssi_log;
- +
- + stfm1000_read(STFM1000_RSSI_TONE, &rssi_dc_est);
- +
- + rssi_mantissa = (rssi_dc_est & 0xffe0) >> 5; /* 11Msb */
- + rssi_exponent = rssi_dc_est & 0x001f; /* 5 lsb */
- + rssi_decoded = (uint32_t)rssi_mantissa << rssi_exponent;
- +
- + /* Convert Rsst to 10log(Rssi) */
- + for (prssi = 20; prssi > 0; prssi--)
- + if (rssi_decoded >= (1 << prssi))
- + break;
- +
- + rssi_log = (3 * rssi_decoded >> prssi) + (3 * prssi - 3);
- +
- + /* clamp to positive */
- + if (rssi_log < 0)
- + rssi_log = 0;
- +
- + /* Compensate for errors in truncation/approximation by adding 1 */
- + rssi_log++;
- +
- + return rssi_log;
- +}
- +
- +static bool stfm1000_tuned(void)
- +{
- + uint32_t tmp;
- + int pilot;
- +
- + /* get pilot */
- + stfm1000_read(STFM1000_PILOTCORRECTION, &tmp);
- + pilot = (tmp & STFM1000_PILOTEST_TB2_MASK) >> STFM1000_PILOTEST_TB2_SHIFT;
- +
- + /* check pilot and signal strength */
- + return (pilot >= 0x1E) && (pilot < 0x80) && (stfm1000_rssi() > 28);
- }
- int stfm1000_set(int setting, int value)
- {
- - (void) setting;
- - (void) value;
- - return -1;
- + int val = 0;
- +
- + switch (setting) {
- + case RADIO_SLEEP:
- + stfm1000_sleep(value);
- + break;
- +
- + case RADIO_FREQUENCY:
- + stfm1000_set_frequency(value / 1000);
- + stfm1000_optimise_channel();
- + break;
- +
- + case RADIO_SCAN_FREQUENCY:
- + stfm1000_set_frequency(value / 1000);
- + val = stfm1000_tuned();
- + break;
- +
- + case RADIO_MUTE:
- + /* no implementation yet */
- + break;
- +
- + case RADIO_REGION:
- + stfm1000_set_region(value);
- + break;
- +
- + case RADIO_FORCE_MONO:
- + /* no implementation yet */
- + break;
- +
- + default:
- + val = -1;
- + break;
- + }
- +
- + return val;
- }
- int stfm1000_get(int setting)
- {
- - (void) setting;
- - return -1;
- -}
- \ No newline at end of file
- + int val = -1; /* default for unsupported query */
- +
- + switch (setting) {
- +
- + case RADIO_PRESENT:
- + val = true;
- + break;
- +
- + case RADIO_TUNED:
- + val = stfm1000_tuned();
- + break;
- +
- + case RADIO_STEREO:
- + val = 0;
- + break;
- +#if 1
- + case RADIO_RSSI:
- + val = stfm1000_rssi();
- + break;
- +
- + case RADIO_RSSI_MIN:
- + val = 0;
- + break;
- +
- + case RADIO_RSSI_MAX:
- + val = 70;
- + break;
- +#endif
- + }
- +
- + return val;
- +}
- diff --git a/firmware/export/stfm1000.h b/firmware/export/stfm1000.h
- index 6c01d63..62a1dd9 100644
- --- a/firmware/export/stfm1000.h
- +++ b/firmware/export/stfm1000.h
- @@ -31,6 +31,11 @@
- struct stfm1000_dbg_info
- {
- + uint32_t tune1;
- + uint32_t sdnominal;
- + uint32_t pilottracking;
- + uint32_t rssi_tone;
- + uint32_t pilotcorrection;
- uint32_t chipid;
- };
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.