Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  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         __le32 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         u8 *ctrl_buffer, *read_buffer, *write_buffer;   /* buffers of urbs */
 90         dma_addr_t ctrl_dma, read_dma, write_dma;       /* dma handles of buffers */
 91         struct acm_line line;                           /* line coding (bits, stop, parity) */
 92         struct work_struct work;                        /* work queue entry for line discipline waking up */
 93         struct tasklet_struct bh;                       /* rx processing */
 94         spinlock_t throttle_lock;                       /* synchronize throtteling and read callback */
 95         unsigned int ctrlin;                            /* input control lines (DCD, DSR, RI, break, overruns) */
 96         unsigned int ctrlout;                           /* output control lines (DTR, RTS) */
 97         unsigned int writesize;                         /* max packet size for the output bulk endpoint */
 98         unsigned int readsize,ctrlsize;                 /* buffer sizes for freeing */
 99         unsigned int used;                              /* someone has this acm's device open */
100         unsigned int minor;                             /* acm minor number */
101         unsigned char throttle;                         /* throttled by tty layer */
102         unsigned char clocal;                           /* termios CLOCAL */
103         unsigned char ready_for_write;                  /* write urb can be used */
104         unsigned char resubmit_to_unthrottle;           /* throtteling has disabled the read urb */
105         unsigned int ctrl_caps;                         /* control capabilities from the class specific header */
106 };
107 
108 /* "Union Functional Descriptor" from CDC spec 5.2.3.X */
109 struct union_desc {
110         u8      bLength;
111         u8      bDescriptorType;
112         u8      bDescriptorSubType;
113 
114         u8      bMasterInterface0;
115         u8      bSlaveInterface0;
116         /* ... and there could be other slave interfaces */
117 } __attribute__ ((packed));
118 
119 /* class specific descriptor types */
120 #define CDC_HEADER_TYPE                 0x00
121 #define CDC_CALL_MANAGEMENT_TYPE        0x01
122 #define CDC_AC_MANAGEMENT_TYPE          0x02
123 #define CDC_UNION_TYPE                  0x06
124 #define CDC_COUNTRY_TYPE                0x07
125 
126 #define CDC_DATA_INTERFACE_TYPE 0x0a
127 
128 /* constants describing various quirks and errors */
129 #define NO_UNION_NORMAL                 1
130 
  This page was automatically generated by the LXR engine.