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.tar.gz rockbox-343c3b795a69e4fc7efa081a56d34906585213b4.zip |
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 9d6425b962..769be8ac77 100644 --- a/firmware/drivers/tuner/lv24020lp.c +++ b/firmware/drivers/tuner/lv24020lp.c | |||
@@ -75,12 +75,11 @@ static int fd_log = -1; | |||
75 | #define FM_CLOCK_PIN 5 | 75 | #define FM_CLOCK_PIN 5 |
76 | #define FM_DATA_PIN 6 | 76 | #define FM_DATA_PIN 6 |
77 | #define FM_NRW_PIN 7 | 77 | #define FM_NRW_PIN 7 |
78 | //#define udelay(x) /* Remove hack when D2 has udelay */ | 78 | /* Remove hack when i7 has udelay */ |
79 | |||
80 | static void udelay(int usecs) | 79 | static void udelay(int usecs) |
81 | { | 80 | { |
82 | while (usecs--) | 81 | while (usecs--) |
83 | asm("nop;nop;"); | 82 | asm("nop;nop;"); |
84 | } | 83 | } |
85 | 84 | ||
86 | #elif defined(COWON_D2) | 85 | #elif defined(COWON_D2) |
@@ -90,7 +89,7 @@ static void udelay(int usecs) | |||
90 | #define FM_NRW_PIN 31 | 89 | #define FM_NRW_PIN 31 |
91 | #define FM_CLOCK_PIN 29 | 90 | #define FM_CLOCK_PIN 29 |
92 | #define FM_DATA_PIN 30 | 91 | #define FM_DATA_PIN 30 |
93 | #define udelay(x) /* Remove hack when D2 has udelay */ | 92 | |
94 | #else | 93 | #else |
95 | #error GPIOs undefined for this target | 94 | #error GPIOs undefined for this target |
96 | #endif | 95 | #endif |
diff --git a/firmware/target/arm/tcc780x/system-target.h b/firmware/target/arm/tcc780x/system-target.h index aa3cc7aa4f..0802bb92e0 100644 --- a/firmware/target/arm/tcc780x/system-target.h +++ b/firmware/target/arm/tcc780x/system-target.h | |||
@@ -34,4 +34,11 @@ | |||
34 | #define inw(a) (*(volatile unsigned short *) (a)) | 34 | #define inw(a) (*(volatile unsigned short *) (a)) |
35 | #define outw(a,b) (*(volatile unsigned short *) (b) = (a)) | 35 | #define outw(a,b) (*(volatile unsigned short *) (b) = (a)) |
36 | 36 | ||
37 | /* TC32 is configured to 1MHz in clock_init() */ | ||
38 | static inline void udelay(unsigned usecs) | ||
39 | { | ||
40 | unsigned stop = TC32MCNT + usecs; | ||
41 | while (TIME_BEFORE(TC32MCNT, stop)); | ||
42 | } | ||
43 | |||
37 | #endif /* SYSTEM_TARGET_H */ | 44 | #endif /* SYSTEM_TARGET_H */ |
diff --git a/firmware/target/arm/tcc780x/system-tcc780x.c b/firmware/target/arm/tcc780x/system-tcc780x.c index bf3c64cd7a..77ae3a4cd9 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) | |||
231 | 231 | ||
232 | /* configure PCK_TCT to 2Mhz (clock source 4 (Xin) divided by 6) */ | 232 | /* configure PCK_TCT to 2Mhz (clock source 4 (Xin) divided by 6) */ |
233 | PCLK_TCT = PCK_EN | (CKSEL_XIN<<24) | 5; | 233 | PCLK_TCT = PCK_EN | (CKSEL_XIN<<24) | 5; |
234 | |||
235 | /* set TC32 timer to XIN divided by 12 (1MHz) */ | ||
236 | TC32EN = (1<<24) | 11; | ||
234 | } | 237 | } |
235 | #endif | 238 | #endif |
236 | 239 | ||
diff --git a/firmware/target/arm/usb-tcc.c b/firmware/target/arm/usb-tcc.c index 6f15e68af8..611e4be195 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) | |||
133 | restore_irq(flags); | 133 | restore_irq(flags); |
134 | } | 134 | } |
135 | 135 | ||
136 | static void udelay(unsigned long msecs) | ||
137 | { | ||
138 | /* TODO: implement me other way */ | ||
139 | msecs*=126; | ||
140 | while (msecs--) | ||
141 | asm("nop;"); | ||
142 | } | ||
143 | |||
144 | static inline void pullup_on(void) | 136 | static inline void pullup_on(void) |
145 | { | 137 | { |
146 | TCC7xx_USB_PHY_CFG = 0x000c; | 138 | TCC7xx_USB_PHY_CFG = 0x000c; |