hal_usb_cdc.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file hal_usb_cdc.h
  15. * @brief USB CDC macros and structures.
  16. *
  17. * @addtogroup USB_CDC
  18. * @{
  19. */
  20. #ifndef USB_CDC_H
  21. #define USB_CDC_H
  22. /*===========================================================================*/
  23. /* Driver constants. */
  24. /*===========================================================================*/
  25. /**
  26. * @name CDC specific messages.
  27. * @{
  28. */
  29. #define CDC_SEND_ENCAPSULATED_COMMAND 0x00U
  30. #define CDC_GET_ENCAPSULATED_RESPONSE 0x01U
  31. #define CDC_SET_COMM_FEATURE 0x02U
  32. #define CDC_GET_COMM_FEATURE 0x03U
  33. #define CDC_CLEAR_COMM_FEATURE 0x04U
  34. #define CDC_SET_AUX_LINE_STATE 0x10U
  35. #define CDC_SET_HOOK_STATE 0x11U
  36. #define CDC_PULSE_SETUP 0x12U
  37. #define CDC_SEND_PULSE 0x13U
  38. #define CDC_SET_PULSE_TIME 0x14U
  39. #define CDC_RING_AUX_JACK 0x15U
  40. #define CDC_SET_LINE_CODING 0x20U
  41. #define CDC_GET_LINE_CODING 0x21U
  42. #define CDC_SET_CONTROL_LINE_STATE 0x22U
  43. #define CDC_SEND_BREAK 0x23U
  44. #define CDC_SET_RINGER_PARMS 0x30U
  45. #define CDC_GET_RINGER_PARMS 0x31U
  46. #define CDC_SET_OPERATION_PARMS 0x32U
  47. #define CDC_GET_OPERATION_PARMS 0x33U
  48. /** @} */
  49. /**
  50. * @name CDC classes
  51. * @{
  52. */
  53. #define CDC_COMMUNICATION_INTERFACE_CLASS 0x02U
  54. #define CDC_DATA_INTERFACE_CLASS 0x0AU
  55. /** @} */
  56. /**
  57. * @name CDC subclasses
  58. * @{
  59. */
  60. #define CDC_ABSTRACT_CONTROL_MODEL 0x02U
  61. /** @} */
  62. /**
  63. * @name CDC descriptors
  64. * @{
  65. */
  66. #define CDC_CS_INTERFACE 0x24U
  67. /** @} */
  68. /**
  69. * @name CDC subdescriptors
  70. * @{
  71. */
  72. #define CDC_HEADER 0x00U
  73. #define CDC_CALL_MANAGEMENT 0x01U
  74. #define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02U
  75. #define CDC_UNION 0x06U
  76. /** @} */
  77. /**
  78. * @name Line Control bit definitions.
  79. * @{
  80. */
  81. #define LC_STOP_1 0U
  82. #define LC_STOP_1P5 1U
  83. #define LC_STOP_2 2U
  84. #define LC_PARITY_NONE 0U
  85. #define LC_PARITY_ODD 1U
  86. #define LC_PARITY_EVEN 2U
  87. #define LC_PARITY_MARK 3U
  88. #define LC_PARITY_SPACE 4U
  89. /** @} */
  90. /*===========================================================================*/
  91. /* Driver pre-compile time settings. */
  92. /*===========================================================================*/
  93. /*===========================================================================*/
  94. /* Derived constants and error checks. */
  95. /*===========================================================================*/
  96. /*===========================================================================*/
  97. /* Driver data structures and types. */
  98. /*===========================================================================*/
  99. /**
  100. * @brief Type of Line Coding structure.
  101. */
  102. typedef struct {
  103. uint8_t dwDTERate[4];
  104. uint8_t bCharFormat;
  105. uint8_t bParityType;
  106. uint8_t bDataBits;
  107. } cdc_linecoding_t;
  108. /*===========================================================================*/
  109. /* Driver macros. */
  110. /*===========================================================================*/
  111. /*===========================================================================*/
  112. /* External declarations. */
  113. /*===========================================================================*/
  114. #endif /* USB_CDC_H */
  115. /** @} */