diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2010-07-26 20:15:16 +0000 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2010-07-26 20:15:16 +0000 |
commit | adc472bec522e5b8bd34302cb3267cfb9a12d12c (patch) | |
tree | 394ca78314cb2ece1fd5412f8870868e608be813 /firmware/drivers/tuner/rda5802.c | |
parent | 6087d8960328b427f495d46d74664a4b0e32af17 (diff) | |
download | rockbox-adc472bec522e5b8bd34302cb3267cfb9a12d12c.tar.gz rockbox-adc472bec522e5b8bd34302cb3267cfb9a12d12c.zip |
FM tuner region code cleanup - FS #11492 by me.
This removes the tuner-specific region structs and makes each driver use the common one (which is now extended with a deemphasis field)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27579 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/tuner/rda5802.c')
-rw-r--r-- | firmware/drivers/tuner/rda5802.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/firmware/drivers/tuner/rda5802.c b/firmware/drivers/tuner/rda5802.c index a505b6b382..8c78a9f243 100644 --- a/firmware/drivers/tuner/rda5802.c +++ b/firmware/drivers/tuner/rda5802.c | |||
@@ -59,16 +59,16 @@ | |||
59 | #define CHANNEL_BAND (0x3 << 2) | 59 | #define CHANNEL_BAND (0x3 << 2) |
60 | #define CHANNEL_BANDw(x) (((x) << 2) & CHANNEL_BAND) | 60 | #define CHANNEL_BANDw(x) (((x) << 2) & CHANNEL_BAND) |
61 | #define CHANNEL_BANDr(x) (((x) & CHANNEL_BAND) >> 2) | 61 | #define CHANNEL_BANDr(x) (((x) & CHANNEL_BAND) >> 2) |
62 | #define CHANNEL_BAND_875_1080 (0x0 << 2) /* tenth-megahertz */ | 62 | #define CHANNEL_BAND_870_1080 (0x0) /* tenth-megahertz */ |
63 | #define CHANNEL_BAND_760_1080 (0x1 << 2) | 63 | #define CHANNEL_BAND_760_1080 (0x1) |
64 | #define CHANNEL_BAND_760_900 (0x2 << 2) | 64 | #define CHANNEL_BAND_760_900 (0x2) |
65 | #define CHANNEL_BAND_650_760 (0x3 << 2) | 65 | #define CHANNEL_BAND_650_760 (0x3) |
66 | #define CHANNEL_SPACE (0x3 << 0) | 66 | #define CHANNEL_SPACE (0x3 << 0) |
67 | #define CHANNEL_SPACEw(x) (((x) << 0) & CHANNEL_SPACE) | 67 | #define CHANNEL_SPACEw(x) (((x) << 0) & CHANNEL_SPACE) |
68 | #define CHANNEL_SPACEr(x) (((x) & CHANNEL_SPACE) >> 0) | 68 | #define CHANNEL_SPACEr(x) (((x) & CHANNEL_SPACE) >> 0) |
69 | #define CHANNEL_SPACE_100KHZ (0x0 << 0) | 69 | #define CHANNEL_SPACE_100KHZ (0x0) |
70 | #define CHANNEL_SPACE_200KHZ (0x1 << 0) | 70 | #define CHANNEL_SPACE_200KHZ (0x1) |
71 | #define CHANNEL_SPACE_50KHZ (0x2 << 0) | 71 | #define CHANNEL_SPACE_50KHZ (0x2) |
72 | 72 | ||
73 | /* SYSCONFIG1 (0x4) */ | 73 | /* SYSCONFIG1 (0x4) */ |
74 | #define SYSCONFIG1_DE (0x1 << 11) | 74 | #define SYSCONFIG1_DE (0x1 << 11) |
@@ -239,13 +239,16 @@ static int rda5802_tuned(void) | |||
239 | 239 | ||
240 | static void rda5802_set_region(int region) | 240 | static void rda5802_set_region(int region) |
241 | { | 241 | { |
242 | const struct rda5802_region_data *rd = &rda5802_region_data[region]; | 242 | const struct fm_region_data *rd = &fm_region_data[region]; |
243 | uint16_t bandspacing = CHANNEL_BANDw(rd->band) | | 243 | int band = (rd->freq_min == 76000000) ? |
244 | CHANNEL_BAND_760_900 : CHANNEL_BAND_870_1080; | ||
245 | int deemphasis = (rd->deemphasis == 50) ? SYSCONFIG1_DE : 0; | ||
246 | |||
247 | uint16_t bandspacing = CHANNEL_BANDw(band) | | ||
244 | CHANNEL_SPACEw(CHANNEL_SPACE_50KHZ); | 248 | CHANNEL_SPACEw(CHANNEL_SPACE_50KHZ); |
245 | uint16_t oldbs = cache[CHANNEL] & (CHANNEL_BAND | CHANNEL_SPACE); | 249 | uint16_t oldbs = cache[CHANNEL] & (CHANNEL_BAND | CHANNEL_SPACE); |
246 | 250 | ||
247 | rda5802_write_masked(SYSCONFIG1, rd->deemphasis ? SYSCONFIG1_DE : 0, | 251 | rda5802_write_masked(SYSCONFIG1, deemphasis, SYSCONFIG1_DE); |
248 | SYSCONFIG1_DE); | ||
249 | rda5802_write_masked(CHANNEL, bandspacing, CHANNEL_BAND | CHANNEL_SPACE); | 252 | rda5802_write_masked(CHANNEL, bandspacing, CHANNEL_BAND | CHANNEL_SPACE); |
250 | rda5802_write_cache(); | 253 | rda5802_write_cache(); |
251 | 254 | ||