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:
parent
40315adeb2
commit
fe8fe41571
2 changed files with 11 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue