mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
shared/runtime/semihosting_arm: Add mp_semihosting_rx_chars.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#define SYS_OPEN 0x01
|
||||
#define SYS_WRITEC 0x03
|
||||
#define SYS_WRITE 0x05
|
||||
#define SYS_READ 0x06
|
||||
#define SYS_READC 0x07
|
||||
|
||||
// Constants:
|
||||
@@ -91,6 +92,20 @@ int mp_semihosting_rx_char() {
|
||||
return mp_semihosting_call(SYS_READC, NULL);
|
||||
}
|
||||
|
||||
// Returns 0 on success.
|
||||
int mp_semihosting_rx_chars(char *str, size_t len) {
|
||||
struct {
|
||||
uint32_t fd;
|
||||
const char *str;
|
||||
uint32_t len;
|
||||
} args = {
|
||||
.fd = mp_semihosting_stdout,
|
||||
.str = str,
|
||||
.len = len,
|
||||
};
|
||||
return mp_semihosting_call(SYS_READ, &args);
|
||||
}
|
||||
|
||||
static void mp_semihosting_tx_char(char c) {
|
||||
mp_semihosting_call(SYS_WRITEC, &c);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user