Fix FS #10474 - FM tuner on Gigabeat S fails to tune last frequency on start

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27018 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2010-06-21 16:45:15 +00:00
parent 9e5846e7fc
commit 02e04585bd

View file

@ -370,19 +370,21 @@ static void si4700_set_frequency(int freq)
int space = SYSCONFIG2_SPACEr(cache[SYSCONFIG2]);
int band = SYSCONFIG2_BANDr(cache[SYSCONFIG2]);
int chan = (freq - bands[band]) / spacings[space];
int readchan;
curr_frequency = freq;
si4700_write_reg(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE);
do
{
/* tuning should be done within 60 ms according to the datasheet */
si4700_write_reg(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE);
sleep(HZ * 60 / 1000);
}
while ((si4700_read_reg(STATUSRSSI) & STATUSRSSI_STC) == 0); /* STC high? */
si4700_write_clear(CHANNEL, CHANNEL_TUNE); /* Set TUNE low */
/* get tune result */
readchan = si4700_read_reg(READCHAN) & READCHAN_READCHAN;
si4700_write_clear(CHANNEL, CHANNEL_TUNE);
} while (!((cache[STATUSRSSI] & STATUSRSSI_STC) && (readchan == chan)));
}
static int si4700_tuned(void)