diff options
Diffstat (limited to 'sys/boot/arm/at91/libat91/getc.c')
-rw-r--r-- | sys/boot/arm/at91/libat91/getc.c | 6 |
1 files changed, 4 insertions, 2 deletions
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); } |