diff --git a/usb_driver.c b/usb_driver.c index c8f75e7..16c6024 100644 --- a/usb_driver.c +++ b/usb_driver.c @@ -132,6 +132,9 @@ void usbdrv_init_global_state() { #endif } +// --------------- + + #if defined(USB_STM32H7) #define TOCAL_VALUE (0x00) #define TRDT_VALUE (0x05) @@ -382,11 +385,10 @@ void usbdrv_initial_ep0_setup() { // addresses of specific DIEPTXF registers, addresses from the RM static uint32_t *USB_pDIEPTXF[4] = { - (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 + (uint32_t *)(((uint32_t)USBG) + 0x028), // DIEPTXF0 + (uint32_t *)(((uint32_t)USBG) + 0x104), // DIEPTXF1 + (uint32_t *)(((uint32_t)USBG) + 0x108), // DIEPTXF2 + (uint32_t *)(((uint32_t)USBG) + 0x10C), // DIEPTXF3 }; // configure USB endpoint @@ -641,7 +643,7 @@ uint32_t usbdrv_arm_IN_endpoint(uint8_t ep, const uint8_t *data, uint16_t len) { // arm OUT endpoint uint32_t usbdrv_arm_OUT_endpoint(uint8_t ep, uint8_t size) { - // arm endpoint only if it was not armed before OR if it's the EP0 OUT which is always enabled, but responds NAK after a successful transfer + // arm endpoint only if it was not armed before if (READ_BIT(USBOUTEP[ep].DOEPCTL, USB_OTG_DOEPCTL_EPENA)) { return 0; }