diff --git a/src/device/dcd.h b/src/device/dcd.h index 0ed4a77d..168eb181 100644 --- a/src/device/dcd.h +++ b/src/device/dcd.h @@ -110,9 +110,6 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoi // 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); diff --git a/src/portable/microchip/samd21/dcd_samd21.c b/src/portable/microchip/samd21/dcd_samd21.c index fedfa2ec..7f3c3495 100644 --- a/src/portable/microchip/samd21/dcd_samd21.c +++ b/src/portable/microchip/samd21/dcd_samd21.c @@ -229,22 +229,6 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) } } -bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr) -{ - (void) rhport; - - // USBD shouldn't check control endpoint state - if ( 0 == ep_addr ) return false; - - uint8_t const epnum = tu_edpt_number(ep_addr); - UsbDeviceEndpoint* ep = &USB->DEVICE.DeviceEndpoint[epnum]; - - if (tu_edpt_dir(ep_addr) == TUSB_DIR_IN) { - return ep->EPINTFLAG.bit.TRCPT1 == 0 && ep->EPSTATUS.bit.BK1RDY == 1; - } - return ep->EPINTFLAG.bit.TRCPT0 == 0 && ep->EPSTATUS.bit.BK0RDY == 1; -} - /*------------------------------------------------------------------*/ static bool maybe_handle_setup_packet(void) { diff --git a/src/portable/microchip/samd51/dcd_samd51.c b/src/portable/microchip/samd51/dcd_samd51.c index a43609b9..f2aff857 100644 --- a/src/portable/microchip/samd51/dcd_samd51.c +++ b/src/portable/microchip/samd51/dcd_samd51.c @@ -233,22 +233,6 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) } } -bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr) -{ - (void) rhport; - - // USBD shouldn't check control endpoint state - if ( 0 == ep_addr ) return false; - - uint8_t const epnum = tu_edpt_number(ep_addr); - UsbDeviceEndpoint* ep = &USB->DEVICE.DeviceEndpoint[epnum]; - - if (tu_edpt_dir(ep_addr) == TUSB_DIR_IN) { - return ep->EPINTFLAG.bit.TRCPT1 == 0 && ep->EPSTATUS.bit.BK1RDY == 1; - } - return ep->EPINTFLAG.bit.TRCPT0 == 0 && ep->EPSTATUS.bit.BK0RDY == 1; -} - /*------------------------------------------------------------------*/ static bool maybe_handle_setup_packet(void) { diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c index 37b5459f..093dcfd7 100644 --- a/src/portable/nordic/nrf5x/dcd_nrf5x.c +++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c @@ -332,21 +332,6 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) } } -bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr) -{ - (void) rhport; - - // USBD shouldn't check control endpoint state - if ( 0 == tu_edpt_number(ep_addr) ) return false; - - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); - - xfer_td_t* xfer = get_td(epnum, dir); - - return xfer->actual_len < xfer->total_len; -} - /*------------------------------------------------------------------*/ /* Interrupt Handler *------------------------------------------------------------------*/ diff --git a/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c b/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c index 0dab2caf..39c365d8 100644 --- a/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c +++ b/src/portable/nxp/lpc11_13_15/dcd_lpc11_13_15.c @@ -218,14 +218,6 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) return true; } -bool dcd_edpt_busy(uint8_t rhport, uint8_t ep_addr) -{ - (void) rhport; - - uint8_t const ep_id = ep_addr2id(ep_addr); - return _dcd.ep[ep_id][0].active; -} - static void prepare_ep_xfer(uint8_t ep_id, uint16_t buf_offset, uint16_t total_bytes) { uint16_t const nbytes = tu_min16(total_bytes, DMA_NBYTES_MAX); diff --git a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c index cdc4d58d..2b49f52e 100644 --- a/src/portable/nxp/lpc17_40/dcd_lpc17_40.c +++ b/src/portable/nxp/lpc17_40/dcd_lpc17_40.c @@ -316,14 +316,6 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) return true; } -bool dcd_edpt_busy(uint8_t rhport, uint8_t ep_addr) -{ - (void) rhport; - - uint8_t ep_id = ep_addr2idx( ep_addr ); - return (_dcd.udca[ep_id] != NULL && !_dcd.udca[ep_id]->retired); -} - void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) { (void) rhport; diff --git a/src/portable/nxp/lpc18_43/dcd_lpc18_43.c b/src/portable/nxp/lpc18_43/dcd_lpc18_43.c index 049624d9..519e0dcc 100644 --- a/src/portable/nxp/lpc18_43/dcd_lpc18_43.c +++ b/src/portable/nxp/lpc18_43/dcd_lpc18_43.c @@ -240,18 +240,6 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) return true; } -bool dcd_edpt_busy(uint8_t rhport, uint8_t ep_addr) -{ - uint8_t const epnum = tu_edpt_number(ep_addr); - uint8_t const dir = tu_edpt_dir(ep_addr); - uint8_t const ep_idx = 2*epnum + dir; - - dcd_qtd_t * p_qtd = &dcd_data_ptr[rhport]->qtd[ep_idx]; - - return p_qtd->active; -// return !p_qhd->qtd_overlay.halted && p_qhd->qtd_overlay.active; -} - bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes) { uint8_t const epnum = tu_edpt_number(ep_addr); diff --git a/src/portable/st/stm32f3/dcd_stm32f3.c b/src/portable/st/stm32f3/dcd_stm32f3.c index 648ff0e1..7339863b 100644 --- a/src/portable/st/stm32f3/dcd_stm32f3.c +++ b/src/portable/st/stm32f3/dcd_stm32f3.c @@ -67,15 +67,19 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc { return false; } + bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes) -{ return false;} -bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr) -{ return false;} +{ + return false; +} void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr) -{} +{ +} + void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) -{} +{ +} #endif diff --git a/src/portable/st/stm32f4/dcd_stm32f4.c b/src/portable/st/stm32f4/dcd_stm32f4.c index 996950ab..3cb502be 100644 --- a/src/portable/st/stm32f4/dcd_stm32f4.c +++ b/src/portable/st/stm32f4/dcd_stm32f4.c @@ -397,32 +397,6 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) } } -bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr) -{ - (void) rhport; - USB_OTG_OUTEndpointTypeDef * out_ep = OUT_EP_BASE; - USB_OTG_INEndpointTypeDef * in_ep = IN_EP_BASE; - - // USBD shouldn't check control endpoint state - if ( 0 == ep_addr ) return false; - - uint8_t const epnum = tu_edpt_number(ep_addr); - - bool enabled = false; - bool xferring = true; - - if (tu_edpt_dir(ep_addr) == TUSB_DIR_IN) { - enabled = (in_ep[epnum].DIEPCTL & USB_OTG_DIEPCTL_EPENA_Msk); - xferring = (in_ep[epnum].DIEPTSIZ & USB_OTG_DIEPTSIZ_PKTCNT_Msk); - } else { - enabled = (out_ep[epnum].DOEPCTL & USB_OTG_DOEPCTL_EPENA_Msk); - xferring = (out_ep[epnum].DOEPTSIZ & USB_OTG_DOEPTSIZ_PKTCNT_Msk); - } - - // TODO: Also check that endpoint is active (not just enabled)? - return (enabled && xferring); -} - /*------------------------------------------------------------------*/ // TODO: Split into "receive on endpoint 0" and "receive generic"; endpoint 0's