mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-18 20:42:24 +00:00
rename host API to be consistent with naming on device stack
- tuh_device_get_speed() to tuh_speed_get() - tuh_device_configured() to tuh_mounted() - tuh_device_ready() to tuh_ready()
This commit is contained in:
parent
9c3fdb8135
commit
88bb8fac3d
@ -225,12 +225,12 @@ extern bool usbh_control_xfer_cb (uint8_t dev_addr, uint8_t ep_addr, xfer_result
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// PUBLIC API (Parameter Verification is required)
|
// PUBLIC API (Parameter Verification is required)
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
bool tuh_device_configured(uint8_t dev_addr)
|
bool tuh_mounted(uint8_t dev_addr)
|
||||||
{
|
{
|
||||||
return get_device(dev_addr)->configured;
|
return get_device(dev_addr)->configured;
|
||||||
}
|
}
|
||||||
|
|
||||||
tusb_speed_t tuh_device_get_speed (uint8_t const dev_addr)
|
tusb_speed_t tuh_speed_get (uint8_t const dev_addr)
|
||||||
{
|
{
|
||||||
TU_ASSERT( dev_addr <= CFG_TUH_DEVICE_MAX + CFG_TUH_HUB, TUSB_SPEED_INVALID);
|
TU_ASSERT( dev_addr <= CFG_TUH_DEVICE_MAX + CFG_TUH_HUB, TUSB_SPEED_INVALID);
|
||||||
return (tusb_speed_t) get_device(dev_addr)->speed;
|
return (tusb_speed_t) get_device(dev_addr)->speed;
|
||||||
|
@ -57,16 +57,23 @@ void tuh_task(void);
|
|||||||
extern void hcd_int_handler(uint8_t rhport);
|
extern void hcd_int_handler(uint8_t rhport);
|
||||||
#define tuh_int_handler hcd_int_handler
|
#define tuh_int_handler hcd_int_handler
|
||||||
|
|
||||||
tusb_speed_t tuh_device_get_speed (uint8_t dev_addr);
|
tusb_speed_t tuh_speed_get (uint8_t dev_addr);
|
||||||
|
|
||||||
// Check if device is configured
|
// Check if device is connected and configured
|
||||||
bool tuh_device_configured(uint8_t dev_addr);
|
bool tuh_mounted(uint8_t dev_addr);
|
||||||
|
|
||||||
|
// Check if device is suspended
|
||||||
|
static inline bool tuh_suspended(uint8_t dev_addr)
|
||||||
|
{
|
||||||
|
// TODO implement suspend & resume on host
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if device is ready to communicate with
|
// Check if device is ready to communicate with
|
||||||
TU_ATTR_ALWAYS_INLINE
|
TU_ATTR_ALWAYS_INLINE
|
||||||
static inline bool tuh_device_ready(uint8_t dev_addr)
|
static inline bool tuh_ready(uint8_t dev_addr)
|
||||||
{
|
{
|
||||||
return tuh_device_configured(dev_addr);
|
return tuh_mounted(dev_addr) && !tuh_suspended(dev_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carry out control transfer
|
// Carry out control transfer
|
||||||
|
@ -87,7 +87,7 @@ static bool need_pre(uint8_t dev_addr)
|
|||||||
{
|
{
|
||||||
// If this device is different to the speed of the root device
|
// If this device is different to the speed of the root device
|
||||||
// (i.e. is a low speed device on a full speed hub) then need pre
|
// (i.e. is a low speed device on a full speed hub) then need pre
|
||||||
return hcd_port_speed_get(0) != tuh_device_get_speed(dev_addr);
|
return hcd_port_speed_get(0) != tuh_speed_get(dev_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hw_xfer_complete(struct hw_endpoint *ep, xfer_result_t xfer_result)
|
static void hw_xfer_complete(struct hw_endpoint *ep, xfer_result_t xfer_result)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user