added usbd_edpt_xfer/usbd_edpt_busy to replace dcd_edpt_transfer/dcd_edpt_busy()

- improve fifo write/read_n with only one lock
- use usbd_edpt_xfer/usbd_edpt_busy for hid/cdc/msc class driver
- replace cdc read's pending_read_from_host by usbd_edpt_busy()
This commit is contained in:
hathach
2019-05-29 16:55:15 +07:00
parent dfdae7a4d2
commit a0307bafda
8 changed files with 146 additions and 84 deletions
+10 -3
View File
@@ -33,11 +33,12 @@
extern "C" {
#endif
//--------------------------------------------------------------------+
// INTERNAL API for stack management
//--------------------------------------------------------------------+
bool usbd_init (void);
//--------------------------------------------------------------------+
// USBD Endpoint API
//--------------------------------------------------------------------+
// Carry out Data and Status stage of control transfer
// - If len = 0, it is equivalent to sending status only
// - If len > wLength : it will be truncated
@@ -46,6 +47,12 @@ bool usbd_control_xfer(uint8_t rhport, tusb_control_request_t const * request, v
// Send STATUS (zero length) packet
bool usbd_control_status(uint8_t rhport, tusb_control_request_t const * request);
// Submit a usb transfer
bool usbd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
// Check if endpoint transferring is complete
bool usbd_edpt_busy (uint8_t rhport, uint8_t ep_addr);
void usbd_edpt_stall(uint8_t rhport, uint8_t ep_addr);
void usbd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr);
bool usbd_edpt_stalled(uint8_t rhport, uint8_t ep_addr);