mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
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:
parent
fe064db965
commit
343c3b795a
4 changed files with 13 additions and 12 deletions
|
|
@ -75,12 +75,11 @@ static int fd_log = -1;
|
||||||
#define FM_CLOCK_PIN 5
|
#define FM_CLOCK_PIN 5
|
||||||
#define FM_DATA_PIN 6
|
#define FM_DATA_PIN 6
|
||||||
#define FM_NRW_PIN 7
|
#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)
|
static void udelay(int usecs)
|
||||||
{
|
{
|
||||||
while (usecs--)
|
while (usecs--)
|
||||||
asm("nop;nop;");
|
asm("nop;nop;");
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(COWON_D2)
|
#elif defined(COWON_D2)
|
||||||
|
|
@ -90,7 +89,7 @@ static void udelay(int usecs)
|
||||||
#define FM_NRW_PIN 31
|
#define FM_NRW_PIN 31
|
||||||
#define FM_CLOCK_PIN 29
|
#define FM_CLOCK_PIN 29
|
||||||
#define FM_DATA_PIN 30
|
#define FM_DATA_PIN 30
|
||||||
#define udelay(x) /* Remove hack when D2 has udelay */
|
|
||||||
#else
|
#else
|
||||||
#error GPIOs undefined for this target
|
#error GPIOs undefined for this target
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,11 @@
|
||||||
#define inw(a) (*(volatile unsigned short *) (a))
|
#define inw(a) (*(volatile unsigned short *) (a))
|
||||||
#define outw(a,b) (*(volatile unsigned short *) (b) = (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 */
|
#endif /* SYSTEM_TARGET_H */
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,9 @@ static void clock_init(void)
|
||||||
|
|
||||||
/* configure PCK_TCT to 2Mhz (clock source 4 (Xin) divided by 6) */
|
/* configure PCK_TCT to 2Mhz (clock source 4 (Xin) divided by 6) */
|
||||||
PCLK_TCT = PCK_EN | (CKSEL_XIN<<24) | 5;
|
PCLK_TCT = PCK_EN | (CKSEL_XIN<<24) | 5;
|
||||||
|
|
||||||
|
/* set TC32 timer to XIN divided by 12 (1MHz) */
|
||||||
|
TC32EN = (1<<24) | 11;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,14 +133,6 @@ void usb_drv_release_endpoint(int ep)
|
||||||
restore_irq(flags);
|
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)
|
static inline void pullup_on(void)
|
||||||
{
|
{
|
||||||
TCC7xx_USB_PHY_CFG = 0x000c;
|
TCC7xx_USB_PHY_CFG = 0x000c;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue