1 /*
2 * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 *---------------------------------------------------------------------------
26 *
27 * i4b_debug.h - i4b debug header file
28 * -----------------------------------
29 *
30 * $Id: i4b_debug.h,v 1.4 2003/09/25 15:54:41 pooka Exp $
31 *
32 * $FreeBSD$
33 *
34 * last edit-date: [Wed May 31 09:51:34 2000]
35 *
36 *---------------------------------------------------------------------------*/
37
38 #ifndef I4B_DEBUG_H
39 #define I4B_DEBUG_H
40
41 #if !defined DO_I4B_DEBUG
42 # define DO_I4B_DEBUG 1 /* default = include debugging code */
43 #elif DO_I4B_DEBUG != 0
44 # undef DO_I4B_DEBUG
45 # define DO_I4B_DEBUG 1
46 #endif
47
48 #undef DO_I4B_MAXDEBUG /* default = disable ALL debug messages */
49
50 #if DO_I4B_DEBUG
51
52 extern unsigned int i4b_l1_debug;
53 extern unsigned int i4b_l2_debug;
54 extern unsigned int i4b_l3_debug;
55 extern unsigned int i4b_l4_debug;
56
57 #define NDBGL1(bits, fmt, args...) \
58 if(bits & i4b_l1_debug) \
59 { printf("%s (L1): %s: " fmt "\n", sc->sc_dev.dv_xname, __FUNCTION__ , ##args ); }
60
61 #define NDBGL2(bits, fmt, args...) \
62 if(bits & i4b_l2_debug) \
63 { printf("i4b-L2 %s: " fmt "\n", __FUNCTION__ , ##args ); }
64
65 #define NDBGL3(bits, fmt, args...) \
66 if(bits & i4b_l3_debug) \
67 { printf("i4b-L3 %s: " fmt "\n", __FUNCTION__ , ##args ); }
68
69 #define NDBGL4(bits, fmt, args...) \
70 if(bits & i4b_l4_debug) \
71 { printf("i4b-L4 %s: " fmt "\n", __FUNCTION__ , ##args ); }
72
73 #else /* !DO_I4B_DEBUG */
74
75 #define NDBGL1(bits, fmt, args...);
76 #define NDBGL2(bits, fmt, args...);
77 #define NDBGL3(bits, fmt, args...);
78 #define NDBGL4(bits, fmt, args...);
79
80 #endif /* DO_I4B_DEBUG */
81
82 /* Layer 1 */
83
84 #define L1_ERROR 0x0001 /* general error message*/
85 #define L1_PRIM 0x0002 /* interlayer primitives*/
86 #define L1_BCHAN 0x0004 /* B channel action */
87 #define L1_H_ERR 0x0008 /* HSCX errors */
88 #define L1_H_IRQ 0x0010 /* HSCX IRQ messages */
89 #define L1_I_ERR 0x0020 /* ISAC errors */
90 #define L1_I_MSG 0x0040 /* ISAC messages */
91 #define L1_I_SETUP 0x0080 /* ISAC setup messages */
92 #define L1_F_MSG 0x0100 /* FSM messages */
93 #define L1_F_ERR 0x0200 /* FSM error messages */
94 #define L1_T_MSG 0x0400 /* Timer messages */
95 #define L1_T_ERR 0x0800 /* Timer error messages */
96 #define L1_H_XFRERR 0x1000 /* HSCX data xfer error */
97 #define L1_I_CICO 0x2000 /* ISAC command in/out */
98 #define L1_S_MSG 0x4000 /* silent messages (soft-HDLC) */
99 #define L1_S_ERR 0x8000 /* error messages (soft-HDLC) */
100
101 #define L1_DEBUG_MAX 0xffef /* all messages on except IRQ! */
102 #define L1_DEBUG_ERR (L1_S_ERR | L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR)
103
104 #ifndef L1_DEBUG_DEFAULT
105 #ifdef DO_I4B_MAXDEBUG
106 #define L1_DEBUG_DEFAULT L1_DEBUG_MAX
107 #else
108 #define L1_DEBUG_DEFAULT L1_DEBUG_ERR
109 #endif
110 #endif
111
112 /* Layer 2 */
113
114 #define L2_ERROR 0x0001 /* general error message */
115 #define L2_PRIM 0x0002 /* interlayer primitives */
116 #define L2_U_MSG 0x0004 /* U frame messages */
117 #define L2_U_ERR 0x0008 /* U frame error messages */
118 #define L2_S_MSG 0x0010 /* S frame messages */
119 #define L2_S_ERR 0x0020 /* S frame error messages */
120 #define L2_I_MSG 0x0040 /* I frame messages */
121 #define L2_I_ERR 0x0080 /* I frame error messages */
122 #define L2_F_MSG 0x0100 /* FSM messages */
123 #define L2_F_ERR 0x0200 /* FSM error messages */
124 #define L2_T_MSG 0x0400 /* timer messages */
125 #define L2_T_ERR 0x0800 /* timer error messages */
126 #define L2_TEI_MSG 0x1000 /* TEI messages */
127 #define L2_TEI_ERR 0x2000 /* TEI error messages */
128
129 #define L2_DEBUG_MAX 0x3fff /* all messages on */
130 #define L2_DEBUG_ERR (L2_ERROR | L2_I_ERR | L2_F_ERR | L2_T_ERR | L2_S_ERR | L2_TEI_ERR | L2_U_ERR )
131
132 #ifndef L2_DEBUG_DEFAULT
133 #ifdef DO_I4B_MAXDEBUG
134 #define L2_DEBUG_DEFAULT L2_DEBUG_MAX
135 #else
136 #define L2_DEBUG_DEFAULT L2_DEBUG_ERR
137 #endif
138 #endif
139
140 /* Layer 3 */
141
142 #define L3_ERR 0x0001 /* general error message */
143 #define L3_MSG 0x0002 /* general message */
144 #define L3_F_MSG 0x0004 /* FSM messages */
145 #define L3_F_ERR 0x0008 /* FSM error messages */
146 #define L3_T_MSG 0x0010 /* timer messages */
147 #define L3_T_ERR 0x0020 /* timer error messages */
148 #define L3_P_MSG 0x0040 /* protocol messages */
149 #define L3_P_ERR 0x0080 /* protocol error messages */
150 #define L3_A_MSG 0x0100 /* AOC messages */
151 #define L3_A_ERR 0x0200 /* AOC error messages */
152 #define L3_PRIM 0x0400 /* messages exchanged */
153
154 #define L3_DEBUG_MAX 0x07ff /* all messages on */
155 #define L3_DEBUG_ERR (L3_ERR | L3_F_ERR | L3_T_ERR | L3_P_ERR | L3_A_ERR)
156
157 #ifndef L3_DEBUG_DEFAULT
158 #ifdef DO_I4B_MAXDEBUG
159 #define L3_DEBUG_DEFAULT L3_DEBUG_MAX
160 #else
161 #define L3_DEBUG_DEFAULT L3_DEBUG_ERR
162 #endif
163 #endif
164
165 /* Layer 4 */
166
167 #define L4_ERR 0x0001 /* general error message */
168 #define L4_MSG 0x0002 /* general message */
169 #define L4_TIMO 0x0004 /* b channel idle timeout msgs */
170 #define L4_DIALST 0x0008 /* network driver dial states */
171 #define L4_IPRDBG 0x0010 /* ipr driver debug messages */
172 #define L4_RBCHDBG 0x0020 /* rbch driver debug messages */
173 #define L4_ISPDBG 0x0040 /* isp driver debug messages */
174 #define L4_TELDBG 0x0080 /* tel driver debug messages */
175 #define L4_TINADBG 0x0100 /* tina driver debug messages */
176 #define L4_TINAMSG 0x0200 /* tina driver messages */
177 #define L4_TINAERR 0x0400 /* tina driver error messages */
178 #define L4_INGDBG 0x0800 /* ing driver debug messages */
179 #define L4_IAVCDBG 0x1000 /* iavc driver debug messages */
180
181 #define L4_DEBUG_MAX 0x0fff /* all messages on */
182 #define L4_DEBUG_ERR (L4_ERR | L4_TINADBG | L4_TINAMSG | L4_TINAERR)
183
184 #ifndef L4_DEBUG_DEFAULT
185 #ifdef DO_I4B_MAXDEBUG
186 #define L4_DEBUG_DEFAULT L4_DEBUG_MAX
187 #else
188 #define L4_DEBUG_DEFAULT L4_DEBUG_ERR
189 #endif
190 #endif
191
192 /*---------------------------------------------------------------------------*
193 * ioctl via /dev/i4bctl:
194 * get/set current debug bits settings
195 *---------------------------------------------------------------------------*/
196
197 typedef struct {
198 unsigned int l1;
199 unsigned int l2;
200 unsigned int l3;
201 unsigned int l4;
202 } ctl_debug_t;
203
204 #define I4B_CTL_GET_DEBUG _IOR('C', 0, ctl_debug_t)
205
206 #define I4B_CTL_SET_DEBUG _IOW('C', 1, ctl_debug_t)
207
208 /*---------------------------------------------------------------------------*
209 * generic get chipset statistics
210 *---------------------------------------------------------------------------*/
211
212 /* for the ihfc-driver: structure for HFC-1/S/SP statistics */
213
214 typedef struct {
215 int txframes;
216 int rxframes;
217 int xdu;
218 int rdo;
219 int crc;
220 int rab;
221 } hfcstat_t;
222
223
224 /* for the isic-driver: structure for HSCX statistics */
225
226 typedef struct {
227 int unit; /* controller number */
228 int chan; /* channel number */
229 int vfr;
230 int rdo;
231 int crc;
232 int rab;
233 int xdu;
234 int rfo;
235 } hscxstat_t;
236
237 /* generic statistics structure */
238
239 struct chipstat {
240 int driver_type; /* type, L1DRVR_XXXX */
241 int driver_unit; /* the unit number */
242 int driver_bchannel; /* the B-channel */
243 union stats { /* union for all drivers */
244 hfcstat_t hfcstat; /* for ihfc driver, L1DRVR_IHFC */
245 hscxstat_t hscxstat; /* for isic driver, L1DRVR_ISIC */
246 } stats;
247 };
248
249 /* get statistics */
250
251 #define I4B_CTL_GET_CHIPSTAT _IOWR('C', 2, struct chipstat)
252
253 /* clear statistics */
254
255 #define I4B_CTL_CLR_CHIPSTAT _IOW('C', 3, struct chipstat)
256
257 /*---------------------------------------------------------------------------*
258 * get LAPD/Q.921 statistics
259 *---------------------------------------------------------------------------*/
260 typedef struct {
261
262 /* transmit */
263
264 u_long tx_i; /* I */
265 u_long tx_rr; /* RR */
266 u_long tx_rnr; /* RNR */
267 u_long tx_rej; /* REJ */
268 u_long tx_sabme; /* SABME*/
269 u_long tx_dm; /* DM */
270 u_long tx_disc; /* DISC */
271 u_long tx_ua; /* UA */
272 u_long tx_frmr; /* FRMR */
273 u_long tx_tei; /* TEI */
274
275 /* receive */
276
277 u_long rx_i; /* I */
278 u_long rx_rr; /* RR */
279 u_long rx_rnr; /* RNR */
280 u_long rx_rej; /* REJ */
281 u_long rx_sabme; /* SABME*/
282 u_long rx_tei; /* TEI */
283 u_long rx_ui; /* UI */
284 u_long rx_disc; /* DISC */
285 u_long rx_xid; /* XID */
286 u_long rx_dm; /* DM */
287 u_long rx_ua; /* UA */
288 u_long rx_frmr; /* FRMR */
289
290 /* errors */
291
292 u_long err_rx_len; /* incorrect length */
293 u_long err_rx_badf; /* bad frame type */
294 u_long err_rx_bads; /* bad s frame */
295 u_long err_rx_badu; /* bad u frame */
296 u_long err_rx_badui; /* bad ui frame */
297 } lapdstat_t;
298
299 typedef struct {
300 int unit;
301 lapdstat_t lapdstat;
302 } l2stat_t;
303
304 #define I4B_CTL_GET_LAPDSTAT _IOWR('C', 4, l2stat_t)
305
306 #define I4B_CTL_CLR_LAPDSTAT _IOW('C', 5, int)
307
308 #endif
309 /* EOF */
Cache object: 6c247f678fb661136d7d5fb7cb78e7fc
|