summaryrefslogtreecommitdiffstats
path: root/pcilib/debug.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-04-30 19:51:49 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-04-30 19:51:49 +0200
commit8da61292f595c5e700a4fef981b0e0d07910b4b2 (patch)
treea012e6312d95d50c3e8bd58bc972dbccdd3bd0bf /pcilib/debug.h
parenta740fcee56bd456a759e03526df476e1791fb2bd (diff)
downloadpcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.gz
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.bz2
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.tar.xz
pcitool-8da61292f595c5e700a4fef981b0e0d07910b4b2.zip
Provide an interface for logging debug messages
Diffstat (limited to 'pcilib/debug.h')
-rw-r--r--pcilib/debug.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/pcilib/debug.h b/pcilib/debug.h
new file mode 100644
index 0000000..f9134be
--- /dev/null
+++ b/pcilib/debug.h
@@ -0,0 +1,23 @@
+#ifndef _PCILIB_DEBUG_H
+#define _PCILIB_DEBUG_H
+
+#define PCILIB_DEBUG
+
+#ifdef PCILIB_DEBUG
+# define PCILIB_DEBUG_DMA
+#endif /* PCILIB_DEBUG */
+
+
+#ifdef PCILIB_DEBUG_DMA
+# define PCILIB_DEBUG_DMA_CALL(function, ...) pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__)
+#else /* PCILIB_DEBUG_DMA */
+# define PCILIB_DEBUG_DMA_CALL(function, ...)
+#endif /* PCILIB_DEBUG_DMA */
+
+#define pcilib_debug(function, ...) \
+ PCILIB_DEBUG_##function##_CALL(PCILIB_DEBUG_##function, __VA_ARGS__)
+
+void pcilib_debug_message(const char *function, const char *file, int line, const char *format, ...);
+
+
+#endif /* _PCILIB_DEBUG_H */