diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-16 09:36:39 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-18 10:39:36 +0200 |
commit | 76ed51fca19b76535337a6f75fcd0de0632b5162 (patch) | |
tree | ef9df809bc4077d8019544700e5c12519a089ef9 /include/printk.h | |
parent | 5d2ae3b7ffb25cdc6bd4b36e039da296c992d00d (diff) | |
download | barebox-76ed51fca19b76535337a6f75fcd0de0632b5162.tar.gz barebox-76ed51fca19b76535337a6f75fcd0de0632b5162.tar.xz |
Add print_hex_dump kernel implementation
This gives us proper support of the different DUMP_PREFIX_* flags
and also the ability to print hexdumps to buffers.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/printk.h')
-rw-r--r-- | include/printk.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/include/printk.h b/include/printk.h index 6a027175ab..9941ddb12c 100644 --- a/include/printk.h +++ b/include/printk.h @@ -115,14 +115,6 @@ int __pr_memory_display(int level, const void *addr, loff_t offs, unsigned nbyte (offs), (nbytes), (size), (swab), pr_fmt("")) : 0; \ }) -#define DUMP_PREFIX_OFFSET 0 -static inline void print_hex_dump(const char *level, const char *prefix_str, - int prefix_type, int rowsize, int groupsize, - const void *buf, size_t len, bool ascii) -{ - memory_display(buf, 0, len, groupsize, 0); -} - struct log_entry { struct list_head list; char *msg; @@ -156,4 +148,16 @@ struct va_format { va_list *va; }; +enum { + DUMP_PREFIX_NONE, + DUMP_PREFIX_ADDRESS, + DUMP_PREFIX_OFFSET +}; +extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, + int groupsize, char *linebuf, size_t linebuflen, + bool ascii); +extern void print_hex_dump(const char *level, const char *prefix_str, + int prefix_type, int rowsize, int groupsize, + const void *buf, size_t len, bool ascii); + #endif |