- basics of HS operation added

This commit is contained in:
Wiesner András 2024-06-23 09:25:45 +02:00
parent 2a40a41687
commit b5f84e77b7
2 changed files with 10 additions and 5 deletions

View File

@ -7,9 +7,13 @@
#elif defined(STM32F407xx) #elif defined(STM32F407xx)
#include <stm32f407xx.h> #include <stm32f407xx.h>
#include <stm32f4xx_hal.h> #include <stm32f4xx_hal.h>
#ifdef USB_HIGH_SPEED
#define USBG (USB_OTG_HS)
#else
#define USBG (USB_OTG_FS)
#endif
#endif #endif
#define USBG (USB_OTG_FS)
#define USBD ((USB_OTG_DeviceTypeDef *) ((uint32_t)(USBG) + (uint32_t)(USB_OTG_DEVICE_BASE))) #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 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))) #define USBOUTEP ((USB_OTG_OUTEndpointTypeDef *) ((uint32_t)(USBG) + (uint32_t)(USB_OTG_OUT_ENDPOINT_BASE)))

View File

@ -382,10 +382,11 @@ void usbdrv_initial_ep0_setup() {
// addresses of specific DIEPTXF registers, addresses from the RM // addresses of specific DIEPTXF registers, addresses from the RM
static uint32_t *USB_pDIEPTXF[4] = { static uint32_t *USB_pDIEPTXF[4] = {
(uint32_t *)(USB_OTG_FS_PERIPH_BASE + 0x028), // DIEPTXF0 (uint32_t *)(USBG + 0x028), // DIEPTXF0
(uint32_t *)(USB_OTG_FS_PERIPH_BASE + 0x104), // DIEPTXF1 (uint32_t *)(USBG + 0x104), // DIEPTXF1
(uint32_t *)(USB_OTG_FS_PERIPH_BASE + 0x108), // DIEPTXF2 (uint32_t *)(USBG + 0x108), // DIEPTXF2
(uint32_t *)(USB_OTG_FS_PERIPH_BASE + 0x10C), // DIEPTXF3 (uint32_t *)(USBG + 0x10C), // DIEPTXF3
// TODO: HS USB controller has more endpoints
}; };
// configure USB endpoint // configure USB endpoint