2 * @file drvr_dbg_prnt.h
4 * @brief Debug printout macroses for the driver.
6 * @author Yury Georgievskiy. CERN AB/CO.
10 * @version 1.0 ygeorgie 09/04/2008 Creation date.
12 #ifndef _DRIVER_DBG_PRINTOUT_H_INCLUDE_
13 #define _DRIVER_DBG_PRINTOUT_H_INCLUDE_
15 /* If driver wants to use these utils - it should provide this function
16 CDCM is providing this function in cdcmDrvr.c */
17 extern char* __drvrnm(void);
19 //!< DeBuG Information Printout Level (IPL)
20 typedef enum _dbgipl
{
21 IPL_NONE
= 0, //!< silent mode
30 IPL_DBG
= 1 << 8, //!< printout debug messages
31 IPL_ERROR
= 1 << 9, //!< printout error messages
32 IPL_INFO
= 1 << 10, //!< printout information messages
33 IPL_WARN
= 1 << 11, //!< printout warning messages
34 IPL_ALL
= (~0) //!< verbose
37 //!< indisputable info printout
38 #define PRNT_ABS_INFO(format...) \
40 printk("%s [%s_INFO] %s(): ", KERN_INFO, __drvrnm(), __func__ ); \
45 //!< indisputable error printout
46 #define PRNT_ABS_ERR(format...) \
48 printk("%s [%s_ERR] %s(): ", KERN_ERR, __drvrnm(), __func__ ); \
53 //!< indisputable warning printout
54 #define PRNT_ABS_WARN(format...) \
56 printk("%s [%s_WARN] %s(): ", KERN_WARNING, __drvrnm(), __func__ ); \
61 //!< indisputable debugging printout
62 #define PRNT_ABS_DBG_MSG(format...) \
64 printk("%s [%s_DBG] %s()@%d: ", KERN_DEBUG, __drvrnm(), \
65 __func__ , __LINE__ ); \
71 /*! @name Driver debug printing.
73 * Driver statics table should be named @e drvrStatT and have a member
74 * @e d_ipl of type \ref dbgipl_t
77 #define PRNT_OPEN(dflg, format, arg...) \
79 if (dflg & IPL_OPEN) { PRNT_ABS_INFO(format, ##arg); } \
82 #define PRNT_CLOSE(dflg, format, arg...) \
84 if (dflg & IPL_CLOSE) { PRNT_ABS_INFO(format, ##arg); } \
87 #define PRNT_READ(dflg, format, arg...) \
89 if (dflg & IPL_READ) {PRNT_ABS_INFO(format, ##arg); } \
92 #define PRNT_WRITE(dflg, format, arg...) \
94 if (dflg & IPL_WRITE) { PRNT_ABS_INFO(format, ##arg); } \
97 #define PRNT_SELECT(dflg, format, arg...) \
99 if (dflg & IPL_SELECT) { PRNT_ABS_INFO(format, ##arg); } \
102 #define PRNT_IOCTL(dflg, format, arg...) \
104 if (dflg & IPL_IOCTL) { PRNT_ABS_INFO(format, ##arg); } \
107 #define PRNT_INSTALL(dflg, format, arg...) \
109 if (dflg & IPL_INSTALL) { PRNT_ABS_INFO(format, ##arg); } \
112 #define PRNT_UNINST(dflg, format, arg...) \
114 if (dflg & IPL_UNINST) { PRNT_ABS_INFO(format, ##arg); } \
117 #define PRNT_DBG(dflg, format, arg...) \
119 if (dflg & IPL_DBG) { PRNT_ABS_DBG_MSG(format, ##arg); } \
122 #define PRNT_ERR(dflg, format, arg...) \
124 if (dflg & IPL_ERROR) { PRNT_ABS_ERR(format, ##arg); } \
127 #define PRNT_INFO(dflg, format, arg...) \
129 if (dflg & IPL_INFO) { PRNT_ABS_INFO(format, ##arg); } \
132 #define PRNT_WARN(dflg, format, arg...) \
134 if (dflg & IPL_WARN) { PRNT_ABS_WARN(format, ##arg); } \
138 #endif /* _DRIVER_DBG_PRINTOUT_H_INCLUDE_ */