usbh_cdc_acm.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2022, sakumisu
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef USBH_CDC_ACM_H
  7. #define USBH_CDC_ACM_H
  8. #include "usb_cdc.h"
  9. struct usbh_cdc_acm {
  10. struct usbh_hubport *hport;
  11. struct usb_endpoint_descriptor *bulkin; /* Bulk IN endpoint */
  12. struct usb_endpoint_descriptor *bulkout; /* Bulk OUT endpoint */
  13. #ifdef CONFIG_USBHOST_CDC_ACM_NOTIFY
  14. struct usb_endpoint_descriptor *intin; /* INTR IN endpoint (optional) */
  15. #endif
  16. struct usbh_urb bulkout_urb;
  17. struct usbh_urb bulkin_urb;
  18. #ifdef CONFIG_USBHOST_CDC_ACM_NOTIFY
  19. struct usbh_urb intin_urb;
  20. #endif
  21. struct cdc_line_coding linecoding;
  22. uint8_t intf;
  23. uint8_t minor;
  24. void *user_data;
  25. };
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. int usbh_cdc_acm_set_line_coding(struct usbh_cdc_acm *cdc_acm_class, struct cdc_line_coding *line_coding);
  30. int usbh_cdc_acm_get_line_coding(struct usbh_cdc_acm *cdc_acm_class, struct cdc_line_coding *line_coding);
  31. int usbh_cdc_acm_set_line_state(struct usbh_cdc_acm *cdc_acm_class, bool dtr, bool rts);
  32. int usbh_cdc_acm_bulk_in_transfer(struct usbh_cdc_acm *cdc_acm_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout);
  33. int usbh_cdc_acm_bulk_out_transfer(struct usbh_cdc_acm *cdc_acm_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout);
  34. void usbh_cdc_acm_run(struct usbh_cdc_acm *cdc_acm_class);
  35. void usbh_cdc_acm_stop(struct usbh_cdc_acm *cdc_acm_class);
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif /* USBH_CDC_ACM_H */