forked from len0rd/rockbox
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:
parent
9e5846e7fc
commit
02e04585bd
1 changed files with 7 additions and 5 deletions
|
@ -370,19 +370,21 @@ static void si4700_set_frequency(int freq)
|
||||||
int space = SYSCONFIG2_SPACEr(cache[SYSCONFIG2]);
|
int space = SYSCONFIG2_SPACEr(cache[SYSCONFIG2]);
|
||||||
int band = SYSCONFIG2_BANDr(cache[SYSCONFIG2]);
|
int band = SYSCONFIG2_BANDr(cache[SYSCONFIG2]);
|
||||||
int chan = (freq - bands[band]) / spacings[space];
|
int chan = (freq - bands[band]) / spacings[space];
|
||||||
|
int readchan;
|
||||||
|
|
||||||
curr_frequency = freq;
|
curr_frequency = freq;
|
||||||
|
|
||||||
si4700_write_reg(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE);
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* tuning should be done within 60 ms according to the datasheet */
|
/* tuning should be done within 60 ms according to the datasheet */
|
||||||
|
si4700_write_reg(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE);
|
||||||
sleep(HZ * 60 / 1000);
|
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)
|
static int si4700_tuned(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue