From a0307bafdaa97628bb5e4d5e476db54cbc028d33 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 29 May 2019 16:55:15 +0700 Subject: 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() --- src/device/dcd.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/device/dcd.h') diff --git a/src/device/dcd.h b/src/device/dcd.h index 35164ac62..bd7088fe4 100644 --- a/src/device/dcd.h +++ b/src/device/dcd.h @@ -100,25 +100,28 @@ void dcd_set_config (uint8_t rhport, uint8_t config_num); // Wake up host void dcd_remote_wakeup(uint8_t rhport); -/*------------------------------------------------------------------*/ -/* Endpoint API - * - open : Configure endpoint's registers - * - xfer : Submit a transfer. When complete dcd_event_xfer_complete - * must be called to notify the stack - * - busy : Check if endpoint transferring is complete (TODO remove) - * - stall : stall endpoint - * - clear_stall : clear stall, data toggle is also reset to DATA0 - *------------------------------------------------------------------*/ +//--------------------------------------------------------------------+ +// Endpoint API +//--------------------------------------------------------------------+ + +// Configure endpoint's registers according to descriptor bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc); + +// Submit a transfer, When complete dcd_event_xfer_complete() is invoked to notify the stack bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes); + +// Check if endpoint transferring is complete (TODO remove) bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr); +// Stall endpoint void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr); + +// clear stall, data toggle is also reset to DATA0 void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr); /*------------------------------------------------------------------*/ /* Event Function - * Called by DCD to notify USBD + * Called by DCD to notify device stack *------------------------------------------------------------------*/ void dcd_event_handler(dcd_event_t const * event, bool in_isr); -- cgit v1.3.1