|
38 | 38 |
|
39 | 39 | #elif CFG_TUSB_MCU == OPT_MCU_STM32F0 |
40 | 40 | #include "stm32f0xx.h" |
41 | | - #define FSDEV_REG_BASE USB_BASE |
42 | 41 | #define FSDEV_HAS_SBUF_ISO 0 |
43 | 42 | // F0x2 models are crystal-less |
44 | 43 | // All have internal D+ pull-up |
|
51 | 50 | // NO internal Pull-ups |
52 | 51 | // *B, and *C: 2 x 16 bits/word |
53 | 52 |
|
54 | | -#elif defined(STM32F302xB) || defined(STM32F302xC) || defined(STM32F303xB) || defined(STM32F303xC) || \ |
55 | | - defined(STM32F373xC) |
| 53 | +#elif CFG_TUSB_MCU == OPT_MCU_STM32F3 |
56 | 54 | #include "stm32f3xx.h" |
57 | 55 | #define FSDEV_HAS_SBUF_ISO 0 |
58 | | - // NO internal Pull-ups |
59 | | - // *B, and *C: 1 x 16 bits/word |
60 | | - // PMA dedicated to USB (no sharing with CAN) |
| 56 | + // NO internal Pull-ups. PMA dedicated to USB (no sharing with CAN) |
| 57 | + // xB, and xC: 512 bytes |
| 58 | + // x6, x8, xD, and xE: 1024 bytes + LPM Support. When CAN clock is enabled, USB can use the first 768 bytes ONLY. |
61 | 59 |
|
62 | | -#elif defined(STM32F302x6) || defined(STM32F302x8) || defined(STM32F302xD) || defined(STM32F302xE) || \ |
63 | | - defined(STM32F303xD) || defined(STM32F303xE) |
64 | | - #include "stm32f3xx.h" |
| 60 | +#elif CFG_TUSB_MCU == OPT_MCU_STM32G0 |
| 61 | + #include "stm32g0xx.h" |
| 62 | + #define FSDEV_HAS_SBUF_ISO 1 |
| 63 | + |
| 64 | +#elif CFG_TUSB_MCU == OPT_MCU_STM32G4 |
| 65 | + #include "stm32g4xx.h" |
65 | 66 | #define FSDEV_HAS_SBUF_ISO 0 |
66 | | - // NO internal Pull-ups |
67 | | - // *6, *8, *D, and *E: 2 x 16 bits/word LPM Support |
68 | | - // When CAN clock is enabled, USB can use first 768 bytes ONLY. |
| 67 | + |
| 68 | +#elif CFG_TUSB_MCU == OPT_MCU_STM32H5 |
| 69 | + #include "stm32h5xx.h" |
| 70 | + #define FSDEV_HAS_SBUF_ISO 1 |
69 | 71 |
|
70 | 72 | #elif CFG_TUSB_MCU == OPT_MCU_STM32L0 |
71 | 73 | #include "stm32l0xx.h" |
|
87 | 89 | #define USB_PMAADDR (USB_BASE + (USB_PMAADDR_NS - USB_BASE_NS)) |
88 | 90 | #endif |
89 | 91 |
|
90 | | -#elif CFG_TUSB_MCU == OPT_MCU_STM32G0 |
91 | | - #include "stm32g0xx.h" |
92 | | - #define FSDEV_HAS_SBUF_ISO 1 |
93 | | - |
94 | | -#elif CFG_TUSB_MCU == OPT_MCU_STM32G4 |
95 | | - #include "stm32g4xx.h" |
96 | | - #define FSDEV_HAS_SBUF_ISO 0 |
97 | | - |
98 | | -#elif CFG_TUSB_MCU == OPT_MCU_STM32H5 |
99 | | - #include "stm32h5xx.h" |
100 | | - #define FSDEV_HAS_SBUF_ISO 1 |
101 | | - |
102 | 92 | #elif CFG_TUSB_MCU == OPT_MCU_STM32U0 |
103 | 93 | #include "stm32u0xx.h" |
104 | 94 | #define FSDEV_HAS_SBUF_ISO 1 |
105 | 95 |
|
106 | 96 | #elif CFG_TUSB_MCU == OPT_MCU_STM32U3 |
107 | 97 | #include "stm32u3xx.h" |
108 | | - #define FSDEV_HAS_SBUF_ISO 1 // This is assumed to work but has not been tested... |
| 98 | + #define FSDEV_HAS_SBUF_ISO 1 |
109 | 99 |
|
110 | 100 | #elif CFG_TUSB_MCU == OPT_MCU_STM32U5 |
111 | 101 | #include "stm32u5xx.h" |
|
114 | 104 | #elif CFG_TUSB_MCU == OPT_MCU_STM32WB |
115 | 105 | #include "stm32wbxx.h" |
116 | 106 | #define FSDEV_HAS_SBUF_ISO 0 |
117 | | - /* ST provided header has incorrect value of USB_PMAADDR */ |
118 | | - #define FSDEV_PMA_BASE USB1_PMAADDR |
119 | 107 |
|
120 | 108 | #else |
121 | 109 | #error You are using an untested or unimplemented STM32 variant. Please update the driver. |
|
185 | 173 | #endif |
186 | 174 |
|
187 | 175 | static const IRQn_Type fsdev_irq[] = { |
188 | | - #if TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32L0, OPT_MCU_STM32L4) |
| 176 | + #if TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32L0, OPT_MCU_STM32L4, OPT_MCU_STM32U5) |
| 177 | + USB_IRQn, |
| 178 | + #elif TU_CHECK_MCU(OPT_MCU_STM32L5, OPT_MCU_STM32U3) |
| 179 | + USB_FS_IRQn, |
| 180 | + #elif TU_CHECK_MCU(OPT_MCU_STM32C0, OPT_MCU_STM32H5, OPT_MCU_STM32U0) |
| 181 | + USB_DRD_FS_IRQn, |
| 182 | + #elif CFG_TUSB_MCU == OPT_MCU_STM32G0 |
| 183 | + #ifdef STM32G0B0xx |
189 | 184 | USB_IRQn, |
| 185 | + #else |
| 186 | + USB_UCPD1_2_IRQn, |
| 187 | + #endif |
190 | 188 | #elif CFG_TUSB_MCU == OPT_MCU_STM32F1 |
191 | 189 | USB_HP_CAN1_TX_IRQn, |
192 | 190 | USB_LP_CAN1_RX0_IRQn, |
193 | 191 | USBWakeUp_IRQn, |
194 | 192 | #elif CFG_TUSB_MCU == OPT_MCU_STM32F3 |
195 | | - // USB remap handles dcd functions |
196 | 193 | USB_HP_CAN_TX_IRQn, |
197 | 194 | USB_LP_CAN_RX0_IRQn, |
198 | 195 | USBWakeUp_IRQn, |
199 | | - #elif CFG_TUSB_MCU == OPT_MCU_STM32G0 |
200 | | - #ifdef STM32G0B0xx |
201 | | - USB_IRQn, |
202 | | - #else |
203 | | - USB_UCPD1_2_IRQn, |
204 | | - #endif |
205 | | - #elif CFG_TUSB_MCU == OPT_MCU_STM32C0 |
206 | | - USB_DRD_FS_IRQn, |
207 | 196 | #elif TU_CHECK_MCU(OPT_MCU_STM32G4, OPT_MCU_STM32L1) |
208 | 197 | USB_HP_IRQn, |
209 | 198 | USB_LP_IRQn, |
210 | 199 | USBWakeUp_IRQn, |
211 | | - #elif CFG_TUSB_MCU == OPT_MCU_STM32H5 |
212 | | - USB_DRD_FS_IRQn, |
213 | | - #elif CFG_TUSB_MCU == OPT_MCU_STM32L5 |
214 | | - USB_FS_IRQn, |
215 | 200 | #elif CFG_TUSB_MCU == OPT_MCU_STM32WB |
216 | 201 | USB_HP_IRQn, |
217 | 202 | USB_LP_IRQn, |
218 | | - #elif CFG_TUSB_MCU == OPT_MCU_STM32U5 |
219 | | - USB_IRQn, |
220 | | - #elif CFG_TUSB_MCU == OPT_MCU_STM32U0 |
221 | | - USB_DRD_FS_IRQn, |
222 | | - #elif CFG_TUSB_MCU == OPT_MCU_STM32U3 |
223 | | - USB_FS_IRQn, |
224 | 203 | #else |
225 | 204 | #error Unknown arch in USB driver |
226 | 205 | #endif |
|
0 commit comments