2022-08-18 21:41:19 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, sakumisu
|
2022-02-08 11:44:46 +08:00
|
|
|
*
|
2022-08-18 21:41:19 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2022-02-08 11:44:46 +08:00
|
|
|
*/
|
2022-08-18 21:41:19 +08:00
|
|
|
#ifndef USBH_CDC_ACM_H
|
|
|
|
|
#define USBH_CDC_ACM_H
|
2022-02-08 11:44:46 +08:00
|
|
|
|
|
|
|
|
#include "usb_cdc.h"
|
|
|
|
|
|
|
|
|
|
struct usbh_cdc_acm {
|
2022-03-19 11:23:40 +08:00
|
|
|
struct usbh_hubport *hport;
|
2023-11-15 22:08:26 +08:00
|
|
|
struct usb_endpoint_descriptor *bulkin; /* Bulk IN endpoint */
|
|
|
|
|
struct usb_endpoint_descriptor *bulkout; /* Bulk OUT endpoint */
|
2024-02-03 16:53:28 +08:00
|
|
|
#ifdef CONFIG_USBHOST_CDC_ACM_NOTIFY
|
|
|
|
|
struct usb_endpoint_descriptor *intin; /* INTR IN endpoint (optional) */
|
|
|
|
|
#endif
|
2023-11-15 22:08:26 +08:00
|
|
|
struct usbh_urb bulkout_urb;
|
|
|
|
|
struct usbh_urb bulkin_urb;
|
2024-02-03 16:53:28 +08:00
|
|
|
#ifdef CONFIG_USBHOST_CDC_ACM_NOTIFY
|
2023-11-15 22:08:26 +08:00
|
|
|
struct usbh_urb intin_urb;
|
2024-02-03 16:53:28 +08:00
|
|
|
#endif
|
2022-03-19 11:23:40 +08:00
|
|
|
|
2022-09-04 20:17:32 +08:00
|
|
|
struct cdc_line_coding linecoding;
|
2024-02-03 16:53:28 +08:00
|
|
|
|
|
|
|
|
uint8_t intf;
|
2022-02-08 11:44:46 +08:00
|
|
|
uint8_t minor;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-04-04 15:37:14 +08:00
|
|
|
int usbh_cdc_acm_set_line_coding(struct usbh_cdc_acm *cdc_acm_class, struct cdc_line_coding *line_coding);
|
|
|
|
|
int usbh_cdc_acm_get_line_coding(struct usbh_cdc_acm *cdc_acm_class, struct cdc_line_coding *line_coding);
|
|
|
|
|
int usbh_cdc_acm_set_line_state(struct usbh_cdc_acm *cdc_acm_class, bool dtr, bool rts);
|
|
|
|
|
|
2023-11-15 22:08:26 +08:00
|
|
|
int usbh_cdc_acm_bulk_in_transfer(struct usbh_cdc_acm *cdc_acm_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout);
|
|
|
|
|
int usbh_cdc_acm_bulk_out_transfer(struct usbh_cdc_acm *cdc_acm_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout);
|
|
|
|
|
|
2022-11-26 23:52:58 +08:00
|
|
|
void usbh_cdc_acm_run(struct usbh_cdc_acm *cdc_acm_class);
|
|
|
|
|
void usbh_cdc_acm_stop(struct usbh_cdc_acm *cdc_acm_class);
|
|
|
|
|
|
2022-02-08 11:44:46 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-08-18 21:41:19 +08:00
|
|
|
#endif /* USBH_CDC_ACM_H */
|