flatUSB/usb_common_defs.h
Epagris e257ca3f39 - converted to CMake-managed library
- added CMake-managed conditional compilation of desired USB classes
- STM32F407xx and STM32H743/5xx support joined in the driver files
2024-06-07 10:01:11 +02:00

20 lines
804 B
C

#ifndef CORE_USB_USB_COMMON_DEFS
#define CORE_USB_USB_COMMON_DEFS
#if defined(STM32H745xx) || defined(STM32H743xx)
#include <stm32h7xx.h>
#include <stm32h7xx_hal.h>
#elif defined(STM32F407xx)
#include <stm32f407xx.h>
#include <stm32f4xx_hal.h>
#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)))
#define USBFIFO(ep) ((uint32_t *)((uint32_t)(USBG) + USB_OTG_FIFO_BASE + (USB_OTG_FIFO_SIZE) * (ep)))
#define USBPCGCCTL ((uint32_t *)((uint32_t)(USBG) + USB_OTG_PCGCCTL_BASE))
#endif /* CORE_USB_USB_COMMON_DEFS */