Merge pull request #887 from hathach/host-update

Host API clean up
This commit is contained in:
Ha Thach
2021-06-10 17:42:43 +07:00
committed by GitHub
16 changed files with 164 additions and 118 deletions

View File

@@ -5,7 +5,7 @@
# Build directory # Build directory
BUILD := _build/$(BOARD) BUILD := _build/$(BOARD)
PROJECT := $(BOARD)-$(notdir $(CURDIR)) PROJECT := $(notdir $(CURDIR))
BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR)) BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR))
# Handy check parameter function # Handy check parameter function

View File

@@ -29,6 +29,8 @@
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC) #if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC)
#include "host/usbh.h" #include "host/usbh.h"
#include "host/usbh_classdriver.h"
#include "cdc_host.h" #include "cdc_host.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@@ -71,13 +73,13 @@ bool tuh_cdc_is_busy(uint8_t dev_addr, cdc_pipeid_t pipeid)
switch (pipeid) switch (pipeid)
{ {
case CDC_PIPE_NOTIFICATION: case CDC_PIPE_NOTIFICATION:
return hcd_edpt_busy(dev_addr, p_cdc->ep_notif ); return usbh_edpt_busy(dev_addr, p_cdc->ep_notif );
case CDC_PIPE_DATA_IN: case CDC_PIPE_DATA_IN:
return hcd_edpt_busy(dev_addr, p_cdc->ep_in ); return usbh_edpt_busy(dev_addr, p_cdc->ep_in );
case CDC_PIPE_DATA_OUT: case CDC_PIPE_DATA_OUT:
return hcd_edpt_busy(dev_addr, p_cdc->ep_out ); return usbh_edpt_busy(dev_addr, p_cdc->ep_out );
default: default:
return false; return false;
@@ -101,7 +103,7 @@ bool tuh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t length, bool i
TU_VERIFY( p_data != NULL && length, TUSB_ERROR_INVALID_PARA); TU_VERIFY( p_data != NULL && length, TUSB_ERROR_INVALID_PARA);
uint8_t const ep_out = cdch_data[dev_addr-1].ep_out; uint8_t const ep_out = cdch_data[dev_addr-1].ep_out;
if ( hcd_edpt_busy(dev_addr, ep_out) ) return false; if ( usbh_edpt_busy(dev_addr, ep_out) ) return false;
return usbh_edpt_xfer(dev_addr, ep_out, (void *) p_data, length); return usbh_edpt_xfer(dev_addr, ep_out, (void *) p_data, length);
} }
@@ -113,7 +115,7 @@ bool tuh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is
TU_VERIFY( p_buffer != NULL && length, TUSB_ERROR_INVALID_PARA); TU_VERIFY( p_buffer != NULL && length, TUSB_ERROR_INVALID_PARA);
uint8_t const ep_in = cdch_data[dev_addr-1].ep_in; uint8_t const ep_in = cdch_data[dev_addr-1].ep_in;
if ( hcd_edpt_busy(dev_addr, ep_in) ) return false; if ( usbh_edpt_busy(dev_addr, ep_in) ) return false;
return usbh_edpt_xfer(dev_addr, ep_in, p_buffer, length); return usbh_edpt_xfer(dev_addr, ep_in, p_buffer, length);
} }

View File

@@ -29,6 +29,8 @@
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HID) #if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HID)
#include "host/usbh.h" #include "host/usbh.h"
#include "host/usbh_classdriver.h"
#include "hid_host.h" #include "hid_host.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@@ -199,7 +201,7 @@ bool tuh_hid_set_report(uint8_t dev_addr, uint8_t instance, uint8_t report_id, u
// TU_VERIFY(tuh_n_hid_n_mounted(dev_addr, instance)); // TU_VERIFY(tuh_n_hid_n_mounted(dev_addr, instance));
// //
// hidh_interface_t* hid_itf = get_instance(dev_addr, instance); // hidh_interface_t* hid_itf = get_instance(dev_addr, instance);
// return !hcd_edpt_busy(dev_addr, hid_itf->ep_in); // return !usbh_edpt_busy(dev_addr, hid_itf->ep_in);
//} //}
//void tuh_hid_send_report(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t const* report, uint16_t len); //void tuh_hid_send_report(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t const* report, uint16_t len);

View File

