diff options
author | Sean Anderson <sean.anderson@seco.com> | 2022-03-22 16:59:23 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-04-01 15:03:13 -0400 |
commit | 3ea744e87359f95251ae7ec3c7a92f8b3293593b (patch) | |
tree | cc8bd663a055e8bcd83b391f56e8de70dbe3503f /arch/arm/lib | |
parent | dcc4f9623e27b92a1e0b97326631b0d5841c49cb (diff) | |
download | u-boot-3ea744e87359f95251ae7ec3c7a92f8b3293593b.zip u-boot-3ea744e87359f95251ae7ec3c7a92f8b3293593b.tar.gz u-boot-3ea744e87359f95251ae7ec3c7a92f8b3293593b.tar.bz2 |
arm: smh: Add some functions for working with the host console
This adds three wrappers around the semihosting commands for reading and
writing to the host console. We use the more standard getc/putc/puts
names instead of readc/writec/write0 for familiarity.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r-- | arch/arm/lib/semihosting.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c index 57ab252..7595dbc 100644 --- a/arch/arm/lib/semihosting.c +++ b/arch/arm/lib/semihosting.c @@ -15,8 +15,11 @@ #define SYSOPEN 0x01 #define SYSCLOSE 0x02 +#define SYSWRITEC 0x03 +#define SYSWRITE0 0x04 #define SYSWRITE 0x05 #define SYSREAD 0x06 +#define SYSREADC 0x07 #define SYSSEEK 0x0A #define SYSFLEN 0x0C #define SYSERRNO 0x13 @@ -167,3 +170,18 @@ long smh_seek(long fd, long pos) return smh_errno(); return 0; } + +int smh_getc(void) +{ + return smh_trap(SYSREADC, NULL); +} + +void smh_putc(char ch) +{ + smh_trap(SYSWRITEC, &ch); +} + +void smh_puts(const char *s) +{ + smh_trap(SYSWRITE0, (char *)s); +} |