1 /** 2 * @file medebug.h 3 * 4 * @brief Debugging defines. 5 * @note Copyright (C) 2006 Meilhaus Electronic GmbH (support@meilhaus.de) 6 * @author Guenter Gebhardt 7 * @author Krzysztof Gantzke (k.gantzke@meilhaus.de) 8 */ 9 10 #ifndef _MEDEBUG_H_ 11 #define _MEDEBUG_H_ 12 13 #ifdef __KERNEL__ 14 15 #include <linux/kernel.h> 16 17 //Messages control. 18 19 #ifdef MEDEBUG_TEST_ALL /* Switch to enable all info messages. */ 20 # ifndef MEDEBUG_TEST 21 # define MEDEBUG_TEST 22 # endif 23 # ifndef MEDEBUG_TEST_INFO 24 # define MEDEBUG_TEST_INFO 25 # endif 26 # ifndef MEDEBUG_DEBUG_REG 27 # define MEDEBUG_DEBUG_REG /* Switch to enable registry access debuging messages. */ 28 # endif 29 # ifndef MEDEBUG_DEBUG_LOCKS 30 # define MEDEBUG_DEBUG_LOCKS /* Switch to enable locking messages. */ 31 # endif 32 #endif 33 34 #ifdef MEDEBUG_TEST_INFO /* Switch to enable info and test messages. */ 35 # ifndef MEDEBUG_INFO 36 # define MEDEBUG_INFO /* Switch to enable info messages. */ 37 # endif 38 # ifndef MEDEBUG_TEST 39 # define MEDEBUG_TEST 40 # endif 41 #endif 42 43 #ifdef MEDEBUG_TEST /* Switch to enable debug test messages. */ 44 # ifndef MEDEBUG_DEBUG 45 # define MEDEBUG_DEBUG /* Switch to enable debug messages. */ 46 # endif 47 # ifndef MEDEBUG_ERROR 48 # define MEDEBUG_ERROR /* Switch to enable error messages. */ 49 # endif 50 #endif 51 52 #ifdef MEDEBUG_ERROR /* Switch to enable error messages. */ 53 # ifndef MEDEBUG_ERROR_CRITICAL /* Also critical error messages. */ 54 # define MEDEBUG_ERROR_CRITICAL /* Switch to enable high importance error messages. */ 55 # endif 56 #endif 57 58 #undef PDEBUG /* Only to be sure. */ 59 #undef PINFO /* Only to be sure. */ 60 #undef PERROR /* Only to be sure. */ 61 #undef PERROR_CRITICAL /* Only to be sure. */ 62 #undef PDEBUG_REG /* Only to be sure. */ 63 #undef PDEBUG_LOCKS /* Only to be sure. */ 64 #undef PSECURITY /* Only to be sure. */ 65 #undef PLOG /* Only to be sure. */ 66 67 #ifdef MEDEBUG_DEBUG 68 # define PDEBUG(fmt, args...) \ 69 printk(KERN_DEBUG"ME_DRV D: <%s> " fmt, __func__, ##args) 70 #else 71 # define PDEBUG(fmt, args...) 72 #endif 73 74 #ifdef MEDEBUG_DEBUG_LOCKS 75 # define PDEBUG_LOCKS(fmt, args...) \ 76 printk(KERN_DEBUG"ME_DRV L: <%s> " fmt, __func__, ##args) 77 #else 78 # define PDEBUG_LOCKS(fmt, args...) 79 #endif 80 81 #ifdef MEDEBUG_DEBUG_REG 82 # define PDEBUG_REG(fmt, args...) \ 83 printk(KERN_DEBUG"ME_DRV R: <%s:%d> REG:" fmt, __func__, __LINE__, ##args) 84 #else 85 # define PDEBUG_REG(fmt, args...) 86 #endif 87 88 #ifdef MEDEBUG_INFO 89 # define PINFO(fmt, args...) \ 90 printk(KERN_INFO"ME_DRV I: " fmt, ##args) 91 #else 92 # define PINFO(fmt, args...) 93 #endif 94 95 #ifdef MEDEBUG_ERROR 96 # define PERROR(fmt, args...) \ 97 printk(KERN_ERR"ME_DRV E: <%s:%i> " fmt, __FILE__, __LINE__, ##args) 98 #else 99 # define PERROR(fmt, args...) 100 #endif 101 102 #ifdef MEDEBUG_ERROR_CRITICAL 103 # define PERROR_CRITICAL(fmt, args...) \ 104 printk(KERN_CRIT"ME_DRV C: <%s:%i> " fmt, __FILE__, __LINE__, ##args) 105 #else 106 # define PERROR_CRITICAL(fmt, args...) 107 #endif 108 109 //This debug is only to detect logical errors! 110 # define PSECURITY(fmt, args...) \ 111 printk(KERN_CRIT"ME_DRV SECURITY: <%s:%s:%i> " fmt, __FILE__, __func__, __LINE__, ##args) 112 //This debug is to keep track in customers' system 113 # define PLOG(fmt, args...) \ 114 printk(KERN_INFO"ME_DRV: " fmt, ##args) 115 116 //This debug is to check new parts during development 117 #ifdef MEDEBUG_DEVELOP 118 # define PDEVELOP(fmt, args...) \ 119 printk(KERN_CRIT"ME_DRV: <%s:%s:%i> " fmt, __FILE__, __func__, __LINE__, ##args) 120 #else 121 # define PDEVELOP(fmt, args...) 122 #endif 123 124 #endif //__KERNEL__ 125 #endif //_MEDEBUG_H_ 126