@@ -29,6 +29,8 @@
#if TUSB_OPT_HOST_ENABLED & CFG_TUH_MSC #if TUSB_OPT_HOST_ENABLED & CFG_TUH_MSC
#include "host/usbh.h" #include "host/usbh.h"
#include "host/usbh_classdriver.h"
#include "msc_host.h" #include "msc_host.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
@@ -109,7 +111,7 @@ bool tuh_msc_mounted(uint8_t dev_addr)
bool tuh_msc_ready(uint8_t dev_addr) bool tuh_msc_ready(uint8_t dev_addr)
{ {
msch_interface_t* p_msc = get_itf(dev_addr); msch_interface_t* p_msc = get_itf(dev_addr);
return p_msc->mounted && !hcd_edpt_busy(dev_addr, p_msc->ep_in); return p_msc->mounted && !usbh_edpt_busy(dev_addr, p_msc->ep_in);
} }
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -122,7 +122,7 @@ void dcd_disconnect(uint8_t rhport) TU_ATTR_WEAK;
void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const * request) TU_ATTR_WEAK; void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const * request) TU_ATTR_WEAK;
// Configure endpoint's registers according to descriptor // Configure endpoint's registers according to descriptor
bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc); bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_ep);
// Close an endpoint. // Close an endpoint.
// Since it is weak, caller must TU_ASSERT this function's existence before calling it. // Since it is weak, caller must TU_ASSERT this function's existence before calling it.

View File

@@ -1248,8 +1248,8 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
// Attempt to transfer on a busy endpoint, sound like an race condition ! // Attempt to transfer on a busy endpoint, sound like an race condition !
TU_ASSERT(_usbd_dev.ep_status[epnum][dir].busy == 0); TU_ASSERT(_usbd_dev.ep_status[epnum][dir].busy == 0);
// Set busy first since the actual transfer can be complete before dcd_edpt_xfer() could return // Set busy first since the actual transfer can be complete before dcd_edpt_xfer()
// and usbd task can preempt and clear the busy // could return and USBD task can preempt and clear the busy
_usbd_dev.ep_status[epnum][dir].busy = true; _usbd_dev.ep_status[epnum][dir].busy = true;
if ( dcd_edpt_xfer(rhport, ep_addr, buffer, total_bytes) ) if ( dcd_edpt_xfer(rhport, ep_addr, buffer, total_bytes) )

View File

@@ -34,7 +34,7 @@
#endif #endif
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Class Drivers // Class Driver API
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
typedef struct typedef struct

View File

