usb使用dma

This commit is contained in:
2025-10-19 01:20:06 +08:00
parent eab38c8eff
commit 4eb3e830d0
3 changed files with 4 additions and 2 deletions

View File

@@ -51,6 +51,8 @@ extern "C" {
//-------------------------------------------------------------------- //--------------------------------------------------------------------
#define CFG_TUD_DWC2_DMA_ENABLE 1
#define CFG_TUSB_MCU OPT_MCU_STM32F4 #define CFG_TUSB_MCU OPT_MCU_STM32F4
// defined by compiler flags for flexibility // defined by compiler flags for flexibility
#ifndef CFG_TUSB_MCU #ifndef CFG_TUSB_MCU

View File

@@ -251,7 +251,7 @@ bool dwc2_core_init(uint8_t rhport, bool is_highspeed, bool is_dma) {
if (is_dma) { if (is_dma) {
// DMA seems to be only settable after a core reset, and not possible to switch on-the-fly // DMA seems to be only settable after a core reset, and not possible to switch on-the-fly
dwc2->gahbcfg |= GAHBCFG_DMAEN | GAHBCFG_HBSTLEN_2; dwc2->gahbcfg |= GAHBCFG_DMAEN | GAHBCFG_HBSTLEN_3;
} else { } else {
dwc2->gintmsk |= GINTSTS_RXFLVL; dwc2->gintmsk |= GINTSTS_RXFLVL;
} }

View File

@@ -51,7 +51,7 @@ extern "C" {
#define EP_MAX_FS 5 #define EP_MAX_FS 5
#define EP_FIFO_SIZE_FS 0x1000 #define EP_FIFO_SIZE_FS 0x1000
#define EP_MAX_HS 5 #define EP_MAX_HS 6
#define EP_FIFO_SIZE_HS 0x1000 #define EP_FIFO_SIZE_HS 0x1000
// #define USB_OTG_HS_BASE_ADDR 0x40040000 // #define USB_OTG_HS_BASE_ADDR 0x40040000