From 84dfcef639afea9f15de4ba1d408a240d26fa4b6 Mon Sep 17 00:00:00 2001 From: sakimisu <1203593632@qq.com> Date: Thu, 2 Feb 2023 23:23:55 +0800 Subject: check if dwc2 supports dma, if not, stop working --- port/dwc2/usb_hc_dwc2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index e1591ae6..0ad34c51 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/port/dwc2/usb_hc_dwc2.c @@ -464,6 +464,12 @@ int usb_hc_init(void) usb_hc_low_level_init(); + if ((USB_OTG_GLB->CID & (0x1U << 8)) == 0U) { + USB_LOG_ERR("This dwc2 version does not support dma, so stop working\r\n"); + while (1) { + } + } + USB_OTG_GLB->GAHBCFG &= ~USB_OTG_GAHBCFG_GINT; ret = dwc2_core_init(); -- cgit v1.3.1