@@ -137,9 +137,6 @@ void hcd_device_close(uint8_t rhport, uint8_t dev_addr);
bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet[8]); bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet[8]);
bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const * ep_desc); bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const * ep_desc);
bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t buflen); bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t buflen);
bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr);
bool hcd_edpt_stalled(uint8_t dev_addr, uint8_t ep_addr);
bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr); bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr);
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -29,6 +29,7 @@
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HUB) #if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HUB)
#include "usbh.h" #include "usbh.h"
#include "usbh_classdriver.h"
#include "hub.h" #include "hub.h"
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -24,7 +24,7 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
#include "common/tusb_common.h" #include "tusb_option.h"
#if TUSB_OPT_HOST_ENABLED #if TUSB_OPT_HOST_ENABLED
@@ -32,10 +32,9 @@
#define CFG_TUH_TASK_QUEUE_SZ 16 #define CFG_TUH_TASK_QUEUE_SZ 16
#endif #endif
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
#include "tusb.h" #include "tusb.h"
#include "host/usbh.h"
#include "host/usbh_classdriver.h"
#include "hub.h" #include "hub.h"
#include "usbh_hcd.h" #include "usbh_hcd.h"
@@ -315,8 +314,11 @@ uint8_t* usbh_get_enum_buf(void)
return _usbh_ctrl_buf; return _usbh_ctrl_buf;
} }
//------------- Endpoint API -------------// //--------------------------------------------------------------------+
// Endpoint API
//--------------------------------------------------------------------+
// TODO has some duplication code with device, refactor later
bool usbh_edpt_claim(uint8_t dev_addr, uint8_t ep_addr) bool usbh_edpt_claim(uint8_t dev_addr, uint8_t ep_addr)
{ {
uint8_t const epnum = tu_edpt_number(ep_addr); uint8_t const epnum = tu_edpt_number(ep_addr);
@@ -344,6 +346,7 @@ bool usbh_edpt_claim(uint8_t dev_addr, uint8_t ep_addr)
return ret; return ret;
} }
// TODO has some duplication code with device, refactor later
bool usbh_edpt_release(uint8_t dev_addr, uint8_t ep_addr) bool usbh_edpt_release(uint8_t dev_addr, uint8_t ep_addr)
{ {
uint8_t const epnum = tu_edpt_number(ep_addr); uint8_t const epnum = tu_edpt_number(ep_addr);
@@ -369,11 +372,36 @@ bool usbh_edpt_release(uint8_t dev_addr, uint8_t ep_addr)
return ret; return ret;
} }
// TODO has some duplication code with device, refactor later
bool usbh_edpt_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes) bool usbh_edpt_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes)
{ {
uint8_t const epnum = tu_edpt_number(ep_addr);
uint8_t const dir = tu_edpt_dir(ep_addr);
usbh_device_t* dev = &_usbh_devices[dev_addr]; usbh_device_t* dev = &_usbh_devices[dev_addr];
TU_LOG2(" Queue EP %02X with %u bytes ... OK\r\n", ep_addr, total_bytes);
return hcd_edpt_xfer(dev->rhport, dev_addr, ep_addr, buffer, total_bytes); TU_LOG2(" Queue EP %02X with %u bytes ... ", ep_addr, total_bytes);
// Attempt to transfer on a busy endpoint, sound like an race condition !
TU_ASSERT(dev->ep_status[epnum][dir].busy == 0);
// Set busy first since the actual transfer can be complete before hcd_edpt_xfer()
// could return and USBH task can preempt and clear the busy
dev->ep_status[epnum][dir].busy = true;
if ( hcd_edpt_xfer(dev->rhport, dev_addr, ep_addr, buffer, total_bytes) )
{
TU_LOG2("OK\r\n");
return true;
}else
{
// HCD error, mark endpoint as ready to allow next transfer
dev->ep_status[epnum][dir].busy = false;
dev->ep_status[epnum][dir].claimed = 0;
TU_LOG2("failed\r\n");
TU_BREAKPOINT();
return false;
}
} }
bool usbh_edpt_control_open(uint8_t dev_addr, uint8_t max_packet_size) bool usbh_edpt_control_open(uint8_t dev_addr, uint8_t max_packet_size)
@@ -420,6 +448,17 @@ bool usbh_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const
return ret; return ret;
} }
bool usbh_edpt_busy(uint8_t dev_addr, uint8_t ep_addr)
{
uint8_t const epnum = tu_edpt_number(ep_addr);
uint8_t const dir = tu_edpt_dir(ep_addr);
usbh_device_t* dev = &_usbh_devices[dev_addr];
return dev->ep_status[epnum][dir].busy;
}
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// HCD Event Handler // HCD Event Handler
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -24,9 +24,6 @@
* This file is part of the TinyUSB stack. * This file is part of the TinyUSB stack.
*/ */
/** \ingroup group_usbh USB Host Core (USBH)
* @{ */
#ifndef _TUSB_USBH_H_ #ifndef _TUSB_USBH_H_
#define _TUSB_USBH_H_ #define _TUSB_USBH_H_
@@ -40,27 +37,6 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF // MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
typedef enum tusb_interface_status_{
TUSB_INTERFACE_STATUS_READY = 0,
TUSB_INTERFACE_STATUS_BUSY,
TUSB_INTERFACE_STATUS_COMPLETE,
TUSB_INTERFACE_STATUS_ERROR,
TUSB_INTERFACE_STATUS_INVALID_PARA
} tusb_interface_status_t;
typedef struct {
#if CFG_TUSB_DEBUG >= 2
char const* name;
#endif
uint8_t class_code;
void (* const init )(void);
bool (* const open )(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const * itf_desc, uint16_t* outlen);
bool (* const set_config )(uint8_t dev_addr, uint8_t itf_num);
bool (* const xfer_cb )(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes);
void (* const close )(uint8_t dev_addr);
} usbh_class_driver_t;
typedef bool (*tuh_control_complete_cb_t)(uint8_t dev_addr, tusb_control_request_t const * request, xfer_result_t result); typedef bool (*tuh_control_complete_cb_t)(uint8_t dev_addr, tusb_control_request_t const * request, xfer_result_t result);
@@ -101,34 +77,14 @@ bool tuh_control_xfer (uint8_t dev_addr, tusb_control_request_t const* request,
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
//TU_ATTR_WEAK uint8_t tuh_attach_cb (tusb_desc_device_t const *desc_device); //TU_ATTR_WEAK uint8_t tuh_attach_cb (tusb_desc_device_t const *desc_device);
/** Callback invoked when device is mounted (configured) */ // Invoked when device is mounted (configured)
TU_ATTR_WEAK void tuh_mount_cb (uint8_t dev_addr); TU_ATTR_WEAK void tuh_mount_cb (uint8_t dev_addr);
/** Callback invoked when device is unmounted (bus reset/unplugged) */ /// Invoked when device is unmounted (bus reset/unplugged)
TU_ATTR_WEAK void tuh_umount_cb(uint8_t dev_addr); TU_ATTR_WEAK void tuh_umount_cb(uint8_t dev_addr);
//--------------------------------------------------------------------+
// CLASS-USBH & INTERNAL API
// TODO move to usbh_pvt.h
//--------------------------------------------------------------------+
bool usbh_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const * ep_desc);
bool usbh_edpt_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
// Claim an endpoint before submitting a transfer.
// If caller does not make any transfer, it must release endpoint for others.
bool usbh_edpt_claim(uint8_t dev_addr, uint8_t ep_addr);
void usbh_driver_set_config_complete(uint8_t dev_addr, uint8_t itf_num);
uint8_t usbh_get_rhport(uint8_t dev_addr);
uint8_t* usbh_get_enum_buf(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* _TUSB_USBH_H_ */ #endif
/** @} */

View File

@@ -0,0 +1,83 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021, Ha Thach (tinyusb.org)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* This file is part of the TinyUSB stack.
*/
#ifndef _TUSB_USBH_CLASSDRIVER_H_
#define _TUSB_USBH_CLASSDRIVER_H_
#include "osal/osal.h"
#include "common/tusb_fifo.h"
#ifdef __cplusplus
extern "C" {
#endif
//--------------------------------------------------------------------+
// Class Driver API
//--------------------------------------------------------------------+
typedef struct {
#if CFG_TUSB_DEBUG >= 2
char const* name;
#endif
uint8_t class_code;
void (* const init )(void);
bool (* const open )(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const * itf_desc, uint16_t* outlen);
bool (* const set_config )(uint8_t dev_addr, uint8_t itf_num);
bool (* const xfer_cb )(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes);
void (* const close )(uint8_t dev_addr);
} usbh_class_driver_t;
// Call by class driver to tell USBH that it has complete the enumeration
void usbh_driver_set_config_complete(uint8_t dev_addr, uint8_t itf_num);
uint8_t usbh_get_rhport(uint8_t dev_addr);
uint8_t* usbh_get_enum_buf(void);
//--------------------------------------------------------------------+
// USBH Endpoint API
//--------------------------------------------------------------------+
// Open an endpoint
bool usbh_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const * desc_ep);
// Submit a usb transfer
bool usbh_edpt_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
// Claim an endpoint before submitting a transfer.
// If caller does not make any transfer, it must release endpoint for others.
bool usbh_edpt_claim(uint8_t dev_addr, uint8_t ep_addr);
// Check if endpoint transferring is complete
bool usbh_edpt_busy(uint8_t dev_addr, uint8_t ep_addr);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -97,12 +97,6 @@ typedef struct {
extern usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1]; // including zero-address extern usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1]; // including zero-address
//--------------------------------------------------------------------+
// callback from HCD ISR
//--------------------------------------------------------------------+
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -440,18 +440,6 @@ bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t *
return true; return true;
} }
bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr)
{
ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);
return !p_qhd->qtd_overlay.halted && (p_qhd->p_qtd_list_head != NULL);
}
bool hcd_edpt_stalled(uint8_t dev_addr, uint8_t ep_addr)
{
ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);
return p_qhd->qtd_overlay.halted && !qhd_has_xact_error(p_qhd);
}
bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr) bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
{ {
ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr); ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);

