From 533c8d2eed68fe76242fa5dcd2b1733d6278a4e8 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 20 Feb 2014 10:41:31 +0700 Subject: use hcd_pipe_is_busy instead of hcd_pipe_is_idle remove hcd_pipe_is_idle --- tinyusb/class/cdc_host.c | 10 ++-------- tinyusb/host/ehci/ehci.c | 6 ------ tinyusb/host/hcd.h | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) (limited to 'tinyusb') diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c index a71982ca7..0d2b1dcc3 100644 --- a/tinyusb/class/cdc_host.c +++ b/tinyusb/class/cdc_host.c @@ -126,10 +126,7 @@ tusb_error_t tusbh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t leng ASSERT( p_data != NULL && length, TUSB_ERROR_INVALID_PARA); pipe_handle_t pipe_out = cdch_data[dev_addr-1].pipe_out; - if ( !hcd_pipe_is_idle(pipe_out) ) - { - return TUSB_ERROR_INTERFACE_IS_BUSY; - } + if ( hcd_pipe_is_busy(pipe_out) ) return TUSB_ERROR_INTERFACE_IS_BUSY; return hcd_pipe_xfer( pipe_out, (void *) p_data, length, is_notify); } @@ -140,10 +137,7 @@ tusb_error_t tusbh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t lengt ASSERT( p_buffer != NULL && length, TUSB_ERROR_INVALID_PARA); pipe_handle_t pipe_in = cdch_data[dev_addr-1].pipe_in; - if ( !hcd_pipe_is_idle(pipe_in) ) - { - return TUSB_ERROR_INTERFACE_IS_BUSY; - } + if ( hcd_pipe_is_busy(pipe_in) ) return TUSB_ERROR_INTERFACE_IS_BUSY; return hcd_pipe_xfer( pipe_in, p_buffer, length, is_notify); } diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c index ac0a060d8..830325274 100644 --- a/tinyusb/host/ehci/ehci.c +++ b/tinyusb/host/ehci/ehci.c @@ -493,12 +493,6 @@ bool hcd_pipe_is_error(pipe_handle_t pipe_hdl) return p_qhd->qtd_overlay.halted; } -bool hcd_pipe_is_idle(pipe_handle_t pipe_hdl) -{ // TODO to be remove - ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle( pipe_hdl ); - return (p_qhd->p_qtd_list_head == NULL); -} - bool hcd_pipe_is_stalled(pipe_handle_t pipe_hdl) { ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle( pipe_hdl ); diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h index 34e89fea4..952dc5fe2 100644 --- a/tinyusb/host/hcd.h +++ b/tinyusb/host/hcd.h @@ -95,7 +95,7 @@ tusb_error_t hcd_pipe_close(pipe_handle_t pipe_hdl) /*ATTR_WARN_UNUSED_RESULT*/ bool hcd_pipe_is_busy(pipe_handle_t pipe_hdl) ATTR_PURE; bool hcd_pipe_is_error(pipe_handle_t pipe_hdl) ATTR_PURE; bool hcd_pipe_is_stalled(pipe_handle_t pipe_hdl) ATTR_PURE; // stalled also counted as error -bool hcd_pipe_is_idle(pipe_handle_t pipe_hdl) ATTR_PURE; + uint8_t hcd_pipe_get_endpoint_addr(pipe_handle_t pipe_hdl) ATTR_PURE; tusb_error_t hcd_pipe_clear_stall(pipe_handle_t pipe_hdl); -- cgit v1.3.1