aboutsummaryrefslogtreecommitdiff
path: root/include/kern
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2020-11-24 15:15:11 -0700
committerJosh Rahm <joshuarahm@gmail.com>2020-11-24 15:22:42 -0700
commitecbcb2509f4b811bce0a56e07de9737d14815251 (patch)
treef96492fb6db5d26c133dc3ab2993a9df3f224ea2 /include/kern
parent351ff7059a5bacb322664412a8c62ee4640b33bf (diff)
downloadstm32l4-ecbcb2509f4b811bce0a56e07de9737d14815251.tar.gz
stm32l4-ecbcb2509f4b811bce0a56e07de9737d14815251.tar.bz2
stm32l4-ecbcb2509f4b811bce0a56e07de9737d14815251.zip
Add better logging capabilities, including the ability to panic.
Diffstat (limited to 'include/kern')
-rw-r--r--include/kern/init.h14
-rw-r--r--include/kern/log.h11
-rw-r--r--include/kern/panic.h6
3 files changed, 31 insertions, 0 deletions
diff --git a/include/kern/init.h b/include/kern/init.h
index 737b85f..0ebbeac 100644
--- a/include/kern/init.h
+++ b/include/kern/init.h
@@ -64,4 +64,18 @@
void(*init7_ptr)() = init7fn; \
static void init7fn
+typedef enum {
+ INIT_LEVEL_0,
+ INIT_LEVEL_1,
+ INIT_LEVEL_2,
+ INIT_LEVEL_3,
+ INIT_LEVEL_4,
+ INIT_LEVEL_5,
+ INIT_LEVEL_6,
+ INIT_LEVEL_7,
+ INIT_LEVEL_MAIN,
+} init_level_t;
+
+init_level_t get_system_init_level();
+
#endif /* INIT_H_ */
diff --git a/include/kern/log.h b/include/kern/log.h
index 5e49def..e1e4088 100644
--- a/include/kern/log.h
+++ b/include/kern/log.h
@@ -1,6 +1,8 @@
#ifndef LOG_H_
#define LOG_H_
+#include <stdarg.h>
+
/*
* Defines logging capabilities. This logging unit will enable logging on
* the systems main USART output.
@@ -9,4 +11,13 @@
/** Similar to fprintf, but with a stripped-down format-string DSL. */
void klogf(const char* fmt, ...);
+/** Like klogf, but with a va_list argument. */
+void kvlogf(const char* fmt, va_list args);
+
+/** Log the following message as an error. */
+void kerr_logf(const char* fmt, ...);
+
+/** Like klogf, but with a va_list argument. */
+void kerr_vlogf(const char* fmt, va_list args);
+
#endif
diff --git a/include/kern/panic.h b/include/kern/panic.h
new file mode 100644
index 0000000..aa064bf
--- /dev/null
+++ b/include/kern/panic.h
@@ -0,0 +1,6 @@
+#ifndef KERN_PANIC_H_
+#define KERN_PANIC_H_
+
+_Noreturn void panic(const char* fmt, ...);
+
+#endif