cdc.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * File : cdc.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2012, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2012-10-03 Yi Qiu first version
  13. * 2012-12-12 heyuanjie87 add CDC endpoints collection
  14. */
  15. #ifndef __CDC_H__
  16. #define __CDC_H__
  17. #define USB_CDC_BUFSIZE 0x40
  18. #define USB_CDC_CLASS_COMM 0x02
  19. #define USB_CDC_CLASS_DATA 0x0A
  20. #define USB_CDC_SUBCLASS_DLCM 0x01
  21. #define USB_CDC_SUBCLASS_ACM 0x02
  22. #define USB_CDC_SUBCLASS_TCM 0x03
  23. #define USB_CDC_SUBCLASS_MCCM 0x04
  24. #define USB_CDC_SUBCLASS_CCM 0x05
  25. #define USB_CDC_SUBCLASS_ETH 0x06
  26. #define USB_CDC_SUBCLASS_ATM 0x07
  27. #define USB_CDC_PROTOCOL_V25TER 0x01
  28. #define USB_CDC_PROTOCOL_I430 0x30
  29. #define USB_CDC_PROTOCOL_HDLC 0x31
  30. #define USB_CDC_PROTOCOL_TRANS 0x32
  31. #define USB_CDC_PROTOCOL_Q921M 0x50
  32. #define USB_CDC_PROTOCOL_Q921 0x51
  33. #define USB_CDC_PROTOCOL_Q921TM 0x52
  34. #define USB_CDC_PROTOCOL_V42BIS 0x90
  35. #define USB_CDC_PROTOCOL_Q931 0x91
  36. #define USB_CDC_PROTOCOL_V120 0x92
  37. #define USB_CDC_PROTOCOL_CAPI20 0x93
  38. #define USB_CDC_PROTOCOL_HOST 0xFD
  39. #define USB_CDC_PROTOCOL_PUFD 0xFE
  40. #define USB_CDC_PROTOCOL_VENDOR 0xFF
  41. #define USB_CDC_CS_INTERFACE 0x24
  42. #define USB_CDC_CS_ENDPOINT 0x25
  43. #define USB_CDC_SCS_HEADER 0x00
  44. #define USB_CDC_SCS_CALL_MGMT 0x01
  45. #define USB_CDC_SCS_ACM 0x02
  46. #define USB_CDC_SCS_UNION 0x06
  47. #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
  48. #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
  49. #define CDC_SET_COMM_FEATURE 0x02
  50. #define CDC_GET_COMM_FEATURE 0x03
  51. #define CDC_CLEAR_COMM_FEATURE 0x04
  52. #define CDC_SET_AUX_LINE_STATE 0x10
  53. #define CDC_SET_HOOK_STATE 0x11
  54. #define CDC_PULSE_SETUP 0x12
  55. #define CDC_SEND_PULSE 0x13
  56. #define CDC_SET_PULSE_TIME 0x14
  57. #define CDC_RING_AUX_JACK 0x15
  58. #define CDC_SET_LINE_CODING 0x20
  59. #define CDC_GET_LINE_CODING 0x21
  60. #define CDC_SET_CONTROL_LINE_STATE 0x22
  61. #define CDC_SEND_BREAK 0x23
  62. #define CDC_SET_RINGER_PARMS 0x30
  63. #define CDC_GET_RINGER_PARMS 0x31
  64. #define CDC_SET_OPERATION_PARMS 0x32
  65. #define CDC_GET_OPERATION_PARMS 0x33
  66. #define CDC_SET_LINE_PARMS 0x34
  67. #define CDC_GET_LINE_PARMS 0x35
  68. #define CDC_DIAL_DIGITS 0x36
  69. #define CDC_SET_UNIT_PARAMETER 0x37
  70. #define CDC_GET_UNIT_PARAMETER 0x38
  71. #define CDC_CLEAR_UNIT_PARAMETER 0x39
  72. #define CDC_GET_PROFILE 0x3A
  73. #define CDC_SET_ETH_MULTICAST_FILTERS 0x40
  74. #define CDC_SET_ETH_POWER_MGMT_FILT 0x41
  75. #define CDC_GET_ETH_POWER_MGMT_FILT 0x42
  76. #define CDC_SET_ETH_PACKET_FILTER 0x43
  77. #define CDC_GET_ETH_STATISTIC 0x44
  78. #define CDC_SET_ATM_DATA_FORMAT 0x50
  79. #define CDC_GET_ATM_DEVICE_STATISTICS 0x51
  80. #define CDC_SET_ATM_DEFAULT_VC 0x52
  81. #define CDC_GET_ATM_VC_STATISTICS 0x53
  82. #pragma pack(1)
  83. struct ucdc_header_descriptor
  84. {
  85. rt_uint8_t length;
  86. rt_uint8_t type;
  87. rt_uint8_t subtype;
  88. rt_uint16_t bcd;
  89. };
  90. typedef struct ucdc_header_descriptor* ucdc_hdr_desc_t;
  91. struct ucdc_acm_descriptor
  92. {
  93. rt_uint8_t length;
  94. rt_uint8_t type;
  95. rt_uint8_t subtype;
  96. rt_uint8_t capabilties;
  97. };
  98. typedef struct ucdc_acm_descriptor* ucdc_acm_desc_t;
  99. struct ucdc_call_mgmt_descriptor
  100. {
  101. rt_uint8_t length;
  102. rt_uint8_t type;
  103. rt_uint8_t subtype;
  104. rt_uint8_t capabilties;
  105. rt_uint8_t data_interface;
  106. };
  107. typedef struct ucdc_call_mgmt_descriptor* ucdc_call_mgmt_desc_t;
  108. struct ucdc_union_descriptor
  109. {
  110. rt_uint8_t length;
  111. rt_uint8_t type;
  112. rt_uint8_t subtype;
  113. rt_uint8_t master_interface;
  114. rt_uint8_t slave_interface0;
  115. };
  116. typedef struct ucdc_union_descriptor* ucdc_union_desc_t;
  117. struct ucdc_comm_descriptor
  118. {
  119. #ifdef RT_USB_DEVICE_COMPOSITE
  120. struct uiad_descriptor iad_desc;
  121. #endif
  122. struct uinterface_descriptor intf_desc;
  123. struct ucdc_header_descriptor hdr_desc;
  124. struct ucdc_call_mgmt_descriptor call_mgmt_desc;
  125. struct ucdc_acm_descriptor acm_desc;
  126. struct ucdc_union_descriptor union_desc;
  127. struct uendpoint_descriptor ep_desc;
  128. };
  129. typedef struct ucdc_comm_descriptor* ucdc_comm_desc_t;
  130. struct ucdc_data_descriptor
  131. {
  132. struct uinterface_descriptor intf_desc;
  133. struct uendpoint_descriptor ep_out_desc;
  134. struct uendpoint_descriptor ep_in_desc;
  135. };
  136. typedef struct ucdc_data_descriptor* ucdc_data_desc_t;
  137. struct ucdc_line_coding
  138. {
  139. rt_uint32_t dwDTERate;
  140. rt_uint8_t bCharFormat;
  141. rt_uint8_t bParityType;
  142. rt_uint8_t bDataBits;
  143. };
  144. typedef struct ucdc_line_coding* ucdc_line_coding_t;
  145. struct cdc_eps
  146. {
  147. uep_t ep_out;
  148. uep_t ep_in;
  149. uep_t ep_cmd;
  150. };
  151. typedef struct cdc_eps* cdc_eps_t;
  152. #pragma pack()
  153. #endif