Guest User

Untitled

a guest
Nov 20th, 2011
125
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/firmware/drivers/tuner/si4700.c b/firmware/drivers/tuner/si4700.c
  2. index 848d25e..398c4ae 100644
  3. --- a/firmware/drivers/tuner/si4700.c
  4. +++ b/firmware/drivers/tuner/si4700.c
  5. @@ -372,6 +372,7 @@ static void si4700_set_frequency(int freq)
  6. 76000000, /* SYSCONFIG2_BAND_760_1080 */
  7. 76000000, /* SYSCONFIG2_BAND_760_900 */
  8. };
  9. + int i;
  10.  
  11. /* check BAND and spacings */
  12. int space = SYSCONFIG2_SPACEr(cache[SYSCONFIG2]);
  13. @@ -379,8 +380,7 @@ static void si4700_set_frequency(int freq)
  14. int chan = (freq - bands[band]) / spacings[space];
  15. int readchan;
  16.  
  17. - do
  18. - {
  19. + for (i = 0; i < 5; i++) {
  20. /* tuning should be done within 60 ms according to the datasheet */
  21. si4700_write_reg(CHANNEL, CHANNEL_CHANw(chan) | CHANNEL_TUNE);
  22. sleep(HZ * 60 / 1000);
  23. @@ -389,7 +389,12 @@ static void si4700_set_frequency(int freq)
  24. readchan = si4700_read_reg(READCHAN) & READCHAN_READCHAN;
  25.  
  26. si4700_write_clear(CHANNEL, CHANNEL_TUNE);
  27. - } while (!((cache[STATUSRSSI] & STATUSRSSI_STC) && (readchan == chan)));
  28. +
  29. + /* check if tuning was successful */
  30. + if ((cache[STATUSRSSI] & STATUSRSSI_STC) && (readchan == chan)) {
  31. + break;
  32. + }
  33. + }
  34. }
  35.  
  36. static int si4700_tuned(void)
  37.  
RAW Paste Data