diff options
-rw-r--r-- | sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c | 1 | ||||
-rw-r--r-- | sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h | 3 | ||||
-rw-r--r-- | sys/boot/arm/at91/libat91/emac.c | 11 | ||||
-rw-r--r-- | sys/boot/arm/at91/libat91/getc.c | 6 |
4 files changed, 13 insertions, 8 deletions
diff --git a/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c b/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c index 6ea79e7..192815d 100644 --- a/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c +++ b/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c @@ -53,6 +53,7 @@ _init(void) register unsigned value; volatile sdram_size_t *p = (sdram_size_t *)SDRAM_BASE; + AT91C_BASE_ST->ST_RTMR = 1; #ifdef BOOT_TSC // For the TSC board, we turn ON the one LED we have while // early in boot. diff --git a/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h b/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h index 13edbec..c706247 100644 --- a/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h +++ b/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h @@ -58,7 +58,8 @@ typedef unsigned int sdram_size_t; /* Master clock frequency at power-up */ #define AT91C_MASTER_CLOCK 60000000 -#define GetSeconds() (AT91C_BASE_RTC->RTC_TIMR & AT91C_RTC_SEC) +/* #define GetSeconds() (AT91C_BASE_RTC->RTC_TIMR & AT91C_RTC_SEC) */ +#define GetSeconds() (AT91C_BASE_ST->ST_CRTR >> 15) extern void _init(void); diff --git a/sys/boot/arm/at91/libat91/emac.c b/sys/boot/arm/at91/libat91/emac.c index e82c613..392537c 100644 --- a/sys/boot/arm/at91/libat91/emac.c +++ b/sys/boot/arm/at91/libat91/emac.c @@ -412,7 +412,8 @@ MII_GetLinkSpeed(AT91PS_EMAC pEmac) break; printf("."); sec = GetSeconds(); - while (GetSeconds() <= sec) continue; + while (GetSeconds() == sec) + continue; } if (stat2 & MII_STS_LINK_STAT) break; @@ -541,7 +542,7 @@ TFTP_Download(unsigned address, char *filename) dlAddress = (char*)address; lastSize = 0; timeout = 10; - thisSeconds = GetSeconds() + 1; + thisSeconds = (GetSeconds() + 2) % 32; serverPort = SWAP16(69); ++localPort; ackBlock = -1; @@ -551,10 +552,10 @@ TFTP_Download(unsigned address, char *filename) if (ackBlock == -2) break; timeout = 10; - thisSeconds = GetSeconds() + 1; - } else if (GetSeconds() > thisSeconds) { + thisSeconds = (GetSeconds() + 2) % 32; + } else if (GetSeconds() == thisSeconds) { --timeout; - thisSeconds = GetSeconds() + 1; + thisSeconds = (GetSeconds() + 2) % 32; if (!serverMACSet) GetServerAddress(); else if (ackBlock == -1) diff --git a/sys/boot/arm/at91/libat91/getc.c b/sys/boot/arm/at91/libat91/getc.c index e0a43b9..59e27a4 100644 --- a/sys/boot/arm/at91/libat91/getc.c +++ b/sys/boot/arm/at91/libat91/getc.c @@ -50,13 +50,15 @@ getc(int seconds) AT91PS_USART pUSART = (AT91PS_USART)AT91C_BASE_DBGU; unsigned thisSecond; + // Clamp to 20s + if (seconds > 20) + seconds = 20; thisSecond = GetSeconds(); seconds = thisSecond + seconds; - do { if ((pUSART->US_CSR & AT91C_US_RXRDY)) return (pUSART->US_RHR & 0xFF); thisSecond = GetSeconds(); - } while (thisSecond < seconds); + } while (thisSecond != seconds); return (-1); } |