1 /*
2  * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-2-Clause
5  *
6  *---------------------------------------------------------------------------*/
7 
8 #ifndef _I4B_TRACE_H_
9 #define _I4B_TRACE_H_
10 
11 #include <glib.h>
12 
13 /*---------------------------------------------------------------------------*
14  *	structure of the header at the beginning of every trace mbuf
15  *---------------------------------------------------------------------------*/
16 typedef struct {
17 	guint32 length;		/* length of the following mbuf		*/
18 	guint32 unit;		/* controller unit number		*/
19 	guint32 type;		/* type of channel			*/
20 #define TRC_CH_I	0		/* Layer 1 INFO's		*/
21 #define TRC_CH_D	1		/* D channel			*/
22 #define TRC_CH_B1	2		/* B1 channel			*/
23 #define TRC_CH_B2	3		/* B2 channel			*/
24 	gint32 dir;		/* direction				*/
25 #define FROM_TE	0			/* user -> network		*/
26 #define FROM_NT 1			/* network -> user		*/
27 	guint32 trunc;		/* # of truncated bytes (frame > MCLBYTES) */
28 	guint32 count;		/* frame count for this unit/type	*/
29 	guint32 ts_sec;		/* timestamp seconds */
30 	guint32 ts_usec;	/* timestamp microseconds */
31 } i4b_trace_hdr_t;
32 
33 #define INFO0		0	/* layer 1 */
34 #define INFO1_8		1
35 #define INFO1_10	2
36 #define INFO2		3
37 #define INFO3		4
38 #define INFO4_8		5
39 #define INFO4_10	6
40 
41 /*---------------------------------------------------------------------------*
42  *	ioctl via /dev/i4btrc device(s):
43  *	get/set current trace flag settings
44  *---------------------------------------------------------------------------*/
45 
46 #define	I4B_TRC_GET	_IOR('T', 0, int)	/* get trace settings	*/
47 #define	I4B_TRC_SET	_IOW('T', 1, int)	/* set trace settings	*/
48 
49 #define TRACE_OFF       0x00		/* tracing off		*/
50 #define TRACE_I		0x01		/* trace L1 INFO's on	*/
51 #define TRACE_D_TX	0x02		/* trace D channel on	*/
52 #define TRACE_D_RX	0x04		/* trace D channel on	*/
53 #define TRACE_B_TX	0x08		/* trace B channel on	*/
54 #define TRACE_B_RX	0x10		/* trace B channel on	*/
55 
56 typedef struct {
57 	gint32 rxunit;		/* unit # for rx frames	*/
58 	gint32 rxflags;		/* d and/or b channel	*/
59 	gint32 txunit;		/* unit # for tx frames */
60 	gint32 txflags;		/* d and/or b channel	*/
61 } i4b_trace_setupa_t;
62 
63 #define	I4B_TRC_SETA	_IOW('T', 2, i4b_trace_setupa_t) /* set analyze mode */
64 #define	I4B_TRC_RESETA	_IOW('T', 3, int)	/* reset analyze mode	*/
65 
66 #endif /* _I4B_TRACE_H_ */
67