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 /firmware/target/arm/tcc780x | |
parent | fe064db965b91394f85a777608375ff782ab8c64 (diff) |
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
Diffstat (limited to 'firmware/target/arm/tcc780x')
-rw-r--r-- | firmware/target/arm/tcc780x/system-target.h | 7 | ||||
-rw-r--r-- | firmware/target/arm/tcc780x/system-tcc780x.c | 3 |
2 files changed, 10 insertions, 0 deletions
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 @@ #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 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) /* 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 |