From: cp0613@linux.alibaba.com <cp0613@linux.alibaba.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2] lib: utils/serial: Optimize semihosting_putc implementation
Date: Wed, 18 Oct 2023 10:42:05 +0800 [thread overview]
Message-ID: <20231018024205.270-1-cp0613@linux.alibaba.com> (raw)
From: Chen Pei <cp0613@linux.alibaba.com>
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>
Changed from v1:
1. simplified by calling semihosting_puts directly.
---
lib/utils/serial/semihosting.c | 10 +++++-----
1 file 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;
--
2.25.1
next reply other threads:[~2023-10-18 2:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 2:42 cp0613 [this message]
2023-10-23 6:35 ` [PATCH v2] lib: utils/serial: Optimize semihosting_putc implementation Guo Ren
2023-10-23 8:22 ` Xiang W
2023-10-23 8:35 ` Anup Patel
2023-10-23 8:57 ` Guo Ren
2023-11-16 6:12 ` Anup Patel
2023-11-16 8:45 ` Xiang W
2023-11-16 16:00 ` Anup Patel
2023-11-17 1:06 ` Xiang W
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231018024205.270-1-cp0613@linux.alibaba.com \
--to=cp0613@linux.alibaba.com \
--cc=opensbi@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox