diff options
| author | Rob Purchase <shotofadds@rockbox.org> | 2009-03-20 23:14:05 +0000 |
|---|---|---|
| committer | Rob Purchase <shotofadds@rockbox.org> | 2009-03-20 23:14:05 +0000 |
| commit | 343c3b795a69e4fc7efa081a56d34906585213b4 (patch) | |
| tree | 0bdc13803b09f98715e040a037067d26819ed55a | |
| parent | fe064db965b91394f85a777608375ff782ab8c64 (diff) | |
| download | rockbox-343c3b795a69e4fc7efa081a56d34906585213b4.zip rockbox-343c3b795a69e4fc7efa081a56d34906585213b4.tar.gz rockbox-343c3b795a69e4fc7efa081a56d34906585213b4.tar.bz2 rockbox-343c3b795a69e4fc7efa081a56d34906585213b4.tar.xz | |
Implement udelay() for D2 and remove the old hacks from USB & FM drivers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20417 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/drivers/tuner/lv24020lp.c | 7 | ||||
| -rw-r--r-- | firmware/target/arm/tcc780x/system-target.h | 7 | ||||
| -rw-r--r-- | firmware/target/arm/tcc780x/system-tcc780x.c | 3 | ||||
| -rw-r--r-- | firmware/target/arm/usb-tcc.c | 8 |
4 files changed, 13 insertions, 12 deletions
diff --git a/firmware/drivers/tuner/lv24020lp.c b/firmware/drivers/tuner/lv24020lp.c index 9d6425b..769be8a 100644 --- a/firmware/drivers/tuner/lv24020lp.c +++ b/firmware/drivers/tuner/lv24020lp.c @@ -75,12 +75,11 @@ static int fd_log = -1; #define FM_CLOCK_PIN 5 #define FM_DATA_PIN 6 #define FM_NRW_PIN 7 -//#define udelay(x) /* Remove hack when D2 has udelay */ - +/* Remove hack when i7 has udelay */ static void udelay(int usecs) { while (usecs--) - asm("nop;nop;"); + asm("nop;nop;"); } #elif defined(COWON_D2) @@ -90,7 +89,7 @@ static void udelay(int usecs) #define FM_NRW_PIN 31 #define FM_CLOCK_PIN 29 #define FM_DATA_PIN 30 -#define udelay(x) /* Remove hack when D2 has udelay */ + #else #error GPIOs undefined for this target #endif diff --git a/firmware/target/arm/tcc780x/system-target.h b/firmware/target/arm/tcc780x/system-target.h index aa3cc7a..0802bb9 100644 --- a/firmware/target/arm/tcc780x/system-target.h +++ b/firmware/target/arm/tcc780x/system-target.h @@ -34,4 +34,11 @@ #define inw(a) (*(volatile unsigned short *) (a)) #define outw(a,b) (*(volatile unsigned short *) (b) = (a)) +/* TC32 is configured to 1MHz in clock_init() */ +static inline void udelay(unsigned usecs) +{ + unsigned stop = TC32MCNT + usecs; + while (TIME_BEFORE(TC32MCNT, stop)); +} + #endif /* SYSTEM_TARGET_H */ diff --git a/firmware/target/arm/tcc780x/system-tcc780x.c b/firmware/target/arm/tcc780x/system-tcc780x.c index bf3c64c..77ae3a4 100644 --- a/firmware/target/arm/tcc780x/system-tcc780x.c +++ b/firmware/target/arm/tcc780x/system-tcc780x.c @@ -231,6 +231,9 @@ static void clock_init(void) /* configure PCK_TCT to 2Mhz (clock source 4 (Xin) divided by 6) */ PCLK_TCT = PCK_EN | (CKSEL_XIN<<24) | 5; + + /* set TC32 timer to XIN divided by 12 (1MHz) */ + TC32EN = (1<<24) | 11; } #endif diff --git a/firmware/target/arm/usb-tcc.c b/firmware/target/arm/usb-tcc.c index 6f15e68..611e4be 100644 --- a/firmware/target/arm/usb-tcc.c +++ b/firmware/target/arm/usb-tcc.c @@ -133,14 +133,6 @@ void usb_drv_release_endpoint(int ep) restore_irq(flags); } -static void udelay(unsigned long msecs) -{ - /* TODO: implement me other way */ - msecs*=126; - while (msecs--) - asm("nop;"); -} - static inline void pullup_on(void) { TCC7xx_USB_PHY_CFG = 0x000c; |