This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / drivers / usb / class / cdc-acm.h
1 /*
2  *
3  * Includes for cdc-acm.c
4  *
5  * Mainly take from usbnet's cdc-ether part
6  *
7  */
8
9 /*
10  * CMSPAR, some architectures can't have space and mark parity.
11  */
12
13 #ifndef CMSPAR
14 #define CMSPAR                  0
15 #endif
16
17 /*
18  * Major and minor numbers.
19  */
20
21 #define ACM_TTY_MAJOR           166
22 #define ACM_TTY_MINORS          32
23
24 /*
25  * Requests.
26  */
27
28 #define USB_RT_ACM              (USB_TYPE_CLASS | USB_RECIP_INTERFACE)
29
30 #define ACM_REQ_COMMAND         0x00
31 #define ACM_REQ_RESPONSE        0x01
32 #define ACM_REQ_SET_FEATURE     0x02
33 #define ACM_REQ_GET_FEATURE     0x03
34 #define ACM_REQ_CLEAR_FEATURE   0x04
35
36 #define ACM_REQ_SET_LINE        0x20
37 #define ACM_REQ_GET_LINE        0x21
38 #define ACM_REQ_SET_CONTROL     0x22
39 #define ACM_REQ_SEND_BREAK      0x23
40
41 /*
42  * IRQs.
43  */
44
45 #define ACM_IRQ_NETWORK         0x00
46 #define ACM_IRQ_LINE_STATE      0x20
47
48 /*
49  * Output control lines.
50  */
51
52 #define ACM_CTRL_DTR            0x01
53 #define ACM_CTRL_RTS            0x02
54
55 /*
56  * Input control lines and line errors.
57  */
58
59 #define ACM_CTRL_DCD            0x01
60 #define ACM_CTRL_DSR            0x02
61 #define ACM_CTRL_BRK            0x04
62 #define ACM_CTRL_RI             0x08
63
64 #define ACM_CTRL_FRAMING        0x10
65 #define ACM_CTRL_PARITY         0x20
66 #define ACM_CTRL_OVERRUN        0x40
67
68 /*
69  * Line speed and caracter encoding.
70  */
71
72 struct acm_line {
73         __u32 speed;
74         __u8 stopbits;
75         __u8 parity;
76         __u8 databits;
77 } __attribute__ ((packed));
78
79 /*
80  * Internal driver structures.
81  */
82
83 struct acm {
84         struct usb_device *dev;                         /* the corresponding usb device */
85         struct usb_interface *control;                  /* control interface */
86         struct usb_interface *data;                     /* data interface */
87         struct tty_struct *tty;                         /* the corresponding tty */
88         struct urb *ctrlurb, *readurb, *writeurb;       /* urbs */
89         struct acm_line line;                           /* line coding (bits, stop, parity) */
90         struct work_struct work;                        /* work queue entry for line discipline waking up */
91         struct tasklet_struct bh;                       /* rx processing */
92         unsigned int ctrlin;                            /* input control lines (DCD, DSR, RI, break, overruns) */
93         unsigned int ctrlout;                           /* output control lines (DTR, RTS) */
94         unsigned int writesize;                         /* max packet size for the output bulk endpoint */
95         unsigned int used;                              /* someone has this acm's device open */
96         unsigned int minor;                             /* acm minor number */
97         unsigned char throttle;                         /* throttled by tty layer */
98         unsigned char clocal;                           /* termios CLOCAL */
99         unsigned char ready_for_write;                  /* write urb can be used */
100 };
101
102 /* "Union Functional Descriptor" from CDC spec 5.2.3.X */
103 struct union_desc {
104         u8      bLength;
105         u8      bDescriptorType;
106         u8      bDescriptorSubType;
107
108         u8      bMasterInterface0;
109         u8      bSlaveInterface0;
110         /* ... and there could be other slave interfaces */
111 } __attribute__ ((packed));
112
113 #define CDC_UNION_TYPE          0x06
114 #define CDC_DATA_INTERFACE_TYPE 0x0a
115