2021-03-14 11:42:18 +00:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
|
|
|
#ifndef USB_DWC3_H
|
|
|
|
#define USB_DWC3_H
|
|
|
|
|
|
|
|
#include "dart.h"
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
typedef struct dwc3_dev dwc3_dev_t;
|
|
|
|
|
2021-05-14 20:47:43 +00:00
|
|
|
typedef enum _cdc_acm_pipe_id_t {
|
|
|
|
CDC_ACM_PIPE_0,
|
|
|
|
CDC_ACM_PIPE_1,
|
|
|
|
CDC_ACM_PIPE_MAX
|
|
|
|
} cdc_acm_pipe_id_t;
|
|
|
|
|
2021-03-14 11:42:18 +00:00
|
|
|
dwc3_dev_t *usb_dwc3_init(uintptr_t regs, dart_dev_t *dart);
|
|
|
|
void usb_dwc3_shutdown(dwc3_dev_t *dev);
|
|
|
|
|
|
|
|
void usb_dwc3_handle_events(dwc3_dev_t *dev);
|
|
|
|
|
2021-08-23 08:00:14 +00:00
|
|
|
ssize_t usb_dwc3_can_read(dwc3_dev_t *dev, cdc_acm_pipe_id_t pipe);
|
2021-05-14 20:47:43 +00:00
|
|
|
bool usb_dwc3_can_write(dwc3_dev_t *dev, cdc_acm_pipe_id_t pipe);
|
2021-03-14 11:42:18 +00:00
|
|
|
|
2021-05-14 20:47:43 +00:00
|
|
|
u8 usb_dwc3_getbyte(dwc3_dev_t *dev, cdc_acm_pipe_id_t pipe);
|
|
|
|
void usb_dwc3_putbyte(dwc3_dev_t *dev, cdc_acm_pipe_id_t pipe, u8 byte);
|
2021-03-14 11:42:18 +00:00
|
|
|
|
2021-05-14 20:47:43 +00:00
|
|
|
size_t usb_dwc3_read(dwc3_dev_t *dev, cdc_acm_pipe_id_t pipe, void *buf, size_t count);
|
2021-05-16 10:04:04 +00:00
|
|
|
size_t usb_dwc3_write(dwc3_dev_t *dev, cdc_acm_pipe_id_t pipe, const void *buf, size_t count);
|
|
|
|
size_t usb_dwc3_queue(dwc3_dev_t *dev, cdc_acm_pipe_id_t pipe, const void *buf, size_t count);
|
2021-05-15 12:01:25 +00:00
|
|
|
void usb_dwc3_flush(dwc3_dev_t *dev, cdc_acm_pipe_id_t pipe);
|
2021-03-14 11:42:18 +00:00
|
|
|
|
|
|
|
#endif
|