summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLimor "Ladyada" Fried <[email protected]>2024-04-25 17:24:51 -0400
committerGitHub <[email protected]>2024-04-25 17:24:51 -0400
commita0cba9b0454b72905075d4adb131e77a16b63bcf (patch)
treec262c4a1cde6d10135d89ba40eacc16af42a0d1b /src
parentfc91e15488523548b6eafa63a3cb6190c1ba72d8 (diff)
parent022de87550fdc63dd6dea91f39feecfce59eabe5 (diff)
Merge pull request #2611 from hathach/add-esp32-max3421e
Add esp32 max3421e
Diffstat (limited to 'src')
-rw-r--r--src/common/tusb_mcu.h7
-rw-r--r--src/common/tusb_verify.h2
-rw-r--r--src/portable/analog/max3421/hcd_max3421.c4
-rw-r--r--src/tusb_option.h4
4 files changed, 13 insertions, 4 deletions
diff --git a/src/common/tusb_mcu.h b/src/common/tusb_mcu.h
index 0ae2573cd..5a567f2d5 100644
--- a/src/common/tusb_mcu.h
+++ b/src/common/tusb_mcu.h
@@ -329,6 +329,9 @@
#define TUP_USBIP_DWC2
#define TUP_DCD_ENDPOINT_MAX 6
+#elif TU_CHECK_MCU(OPT_MCU_ESP32) && (CFG_TUD_ENABLED || !(defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421))
+ #error "MCUs are only supported with CFG_TUH_MAX3421 enabled"
+
//--------------------------------------------------------------------+
// Dialog
//--------------------------------------------------------------------+
@@ -426,8 +429,8 @@
#define TUP_MCU_MULTIPLE_CORE 0
#endif
-#ifndef TUP_DCD_ENDPOINT_MAX
- #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
+#if !defined(TUP_DCD_ENDPOINT_MAX) && defined(CFG_TUD_ENABLED) && CFG_TUD_ENABLED
+#warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
#define TUP_DCD_ENDPOINT_MAX 8
#endif
diff --git a/src/common/tusb_verify.h b/src/common/tusb_verify.h
index 71406dacf..0a9549c99 100644
--- a/src/common/tusb_verify.h
+++ b/src/common/tusb_verify.h
@@ -84,7 +84,7 @@
if ( (*ARM_CM_DHCSR) & 1UL ) __asm("BKPT #0\n"); /* Only halt mcu if debugger is attached */ \
} while(0)
-#elif defined(__riscv)
+#elif defined(__riscv) && !TUP_MCU_ESPRESSIF
#define TU_BREAKPOINT() do { __asm("ebreak\n"); } while(0)
#elif defined(_mips)
diff --git a/src/portable/analog/max3421/hcd_max3421.c b/src/portable/analog/max3421/hcd_max3421.c
index 39afb7505..4dc93d2d8 100644
--- a/src/portable/analog/max3421/hcd_max3421.c
+++ b/src/portable/analog/max3421/hcd_max3421.c
@@ -479,13 +479,15 @@ bool hcd_init(uint8_t rhport) {
_hcd_data.spi_mutex = osal_mutex_create(&_hcd_data.spi_mutexdef);
#endif
+ // NOTE: driver does not seem to work without nRST pin signal
+
// full duplex, interrupt negative edge
reg_write(rhport, PINCTL_ADDR, _tuh_cfg.pinctl | PINCTL_FDUPSPI, false);
// v1 is 0x01, v2 is 0x12, v3 is 0x13
uint8_t const revision = reg_read(rhport, REVISION_ADDR, false);
- TU_ASSERT(revision == 0x01 || revision == 0x12 || revision == 0x13, false);
TU_LOG2_HEX(revision);
+ TU_ASSERT(revision == 0x01 || revision == 0x12 || revision == 0x13, false);
// reset
reg_write(rhport, USBCTL_ADDR, USBCTL_CHIPRES, false);
diff --git a/src/tusb_option.h b/src/tusb_option.h
index cbcb69edd..3ead20ee7 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -119,6 +119,10 @@
// Espressif
#define OPT_MCU_ESP32S2 900 ///< Espressif ESP32-S2
#define OPT_MCU_ESP32S3 901 ///< Espressif ESP32-S3
+#define OPT_MCU_ESP32 902 ///< Espressif ESP32 (for host max3421e)
+#define OPT_MCU_ESP32C3 903 ///< Espressif ESP32-C3
+#define OPT_MCU_ESP32C6 904 ///< Espressif ESP32-C6
+#define TUP_MCU_ESPRESSIF (CFG_TUSB_MCU >= 900 && CFG_TUSB_MCU < 1000) // check if Espressif MCU
// Dialog
#define OPT_MCU_DA1469X 1000 ///< Dialog Semiconductor DA1469x