summaryrefslogtreecommitdiff
path: root/src/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-09-27 17:52:18 +0700
committerhathach <[email protected]>2023-09-27 17:52:18 +0700
commit76c43a5bdc5394b1d4f5d8ce13968e31fe2b40fc (patch)
treec88540e4a347111e7df80811e840b62380551ded /src/host
parent6dc64eaa28ab905063233895345ba3c1186b836d (diff)
parent5b08a65ad2e695332d56bd4676841a91f34dd5b1 (diff)
Merge branch 'master' into add-max3421-esp32
Diffstat (limited to 'src/host')
-rw-r--r--src/host/hcd.h2
-rw-r--r--src/host/usbh.h11
2 files changed, 9 insertions, 4 deletions
diff --git a/src/host/hcd.h b/src/host/hcd.h
index a2d4da85d..edffb34cb 100644
--- a/src/host/hcd.h
+++ b/src/host/hcd.h
@@ -131,7 +131,7 @@ bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param) TU_AT
bool hcd_init(uint8_t rhport);
// Interrupt Handler
-void hcd_int_handler(uint8_t rhport);
+void hcd_int_handler(uint8_t rhport, bool in_isr);
// Interrupt Hanndler (extended version)
void hcd_int_handler_ext(uint8_t rhport, bool in_isr);
diff --git a/src/host/usbh.h b/src/host/usbh.h
index 684e8240e..770d70dfe 100644
--- a/src/host/usbh.h
+++ b/src/host/usbh.h
@@ -124,11 +124,16 @@ void tuh_task(void) {
bool tuh_task_event_ready(void);
#ifndef _TUSB_HCD_H_
-extern void hcd_int_handler(uint8_t rhport);
+extern void hcd_int_handler(uint8_t rhport, bool in_isr);
#endif
-// Interrupt handler, name alias to HCD
-#define tuh_int_handler hcd_int_handler
+// Interrupt handler alias to HCD with in_isr as optional parameter
+// - tuh_int_handler(rhport) --> hcd_int_handler(rhport, true)
+// - tuh_int_handler(rhport, in_isr) --> hcd_int_handler(rhport, in_isr)
+// Note: this is similar to TU_VERIFY(), _GET_3RD_ARG() is defined in tusb_verify.h
+#define _tuh_int_handler_1arg(_rhport) hcd_int_handler(_rhport, true)
+#define _tuh_int_hanlder_2arg(_rhport, _in_isr) hcd_int_handler(_rhport, _in_isr)
+#define tuh_int_handler(...) _GET_3RD_ARG(__VA_ARGS__, _tuh_int_hanlder_2arg, _tuh_int_handler_1arg, _dummy)(__VA_ARGS__)
// Check if roothub port is initialized and active as a host
bool tuh_rhport_is_active(uint8_t rhport);