]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/i4b/include/i4b_debug.h
unfinished sblive driver, playback/mixer only for now - not enabled in
[FreeBSD/FreeBSD.git] / sys / i4b / include / i4b_debug.h
1 /*
2  * Copyright (c) 1997, 1999 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.20 1999/12/13 21:25:28 hm Exp $ 
31  *
32  * $FreeBSD$
33  *
34  *      last edit-date: [Mon Dec 13 22:06:59 1999]
35  *
36  *---------------------------------------------------------------------------*/
37
38 #define DO_I4B_DEBUG    /* enable debugging code inclusion */
39
40 #undef DO_I4B_MAXDEBUG  /* enable ALL debug messages by default */
41
42 #ifdef DO_I4B_DEBUG
43
44 extern unsigned int i4b_l1_debug;
45 extern unsigned int i4b_l2_debug;
46 extern unsigned int i4b_l3_debug;
47 extern unsigned int i4b_l4_debug;
48
49 #define DBGL1(bits, routine, what)                      \
50         if(bits & i4b_l1_debug)                         \
51         {                                               \
52                 printf("i4b-L1-%s: ", routine); \
53                 printf what ;                           \
54         }
55
56 #define DBGL2(bits, routine, what)                      \
57         if(bits & i4b_l2_debug)                         \
58         {                                               \
59                 printf("i4b-L2-%s: ", routine); \
60                 printf what ;                           \
61         }
62
63 #define DBGL3(bits, routine, what)                      \
64         if(bits & i4b_l3_debug)                         \
65         {                                               \
66                 printf("i4b-L3-%s: ", routine); \
67                 printf what ;                           \
68         }
69
70 #define DBGL4(bits, routine, what)                      \
71         if(bits & i4b_l4_debug)                         \
72         {                                               \
73                 printf("i4b-L4-%s: ", routine); \
74                 printf what ;                           \
75         }
76 #else /* !DO_I4B_DEBUG */
77
78 #define DBGL1(bits, routine, what);
79 #define DBGL2(bits, routine, what);
80 #define DBGL3(bits, routine, what);
81 #define DBGL4(bits, routine, what);
82
83 #endif /* DO_I4B_DEBUG */
84
85 /* Layer 1 */
86
87 #define L1_ERROR        0x0001          /* general error message*/
88 #define L1_PRIM         0x0002          /* interlayer primitives*/
89 #define L1_BCHAN        0x0004          /* B channel action     */
90 #define L1_H_ERR        0x0008          /* HSCX errors          */
91 #define L1_H_IRQ        0x0010          /* HSCX IRQ messages    */
92 #define L1_I_ERR        0x0020          /* ISAC errors          */
93 #define L1_I_MSG        0x0040          /* ISAC messages        */
94 #define L1_I_SETUP      0x0080          /* ISAC setup messages  */
95 #define L1_F_MSG        0x0100          /* FSM messages         */
96 #define L1_F_ERR        0x0200          /* FSM error messages   */
97 #define L1_T_MSG        0x0400          /* Timer messages       */
98 #define L1_T_ERR        0x0800          /* Timer error messages */
99 #define L1_H_XFRERR     0x1000          /* HSCX data xfer error */
100 #define L1_I_CICO       0x2000          /* ISAC command in/out  */
101
102 #define L1_DEBUG_MAX    0x3fef          /* all messages on except IRQ!  */
103 #define L1_DEBUG_ERR (L1_H_ERR | L1_I_ERR | L1_F_ERR | L1_T_ERR | L1_ERROR)
104
105 #ifndef L1_DEBUG_DEFAULT
106 #ifdef DO_I4B_MAXDEBUG
107 #define L1_DEBUG_DEFAULT L1_DEBUG_MAX
108 #else
109 #define L1_DEBUG_DEFAULT L1_DEBUG_ERR
110 #endif
111 #endif
112
113 /* Layer 2 */
114
115 #define L2_ERROR        0x0001          /* general error message        */
116 #define L2_PRIM         0x0002          /* interlayer primitives        */
117 #define L2_U_MSG        0x0004          /* U frame messages             */
118 #define L2_U_ERR        0x0008          /* U frame error messages       */
119 #define L2_S_MSG        0x0010          /* S frame messages             */
120 #define L2_S_ERR        0x0020          /* S frame error messages       */
121 #define L2_I_MSG        0x0040          /* I frame messages             */
122 #define L2_I_ERR        0x0080          /* I frame error messages       */
123 #define L2_F_MSG        0x0100          /* FSM messages                 */
124 #define L2_F_ERR        0x0200          /* FSM error messages           */
125 #define L2_T_MSG        0x0400          /* timer messages               */
126 #define L2_T_ERR        0x0800          /* timer error messages         */
127 #define L2_TEI_MSG      0x1000          /* TEI messages                 */
128 #define L2_TEI_ERR      0x2000          /* TEI error messages           */
129
130 #define L2_DEBUG_MAX    0x3fff          /* all messages on              */
131 #define L2_DEBUG_ERR (L2_ERROR | L2_I_ERR | L2_F_ERR | L2_T_ERR | L2_S_ERR | L2_TEI_ERR | L2_U_ERR )
132
133 #ifndef L2_DEBUG_DEFAULT
134 #ifdef DO_I4B_MAXDEBUG
135 #define L2_DEBUG_DEFAULT L2_DEBUG_MAX
136 #else
137 #define L2_DEBUG_DEFAULT L2_DEBUG_ERR
138 #endif
139 #endif
140
141 /* Layer 3 */
142
143 #define L3_ERR          0x0001          /* general error message        */
144 #define L3_MSG          0x0002          /* general message              */
145 #define L3_F_MSG        0x0004          /* FSM messages                 */
146 #define L3_F_ERR        0x0008          /* FSM error messages           */
147 #define L3_T_MSG        0x0010          /* timer messages               */
148 #define L3_T_ERR        0x0020          /* timer error messages         */
149 #define L3_P_MSG        0x0040          /* protocol messages            */
150 #define L3_P_ERR        0x0080          /* protocol error messages      */
151 #define L3_A_MSG        0x0100          /* AOC messages                 */
152 #define L3_A_ERR        0x0200          /* AOC error messages           */
153 #define L3_PRIM         0x0400          /* messages exchanged           */
154
155 #define L3_DEBUG_MAX    0x07ff          /* all messages on      */
156 #define L3_DEBUG_ERR    (L3_ERR | L3_F_ERR | L3_T_ERR | L3_P_ERR | L3_A_ERR)
157
158 #ifndef L3_DEBUG_DEFAULT
159 #ifdef DO_I4B_MAXDEBUG
160 #define L3_DEBUG_DEFAULT L3_DEBUG_MAX
161 #else
162 #define L3_DEBUG_DEFAULT L3_DEBUG_ERR
163 #endif
164 #endif
165
166 /* Layer 4 */
167
168 #define L4_ERR          0x0001          /* general error message        */
169 #define L4_MSG          0x0002          /* general message              */
170 #define L4_TIMO         0x0004          /* b channel idle timeout msgs  */
171 #define L4_DIALST       0x0008          /* network driver dial states   */
172 #define L4_IPRDBG       0x0010          /* ipr driver debug messages    */
173 #define L4_RBCHDBG      0x0020          /* rbch driver debug messages   */
174 #define L4_ISPDBG       0x0040          /* isp driver debug messages    */
175 #define L4_TELDBG       0x0080          /* tel driver debug messages    */
176 #define L4_TINADBG      0x0100          /* tina driver debug messages   */
177 #define L4_TINAMSG      0x0200          /* tina driver messages         */
178 #define L4_TINAERR      0x0400          /* tina driver error messages   */
179
180 #define L4_DEBUG_MAX    0x07ff          /* all messages on      */
181 #define L4_DEBUG_ERR    (L4_ERR | L4_TINADBG |  L4_TINAMSG | L4_TINAERR)
182
183 #ifndef L4_DEBUG_DEFAULT
184 #ifdef DO_I4B_MAXDEBUG
185 #define L4_DEBUG_DEFAULT L4_DEBUG_MAX
186 #else
187 #define L4_DEBUG_DEFAULT L4_DEBUG_ERR
188 #endif
189 #endif
190
191 /*---------------------------------------------------------------------------*
192  *      ioctl via /dev/i4bctl:
193  *      get/set current debug bits settings
194  *---------------------------------------------------------------------------*/
195
196 typedef struct {
197         unsigned int    l1;
198         unsigned int    l2;
199         unsigned int    l3;
200         unsigned int    l4;     
201 } ctl_debug_t;
202         
203 #define I4B_CTL_GET_DEBUG       _IOR('C', 0, ctl_debug_t)
204
205 #define I4B_CTL_SET_DEBUG       _IOW('C', 1, ctl_debug_t)
206
207 /*---------------------------------------------------------------------------*
208  *      get hscx statistics
209  *---------------------------------------------------------------------------*/
210
211 typedef struct {
212         int unit;       /* controller number */
213         int chan;       /* channel number */
214         int vfr;
215         int rdo;
216         int crc;
217         int rab;
218         int xdu;
219         int rfo;
220 } hscxstat_t;
221         
222 #define I4B_CTL_GET_HSCXSTAT    _IOWR('C', 2, hscxstat_t)
223
224 #define I4B_CTL_CLR_HSCXSTAT    _IOW('C', 3, hscxstat_t)
225
226 /*---------------------------------------------------------------------------*
227  *      get LAPD/Q.921 statistics
228  *---------------------------------------------------------------------------*/
229 typedef struct {
230                                 /* transmit */
231
232         u_long  tx_i;   /* I    */
233         u_long  tx_rr;  /* RR   */
234         u_long  tx_rnr; /* RNR  */
235         u_long  tx_rej; /* REJ  */
236         u_long  tx_sabme;       /* SABME*/
237         u_long  tx_dm;  /* DM   */
238         u_long  tx_disc;        /* DISC */
239         u_long  tx_ua;  /* UA   */
240         u_long  tx_frmr;        /* FRMR */      
241         u_long  tx_tei; /* TEI  */
242
243                                 /* receive */
244
245         u_long  rx_i;   /* I    */
246         u_long  rx_rr;  /* RR   */
247         u_long  rx_rnr; /* RNR  */
248         u_long  rx_rej; /* REJ  */
249         u_long  rx_sabme;       /* SABME*/
250         u_long  rx_tei; /* TEI  */
251         u_long  rx_ui;  /* UI   */
252         u_long  rx_disc;        /* DISC */
253         u_long  rx_xid; /* XID  */
254         u_long  rx_dm;  /* DM   */
255         u_long  rx_ua;  /* UA   */
256         u_long  rx_frmr;        /* FRMR */      
257         
258                                         /* errors */
259
260         u_long  err_rx_len;     /* incorrect length */
261         u_long  err_rx_badf;    /* bad frame type */
262         u_long  err_rx_bads;    /* bad s frame */
263         u_long  err_rx_badu;    /* bad u frame */
264         u_long  err_rx_badui;   /* bad ui frame */
265 } lapdstat_t;
266
267 typedef struct {
268         int unit;
269         lapdstat_t lapdstat;
270 } l2stat_t;
271
272 #define I4B_CTL_GET_LAPDSTAT    _IOWR('C', 4, l2stat_t)
273
274 #define I4B_CTL_CLR_LAPDSTAT    _IOW('C', 5, int)
275
276 /* EOF */