From b5f84e77b72667c0447a0f49c82026fa76657eaa Mon Sep 17 00:00:00 2001 From: Epagris Date: Sun, 23 Jun 2024 09:25:45 +0200 Subject: [PATCH] - basics of HS operation added --- usb_common_defs.h | 6 +++++- usb_driver.c | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/usb_common_defs.h b/usb_common_defs.h index 04bba16..33c5abb 100644 --- a/usb_common_defs.h +++ b/usb_common_defs.h @@ -7,9 +7,13 @@ #elif defined(STM32F407xx) #include #include +#ifdef USB_HIGH_SPEED +#define USBG (USB_OTG_HS) +#else +#define USBG (USB_OTG_FS) +#endif #endif -#define USBG (USB_OTG_FS) #define USBD ((USB_OTG_DeviceTypeDef *) ((uint32_t)(USBG) + (uint32_t)(USB_OTG_DEVICE_BASE))) #define USBINEP ((USB_OTG_INEndpointTypeDef *) ((uint32_t)(USBG) + (uint32_t)(USB_OTG_IN_ENDPOINT_BASE))) #define USBOUTEP ((USB_OTG_OUTEndpointTypeDef *) ((uint32_t)(USBG) + (uint32_t)(USB_OTG_OUT_ENDPOINT_BASE))) diff --git a/usb_driver.c b/usb_driver.c index 5b54e7c..1d1f6bc 100644 --- a/usb_driver.c +++ b/usb_driver.c @@ -382,10 +382,11 @@ void usbdrv_initial_ep0_setup() { // addresses of specific DIEPTXF registers, addresses from the RM static uint32_t *USB_pDIEPTXF[4] = { - (uint32_t *)(USB_OTG_FS_PERIPH_BASE + 0x028), // DIEPTXF0 - (uint32_t *)(USB_OTG_FS_PERIPH_BASE + 0x104), // DIEPTXF1 - (uint32_t *)(USB_OTG_FS_PERIPH_BASE + 0x108), // DIEPTXF2 - (uint32_t *)(USB_OTG_FS_PERIPH_BASE + 0x10C), // DIEPTXF3 + (uint32_t *)(USBG + 0x028), // DIEPTXF0 + (uint32_t *)(USBG + 0x104), // DIEPTXF1 + (uint32_t *)(USBG + 0x108), // DIEPTXF2 + (uint32_t *)(USBG + 0x10C), // DIEPTXF3 + // TODO: HS USB controller has more endpoints }; // configure USB endpoint