drivers: serial: Use microseconds to represent timeout
Updated uart_rx_enable() and uart_tx() to use timeout given
in microseconds. Previously argument was given in milliseconds.
However, there are cases when milliseconds granularity is not
enough and can significantly reduce a throughput, e.g. 1ms is
100 bytes at 1Mb.
Updated 4 drivers which implement asynchronous API. Updated
places where API was used.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c
index 856c32e..a7b71f2 100644
--- a/drivers/serial/uart_stm32.c
+++ b/drivers/serial/uart_stm32.c
@@ -808,10 +808,10 @@
static inline void async_timer_start(struct k_work_delayable *work,
int32_t timeout)
{
- if ((timeout != SYS_FOREVER_MS) && (timeout != 0)) {
+ if ((timeout != SYS_FOREVER_US) && (timeout != 0)) {
/* start timer */
- LOG_DBG("async timer started for %d ms", timeout);
- k_work_reschedule(work, K_MSEC(timeout));
+ LOG_DBG("async timer started for %d us", timeout);
+ k_work_reschedule(work, K_USEC(timeout));
}
}