mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
stdio_semihosting: Convert to ztimer
This commit is contained in:
parent
49cecdbc44
commit
2b696fd770
@ -45,7 +45,7 @@ ifneq (,$(filter stdio_uart,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
ifneq (,$(filter stdio_semihosting,$(USEMODULE)))
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer_msec
|
||||
FEATURES_REQUIRED_ANY += cpu_core_cortexm|arch_riscv
|
||||
endif
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "stdio_semihosting.h"
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#if MODULE_VFS
|
||||
#include "vfs.h"
|
||||
@ -35,7 +35,7 @@
|
||||
* @brief Rate at which the stdin read polls (breaks) the debugger for input
|
||||
* data
|
||||
*/
|
||||
#define STDIO_SEMIHOSTING_POLL_RATE (10 * US_PER_MS)
|
||||
#define STDIO_SEMIHOSTING_POLL_RATE (10)
|
||||
|
||||
/**
|
||||
* @brief ARM Semihosting STDIN file descriptor. Also used with RISC-V
|
||||
@ -157,10 +157,11 @@ void stdio_init(void)
|
||||
ssize_t stdio_read(void* buffer, size_t count)
|
||||
{
|
||||
if (STDIO_SEMIHOSTING_RX) {
|
||||
xtimer_ticks32_t last_wakeup = xtimer_now();
|
||||
uint32_t last_wakeup = ztimer_now(ZTIMER_MSEC);
|
||||
ssize_t bytes_read = _semihosting_read(buffer, count);
|
||||
while (bytes_read == 0) {
|
||||
xtimer_periodic_wakeup(&last_wakeup, STDIO_SEMIHOSTING_POLL_RATE);
|
||||
ztimer_periodic_wakeup(ZTIMER_MSEC, &last_wakeup,
|
||||
STDIO_SEMIHOSTING_POLL_RATE);
|
||||
bytes_read = _semihosting_read(buffer, count);
|
||||
}
|
||||
return bytes_read;
|
||||
|
Loading…
Reference in New Issue
Block a user