rename and expose tuh_bus_info_get() to application
This commit is contained in:
@@ -90,13 +90,6 @@ typedef struct {
|
||||
};
|
||||
} hcd_event_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t rhport;
|
||||
uint8_t hub_addr;
|
||||
uint8_t hub_port;
|
||||
uint8_t speed;
|
||||
} tuh_bus_info_t;
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Memory API
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -186,9 +179,6 @@ bool hcd_edpt_clear_stall(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr);
|
||||
// USBH implemented API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Get device port information
|
||||
extern bool hcd_bus_info_get(uint8_t daddr, tuh_bus_info_t* bus_info);
|
||||
|
||||
// Called by HCD to notify stack
|
||||
extern void hcd_event_handler(hcd_event_t const* event, bool in_isr);
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
|
||||
#if CFG_TUH_ENABLED
|
||||
|
||||
#include "host/hcd.h"
|
||||
#include "hcd.h"
|
||||
#include "tusb.h"
|
||||
#include "host/usbh_pvt.h"
|
||||
#include "usbh_pvt.h"
|
||||
#include "hub.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -342,7 +342,7 @@ bool tuh_vid_pid_get(uint8_t dev_addr, uint16_t *vid, uint16_t *pid) {
|
||||
|
||||
tusb_speed_t tuh_speed_get(uint8_t daddr) {
|
||||
tuh_bus_info_t bus_info;
|
||||
hcd_bus_info_get(daddr, &bus_info);
|
||||
tuh_bus_info_get(daddr, &bus_info);
|
||||
return bus_info.speed;
|
||||
}
|
||||
|
||||
@@ -875,7 +875,7 @@ bool tuh_edpt_abort_xfer(uint8_t daddr, uint8_t ep_addr) {
|
||||
|
||||
uint8_t usbh_get_rhport(uint8_t daddr) {
|
||||
tuh_bus_info_t bus_info;
|
||||
hcd_bus_info_get(daddr, &bus_info);
|
||||
tuh_bus_info_get(daddr, &bus_info);
|
||||
return bus_info.rhport;
|
||||
}
|
||||
|
||||
@@ -1013,7 +1013,7 @@ bool usbh_edpt_busy(uint8_t dev_addr, uint8_t ep_addr) {
|
||||
// HCD Event Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
bool hcd_bus_info_get(uint8_t daddr, tuh_bus_info_t* bus_info) {
|
||||
bool tuh_bus_info_get(uint8_t daddr, tuh_bus_info_t* bus_info) {
|
||||
usbh_device_t const* dev = get_device(daddr);
|
||||
if (dev) {
|
||||
*bus_info = dev->bus_info;
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
// forward declaration
|
||||
struct tuh_xfer_s;
|
||||
typedef struct tuh_xfer_s tuh_xfer_t;
|
||||
|
||||
typedef void (*tuh_xfer_cb_t)(tuh_xfer_t* xfer);
|
||||
|
||||
// Note1: layout and order of this will be changed in near future
|
||||
@@ -80,6 +79,14 @@ typedef struct {
|
||||
tusb_desc_interface_t desc;
|
||||
} tuh_itf_info_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t rhport;
|
||||
uint8_t hub_addr;
|
||||
uint8_t hub_port;
|
||||
uint8_t speed;
|
||||
} tuh_bus_info_t;
|
||||
|
||||
|
||||
// ConfigID for tuh_configure()
|
||||
enum {
|
||||
TUH_CFGID_INVALID = 0,
|
||||
@@ -177,6 +184,8 @@ extern void hcd_int_handler(uint8_t rhport, bool in_isr);
|
||||
#define _tuh_int_handler_arg0() TU_VERIFY_STATIC(false, "tuh_int_handler() must have 1 or 2 arguments")
|
||||
#define _tuh_int_handler_arg1(_rhport) hcd_int_handler(_rhport, true)
|
||||
#define _tuh_int_handler_arg2(_rhport, _in_isr) hcd_int_handler(_rhport, _in_isr)
|
||||
|
||||
// 1st argument is rhport (mandatory), 2nd argument in_isr (optional)
|
||||
#define tuh_int_handler(...) TU_FUNC_OPTIONAL_ARG(_tuh_int_handler, __VA_ARGS__)
|
||||
|
||||
// Check if roothub port is initialized and active as a host
|
||||
@@ -214,6 +223,9 @@ TU_ATTR_ALWAYS_INLINE static inline bool tuh_ready(uint8_t daddr) {
|
||||
return tuh_mounted(daddr) && !tuh_suspended(daddr);
|
||||
}
|
||||
|
||||
// Get bus information of device
|
||||
bool tuh_bus_info_get(uint8_t daddr, tuh_bus_info_t* bus_info);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Transfer API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
Reference in New Issue
Block a user