Implement ms timer and fix all timers

This will fix everything that uses a timer (or sleep).

Without this any function like eMMC/SD read/write/verify, TSEC/SE, etc can break when the time reaches the max value of the u32 microsecond timer (71minutes).

This fixes every possible breakage, including backup and restore (read/write/verify errors) that takes a lot of time.

The new max before a timer reset is now 48 days (the old one was 71 minutes)
This commit is contained in:
Kostas Missos
2018-07-04 18:39:26 +03:00
parent ebb9ca5bf5
commit 5e8eb1c57a
17 changed files with 146 additions and 129 deletions

View File

@@ -36,7 +36,7 @@ void uart_init(u32 idx, u32 baud)
uart->UART_IER_DLAB = 0;
uart->UART_IIR_FCR = 7; //Enable and clear TX and RX FIFOs.
(void)uart->UART_LSR;
sleep(3 * ((baud + 999999) / baud));
usleep(3 * ((baud + 999999) / baud));
uart->UART_LCR = 3; //Set word length 8.
uart->UART_MCR = 0;
uart->UART_MSR = 0;