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
This commit is contained in:
Rob Purchase 2009-03-20 23:14:05 +00:00
parent fe064db965
commit 343c3b795a
4 changed files with 13 additions and 12 deletions

View file

@ -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 */

View file

@ -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