aboutsummaryrefslogtreecommitdiff
path: root/lib/utils/serial/semihosting.c
diff options
context:
space:
mode:
authorChen Pei <cp0613@linux.alibaba.com>2023-10-18 10:42:05 +0800
committerAnup Patel <anup@brainfault.org>2023-11-16 11:36:44 +0530
commit07f2ccd990de5f55ce7d194846fff91b6c3aedf6 (patch)
treeb3bb14f115459d2f305e6c21101d316102880d75 /lib/utils/serial/semihosting.c
parent52fd64b82c0de0fdf386c96f2b9e1c4c3e56d80d (diff)
downloadopensbi-07f2ccd990de5f55ce7d194846fff91b6c3aedf6.zip
opensbi-07f2ccd990de5f55ce7d194846fff91b6c3aedf6.tar.gz
opensbi-07f2ccd990de5f55ce7d194846fff91b6c3aedf6.tar.bz2
lib: utils/serial: Optimize semihosting_putc implementation
For some debuggers that do not implement SYSWRITEC and SYSREADC operations, we can use SYSWRITE and SYSREAD instead like the implementation of semihosting_getc(). Signed-off-by: Chen Pei <cp0613@linux.alibaba.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib/utils/serial/semihosting.c')
-rw-r--r--lib/utils/serial/semihosting.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
index ce65887..a27c69e 100644
--- a/lib/utils/serial/semihosting.c
+++ b/lib/utils/serial/semihosting.c
@@ -160,11 +160,6 @@ static long semihosting_write(long fd, const void *memp, size_t len)
/* clang-format on */
-static void semihosting_putc(char ch)
-{
- semihosting_trap(SYSWRITEC, &ch);
-}
-
static unsigned long semihosting_puts(const char *str, unsigned long len)
{
char ch;
@@ -183,6 +178,11 @@ static unsigned long semihosting_puts(const char *str, unsigned long len)
return (ret < 0) ? 0 : ret;
}
+static void semihosting_putc(char ch)
+{
+ semihosting_puts(&ch, 1);
+}
+
static int semihosting_getc(void)
{
char ch = 0;