Merge branch 'upstream-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6] / include / linux / cycx_x25.h
1 #ifndef _CYCX_X25_H
2 #define _CYCX_X25_H
3 /*
4 * cycx_x25.h    Cyclom X.25 firmware API definitions.
5 *
6 * Author:       Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 *
8 * Copyright:    (c) 1998-2003 Arnaldo Carvalho de Melo
9 *
10 * Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com>
11 *
12 *               This program is free software; you can redistribute it and/or
13 *               modify it under the terms of the GNU General Public License
14 *               as published by the Free Software Foundation; either version
15 *               2 of the License, or (at your option) any later version.
16 * ============================================================================
17 * 2000/04/02    acme            dprintk and cycx_debug
18 * 1999/01/03    acme            judicious use of data types
19 * 1999/01/02    acme            #define X25_ACK_N3      0x4411
20 * 1998/12/28    acme            cleanup: lot'o'things removed
21 *                                        commands listed,
22 *                                        TX25Cmd & TX25Config structs
23 *                                        typedef'ed
24 */
25 #ifndef PACKED
26 #define PACKED __attribute__((packed))
27 #endif 
28
29 /* X.25 shared memory layout. */
30 #define X25_MBOX_OFFS   0x300   /* general mailbox block */
31 #define X25_RXMBOX_OFFS 0x340   /* receive mailbox */
32
33 /* Debug */
34 #define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a)
35
36 extern unsigned int cycx_debug;
37
38 /* Data Structures */
39 /* X.25 Command Block. */
40 struct cycx_x25_cmd {
41         u16 command;
42         u16 link;       /* values: 0 or 1 */
43         u16 len;        /* values: 0 thru 0x205 (517) */
44         u32 buf;
45 } PACKED;
46
47 /* Defines for the 'command' field. */
48 #define X25_CONNECT_REQUEST             0x4401
49 #define X25_CONNECT_RESPONSE            0x4402
50 #define X25_DISCONNECT_REQUEST          0x4403
51 #define X25_DISCONNECT_RESPONSE         0x4404
52 #define X25_DATA_REQUEST                0x4405
53 #define X25_ACK_TO_VC                   0x4406
54 #define X25_INTERRUPT_RESPONSE          0x4407
55 #define X25_CONFIG                      0x4408
56 #define X25_CONNECT_INDICATION          0x4409
57 #define X25_CONNECT_CONFIRM             0x440A
58 #define X25_DISCONNECT_INDICATION       0x440B
59 #define X25_DISCONNECT_CONFIRM          0x440C
60 #define X25_DATA_INDICATION             0x440E
61 #define X25_INTERRUPT_INDICATION        0x440F
62 #define X25_ACK_FROM_VC                 0x4410
63 #define X25_ACK_N3                      0x4411
64 #define X25_CONNECT_COLLISION           0x4413
65 #define X25_N3WIN                       0x4414
66 #define X25_LINE_ON                     0x4415
67 #define X25_LINE_OFF                    0x4416
68 #define X25_RESET_REQUEST               0x4417
69 #define X25_LOG                         0x4500
70 #define X25_STATISTIC                   0x4600
71 #define X25_TRACE                       0x4700
72 #define X25_N2TRACEXC                   0x4702
73 #define X25_N3TRACEXC                   0x4703
74
75 /**
76  *      struct cycx_x25_config - cyclom2x x25 firmware configuration
77  *      @link - link number
78  *      @speed - line speed
79  *      @clock - internal/external
80  *      @n2 - # of level 2 retransm.(values: 1 thru FF)
81  *      @n2win - level 2 window (values: 1 thru 7)
82  *      @n3win - level 3 window (values: 1 thru 7)
83  *      @nvc - # of logical channels (values: 1 thru 64)
84  *      @pktlen - level 3 packet lenght - log base 2 of size
85  *      @locaddr - my address
86  *      @remaddr - remote address
87  *      @t1 - time, in seconds
88  *      @t2 - time, in seconds
89  *      @t21 - time, in seconds
90  *      @npvc - # of permanent virt. circuits (1 thru nvc)
91  *      @t23 - time, in seconds
92  *      @flags - see dosx25.doc, in portuguese, for details
93  */
94 struct cycx_x25_config {
95         u8  link;
96         u8  speed;
97         u8  clock;
98         u8  n2;
99         u8  n2win;
100         u8  n3win;
101         u8  nvc;
102         u8  pktlen;
103         u8  locaddr;
104         u8  remaddr;
105         u16 t1;
106         u16 t2;
107         u8  t21;
108         u8  npvc;
109         u8  t23;
110         u8  flags;
111 } PACKED;
112
113 struct cycx_x25_stats {
114         u16 rx_crc_errors;
115         u16 rx_over_errors;
116         u16 n2_tx_frames;
117         u16 n2_rx_frames;
118         u16 tx_timeouts;
119         u16 rx_timeouts;
120         u16 n3_tx_packets;
121         u16 n3_rx_packets;
122         u16 tx_aborts;
123         u16 rx_aborts;
124 } PACKED;
125 #endif  /* _CYCX_X25_H */