aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/apos/attrs.h4
-rw-r--r--include/apos/debug.h22
2 files changed, 25 insertions, 1 deletions
diff --git a/include/apos/attrs.h b/include/apos/attrs.h
index 00dcf82..e088ec9 100644
--- a/include/apos/attrs.h
+++ b/include/apos/attrs.h
@@ -1,7 +1,9 @@
#ifndef APOS_COMPILER_ATTRIBUTES_H
#define __section(section) __attribute__((__section__(section)))
+#define __fmt(x, y) __attribute__((format (__printf__, x, y)))
#define __noinline __attribute__((noinline))
-#define __weak __attribute((weak))
+#define __weak __attribute__((weak))
+#define __packed __attribute__((packed))
#endif /* APOS_COMPILER_ATTRIBUTES_H */
diff --git a/include/apos/debug.h b/include/apos/debug.h
new file mode 100644
index 0000000..021612d
--- /dev/null
+++ b/include/apos/debug.h
@@ -0,0 +1,22 @@
+#ifndef APOS_DEBUG_H
+#define APOS_DEBUG_H
+
+#include <apos/attrs.h>
+
+#ifdef DEBUG
+enum serial_dev_t {
+ /* only the NS16550A and compatible at the moment */
+ NS16550A,
+};
+
+void __fmt(1, 2) dbg(const char *fmt, ...);
+void dbg_init(void *pt, enum serial_dev_t dev);
+
+#else
+
+#define dbg(...)
+#define dbg_init(...)
+
+#endif /* DEBUG */
+
+#endif /* APOS_DEBUG_H */