diff --git a/sources/BaS.c b/sources/BaS.c index 46e9c51..71ab9b8 100644 --- a/sources/BaS.c +++ b/sources/BaS.c @@ -19,8 +19,8 @@ extern void sd_card_idle(); extern int sd_card_init(); /* wait...() routines moved to sysinit.c */ -extern inline void wait(uint32_t us); -extern inline bool waitfor(uint32_t us,int (*condition)(void)); +extern inline void wait(volatile uint32_t us); +extern inline volatile bool waitfor(volatile uint32_t us,int (*condition)(void)); /* Symbols from the linker script */ extern uint8_t _STRAM_END[]; diff --git a/sources/sd_card.c b/sources/sd_card.c index 455d75a..8613f51 100644 --- a/sources/sd_card.c +++ b/sources/sd_card.c @@ -6,7 +6,9 @@ #include #include "bas_printf.h" -extern void wait(uint32_t value); +extern void wait(volatile uint32_t value); + +#ifdef _NOT_USED_ /* disabled assembler routines */ void sd_card_idle(void) { @@ -37,6 +39,7 @@ int sd_card_init(void) return ret; } +#endif /* _NOT_USED_ */ uint32_t sd_com(uint32_t command) { @@ -51,7 +54,7 @@ uint32_t sd_com(uint32_t command) return ret; } -void sd_init(void) +void sd_card_init(void) { uint32_t ret; int i; @@ -89,7 +92,6 @@ void sd_init(void) wait(10000); MCF_DSPI_DMCR = 0x800d3c00; - for (i = 0; i < 10; i++) { ret = sd_com(0x082000ff); @@ -107,8 +109,14 @@ void sd_init(void) ret = sd_com(0x082000ff); } + MCF_DSPI_DMCR = 0x800d3c00; + wait(10000); xprintf("finished\r\n"); } +void sd_card_idle(void) +{ +} + diff --git a/sources/sysinit.c b/sources/sysinit.c index 7306441..32b215b 100644 --- a/sources/sysinit.c +++ b/sources/sysinit.c @@ -26,7 +26,7 @@ extern volatile long _VRAM; /* start address of video ram from linker script */ * wait for the specified number of us on slice timer 0. Replaces the original routines that had * the number of useconds to wait for hardcoded in their name. */ -inline void wait(uint32_t us) +inline volatile void wait(uint32_t us) { uint32_t target = MCF_SLT_SCNT(0) - (us * 132); @@ -37,7 +37,7 @@ inline void wait(uint32_t us) * the same as above, with a checker function which gets called while * busy waiting and allows for an early return if it returns true */ -inline bool waitfor(uint32_t us, int (*condition)(void)) +inline volatile bool waitfor(volatile uint32_t us, int (*condition)(void)) { uint32_t target = MCF_SLT_SCNT(0) - (us * 132);