3 * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
5 * Copyright © 2005 Agere Systems Inc.
9 *------------------------------------------------------------------------------
11 * et131x_debug.h - Defines, structs, enums, prototypes, etc. used for
12 * outputting debug messages to the system logging facility
15 *------------------------------------------------------------------------------
19 * This software is provided subject to the following terms and conditions,
20 * which you should read carefully before using the software. Using this
21 * software indicates your acceptance of these terms and conditions. If you do
22 * not agree with these terms and conditions, do not use the software.
24 * Copyright © 2005 Agere Systems Inc.
25 * All rights reserved.
27 * Redistribution and use in source or binary forms, with or without
28 * modifications, are permitted provided that the following conditions are met:
30 * . Redistributions of source code must retain the above copyright notice, this
31 * list of conditions and the following Disclaimer as comments in the code as
32 * well as in the documentation and/or other materials provided with the
35 * . Redistributions in binary form must reproduce the above copyright notice,
36 * this list of conditions and the following Disclaimer in the documentation
37 * and/or other materials provided with the distribution.
39 * . Neither the name of Agere Systems Inc. nor the names of the contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
45 * THIS SOFTWARE IS PROVIDED
\93AS IS
\94 AND ANY EXPRESS OR IMPLIED WARRANTIES,
46 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
47 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
48 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
49 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
50 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
51 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
52 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
53 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
55 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
60 #ifndef __ET131X_DBG_H__
61 #define __ET131X_DBG_H__
63 /* Define Masks for debugging types/levels */
64 #define DBG_ERROR_ON 0x00000001L
65 #define DBG_WARNING_ON 0x00000002L
66 #define DBG_NOTICE_ON 0x00000004L
67 #define DBG_TRACE_ON 0x00000008L
68 #define DBG_VERBOSE_ON 0x00000010L
69 #define DBG_PARAM_ON 0x00000020L
70 #define DBG_BREAK_ON 0x00000040L
71 #define DBG_RX_ON 0x00000100L
72 #define DBG_TX_ON 0x00000200L
74 #ifdef CONFIG_ET131X_DEBUG
77 * Set the level of debugging if not done with a preprocessor define. See
78 * et131x_main.c, function et131x_init_module() for how the debug level
79 * translates into the types of messages displayed.
85 #define DBG_DEFAULTS (DBG_ERROR_ON | DBG_WARNING_ON | DBG_BREAK_ON)
87 #define DBG_FLAGS(A) ((A)->dbgFlags)
88 #define DBG_NAME(A) ((A)->dbgName)
89 #define DBG_LEVEL(A) ((A)->dbgLevel)
92 #define DBG_PRINT(S...) printk(KERN_DEBUG S)
93 #endif /* DBG_PRINT */
96 #define DBG_PRINTC(S...) printk(S)
97 #endif /* DBG_PRINTC */
100 #define DBG_TRAP {} /* BUG() */
101 #endif /* DBG_TRAP */
103 #define _ENTER_STR ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
104 #define _LEAVE_STR "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
106 #define _DBG_ENTER(A) printk(KERN_DEBUG "%s:%.*s:%s\n", DBG_NAME(A), \
107 ++DBG_LEVEL(A), _ENTER_STR, __func__)
108 #define _DBG_LEAVE(A) printk(KERN_DEBUG "%s:%.*s:%s\n", DBG_NAME(A), \
109 DBG_LEVEL(A)--, _LEAVE_STR, __func__)
111 #define DBG_ENTER(A) \
113 if (DBG_FLAGS(A) & DBG_TRACE_ON) \
117 #define DBG_LEAVE(A) \
119 if (DBG_FLAGS(A) & DBG_TRACE_ON) \
123 #define DBG_PARAM(A, N, F, S...) \
125 if (DBG_FLAGS(A) & DBG_PARAM_ON) \
126 DBG_PRINT(" %s -- "F" ", N, S); \
129 #define DBG_ERROR(A, S...) \
131 if (DBG_FLAGS(A) & DBG_ERROR_ON) { \
132 DBG_PRINT("%s:ERROR:%s ", DBG_NAME(A), __func__);\
138 #define DBG_WARNING(A, S...) \
140 if (DBG_FLAGS(A) & DBG_WARNING_ON) { \
141 DBG_PRINT("%s:WARNING:%s ", DBG_NAME(A), __func__); \
146 #define DBG_NOTICE(A, S...) \
148 if (DBG_FLAGS(A) & DBG_NOTICE_ON) { \
149 DBG_PRINT("%s:NOTICE:%s ", DBG_NAME(A), __func__); \
154 #define DBG_TRACE(A, S...) \
156 if (DBG_FLAGS(A) & DBG_TRACE_ON) { \
157 DBG_PRINT("%s:TRACE:%s ", DBG_NAME(A), __func__); \
162 #define DBG_VERBOSE(A, S...) \
164 if (DBG_FLAGS(A) & DBG_VERBOSE_ON) { \
165 DBG_PRINT("%s:VERBOSE:%s ", DBG_NAME(A), __func__); \
170 #define DBG_RX(A, S...) \
172 if (DBG_FLAGS(A) & DBG_RX_ON) \
176 #define DBG_RX_ENTER(A) \
178 if (DBG_FLAGS(A) & DBG_RX_ON) \
182 #define DBG_RX_LEAVE(A) \
184 if (DBG_FLAGS(A) & DBG_RX_ON) \
188 #define DBG_TX(A, S...) \
190 if (DBG_FLAGS(A) & DBG_TX_ON) \
194 #define DBG_TX_ENTER(A) \
196 if (DBG_FLAGS(A) & DBG_TX_ON) \
200 #define DBG_TX_LEAVE(A) \
202 if (DBG_FLAGS(A) & DBG_TX_ON) \
206 #define DBG_ASSERT(C) \
209 DBG_PRINT("ASSERT(%s) -- %s#%d (%s) ", \
210 #C, __FILE__, __LINE__, __func__); \
220 unsigned long dbgFlags;
223 #else /* CONFIG_ET131X_DEBUG */
227 #define DBG_PRINT(S...)
230 #define DBG_PARAM(A,N,F,S...)
231 #define DBG_ERROR(A,S...)
232 #define DBG_WARNING(A,S...)
233 #define DBG_NOTICE(A,S...)
234 #define DBG_TRACE(A,S...)
235 #define DBG_VERBOSE(A,S...)
236 #define DBG_RX(A,S...)
237 #define DBG_RX_ENTER(A)
238 #define DBG_RX_LEAVE(A)
239 #define DBG_TX(A,S...)
240 #define DBG_TX_ENTER(A)
241 #define DBG_TX_LEAVE(A)
242 #define DBG_ASSERT(C)
243 #define STATIC static
245 #endif /* CONFIG_ET131X_DEBUG */
247 /* Forward declaration of the private adapter structure */
248 struct et131x_adapter;
250 void DumpTxQueueContents(int dbgLvl, struct et131x_adapter *adapter);
251 void DumpDeviceBlock(int dbgLvl, struct et131x_adapter *adapter,
253 void DumpDeviceReg(int dbgLvl, struct et131x_adapter *adapter);
255 #endif /* __ET131X_DBG_H__ */