aboutsummaryrefslogtreecommitdiff
path: root/include/apos
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-01-06 17:41:38 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-01-06 17:41:38 +0200
commit513a8d20beeacb3a7fc2c3c140d014f7fb25cd6f (patch)
treea4d2cc6cc0bd0990c282d6163767fbfaa12d0718 /include/apos
parent6f052e236715846b1a14f9fe59f89346efb809e6 (diff)
downloadkmi-513a8d20beeacb3a7fc2c3c140d014f7fb25cd6f.tar.gz
kmi-513a8d20beeacb3a7fc2c3c140d014f7fb25cd6f.zip
Jump back to kernelspace tested
+ Added automated categories to debugging, bug/info/warn/error etc. Now I should just try to use them here and there :D
Diffstat (limited to 'include/apos')
-rw-r--r--include/apos/attrs.h1
-rw-r--r--include/apos/debug.h12
2 files changed, 13 insertions, 0 deletions
diff --git a/include/apos/attrs.h b/include/apos/attrs.h
index 64ec27d..0a731cc 100644
--- a/include/apos/attrs.h
+++ b/include/apos/attrs.h
@@ -2,6 +2,7 @@
#define __section(section) __attribute__((__section__(section)))
#define __fmt(x, y) __attribute__((format (__printf__, x, y)))
+#define __aligned(a) __attribute__((aligned(a)))
#define __noinline __attribute__((noinline))
#define __noreturn __attribute__((noreturn))
#define __packed __attribute__((packed))
diff --git a/include/apos/debug.h b/include/apos/debug.h
index 1a3265f..9aa132f 100644
--- a/include/apos/debug.h
+++ b/include/apos/debug.h
@@ -19,12 +19,24 @@ void __fmt(1, 2) dbg(const char *fmt, ...);
void setup_dbg(pm_t pt, enum serial_dev dev);
struct dbg_info dbg_from_fdt(void *fdt);
+#define COMMON_FORMAT "[%s] %s:%d\n\t"
+#define COMMON_ARGS(s) s, __FILE__, __LINE__
+#define bug(fmt, ...) dbg(COMMON_FORMAT fmt, COMMON_ARGS("BUG"), __VA_ARGS__)
+#define warn(fmt, ...) dbg(COMMON_FORMAT fmt, COMMON_ARGS("WARN"), __VA_ARGS__)
+#define info(fmt, ...) dbg(COMMON_FORMAT fmt, COMMON_ARGS("INFO"), __VA_ARGS__)
+#define error(fmt, ...) dbg(COMMON_FORMAT fmt, COMMON_ARGS("ERROR"), __VA_ARGS__)
+
#else
#define dbg(...)
#define dbg_init(...)
#define dbg_from_fdt(...)
+#define bug(...)
+#define warn(...)
+#define info(...)
+#define error(...)
+
#endif /* DEBUG */
#endif /* APOS_DEBUG_H */