1
0

cdc.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. */
  14. #define USB_CDC_PRODUCT_ID 0x5740 /* Product ID */
  15. #define USB_CDC_BUFSIZE 0x40
  16. #define USB_CDC_CLASS_COMM 0x02
  17. #define USB_CDC_CLASS_DATA 0x0A
  18. #define USB_CDC_SUBCLASS_DLCM 0x01
  19. #define USB_CDC_SUBCLASS_ACM 0x02
  20. #define USB_CDC_SUBCLASS_TCM 0x03
  21. #define USB_CDC_SUBCLASS_MCCM 0x04
  22. #define USB_CDC_SUBCLASS_CCM 0x05
  23. #define USB_CDC_SUBCLASS_ETH 0x06
  24. #define USB_CDC_SUBCLASS_ATM 0x07
  25. #define USB_CDC_PROTOCOL_V25TER 0x01
  26. #define USB_CDC_PROTOCOL_I430 0x30
  27. #define USB_CDC_PROTOCOL_HDLC 0x31
  28. #define USB_CDC_PROTOCOL_TRANS 0x32
  29. #define USB_CDC_PROTOCOL_Q921M 0x50
  30. #define USB_CDC_PROTOCOL_Q921 0x51
  31. #define USB_CDC_PROTOCOL_Q921TM 0x52
  32. #define USB_CDC_PROTOCOL_V42BIS 0x90
  33. #define USB_CDC_PROTOCOL_Q931 0x91
  34. #define USB_CDC_PROTOCOL_V120 0x92
  35. #define USB_CDC_PROTOCOL_CAPI20 0x93
  36. #define USB_CDC_PROTOCOL_HOST 0xFD
  37. #define USB_CDC_PROTOCOL_PUFD 0xFE
  38. #define USB_CDC_CS_INTERFACE 0x24
  39. #define USB_CDC_CS_ENDPOINT 0x25
  40. #define USB_CDC_SCS_HEADER 0x00
  41. #define USB_CDC_SCS_CALL_MGMT 0x01
  42. #define USB_CDC_SCS_ACM 0x02
  43. #define USB_CDC_SCS_UNION 0x06
  44. #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
  45. #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
  46. #define CDC_SET_COMM_FEATURE 0x02
  47. #define CDC_GET_COMM_FEATURE 0x03
  48. #define CDC_CLEAR_COMM_FEATURE 0x04
  49. #define CDC_SET_AUX_LINE_STATE 0x10
  50. #define CDC_SET_HOOK_STATE 0x11
  51. #define CDC_PULSE_SETUP 0x12
  52. #define CDC_SEND_PULSE 0x13
  53. #define CDC_SET_PULSE_TIME 0x14
  54. #define CDC_RING_AUX_JACK 0x15
  55. #define CDC_SET_LINE_CODING 0x20
  56. #define CDC_GET_LINE_CODING 0x21
  57. #define CDC_SET_CONTROL_LINE_STATE 0x22
  58. #define CDC_SEND_BREAK 0x23
  59. #define CDC_SET_RINGER_PARMS 0x30
  60. #define CDC_GET_RINGER_PARMS 0x31
  61. #define CDC_SET_OPERATION_PARMS 0x32
  62. #define CDC_GET_OPERATION_PARMS 0x33
  63. #define CDC_SET_LINE_PARMS 0x34
  64. #define CDC_GET_LINE_PARMS 0x35
  65. #define CDC_DIAL_DIGITS 0x36
  66. #define CDC_SET_UNIT_PARAMETER 0x37
  67. #define CDC_GET_UNIT_PARAMETER 0x38
  68. #define CDC_CLEAR_UNIT_PARAMETER 0x39
  69. #define CDC_GET_PROFILE 0x3A
  70. #define CDC_SET_ETH_MULTICAST_FILTERS 0x40
  71. #define CDC_SET_ETH_POWER_MGMT_FILT 0x41
  72. #define CDC_GET_ETH_POWER_MGMT_FILT 0x42
  73. #define CDC_SET_ETH_PACKET_FILTER 0x43
  74. #define CDC_GET_ETH_STATISTIC 0x44
  75. #define CDC_SET_ATM_DATA_FORMAT 0x50
  76. #define CDC_GET_ATM_DEVICE_STATISTICS 0x51
  77. #define CDC_SET_ATM_DEFAULT_VC 0x52
  78. #define CDC_GET_ATM_VC_STATISTICS 0x53
  79. #pragma pack(1)
  80. struct ucdc_header_descriptor
  81. {
  82. rt_uint8_t length;
  83. rt_uint8_t type;
  84. rt_uint8_t subtype;
  85. rt_uint16_t bcd;
  86. };
  87. typedef struct ucdc_header_descriptor* ucdc_hdr_desc_t;
  88. struct ucdc_acm_descriptor
  89. {
  90. rt_uint8_t length;
  91. rt_uint8_t type;
  92. rt_uint8_t subtype;
  93. rt_uint8_t capabilties;
  94. };
  95. typedef struct ucdc_acm_descriptor* ucdc_acm_desc_t;
  96. struct ucdc_call_mgmt_descriptor
  97. {
  98. rt_uint8_t length;
  99. rt_uint8_t type;
  100. rt_uint8_t subtype;
  101. rt_uint8_t capabilties;
  102. rt_uint8_t data_interface;
  103. };
  104. typedef struct ucdc_call_mgmt_descriptor* ucdc_call_mgmt_desc_t;
  105. struct ucdc_union_descriptor
  106. {
  107. rt_uint8_t length;
  108. rt_uint8_t type;
  109. rt_uint8_t subtype;
  110. rt_uint8_t master_interface;
  111. rt_uint8_t slave_interface0;
  112. };
  113. typedef struct ucdc_union_descriptor* ucdc_union_desc_t;
  114. struct ucdc_comm_descriptor
  115. {
  116. struct uinterface_descriptor intf_desc;
  117. struct ucdc_header_descriptor hdr_desc;
  118. struct ucdc_call_mgmt_descriptor call_mgmt_desc;
  119. struct ucdc_acm_descriptor acm_desc;
  120. struct ucdc_union_descriptor union_desc;
  121. struct uendpoint_descriptor ep_desc;
  122. };
  123. typedef struct ucdc_comm_descriptor* ucdc_comm_desc_t;
  124. struct ucdc_data_descriptor
  125. {
  126. struct uinterface_descriptor intf_desc;
  127. struct uendpoint_descriptor ep_out_desc;
  128. struct uendpoint_descriptor ep_in_desc;
  129. };
  130. typedef struct ucdc_data_descriptor* ucdc_data_desc_t;
  131. struct ucdc_line_coding
  132. {
  133. rt_uint32_t dwDTERate;
  134. rt_uint8_t bCharFormat;
  135. rt_uint8_t bParityType;
  136. rt_uint8_t bDataBits;
  137. };
  138. typedef struct ucdc_line_coding* ucdc_line_coding_t;
  139. #pragma pack()