View File

@@ -489,18 +489,6 @@ bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t *
return true; return true;
} }
bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr)
{
ohci_ed_t const * const p_ed = ed_from_addr(dev_addr, ep_addr);
return tu_align16(p_ed->td_head.address) != tu_align16(p_ed->td_tail);
}
bool hcd_edpt_stalled(uint8_t dev_addr, uint8_t ep_addr)
{
ohci_ed_t const * const p_ed = ed_from_addr(dev_addr, ep_addr);
return p_ed->td_head.halted && p_ed->is_stalled;
}
bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr) bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
{ {
ohci_ed_t * const p_ed = ed_from_addr(dev_addr, ep_addr); ohci_ed_t * const p_ed = ed_from_addr(dev_addr, ep_addr);

View File

@@ -515,25 +515,19 @@ bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const
return true; return true;
} }
bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr) //bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr)
{ //{
// EPX is shared, so multiple device addresses and endpoint addresses share that // // EPX is shared, so multiple device addresses and endpoint addresses share that
// so if any transfer is active on epx, we are busy. Interrupt endpoints have their own // // so if any transfer is active on epx, we are busy. Interrupt endpoints have their own
// EPX so ep->active will only be busy if there is a pending transfer on that interrupt endpoint // // EPX so ep->active will only be busy if there is a pending transfer on that interrupt endpoint
// on that device // // on that device
pico_trace("hcd_edpt_busy dev addr %d ep_addr 0x%x\n", dev_addr, ep_addr); // pico_trace("hcd_edpt_busy dev addr %d ep_addr 0x%x\n", dev_addr, ep_addr);
struct hw_endpoint *ep = get_dev_ep(dev_addr, ep_addr); // struct hw_endpoint *ep = get_dev_ep(dev_addr, ep_addr);
assert(ep); // assert(ep);
bool busy = ep->active; // bool busy = ep->active;
pico_trace("busy == %d\n", busy); // pico_trace("busy == %d\n", busy);
return busy; // return busy;
} //}
bool hcd_edpt_stalled(uint8_t dev_addr, uint8_t ep_addr)
{
panic("hcd_pipe_stalled");
return false;
}
bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr) bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
{ {