diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-05-02 00:37:45 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-05-02 00:37:45 +0200 |
commit | 92b8fe6e949f08308d237e87441e066a19a9eda6 (patch) | |
tree | af4f5e8aa9a06a9203f9aecc66d102968d2e8cbf /pcilib/debug.h | |
parent | ccc34fa5ecea32517b72ebc01aca8f02295105fe (diff) | |
download | pcitool-92b8fe6e949f08308d237e87441e066a19a9eda6.tar.gz pcitool-92b8fe6e949f08308d237e87441e066a19a9eda6.tar.bz2 pcitool-92b8fe6e949f08308d237e87441e066a19a9eda6.tar.xz pcitool-92b8fe6e949f08308d237e87441e066a19a9eda6.zip |
Provide data debugging API
Diffstat (limited to 'pcilib/debug.h')
-rw-r--r-- | pcilib/debug.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/pcilib/debug.h b/pcilib/debug.h index b7c547f..fb0a791 100644 --- a/pcilib/debug.h +++ b/pcilib/debug.h @@ -1,6 +1,8 @@ #ifndef _PCILIB_DEBUG_H #define _PCILIB_DEBUG_H +#include <stdarg.h> + #define PCILIB_DEBUG #ifdef PCILIB_DEBUG @@ -10,22 +12,34 @@ #ifdef PCILIB_DEBUG_DMA -# define PCILIB_DEBUG_DMA_CALL(function, ...) pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__) +# define PCILIB_DEBUG_DMA_MESSAGE(function, ...) pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__) +# define PCILIB_DEBUG_DMA_BUFFER(function, ...) pcilib_debug_data_buffer (#function, __VA_ARGS__) #else /* PCILIB_DEBUG_DMA */ -# define PCILIB_DEBUG_DMA_CALL(function, ...) +# define PCILIB_DEBUG_DMA_MESSAGE(function, ...) +# define PCILIB_DEBUG_DMA_BUFFER(function, ...) #endif /* PCILIB_DEBUG_DMA */ #ifdef PCILIB_DEBUG_MISSING_EVENTS -# define PCILIB_DEBUG_MISSING_EVENTS_CALL(function, ...) pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__) +# define PCILIB_DEBUG_MISSING_EVENTS_MESSAGE(function, ...) pcilib_debug_message (#function, __FILE__, __LINE__, __VA_ARGS__) +# define PCILIB_DEBUG_MISSING_EVENTS_BUFFER(function, ...) pcilib_debug_data_buffer (#function, __VA_ARGS__) #else /* PCILIB_DEBUG_MISSING_EVENTS */ -# define PCILIB_DEBUG_MISSING_EVENTS_CALL(function, ...) +# define PCILIB_DEBUG_MISSING_EVENTS_MESSAGE(function, ...) +# define PCILIB_DEBUG_MISSING_EVENTS_BUFFER(function, ...) #endif /* PCILIB_DEBUG_MISSING_EVENTS */ - #define pcilib_debug(function, ...) \ - PCILIB_DEBUG_##function##_CALL(PCILIB_DEBUG_##function, __VA_ARGS__) + PCILIB_DEBUG_##function##_MESSAGE(PCILIB_DEBUG_##function, __VA_ARGS__) + +#define pcilib_debug_buffer(function, ...) \ + PCILIB_DEBUG_##function##_BUFFER(PCILIB_DEBUG_##function, __VA_ARGS__) + +typedef enum { + PCILIB_DEBUG_BUFFER_APPEND = 1, + PCILIB_DEBUG_BUFFER_MKDIR = 2 +} pcilib_debug_buffer_flags_t; void pcilib_debug_message(const char *function, const char *file, int line, const char *format, ...); +void pcilib_debug_data_buffer(const char *function, size_t size, void *buffer, pcilib_debug_buffer_flags_t flags, const char *file, ...); #endif /* _PCILIB_DEBUG_H */ |