From e561f4f4c68ebad8bf7b35adaaa9907ffb7c5fe0 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 6 Mar 2018 17:18:43 +0700 Subject: [PATCH] rename to hal_dcd_pipe_clear_stall() --- hw/mcu/nxp/lpc43xx/tusb_port/dcd_lpc43xx.c | 4 +--- tinyusb/device/dcd.h | 4 ++-- tinyusb/device/dcd_lpc175x_6x.c | 4 +--- tinyusb/device/dcd_lpc_11uxx_13uxx.c | 4 +--- tinyusb/device/usbd.c | 2 +- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/hw/mcu/nxp/lpc43xx/tusb_port/dcd_lpc43xx.c b/hw/mcu/nxp/lpc43xx/tusb_port/dcd_lpc43xx.c index f742548c..cc34a2ce 100644 --- a/hw/mcu/nxp/lpc43xx/tusb_port/dcd_lpc43xx.c +++ b/hw/mcu/nxp/lpc43xx/tusb_port/dcd_lpc43xx.c @@ -378,15 +378,13 @@ void hal_dcd_pipe_stall(endpoint_handle_t edpt_hdl) (*reg_control) |= ENDPTCTRL_MASK_STALL << (edpt_hdl.index & 0x01 ? 16 : 0); } -tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) +void hal_dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) { volatile uint32_t * reg_control = get_reg_control_addr(coreid, edpt_addr2phy(edpt_addr)); // data toggle also need to be reset (*reg_control) |= ENDPTCTRL_MASK_TOGGLE_RESET << ((edpt_addr & TUSB_DIR_DEV_TO_HOST_MASK) ? 16 : 0); (*reg_control) &= ~(ENDPTCTRL_MASK_STALL << ((edpt_addr & TUSB_DIR_DEV_TO_HOST_MASK) ? 16 : 0)); - - return TUSB_ERROR_NONE; } bool hal_dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc, endpoint_handle_t* eh) diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index 13cdbbbb..a2948af5 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -91,12 +91,12 @@ bool hal_dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endp tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes); // only queue, not transferring yet tusb_error_t hal_dcd_pipe_xfer(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes, bool int_on_complete); -void hal_dcd_pipe_stall(endpoint_handle_t edpt_hdl); bool dcd_pipe_is_busy(endpoint_handle_t edpt_hdl); // TODO coreid + endpoint address are part of endpoint handle, not endpoint handle, data toggle also need to be reset -tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr); +void hal_dcd_pipe_stall(endpoint_handle_t edpt_hdl); +void hal_dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr); #ifdef __cplusplus } diff --git a/tinyusb/device/dcd_lpc175x_6x.c b/tinyusb/device/dcd_lpc175x_6x.c index bdd06497..2f5d069a 100644 --- a/tinyusb/device/dcd_lpc175x_6x.c +++ b/tinyusb/device/dcd_lpc175x_6x.c @@ -458,13 +458,11 @@ void hal_dcd_pipe_stall(endpoint_handle_t edpt_hdl) sie_write(SIE_CMDCODE_ENDPOINT_SET_STATUS+edpt_hdl.index, 1, SIE_SET_ENDPOINT_STALLED_MASK); } -tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) +void hal_dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) { uint8_t ep_id = edpt_addr2phy(edpt_addr); sie_write(SIE_CMDCODE_ENDPOINT_SET_STATUS+ep_id, 1, 0); - - return TUSB_ERROR_FAILED; } void dd_xfer_init(dcd_dma_descriptor_t* p_dd, void* buffer, uint16_t total_bytes) diff --git a/tinyusb/device/dcd_lpc_11uxx_13uxx.c b/tinyusb/device/dcd_lpc_11uxx_13uxx.c index f5422e99..151abe79 100644 --- a/tinyusb/device/dcd_lpc_11uxx_13uxx.c +++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c @@ -438,7 +438,7 @@ bool dcd_pipe_is_stalled(endpoint_handle_t edpt_hdl) return dcd_data.qhd[edpt_hdl.index][0].stall || dcd_data.qhd[edpt_hdl.index][1].stall; } -tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) +void hal_dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) { uint8_t ep_id = edpt_addr2phy(edpt_addr); // uint8_t active_buffer = BIT_TEST_(LPC_USB->EPINUSE, ep_id) ? 1 : 0; @@ -454,8 +454,6 @@ tusb_error_t dcd_pipe_clear_stall(uint8_t coreid, uint8_t edpt_addr) { queue_xfer_in_next_td(ep_id); } - - return TUSB_ERROR_NONE; } endpoint_handle_t hal_dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code) diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 3a3bb622..e16afbfb 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -297,7 +297,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t coreid, tusb_control_request_t TUSB_REQUEST_TYPE_STANDARD == p_request->bmRequestType_bit.type && TUSB_REQUEST_CLEAR_FEATURE == p_request->bRequest ) { - dcd_pipe_clear_stall(coreid, u16_low_u8(p_request->wIndex) ); + hal_dcd_pipe_clear_stall(coreid, u16_low_u8(p_request->wIndex) ); } else { error = TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;