summaryrefslogtreecommitdiff
path: root/src/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-10-11 17:53:39 +0700
committerhathach <[email protected]>2024-10-11 17:53:39 +0700
commit1587d48e89cbaa8d0d1c870809bc40c3c8d1056f (patch)
treea01565a3ddfef6225497dc4e83ffc0fa93830ce2 /src/host
parentf3b7d7515e9cae834013dc9ee3a67d87111090eb (diff)
hcd_init() take init struct
Diffstat (limited to 'src/host')
-rw-r--r--src/host/hcd.h19
-rw-r--r--src/host/usbh.c2
2 files changed, 7 insertions, 14 deletions
diff --git a/src/host/hcd.h b/src/host/hcd.h
index 5547c7cc5..97cb01754 100644
--- a/src/host/hcd.h
+++ b/src/host/hcd.h
@@ -53,26 +53,21 @@
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+
-typedef enum
-{
+typedef enum {
HCD_EVENT_DEVICE_ATTACH,
HCD_EVENT_DEVICE_REMOVE,
HCD_EVENT_XFER_COMPLETE,
- // Not an HCD event, just a convenient way to defer ISR function
- USBH_EVENT_FUNC_CALL,
-
+ USBH_EVENT_FUNC_CALL, // Not an HCD event
HCD_EVENT_COUNT
} hcd_eventid_t;
-typedef struct
-{
+typedef struct {
uint8_t rhport;
uint8_t event_id;
uint8_t dev_addr;
- union
- {
+ union {
// Attach, Remove
struct {
uint8_t hub_addr;
@@ -93,11 +88,9 @@ typedef struct
void* param;
}func_call;
};
-
} hcd_event_t;
-typedef struct
-{
+typedef struct {
uint8_t rhport;
uint8_t hub_addr;
uint8_t hub_port;
@@ -128,7 +121,7 @@ bool hcd_dcache_clean_invalidate(void const* addr, uint32_t data_size) TU_ATTR_W
bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param);
// Initialize controller to host mode
-bool hcd_init(uint8_t rhport);
+bool hcd_init(const tusb_rhport_init_t* rh_init);
// De-initialize controller
bool hcd_deinit(uint8_t rhport);
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 39bc8d63a..f9e6c4e97 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -405,7 +405,7 @@ bool tuh_rhport_init(const tusb_rhport_init_t* rh_init) {
// Init host controller
_usbh_controller = rh_init->rhport;
- TU_ASSERT(hcd_init(rh_init->rhport));
+ TU_ASSERT(hcd_init(rh_init));
hcd_int_enable(rh_init->rhport);
return true;