diff options
| author | sakumisu <[email protected]> | 2025-12-01 20:31:03 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-12-01 20:31:03 +0800 |
| commit | 7d3048712b7eb921c434c0ec88b634cd7654f02b (patch) | |
| tree | a530b07f854a5ec3372f2efbb6db7516df00eaab | |
| parent | 747c6bd9dd5fdcd4ebd125e647cfcef60e635b03 (diff) | |
fix(core): fix incompatible warning
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | core/usbd_core.h | 3 | ||||
| -rw-r--r-- | core/usbh_core.h | 3 | ||||
| -rw-r--r-- | core/usbotg_core.c | 6 | ||||
| -rw-r--r-- | core/usbotg_core.h | 2 |
4 files changed, 9 insertions, 5 deletions
diff --git a/core/usbd_core.h b/core/usbd_core.h index 58566826..f03608bc 100644 --- a/core/usbd_core.h +++ b/core/usbd_core.h @@ -56,6 +56,7 @@ enum usbd_event_type { typedef int (*usbd_request_handler)(uint8_t busid, struct usb_setup_packet *setup, uint8_t **data, uint32_t *len); typedef void (*usbd_endpoint_callback)(uint8_t busid, uint8_t ep, uint32_t nbytes); typedef void (*usbd_notify_handler)(uint8_t busid, uint8_t event, void *arg); +typedef void (*usbd_event_handler_t)(uint8_t busid, uint8_t event); struct usbd_endpoint { uint8_t ep_addr; @@ -115,7 +116,7 @@ bool usb_device_is_suspend(uint8_t busid); int usbd_send_remote_wakeup(uint8_t busid); uint8_t usbd_get_ep0_next_state(uint8_t busid); -int usbd_initialize(uint8_t busid, uintptr_t reg_base, void (*event_handler)(uint8_t busid, uint8_t event)); +int usbd_initialize(uint8_t busid, uintptr_t reg_base, usbd_event_handler_t event_handler); int usbd_deinitialize(uint8_t busid); #ifdef __cplusplus diff --git a/core/usbh_core.h b/core/usbh_core.h index cabbcf20..4ec86ab0 100644 --- a/core/usbh_core.h +++ b/core/usbh_core.h @@ -61,6 +61,8 @@ extern "C" { USB_GET_MULT(ep_desc->wMaxPacketSize)); \ } while (0) +typedef void (*usbh_event_handler_t)(uint8_t busid, uint8_t hub_index, uint8_t hub_port, uint8_t intf, uint8_t event); + struct usbh_class_info { uint8_t match_flags; /* Used for product specific matches; range is inclusive */ uint8_t bInterfaceClass; /* Base device class code */ @@ -171,6 +173,7 @@ struct usbh_bus { usb_osal_thread_t hub_thread; usb_osal_mq_t hub_mq; usb_osal_mutex_t mutex; + usbh_event_handler_t event_handler; }; static inline void usbh_control_urb_fill(struct usbh_urb *urb, diff --git a/core/usbotg_core.c b/core/usbotg_core.c index fb7e64ce..afcd4d2f 100644 --- a/core/usbotg_core.c +++ b/core/usbotg_core.c @@ -17,8 +17,8 @@ struct usbotg_core_priv { uint32_t reg_base; bool usbh_initialized; bool usbd_initialized; - void *device_event_callback; - void *host_event_callback; + usbd_event_handler_t device_event_callback; + usbh_event_handler_t host_event_callback; uint8_t current_mode; usb_osal_sem_t change_sem; usb_osal_thread_t change_thread; @@ -75,7 +75,7 @@ static void usbotg_rolechange_thread(void *argument) } } -int usbotg_initialize(uint8_t busid, uint32_t reg_base, void *device_event_callback, void *host_event_callback, uint8_t default_role) +int usbotg_initialize(uint8_t busid, uint32_t reg_base, usbd_event_handler_t device_event_callback, usbd_event_handler_t host_event_callback, uint8_t default_role); { char thread_name[32] = { 0 }; diff --git a/core/usbotg_core.h b/core/usbotg_core.h index 4729d8c8..7f7208ac 100644 --- a/core/usbotg_core.h +++ b/core/usbotg_core.h @@ -14,7 +14,7 @@ extern "C" { #include "usbh_core.h" #include "usb_otg.h" -int usbotg_initialize(uint8_t busid, uint32_t reg_base, void *device_event_callback, void *host_event_callback, uint8_t default_role); +int usbotg_initialize(uint8_t busid, uint32_t reg_base, usbd_event_handler_t device_event_callback, usbd_event_handler_t host_event_callback, uint8_t default_role); int usbotg_deinitialize(uint8_t busid); /* called by user */ |
