drivers: serial: nrf_uarte: Support for no multithreading

Don use k_sleep when multithreading is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2021-04-15 12:33:40 +02:00 committed by Carles Cufí
commit fe8fe41571
2 changed files with 11 additions and 5 deletions

View file

@ -272,10 +272,14 @@ static void uart_nrfx_poll_out(const struct device *dev, unsigned char c)
while (atomic_cas((atomic_t *) lock,
(atomic_val_t) 0,
(atomic_val_t) 1) == false) {
/* k_sleep allows other threads to execute and finish
* their transactions.
*/
k_msleep(1);
if (IS_ENABLED(CONFIG_MULTITHREADING)) {
/* k_sleep allows other threads to execute and finish
* their transactions.
*/
k_msleep(1);
} else {
k_busy_wait(1000);
}
if (--safety_cnt == 0) {
break;
}

View file

@ -489,7 +489,9 @@ static int wait_tx_ready(const struct device *dev)
irq_unlock(key);
}
k_msleep(1);
if (IS_ENABLED(CONFIG_MULTITHREADING)) {
k_msleep(1);
}
} while (1);
return key;