lisodsp_debug.h

Go to the documentation of this file.
00001 /* 00002 * linux software DSP - OSS device driver - debug header 00003 * 00004 * Copyright 2004 Benjamin Gerard << ben <at> sashipa <dot> com >> 00005 * 00006 * Redistribution of this file is permitted under the 00007 * GNU General Public License. 00008 * 00009 * $Id: lisodsp_debug.h,v 1.1.1.1 2004/06/25 00:22:23 benjihan Exp $ 00010 */ 00011 00024 #ifndef _LISO_DEBUG_H_ 00025 #define _LISO_DEBUG_H_ 00026 00027 #include <linux/kernel.h> 00028 /* #include <linux/fs.h> */ 00029 00039 #ifdef USE_DEBUG 00040 00042 extern int debug; 00043 00045 extern int tabs; 00046 00048 extern const char tabs_str[8]; 00049 00050 #define TABS_MSK (sizeof(tabs_str)-1) 00051 00052 #endif 00053 00059 #define liso_err(format, arg...)\ 00060 printk(KERN_ERR "lisodsp: " format "\n" , ## arg) 00061 00063 #define liso_info(format, arg...)\ 00064 printk(KERN_INFO "lisodsp: " format "\n" , ## arg) 00065 00067 #define liso_warn(format, arg...)\ 00068 printk(KERN_WARNING "lisodsp: " format "\n" , ## arg) 00069 00071 #ifdef USE_DEBUG 00072 # define liso_dbg(format, arg...)\ 00073 if (debug) {\ 00074 printk(KERN_DEBUG "%s(%04d) " format "\n",\ 00075 tabs_str+TABS_MSK-(tabs&TABS_MSK),\ 00076 /*__FUNCTION__,*/__LINE__, ## arg);\ 00077 } else 00078 #else 00079 # define liso_dbg(format, arg...) 00080 #endif 00081 00083 #define liso_print printk 00084 00093 #ifdef USE_DEBUG 00094 # define liso_enter()\ 00095 if (debug) {\ 00096 printk(KERN_DEBUG "%s%s:%d {\n",\ 00097 tabs_str+TABS_MSK-(tabs&TABS_MSK),\ 00098 __FUNCTION__,__LINE__);\ 00099 ++tabs;\ 00100 } else 00101 #else 00102 # define liso_enter() do {} while(0) 00103 #endif 00104 00106 #ifdef USE_DEBUG 00107 # define liso_return(CODE)\ 00108 do {\ 00109 typeof(CODE) __rc=(CODE);\ 00110 if (debug) {\ 00111 --tabs;\ 00112 printk(KERN_DEBUG "%s} %s:%d (%d)\n",\ 00113 tabs_str+TABS_MSK-(tabs&TABS_MSK),\ 00114 __FUNCTION__,__LINE__,\ 00115 (int)__rc);\ 00116 }\ 00117 return __rc;\ 00118 } while(0) 00119 00120 # define liso_return_void(CODE)\ 00121 do {\ 00122 if (debug) {\ 00123 --tabs;\ 00124 printk(KERN_DEBUG "%s} %s:%d\n",tabs_str+TABS_MSK-(tabs&TABS_MSK),\ 00125 __FUNCTION__,__LINE__);\ 00126 }\ 00127 return;\ 00128 } while(0) 00129 #else 00130 # define liso_return(CODE) return (CODE) 00131 # define liso_return_void(CODE) return 00132 #endif 00133 00135 #define liso_leave(CODE) liso_return(CODE) 00136 00137 #define liso_leave_void() liso_return_void() 00138 00146 #define liso_test_magic(OBJ)\ 00147 (!OBJ || /* IS_ERR(OBJ) || */ OBJ->magic != OBJ) 00148 00150 #define liso_test_magic_or_returns(OBJ,NAME)\ 00151 if (liso_test_magic(OBJ)) {\ 00152 liso_dbg("invalid " NAME " [%p,%p]",OBJ,OBJ->magic);\ 00153 liso_return(-EINVAL);\ 00154 } else 00155 00163 #endif /* #ifndef _LISO_DEBUG_H_ */

lisodsp logo lisodsp developer documentation
version 0.5.0
Generated on June 2004
by doxygen 1.3.7