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/si4700.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/si4700.c')
-rw-r--r-- | firmware/drivers/tuner/si4700.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/firmware/drivers/tuner/si4700.c b/firmware/drivers/tuner/si4700.c index f9b26be6f8..ea88dc9835 100644 --- a/firmware/drivers/tuner/si4700.c +++ b/firmware/drivers/tuner/si4700.c | |||
@@ -400,14 +400,17 @@ static int si4700_tuned(void) | |||
400 | 400 | ||
401 | static void si4700_set_region(int region) | 401 | static void si4700_set_region(int region) |
402 | { | 402 | { |
403 | const struct si4700_region_data *rd = &si4700_region_data[region]; | 403 | const struct fm_region_data *rd = &fm_region_data[region]; |
404 | uint16_t bandspacing = SYSCONFIG2_BANDw(rd->band) | | 404 | |
405 | SYSCONFIG2_SPACEw(rd->spacing); | 405 | int band = (rd->freq_min == 76000000) ? 2 : 0; |
406 | int spacing = (100000 / rd->freq_step); | ||
407 | int deemphasis = (rd->deemphasis == 50) ? SYSCONFIG1_DE : 0; | ||
408 | |||
409 | uint16_t bandspacing = SYSCONFIG2_BANDw(band) | | ||
410 | SYSCONFIG2_SPACEw(spacing); | ||
406 | uint16_t oldbs = cache[SYSCONFIG2] & (SYSCONFIG2_BAND | SYSCONFIG2_SPACE); | 411 | uint16_t oldbs = cache[SYSCONFIG2] & (SYSCONFIG2_BAND | SYSCONFIG2_SPACE); |
407 | 412 | ||
408 | si4700_write_masked(SYSCONFIG1, | 413 | si4700_write_masked(SYSCONFIG1, deemphasis, SYSCONFIG1_DE); |
409 | rd->deemphasis ? SYSCONFIG1_DE : 0, | ||
410 | SYSCONFIG1_DE); | ||
411 | si4700_write_masked(SYSCONFIG2, bandspacing, | 414 | si4700_write_masked(SYSCONFIG2, bandspacing, |
412 | SYSCONFIG2_BAND | SYSCONFIG2_SPACE); | 415 | SYSCONFIG2_BAND | SYSCONFIG2_SPACE); |
413 | 416 | ||