aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/usbfs.c
diff options
context:
space:
mode:
authorAlex Maclean <monkeh@monkeh.net>2023-12-15 19:43:58 +0000
committerKevinOConnor <kevin@koconnor.net>2023-12-21 20:58:57 -0500
commit71ab6240f2dd8132ab29d9251690b3f8b6da0517 (patch)
treede288a6f2a092749667b3d7c619e022b705bdd72 /src/stm32/usbfs.c
parent547bfbf81847c758a3fb07e76963544bdbc6438d (diff)
downloadkutter-71ab6240f2dd8132ab29d9251690b3f8b6da0517.tar.gz
kutter-71ab6240f2dd8132ab29d9251690b3f8b6da0517.tar.xz
kutter-71ab6240f2dd8132ab29d9251690b3f8b6da0517.zip
stm32: Fix STM32G4 USB
STM32G4 USB controller requires 8 or 16-bit access, not 32-bit Signed-off-by: Alex Maclean <monkeh@monkeh.net>
Diffstat (limited to 'src/stm32/usbfs.c')
-rw-r--r--src/stm32/usbfs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/stm32/usbfs.c b/src/stm32/usbfs.c
index ad2e7b3e..5385c956 100644
--- a/src/stm32/usbfs.c
+++ b/src/stm32/usbfs.c
@@ -15,7 +15,7 @@
#include "internal.h" // GPIO
#include "sched.h" // DECL_INIT
-#if CONFIG_MACH_STM32F1 || CONFIG_MACH_STM32G4
+#if CONFIG_MACH_STM32F1
// Transfer memory is accessed with 32bits, but contains only 16bits of data
typedef volatile uint32_t epmword_t;
#define WSIZE 2
@@ -25,6 +25,11 @@
typedef volatile uint16_t epmword_t;
#define WSIZE 2
#define USBx_IRQn USB_IRQn
+#elif CONFIG_MACH_STM32G4
+ // Transfer memory is accessed with 16bits and contains 16bits of data
+ typedef volatile uint16_t epmword_t;
+ #define WSIZE 2
+ #define USBx_IRQn USB_LP_IRQn
#elif CONFIG_MACH_STM32G0
// Transfer memory is accessed with 32bits and contains 32bits of data
typedef volatile uint32_t epmword_t;