Delete Adafruit's DCD, add stubs for missing DCD functions, use ESP32 core DCD
This commit is contained in:
@@ -1,3 +1,25 @@
|
|||||||
Import("env")
|
Import("env")
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Keep allow-multiple-definition for core TinyUSB symbol overlaps
|
||||||
env.Append(LINKFLAGS=["-Wl,--allow-multiple-definition"])
|
env.Append(LINKFLAGS=["-Wl,--allow-multiple-definition"])
|
||||||
|
|
||||||
|
# Delete the Adafruit library's generic DCD so the ESP32 core's
|
||||||
|
# patched version from libarduino_tinyusb.a is used instead.
|
||||||
|
# We provide stubs (src/dcd_stubs.c) for the few ISO/SOF functions
|
||||||
|
# the ESP32 core's older DCD doesn't implement.
|
||||||
|
lib_path = os.path.join(
|
||||||
|
env.subst("$PROJECT_DIR"),
|
||||||
|
".pio", "libdeps", env.subst("$PIOENV"),
|
||||||
|
"Adafruit TinyUSB Library", "src"
|
||||||
|
)
|
||||||
|
|
||||||
|
dcd_path = os.path.join(lib_path, "portable", "synopsys", "dwc2", "dcd_dwc2.c")
|
||||||
|
backup = dcd_path + ".bak"
|
||||||
|
|
||||||
|
if os.path.exists(dcd_path):
|
||||||
|
# Rename .c -> .bak so the build system doesn't compile it
|
||||||
|
os.rename(dcd_path, backup)
|
||||||
|
print("[extra_script] Renamed dcd_dwc2.c -> dcd_dwc2.c.bak (using ESP32 core DCD + project stubs)")
|
||||||
|
else:
|
||||||
|
print("[extra_script] dcd_dwc2.c not found at:", dcd_path)
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Stub DCD functions required by Adafruit TinyUSB Library's usbd.c
|
||||||
|
* but not provided by ESP32 Arduino core's older libarduino_tinyusb.a.
|
||||||
|
* These are for ISO transfers / SOF interrupt only -- MIDI doesn't use them.
|
||||||
|
*/
|
||||||
|
#include "tusb.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// SOF (Start of Frame)
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
void dcd_sof_enable(uint8_t rhport, bool enabled) {
|
||||||
|
(void)rhport;
|
||||||
|
(void)enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// ISO (Isochronous)
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
bool dcd_edpt_iso_alloc(uint8_t rhport, uint8_t dir, uint8_t ep_addr, uint16_t packet_size) {
|
||||||
|
(void)rhport;
|
||||||
|
(void)dir;
|
||||||
|
(void)ep_addr;
|
||||||
|
(void)packet_size;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dcd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t const *p_endpoint_desc) {
|
||||||
|
(void)rhport;
|
||||||
|
(void)p_endpoint_desc;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user