summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-10-19 14:38:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-11-02 09:26:08 +0100
commitef617bbfe348b0e7e45a682cdb733107fedf0ca1 (patch)
tree0330f1151f54d8959702559b7aeb52716f038327 /include
parentef59dac7ca88bc4eebbe719a09f01164fd4781eb (diff)
downloadbarebox-ef617bbfe348b0e7e45a682cdb733107fedf0ca1.tar.gz
barebox-ef617bbfe348b0e7e45a682cdb733107fedf0ca1.tar.xz
include: debug_ll: define puthexc_ll
puthex_ll prints a single zero-padded unsigned long, which for a single byte is not very readable, especially on 64-bit systems. Define puthexc_ll() as well, which just accepts a byte and formats its nibbles as hexadecimal characters. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221019123817.1659468-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/debug_ll.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/debug_ll.h b/include/debug_ll.h
index 735033b314..856a157bf5 100644
--- a/include/debug_ll.h
+++ b/include/debug_ll.h
@@ -33,17 +33,25 @@ static inline void putc_ll(char value)
PUTC_LL(value);
}
-static inline void puthex_ll(unsigned long value)
+static inline void puthexc_ll(unsigned char value)
{
int i; unsigned char ch;
- for (i = sizeof(unsigned long) * 2; i--; ) {
+ for (i = 2; i--; ) {
ch = ((value >> (i * 4)) & 0xf);
ch += (ch >= 10) ? 'a' - 10 : '0';
putc_ll(ch);
}
}
+static inline void puthex_ll(unsigned long value)
+{
+ int i;
+
+ for (i = sizeof(unsigned long); i--; )
+ puthexc_ll(value >> (i * 8));
+}
+
/*
* Be careful with puts_ll, it only works if the binary is running at the
* link address which often is not the case during early startup. If in doubt
@@ -66,6 +74,10 @@ static inline void putc_ll(char value)
{
}
+static inline void puthexc_ll(unsigned char value)
+{
+}
+
static inline void puthex_ll(unsigned long value)
{
}