cdc_class.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /**
  2. **************************************************************************
  3. * @file cdc_class.h
  4. * @version v2.0.6
  5. * @date 2021-12-31
  6. * @brief usb cdc class file
  7. **************************************************************************
  8. * Copyright notice & Disclaimer
  9. *
  10. * The software Board Support Package (BSP) that is made available to
  11. * download from Artery official website is the copyrighted work of Artery.
  12. * Artery authorizes customers to use, copy, and distribute the BSP
  13. * software and its related documentation for the purpose of design and
  14. * development in conjunction with Artery microcontrollers. Use of the
  15. * software is governed by this copyright notice and the following disclaimer.
  16. *
  17. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  18. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  19. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  20. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  21. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  23. *
  24. **************************************************************************
  25. */
  26. /* define to prevent recursive inclusion -------------------------------------*/
  27. #ifndef __CDC_CLASS_H
  28. #define __CDC_CLASS_H
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. #include "usb_std.h"
  33. #include "usbd_core.h"
  34. /** @addtogroup AT32F403A_407_middlewares_usbd_class
  35. * @{
  36. */
  37. /** @addtogroup USB_cdc_class
  38. * @{
  39. */
  40. /** @defgroup USB_cdc_class_definition
  41. * @{
  42. */
  43. /**
  44. * @brief usb cdc use endpoint define
  45. */
  46. #define USBD_CDC_INT_EPT 0x82
  47. #define USBD_CDC_BULK_IN_EPT 0x81
  48. #define USBD_CDC_BULK_OUT_EPT 0x01
  49. /**
  50. * @brief usb cdc in and out max packet size define
  51. */
  52. #define USBD_IN_MAXPACKET_SIZE 0x40
  53. #define USBD_OUT_MAXPACKET_SIZE 0x40
  54. #define USBD_CMD_MAXPACKET_SIZE 0x08
  55. /**
  56. * @brief usb cdc class request code define
  57. */
  58. #define SET_LINE_CODING 0x20
  59. #define GET_LINE_CODING 0x21
  60. /**
  61. * @}
  62. */
  63. /** @defgroup USB_cdc_class_exported_types
  64. * @{
  65. */
  66. /**
  67. * @brief usb cdc class set line coding struct
  68. */
  69. typedef struct
  70. {
  71. uint32_t bitrate; /* line coding baud rate */
  72. uint8_t format; /* line coding foramt */
  73. uint8_t parity; /* line coding parity */
  74. uint8_t data; /* line coding data bit */
  75. }linecoding_type;
  76. /**
  77. * @}
  78. */
  79. /** @defgroup USB_cdc_class_exported_functions
  80. * @{
  81. */
  82. extern usbd_class_handler class_handler;
  83. uint16_t usb_vcp_get_rxdata(void *udev, uint8_t *recv_data);
  84. error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len);
  85. /**
  86. * @}
  87. */
  88. /**
  89. * @}
  90. */
  91. /**
  92. * @}
  93. */
  94. #ifdef __cplusplus
  95. }
  96. #endif
  97. #endif