get hcd work esp32p4 but only in slave mode. In DMA channel's HCDMA is increased but data transfer over USB is not correct.
This commit is contained in:
@@ -179,8 +179,10 @@ bool usb_init(void) {
|
|||||||
// maybe we can use USB_OTG_MODE_DEFAULT and switch using dwc2 driver
|
// maybe we can use USB_OTG_MODE_DEFAULT and switch using dwc2 driver
|
||||||
#if CFG_TUD_ENABLED
|
#if CFG_TUD_ENABLED
|
||||||
.otg_mode = USB_OTG_MODE_DEVICE,
|
.otg_mode = USB_OTG_MODE_DEVICE,
|
||||||
|
.otg_speed = BOARD_TUD_RHPORT ? USB_PHY_SPEED_HIGH : USB_PHY_SPEED_FULL,
|
||||||
#elif CFG_TUH_ENABLED
|
#elif CFG_TUH_ENABLED
|
||||||
.otg_mode = USB_OTG_MODE_HOST,
|
.otg_mode = USB_OTG_MODE_HOST,
|
||||||
|
.otg_speed= BOARD_TUH_RHPORT ? USB_PHY_SPEED_HIGH : USB_PHY_SPEED_FULL,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -10,9 +10,15 @@ set(RHPORT_SPEED OPT_MODE_FULL_SPEED OPT_MODE_HIGH_SPEED)
|
|||||||
if (NOT DEFINED RHPORT_DEVICE)
|
if (NOT DEFINED RHPORT_DEVICE)
|
||||||
if (IDF_TARGET STREQUAL "esp32p4")
|
if (IDF_TARGET STREQUAL "esp32p4")
|
||||||
set(RHPORT_DEVICE 1)
|
set(RHPORT_DEVICE 1)
|
||||||
set(RHPORT_HOST 1)
|
|
||||||
else ()
|
else ()
|
||||||
set(RHPORT_DEVICE 0)
|
set(RHPORT_DEVICE 0)
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED RHPORT_HOST)
|
||||||
|
if (IDF_TARGET STREQUAL "esp32p4")
|
||||||
|
set(RHPORT_HOST 1)
|
||||||
|
else ()
|
||||||
set(RHPORT_HOST 0)
|
set(RHPORT_HOST 0)
|
||||||
endif ()
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
@@ -169,6 +169,7 @@
|
|||||||
defined (STM32F107xB) || defined (STM32F107xC)
|
defined (STM32F107xB) || defined (STM32F107xC)
|
||||||
#define TUP_USBIP_DWC2
|
#define TUP_USBIP_DWC2
|
||||||
#define TUP_USBIP_DWC2_STM32
|
#define TUP_USBIP_DWC2_STM32
|
||||||
|
#define CFG_TUH_DWC2_DMA_ENABLE_DEFAULT 0
|
||||||
|
|
||||||
#define TUP_DCD_ENDPOINT_MAX 4
|
#define TUP_DCD_ENDPOINT_MAX 4
|
||||||
#elif defined(STM32F102x6) || defined(STM32F102xB) || \
|
#elif defined(STM32F102x6) || defined(STM32F102xB) || \
|
||||||
@@ -343,12 +344,14 @@
|
|||||||
#define TUP_USBIP_DWC2
|
#define TUP_USBIP_DWC2
|
||||||
#define TUP_USBIP_DWC2_ESP32
|
#define TUP_USBIP_DWC2_ESP32
|
||||||
#define TUP_DCD_ENDPOINT_MAX 7 // only 5 TX FIFO for endpoint IN
|
#define TUP_DCD_ENDPOINT_MAX 7 // only 5 TX FIFO for endpoint IN
|
||||||
|
#define CFG_TUH_DWC2_DMA_ENABLE_DEFAULT 0 // TODO currently have issue with buffer DMA with espressif
|
||||||
|
|
||||||
#elif TU_CHECK_MCU(OPT_MCU_ESP32P4)
|
#elif TU_CHECK_MCU(OPT_MCU_ESP32P4)
|
||||||
#define TUP_USBIP_DWC2
|
#define TUP_USBIP_DWC2
|
||||||
#define TUP_USBIP_DWC2_ESP32
|
#define TUP_USBIP_DWC2_ESP32
|
||||||
#define TUP_RHPORT_HIGHSPEED 1 // port0 FS, port1 HS
|
#define TUP_RHPORT_HIGHSPEED 1 // port0 FS, port1 HS
|
||||||
#define TUP_DCD_ENDPOINT_MAX 16 // FS 7 ep, HS 16 ep
|
#define TUP_DCD_ENDPOINT_MAX 16 // FS 7 ep, HS 16 ep
|
||||||
|
#define CFG_TUH_DWC2_DMA_ENABLE_DEFAULT 0 // TODO currently have issue with buffer DMA with espressif
|
||||||
|
|
||||||
#elif TU_CHECK_MCU(OPT_MCU_ESP32, OPT_MCU_ESP32C2, OPT_MCU_ESP32C3, OPT_MCU_ESP32C6, OPT_MCU_ESP32H2)
|
#elif TU_CHECK_MCU(OPT_MCU_ESP32, OPT_MCU_ESP32C2, OPT_MCU_ESP32C3, OPT_MCU_ESP32C6, OPT_MCU_ESP32H2)
|
||||||
#if (CFG_TUD_ENABLED || !(defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421))
|
#if (CFG_TUD_ENABLED || !(defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421))
|
||||||
|
@@ -100,14 +100,15 @@ TU_ATTR_ALWAYS_INLINE static inline void dwc2_remote_wakeup_delay(void) {
|
|||||||
TU_ATTR_ALWAYS_INLINE static inline void dwc2_phy_init(dwc2_regs_t* dwc2, uint8_t hs_phy_type) {
|
TU_ATTR_ALWAYS_INLINE static inline void dwc2_phy_init(dwc2_regs_t* dwc2, uint8_t hs_phy_type) {
|
||||||
(void)dwc2;
|
(void)dwc2;
|
||||||
(void)hs_phy_type;
|
(void)hs_phy_type;
|
||||||
// nothing to do
|
// maybe usb_utmi_hal_init()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MCU specific PHY update, it is called AFTER init() and core reset
|
// MCU specific PHY update, it is called AFTER init() and core reset
|
||||||
TU_ATTR_ALWAYS_INLINE static inline void dwc2_phy_update(dwc2_regs_t* dwc2, uint8_t hs_phy_type) {
|
TU_ATTR_ALWAYS_INLINE static inline void dwc2_phy_update(dwc2_regs_t* dwc2, uint8_t hs_phy_type) {
|
||||||
(void)dwc2;
|
(void)dwc2;
|
||||||
(void)hs_phy_type;
|
(void)hs_phy_type;
|
||||||
// nothing to do
|
// maybe usb_utmi_hal_disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -541,13 +541,22 @@ typedef struct {
|
|||||||
volatile uint32_t gotgctl; // 000 OTG Control and Status
|
volatile uint32_t gotgctl; // 000 OTG Control and Status
|
||||||
volatile dwc2_gotgctl_t gotgctl_bm;
|
volatile dwc2_gotgctl_t gotgctl_bm;
|
||||||
};
|
};
|
||||||
|
union {
|
||||||
volatile uint32_t gotgint; // 004 OTG Interrupt
|
volatile uint32_t gotgint; // 004 OTG Interrupt
|
||||||
|
volatile dwc2_gotgint_t gotgint_bm;
|
||||||
|
};
|
||||||
|
union {
|
||||||
volatile uint32_t gahbcfg; // 008 AHB Configuration
|
volatile uint32_t gahbcfg; // 008 AHB Configuration
|
||||||
|
volatile dwc2_gahbcfg_t gahbcfg_bm;
|
||||||
|
};
|
||||||
union {
|
union {
|
||||||
volatile uint32_t gusbcfg; // 00c USB Configuration
|
volatile uint32_t gusbcfg; // 00c USB Configuration
|
||||||
volatile dwc2_gusbcfg_t gusbcfg_bm;
|
volatile dwc2_gusbcfg_t gusbcfg_bm;
|
||||||
};
|
};
|
||||||
|
union {
|
||||||
volatile uint32_t grstctl; // 010 Reset
|
volatile uint32_t grstctl; // 010 Reset
|
||||||
|
volatile dwc2_grstctl_t grstctl_bm;
|
||||||
|
};
|
||||||
volatile uint32_t gintsts; // 014 Interrupt
|
volatile uint32_t gintsts; // 014 Interrupt
|
||||||
volatile uint32_t gintmsk; // 018 Interrupt Mask
|
volatile uint32_t gintmsk; // 018 Interrupt Mask
|
||||||
volatile uint32_t grxstsr; // 01c Receive Status Debug Read
|
volatile uint32_t grxstsr; // 01c Receive Status Debug Read
|
||||||
|
@@ -241,6 +241,8 @@
|
|||||||
#include "tusb_config.h"
|
#include "tusb_config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "common/tusb_mcu.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// USBIP
|
// USBIP
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@@ -256,12 +258,18 @@
|
|||||||
|
|
||||||
// Enable DWC2 Slave mode for host
|
// Enable DWC2 Slave mode for host
|
||||||
#ifndef CFG_TUH_DWC2_SLAVE_ENABLE
|
#ifndef CFG_TUH_DWC2_SLAVE_ENABLE
|
||||||
#define CFG_TUH_DWC2_SLAVE_ENABLE 1
|
#ifndef CFG_TUH_DWC2_SLAVE_ENABLE_DEFAULT
|
||||||
|
#define CFG_TUH_DWC2_SLAVE_ENABLE_DEFAULT 1
|
||||||
|
#endif
|
||||||
|
#define CFG_TUH_DWC2_SLAVE_ENABLE CFG_TUH_DWC2_SLAVE_ENABLE_DEFAULT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable DWC2 DMA for host
|
// Enable DWC2 DMA for host
|
||||||
#ifndef CFG_TUH_DWC2_DMA_ENABLE
|
#ifndef CFG_TUH_DWC2_DMA_ENABLE
|
||||||
#define CFG_TUH_DWC2_DMA_ENABLE 1
|
#ifndef CFG_TUH_DWC2_DMA_ENABLE_DEFAULT
|
||||||
|
#define CFG_TUH_DWC2_DMA_ENABLE_DEFAULT 1
|
||||||
|
#endif
|
||||||
|
#define CFG_TUH_DWC2_DMA_ENABLE CFG_TUH_DWC2_DMA_ENABLE_DEFAULT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable PIO-USB software host controller
|
// Enable PIO-USB software host controller
|
||||||
@@ -278,7 +286,6 @@
|
|||||||
#define CFG_TUH_MAX3421 0
|
#define CFG_TUH_MAX3421 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "common/tusb_mcu.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// RootHub Mode detection
|
// RootHub Mode detection
|
||||||
|
Reference in New Issue
Block a user