Created
January 23, 2017 17:45
-
-
Save FantomJAC/7495b6974ce3ddf2f4f5ad1188eb5e5b to your computer and use it in GitHub Desktop.
vprintk for zephyr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 84330d4ad6b4b699819f5677fa6cb36a72b95088 Mon Sep 17 00:00:00 2001 | |
From: Shotaro Uchida <[email protected]> | |
Date: Fri, 13 Jan 2017 14:55:08 +0900 | |
Subject: [PATCH] printk: vprintk | |
--- | |
include/misc/printk.h | 1 + | |
misc/printk.c | 7 +++++++ | |
2 files changed, 8 insertions(+) | |
diff --git a/include/misc/printk.h b/include/misc/printk.h | |
index fd48dcf..02cef54 100644 | |
--- a/include/misc/printk.h | |
+++ b/include/misc/printk.h | |
@@ -55,6 +55,7 @@ extern __printf_like(1, 2) int printk(const char *fmt, ...); | |
extern __printf_like(3, 4) int snprintk(char *str, size_t size, | |
const char *fmt, ...); | |
extern int vsnprintk(char *str, size_t size, const char *fmt, va_list ap); | |
+extern int vprintk(const char *fmt, va_list ap); | |
void _vprintk(int (*out)(int, void *), void *ctx, const char *fmt, va_list ap); | |
#else | |
diff --git a/misc/printk.c b/misc/printk.c | |
index 5047fe2..02ead94 100644 | |
--- a/misc/printk.c | |
+++ b/misc/printk.c | |
@@ -216,6 +216,13 @@ int printk(const char *fmt, ...) | |
return ctx.count; | |
} | |
+int vprintk(const char *fmt, va_list ap) | |
+{ | |
+ struct out_context ctx = { 0 }; | |
+ _vprintk((out_func_t)char_out, &ctx, fmt, ap); | |
+ return ctx.count; | |
+} | |
+ | |
/** | |
* @brief Output an unsigned long in hex format | |
* | |
-- | |
2.7.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment