replaced wait_xms()- and wait_xus()-routines by a generic one that takes the number of us to wait as a parameter

This commit is contained in:
Markus Fröschle
2012-11-15 06:25:15 +00:00
parent 02aeeb262f
commit 8c123b0ac3
2 changed files with 8 additions and 42 deletions

View File

@@ -18,8 +18,7 @@ extern void sd_card_idle();
extern int sd_card_init(); extern int sd_card_init();
/* wait...() routines moved to sysinit.c */ /* wait...() routines moved to sysinit.c */
extern void wait_10ms(); extern void wait(uint32_t us);
extern void wait_1ms();
/* Symbols from the linker script */ /* Symbols from the linker script */
extern uint8_t _STRAM_END[]; extern uint8_t _STRAM_END[];
@@ -169,7 +168,7 @@ void BaS(void)
/* IDE reset */ /* IDE reset */
* (volatile uint8_t *) (0xffff8802 - 2) = 14; * (volatile uint8_t *) (0xffff8802 - 2) = 14;
* (volatile uint8_t *) (0xffff8802 - 0) = 0x80; * (volatile uint8_t *) (0xffff8802 - 0) = 0x80;
wait_1ms(); wait(1);
* (volatile uint8_t *) (0xffff8802 - 0) = 0; * (volatile uint8_t *) (0xffff8802 - 0) = 0;

View File

@@ -22,49 +22,16 @@ extern void flush_and_invalidate_caches_before_copy(void);
extern volatile long _VRAM; /* start address of video ram from linker script */ extern volatile long _VRAM; /* start address of video ram from linker script */
/* /*
* wait routines * 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.
*/ */
void wait_10ms(void) void wait(uint32_t us)
{ {
uint32_t target = MCF_SLT_SCNT(0) - 1320000; uint32_t target = MCF_SLT_SCNT(0) - (us * 132);
while (MCF_SLT_SCNT(0) > target); while (MCF_SLT_SCNT(0) > target);
} }
void wait_1ms(void)
{
uint32_t target = MCF_SLT_SCNT(0) - 132000;
while (MCF_SLT_SCNT(0) > target);
}
void wait_100us(void)
{
uint32_t target = MCF_SLT_SCNT(0) - 13200;
while (MCF_SLT_SCNT(0) > target);
}
void wait_50us(void)
{
uint32_t target = MCF_SLT_SCNT(0) - 6600;
while (MCF_SLT_SCNT(0) > target);
}
void wait_10us(void)
{
uint32_t target = MCF_SLT_SCNT(0) - 1320;
while (MCF_SLT_SCNT(0) > target);
}
void wait_1us(void)
{
uint32_t target = MCF_SLT_SCNT(0) - 132;
while (MCF_SLT_SCNT(0) > target);
}
/* /*
* init SLICE TIMER 0 * init SLICE TIMER 0
@@ -627,7 +594,7 @@ void dvi_on(void) {
wait_i2c_transfer_finished(); wait_i2c_transfer_finished();
MCF_I2C_I2CR |= 0x08; // txak=1 MCF_I2C_I2CR |= 0x08; // txak=1
wait_50us(); wait(50);
receivedByte = MCF_I2C_I2DR; receivedByte = MCF_I2C_I2DR;
@@ -698,7 +665,7 @@ void init_ac97(void) {
{ {
MCF_PSC2_PSCTB_AC97 = 0x00000000; //SLOT2-12:RD REG ALLES 0 MCF_PSC2_PSCTB_AC97 = 0x00000000; //SLOT2-12:RD REG ALLES 0
} }
wait_50us(); wait(50);
va = MCF_PSC2_PSCTB_AC97; va = MCF_PSC2_PSCTB_AC97;
if ((va & 0x80000fff) == 0x80000800) { if ((va & 0x80000fff) == 0x80000800) {