| Linux kernel & device driver programming |
| [ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] |
1 1
2 /*
3 *
4 Copyright (c) Eicon Networks, 2002.
5 *
6 This source file is supplied for the use wit
7 Eicon Networks range of DIVA Server Adapters
8 *
9 Eicon File Revision : 2.1
10 *
11 This program is free software; you can redis
12 it under the terms of the GNU General Public
13 the Free Software Foundation; either version
14 any later version.
15 *
16 This program is distributed in the hope that
17 but WITHOUT ANY WARRANTY OF ANY KIND WHATSOE
18 implied warranty of MERCHANTABILITY or FITNE
19 See the GNU General Public License for more
20 *
21 You should have received a copy of the GNU G
22 along with this program; if not, write to th
23 Foundation, Inc., 675 Mass Ave, Cambridge, M
24 *
25 */
26
27 #include "debuglib.h"
28
29 #ifdef DIVA_NO_DEBUGLIB
30 static DIVA_DI_PRINTF dprintf;
31 #else /* DIVA_NO_DEBUGLIB */
32
33 _DbgHandle_ myDriverDebugHandle = { 0 /*!Regis
34 DIVA_DI_PRINTF dprintf = no_printf;
35 /*********************************************
36 #define DBG_FUNC(name) \
37 void \
38 myDbgPrint_##name (char *format, ...) \
39 { va_list ap ; \
40 if ( myDriverDebugHandle.dbg_prt ) \
41 { va_start (ap, format) ; \
42 (myDriverDebugHandle.dbg_prt) \
43 (myDriverDebugHandle.id, DLI_##name, format
44 va_end (ap) ; \
45 } }
46 DBG_FUNC(LOG)
47 DBG_FUNC(FTL)
48 DBG_FUNC(ERR)
49 DBG_FUNC(TRC)
50 DBG_FUNC(MXLOG)
51 DBG_FUNC(FTL_MXLOG)
52 void
53 myDbgPrint_EVL (long msgID, ...)
54 { va_list ap ;
55 if ( myDriverDebugHandle.dbg_ev )
56 { va_start (ap, msgID) ;
57 (myDriverDebugHandle.dbg_ev)
58 (myDriverDebugHandle.id, (unsigned long)msg
59 va_end (ap) ;
60 } }
61 DBG_FUNC(REG)
62 DBG_FUNC(MEM)
63 DBG_FUNC(SPL)
64 DBG_FUNC(IRP)
65 DBG_FUNC(TIM)
66 DBG_FUNC(BLK)
67 DBG_FUNC(TAPI)
68 DBG_FUNC(NDIS)
69 DBG_FUNC(CONN)
70 DBG_FUNC(STAT)
71 DBG_FUNC(SEND)
72 DBG_FUNC(RECV)
73 DBG_FUNC(PRV0)
74 DBG_FUNC(PRV1)
75 DBG_FUNC(PRV2)
76 DBG_FUNC(PRV3)
77 /*********************************************
78 int
79 DbgRegister (char *drvName, char *drvTag, unsi
80 {
81 int len;
82 /*
83 * deregister (if already registered) and zero
84 */
85 DbgDeregister () ;
86 /*
87 * initialize the debug handle
88 */
89 myDriverDebugHandle.Version = DBG_HANDLE_VERS
90 myDriverDebugHandle.id = -1 ;
91 myDriverDebugHandle.dbgMask = dbgMask | (DL_E
92 len = strlen (drvName) ;
93 memcpy (myDriverDebugHandle.drvName, drvName,
94 (len < sizeof(myDriverDebugHandle.drv
95 len : sizeof(myDriverDebugHandle.drvName)
96 len = strlen (drvTag) ;
97 memcpy (myDriverDebugHandle.drvTag, drvTag,
98 (len < sizeof(myDriverDebugHandle.drv
99 len : sizeof(myDriverDebugHandle.drvTag) -
100 /*
101 * Try to register debugging via old (and only
102 */
103 dprintf("\000\377", &myDriverDebugHandle) ;
104 if ( myDriverDebugHandle.dbg_prt )
105 {
106 return (1) ;
107 }
108 /*
109 * Check if we registered with an old maint dr
110 */
111 if ( myDriverDebugHandle.dbg_end != NULL
112 /* location of 'dbg_prt' in _OldDbgHandle_
113 && (myDriverDebugHandle.regTime.LowPart ||
114 myDriverDebugHandle.regTime.HighPart )
115 /* same location as in _OldDbgHandle_ struc
116 {
117 dprintf("%s: Cannot log to old maint driver
118 myDriverDebugHandle.dbg_end =
119 ((_OldDbgHandle_ *)&myDriverDebugHandle)->db
120 DbgDeregister () ;
121 }
122 return (0) ;
123 }
124 /*********************************************
125 void
126 DbgSetLevel (unsigned long dbgMask)
127 {
128 myDriverDebugHandle.dbgMask = dbgMask | (DL_E
129 }
130 /*********************************************
131 void
132 DbgDeregister (void)
133 {
134 if ( myDriverDebugHandle.dbg_end )
135 {
136 (myDriverDebugHandle.dbg_end)(&myDriverDebug
137 }
138 memset (&myDriverDebugHandle, 0, sizeof(myDri
139 }
140 void xdi_dbg_xlog (char* x, ...) {
141 va_list ap;
142 va_start (ap, x);
143 if (myDriverDebugHandle.dbg_end &&
144 (myDriverDebugHandle.dbg_irq || myDriverDeb
145 (myDriverDebugHandle.dbgMask & DL_STAT)) {
146 if (myDriverDebugHandle.dbg_irq) {
147 (*(myDriverDebugHandle.dbg_irq))(myDriverDe
148 (x[0] != 0) ? DLI_TRC : DLI_XLOG, x, ap
149 } else {
150 (*(myDriverDebugHandle.dbg_old))(myDriverDe
151 }
152 }
153 va_end(ap);
154 }
155 /*********************************************
156 #endif /* DIVA_NO_DEBUGLIB */
157
| This page was automatically generated by the LXR engine. |