cdc-acm.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. *
  3. * Includes for cdc-acm.c
  4. *
  5. * Mainly take from usbnet's cdc-ether part
  6. *
  7. */
  8. /*
  9. * CMSPAR, some architectures can't have space and mark parity.
  10. */
  11. #ifndef CMSPAR
  12. #define CMSPAR 0
  13. #endif
  14. /*
  15. * Major and minor numbers.
  16. */
  17. #define ACM_TTY_MAJOR 166
  18. #define ACM_TTY_MINORS 32
  19. /*
  20. * Requests.
  21. */
  22. #define USB_RT_ACM (USB_TYPE_CLASS | USB_RECIP_INTERFACE)
  23. /*
  24. * Output control lines.
  25. */
  26. #define ACM_CTRL_DTR 0x01
  27. #define ACM_CTRL_RTS 0x02
  28. /*
  29. * Input control lines and line errors.
  30. */
  31. #define ACM_CTRL_DCD 0x01
  32. #define ACM_CTRL_DSR 0x02
  33. #define ACM_CTRL_BRK 0x04
  34. #define ACM_CTRL_RI 0x08
  35. #define ACM_CTRL_FRAMING 0x10
  36. #define ACM_CTRL_PARITY 0x20
  37. #define ACM_CTRL_OVERRUN 0x40
  38. /*
  39. * Internal driver structures.
  40. */
  41. /*
  42. * The only reason to have several buffers is to accomodate assumptions
  43. * in line disciplines. They ask for empty space amount, receive our URB size,
  44. * and proceed to issue several 1-character writes, assuming they will fit.
  45. * The very first write takes a complete URB. Fortunately, this only happens
  46. * when processing onlcr, so we only need 2 buffers.
  47. */
  48. #define ACM_NWB 2
  49. struct acm_wb {
  50. unsigned char *buf;
  51. dma_addr_t dmah;
  52. int len;
  53. int use;
  54. };
  55. struct acm {
  56. struct usb_device *dev; /* the corresponding usb device */
  57. struct usb_interface *control; /* control interface */
  58. struct usb_interface *data; /* data interface */
  59. struct tty_struct *tty; /* the corresponding tty */
  60. struct urb *ctrlurb, *readurb, *writeurb; /* urbs */
  61. u8 *ctrl_buffer, *read_buffer; /* buffers of urbs */
  62. dma_addr_t ctrl_dma, read_dma; /* dma handles of buffers */
  63. struct acm_wb wb[ACM_NWB];
  64. int write_current; /* current write buffer */
  65. int write_used; /* number of non-empty write buffers */
  66. int write_ready; /* write urb is not running */
  67. spinlock_t write_lock;
  68. struct usb_cdc_line_coding line; /* bits, stop, parity */
  69. struct work_struct work; /* work queue entry for line discipline waking up */
  70. struct tasklet_struct bh; /* rx processing */
  71. spinlock_t throttle_lock; /* synchronize throtteling and read callback */
  72. unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */
  73. unsigned int ctrlout; /* output control lines (DTR, RTS) */
  74. unsigned int writesize; /* max packet size for the output bulk endpoint */
  75. unsigned int readsize,ctrlsize; /* buffer sizes for freeing */
  76. unsigned int used; /* someone has this acm's device open */
  77. unsigned int minor; /* acm minor number */
  78. unsigned char throttle; /* throttled by tty layer */
  79. unsigned char clocal; /* termios CLOCAL */
  80. unsigned char resubmit_to_unthrottle; /* throtteling has disabled the read urb */
  81. unsigned int ctrl_caps; /* control capabilities from the class specific header */
  82. };
  83. #define CDC_DATA_INTERFACE_TYPE 0x0a
  84. /* constants describing various quirks and errors */
  85. #define NO_UNION_NORMAL 1