Declare interrupt handler functions for ESP32 DWC2#3330
Declare interrupt handler functions for ESP32 DWC2#3330
Conversation
|
|
I think the real issue is prevent |
|
@HiFiPhile it was hard to track this down, but in Arduino we now have both Host and Device enabled at the same time and that produced build errors for undefined |
So they both compile the function |
I can't find how |
|
@HiFiPhile let me try to compile and give you the exact errors |
|
@HiFiPhile Host I guess my mistake, not |
|
@HiFiPhile @hathach CI failures are unrelated to this PR |
|
@me-no-dev Thank you for the log. Another way is to fix once for all (future) ports, but it will leak dcd api into hcd or vice versa: diff --git a/src/portable/synopsys/dwc2/dwc2_common.c b/src/portable/synopsys/dwc2/dwc2_common.c
index 5ff18ab94..ee79ddc46 100644
--- a/src/portable/synopsys/dwc2/dwc2_common.c
+++ b/src/portable/synopsys/dwc2/dwc2_common.c
@@ -30,15 +30,6 @@
#if defined(TUP_USBIP_DWC2) && (CFG_TUH_ENABLED || CFG_TUD_ENABLED)
-#if CFG_TUD_ENABLED
-#include "device/dcd.h"
-#endif
-
-#if CFG_TUH_ENABLED
-#include "host/hcd.h"
-#include "host/usbh.h"
-#endif
-
#include "dwc2_common.h"
//--------------------------------------------------------------------
diff --git a/src/portable/synopsys/dwc2/dwc2_common.h b/src/portable/synopsys/dwc2/dwc2_common.h
index 0166b0261..dc204f578 100644
--- a/src/portable/synopsys/dwc2/dwc2_common.h
+++ b/src/portable/synopsys/dwc2/dwc2_common.h
@@ -30,6 +30,14 @@
#include "common/tusb_common.h"
#include "dwc2_type.h"
+#if CFG_TUD_ENABLED
+#include "device/dcd.h"
+#endif
+
+#if CFG_TUH_ENABLED
+#include "host/hcd.h"
+#endif
+
// Following symbols must be defined by port header
// - _dwc2_controller[]: array of controllers
// - DWC2_EP_MAX: largest EP counts of all controllersLet's see how @hathach thinks. |
|
@HiFiPhile I'm OK with whatever you guys decide, as long as it's working 😄 |
|
@HiFiPhile maybe the includes can be added to |
I'm good with it, other port headers are simpler and doesn't need dcd/hcd api for now. |
|
@me-no-dev let me check, I think I got is the old version of esp32p4 devkit that does not wire the usbfs to usbc connector. And I didn't test with dual examples. |
|
@hathach yes. P4 EV board has the USB-OTG port only for host, but there are other boards and there are also S2 and S3 boards that we tested with. Both host and device are working fine with the changes (only one is initialize at a time), but since Arduino uses pre-built TinyUSB, we need it to be compiled for both at the same time. |
|
@HiFiPhile suggestion is better, I have made an PR for it, also update example to compile/test with #3333, but haven't tested dual mode on 2 otg (fs & hs) just yet as I don't have time to wiring up the board atm, will test it out later. |



When both host and device are enabled at the same time, this function is compiled twice, once for host and once for device, but the device
dcd_int_handleris not declared when compiling host and the opposite for when compiling device. This PR only adds the declarations so that the function can compile in both cases.Device
dcd_dwc2.cHost
hcd_dwc2.c