Skip to content

Commit a4ba3f2

Browse files
committed
add TUP_USBIP_DWC2
1 parent 11c89d4 commit a4ba3f2

File tree

2 files changed

+59
-58
lines changed

2 files changed

+59
-58
lines changed

src/common/tusb_mcu.h

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -51,119 +51,119 @@
5151

5252
//------------- NXP -------------//
5353
#if TU_CHECK_MCU(OPT_MCU_LPC11UXX, OPT_MCU_LPC13XX, OPT_MCU_LPC15XX)
54-
#define TUP_DCD_ENDPOINT_MAX 5
54+
#define TUP_DCD_ENDPOINT_MAX 5
5555

5656
#elif TU_CHECK_MCU(OPT_MCU_LPC175X_6X, OPT_MCU_LPC177X_8X, OPT_MCU_LPC40XX)
57-
#define TUP_DCD_ENDPOINT_MAX 16
57+
#define TUP_DCD_ENDPOINT_MAX 16
5858
#define TUP_USBIP_OHCI
5959

6060
#elif TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX)
6161
// TODO USB0 has 6, USB1 has 4
6262
#define TUP_USBIP_CHIPIDEA_HS
6363
#define TUP_USBIP_EHCI
6464

65-
#define TUP_DCD_ENDPOINT_MAX 6
66-
#define TUP_RHPORT_HIGHSPEED 0x01 // Port0 HS, Port1 FS
65+
#define TUP_DCD_ENDPOINT_MAX 6
66+
#define TUP_RHPORT_HIGHSPEED 0x01 // Port0 HS, Port1 FS
6767

6868

6969
#elif TU_CHECK_MCU(OPT_MCU_LPC51UXX)
7070
#define TUP_DCD_ENDPOINT_MAX 5
7171

7272
#elif TU_CHECK_MCU(OPT_MCU_LPC54XXX)
7373
// TODO USB0 has 5, USB1 has 6
74-
#define TUP_DCD_ENDPOINT_MAX 6
74+
#define TUP_DCD_ENDPOINT_MAX 6
7575

7676
#elif TU_CHECK_MCU(OPT_MCU_LPC55XX)
7777
// TODO USB0 has 5, USB1 has 6
78-
#define TUP_DCD_ENDPOINT_MAX 6
78+
#define TUP_DCD_ENDPOINT_MAX 6
7979

8080
#elif TU_CHECK_MCU(OPT_MCU_MIMXRT10XX)
8181
#define TUP_USBIP_CHIPIDEA_HS
8282
#define TUP_USBIP_EHCI
8383

84-
#define TUP_DCD_ENDPOINT_MAX 8
85-
#define TUP_RHPORT_HIGHSPEED 0x03 // Port0 HS, Port1 HS
84+
#define TUP_DCD_ENDPOINT_MAX 8
85+
#define TUP_RHPORT_HIGHSPEED 0x03 // Port0 HS, Port1 HS
8686

8787

8888
#elif TU_CHECK_MCU(OPT_MCU_MKL25ZXX, OPT_MCU_K32L2BXX)
89-
#define TUP_DCD_ENDPOINT_MAX 16
89+
#define TUP_DCD_ENDPOINT_MAX 16
9090

9191
#elif TU_CHECK_MCU(OPT_MCU_MM32F327X)
92-
#define TUP_DCD_ENDPOINT_MAX 16
92+
#define TUP_DCD_ENDPOINT_MAX 16
9393

9494
//------------- Nordic -------------//
9595
#elif TU_CHECK_MCU(OPT_MCU_NRF5X)
9696
// 8 CBI + 1 ISO
97-
#define TUP_DCD_ENDPOINT_MAX 9
97+
#define TUP_DCD_ENDPOINT_MAX 9
9898

9999
//------------- Microchip -------------//
100100
#elif TU_CHECK_MCU(OPT_MCU_SAMD21, OPT_MCU_SAMD51, OPT_MCU_SAME5X) || \
101101
TU_CHECK_MCU(OPT_MCU_SAMD11, OPT_MCU_SAML21, OPT_MCU_SAML22)
102-
#define TUP_DCD_ENDPOINT_MAX 8
102+
#define TUP_DCD_ENDPOINT_MAX 8
103103

104104
#elif TU_CHECK_MCU(OPT_MCU_SAMG)
105-
#define TUP_DCD_ENDPOINT_MAX 6
105+
#define TUP_DCD_ENDPOINT_MAX 6
106106
#define TUP_DCD_ENDPOINT_EXCLUSIVE_NUMBER
107107

108108
#elif TU_CHECK_MCU(OPT_MCU_SAMX7X)
109-
#define TUP_DCD_ENDPOINT_MAX 10
110-
#define TUP_RHPORT_HIGHSPEED 0x01
109+
#define TUP_DCD_ENDPOINT_MAX 10
110+
#define TUP_RHPORT_HIGHSPEED 0x01
111111
#define TUP_DCD_ENDPOINT_EXCLUSIVE_NUMBER
112112

113113
#elif TU_CHECK_MCU(OPT_MCU_PIC32MZ)
114-
#define TUP_DCD_ENDPOINT_MAX 8
114+
#define TUP_DCD_ENDPOINT_MAX 8
115115
#define TUP_DCD_ENDPOINT_EXCLUSIVE_NUMBER
116116

117117
//------------- ST -------------//
118118
#elif TU_CHECK_MCU(OPT_MCU_STM32F0)
119-
#define TUP_DCD_ENDPOINT_MAX 8
119+
#define TUP_DCD_ENDPOINT_MAX 8
120120

121121
#elif TU_CHECK_MCU(OPT_MCU_STM32F1)
122122
#if defined (STM32F105x8) || defined (STM32F105xB) || defined (STM32F105xC) || \
123123
defined (STM32F107xB) || defined (STM32F107xC)
124124
#define TUP_USBIP_DWC2
125125
#define TUP_USBIP_DWC2_STM32
126126

127-
#define TUP_DCD_ENDPOINT_MAX 4
127+
#define TUP_DCD_ENDPOINT_MAX 4
128128
#else
129-
#define TUP_DCD_ENDPOINT_MAX 8
129+
#define TUP_DCD_ENDPOINT_MAX 8
130130
#endif
131131

132132
#elif TU_CHECK_MCU(OPT_MCU_STM32F2)
133133
#define TUP_USBIP_DWC2
134134
#define TUP_USBIP_DWC2_STM32
135135

136136
// FS has 4 ep, HS has 5 ep
137-
#define TUP_DCD_ENDPOINT_MAX 6
137+
#define TUP_DCD_ENDPOINT_MAX 6
138138

139139
#elif TU_CHECK_MCU(OPT_MCU_STM32F3)
140-
#define TUP_DCD_ENDPOINT_MAX 8
140+
#define TUP_DCD_ENDPOINT_MAX 8
141141

142142
#elif TU_CHECK_MCU(OPT_MCU_STM32F4)
143143
#define TUP_USBIP_DWC2
144144
#define TUP_USBIP_DWC2_STM32
145145

146146
// For most mcu, FS has 4, HS has 6. TODO 446/469/479 HS has 9
147-
#define TUP_DCD_ENDPOINT_MAX 6
147+
#define TUP_DCD_ENDPOINT_MAX 6
148148

149149
#elif TU_CHECK_MCU(OPT_MCU_STM32F7)
150150
#define TUP_USBIP_DWC2
151151
#define TUP_USBIP_DWC2_STM32
152152

153153
// FS has 6, HS has 9
154-
#define TUP_DCD_ENDPOINT_MAX 9
154+
#define TUP_DCD_ENDPOINT_MAX 9
155155

156156
#elif TU_CHECK_MCU(OPT_MCU_STM32H7)
157157
#define TUP_USBIP_DWC2
158158
#define TUP_USBIP_DWC2_STM32
159159

160-
#define TUP_DCD_ENDPOINT_MAX 9
160+
#define TUP_DCD_ENDPOINT_MAX 9
161161

162162
#elif TU_CHECK_MCU(OPT_MCU_STM32G4)
163-
#define TUP_DCD_ENDPOINT_MAX 8
163+
#define TUP_DCD_ENDPOINT_MAX 8
164164

165165
#elif TU_CHECK_MCU(OPT_MCU_STM32L0, OPT_MCU_STM32L1)
166-
#define TUP_DCD_ENDPOINT_MAX 8
166+
#define TUP_DCD_ENDPOINT_MAX 8
167167

168168
#elif TU_CHECK_MCU(OPT_MCU_STM32L4)
169169
#if defined (STM32L475xx) || defined (STM32L476xx) || \
@@ -174,84 +174,89 @@
174174
#define TUP_USBIP_DWC2
175175
#define TUP_USBIP_DWC2_STM32
176176

177-
#define TUP_DCD_ENDPOINT_MAX 6
177+
#define TUP_DCD_ENDPOINT_MAX 6
178178
#else
179-
#define TUP_DCD_ENDPOINT_MAX 8
179+
#define TUP_DCD_ENDPOINT_MAX 8
180180
#endif
181181

182182
//------------- Sony -------------//
183183
#elif TU_CHECK_MCU(OPT_MCU_CXD56)
184-
#define TUP_DCD_ENDPOINT_MAX 7
185-
#define TUP_RHPORT_HIGHSPEED 0x01
184+
#define TUP_DCD_ENDPOINT_MAX 7
185+
#define TUP_RHPORT_HIGHSPEED 0x01
186186
#define TUP_DCD_ENDPOINT_EXCLUSIVE_NUMBER
187187

188188
//------------- TI -------------//
189189
#elif TU_CHECK_MCU(OPT_MCU_MSP430x5xx)
190-
#define TUP_DCD_ENDPOINT_MAX 8
190+
#define TUP_DCD_ENDPOINT_MAX 8
191191

192192
#elif TU_CHECK_MCU(OPT_MCU_MSP432E4, OPT_MCU_TM4C123, OPT_MCU_TM4C129)
193-
#define TUP_DCD_ENDPOINT_MAX 8
193+
#define TUP_DCD_ENDPOINT_MAX 8
194194

195195
//------------- ValentyUSB -------------//
196196
#elif TU_CHECK_MCU(OPT_MCU_VALENTYUSB_EPTRI)
197-
#define TUP_DCD_ENDPOINT_MAX 16
197+
#define TUP_DCD_ENDPOINT_MAX 16
198198

199199
//------------- Nuvoton -------------//
200200
#elif TU_CHECK_MCU(OPT_MCU_NUC121, OPT_MCU_NUC126)
201-
#define TUP_DCD_ENDPOINT_MAX 8
201+
#define TUP_DCD_ENDPOINT_MAX 8
202202

203203
#elif TU_CHECK_MCU(OPT_MCU_NUC120)
204-
#define TUP_DCD_ENDPOINT_MAX 6
204+
#define TUP_DCD_ENDPOINT_MAX 6
205205

206206
#elif TU_CHECK_MCU(OPT_MCU_NUC505)
207-
#define TUP_DCD_ENDPOINT_MAX 12
208-
#define TUP_RHPORT_HIGHSPEED 0x01
207+
#define TUP_DCD_ENDPOINT_MAX 12
208+
#define TUP_RHPORT_HIGHSPEED 0x01
209209

210210
//------------- Espressif -------------//
211211
#elif TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
212-
#define TUP_DCD_ENDPOINT_MAX 6
212+
#define TUP_USBIP_DWC2
213+
#define TUP_DCD_ENDPOINT_MAX 6
213214

214215
//------------- Dialog -------------//
215216
#elif TU_CHECK_MCU(OPT_MCU_DA1469X)
216-
#define TUP_DCD_ENDPOINT_MAX 4
217+
#define TUP_DCD_ENDPOINT_MAX 4
217218

218219
//------------- Raspberry Pi -------------//
219220
#elif TU_CHECK_MCU(OPT_MCU_RP2040)
220-
#define TUP_DCD_ENDPOINT_MAX 16
221+
#define TUP_DCD_ENDPOINT_MAX 16
221222

222223
//------------- Silabs -------------//
223224
#elif TU_CHECK_MCU(OPT_MCU_EFM32GG)
224-
#define TUP_DCD_ENDPOINT_MAX 7
225+
#define TUP_USBIP_DWC2
226+
#define TUP_DCD_ENDPOINT_MAX 7
225227

226228
//------------- Renesas -------------//
227229
#elif TU_CHECK_MCU(OPT_MCU_RX63X, OPT_MCU_RX65X, OPT_MCU_RX72N)
228-
#define TUP_DCD_ENDPOINT_MAX 10
230+
#define TUP_DCD_ENDPOINT_MAX 10
229231

230232
//------------- GigaDevice -------------//
231233
#elif TU_CHECK_MCU(OPT_MCU_GD32VF103)
232-
#define TUP_DCD_ENDPOINT_MAX 4
234+
#define TUP_USBIP_DWC2
235+
#define TUP_DCD_ENDPOINT_MAX 4
233236

234237
//------------- Broadcom -------------//
235238
#elif TU_CHECK_MCU(OPT_MCU_BCM2711, OPT_MCU_BCM2835, OPT_MCU_BCM2837)
236-
#define TUP_DCD_ENDPOINT_MAX 8
237-
#define TUP_RHPORT_HIGHSPEED 0x01
239+
#define TUP_USBIP_DWC2
240+
#define TUP_DCD_ENDPOINT_MAX 8
241+
#define TUP_RHPORT_HIGHSPEED 0x01
238242

239243
//------------- Broadcom -------------//
240244
#elif TU_CHECK_MCU(OPT_MCU_XMC4000)
241-
#define TUP_DCD_ENDPOINT_MAX 8
245+
#define TUP_USBIP_DWC2
246+
#define TUP_DCD_ENDPOINT_MAX 8
242247

243248
//------------- BridgeTek -------------//
244249
#elif TU_CHECK_MCU(OPT_MCU_FT90X)
245-
#define TUP_DCD_ENDPOINT_MAX 8
246-
#define TUP_RHPORT_HIGHSPEED 0x01
250+
#define TUP_DCD_ENDPOINT_MAX 8
251+
#define TUP_RHPORT_HIGHSPEED 0x01
247252

248253
#elif TU_CHECK_MCU(OPT_MCU_FT93X)
249-
#define TUP_DCD_ENDPOINT_MAX 16
250-
#define TUP_RHPORT_HIGHSPEED 0x01
254+
#define TUP_DCD_ENDPOINT_MAX 16
255+
#define TUP_RHPORT_HIGHSPEED 0x01
251256

252257
//------------ Allwinner -------------//
253258
#elif TU_CHECK_MCU(OPT_MCU_F1C100S)
254-
#define TUP_DCD_ENDPOINT_MAX 4
259+
#define TUP_DCD_ENDPOINT_MAX 4
255260

256261
#endif
257262

@@ -261,12 +266,12 @@
261266

262267
#ifndef TUP_DCD_ENDPOINT_MAX
263268
#warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
264-
#define TUP_DCD_ENDPOINT_MAX 8
269+
#define TUP_DCD_ENDPOINT_MAX 8
265270
#endif
266271

267272
// Default to fullspeed if not defined
268273
#ifndef TUP_RHPORT_HIGHSPEED
269-
#define TUP_RHPORT_HIGHSPEED 0x00
274+
#define TUP_RHPORT_HIGHSPEED 0x00
270275
#endif
271276

272277
#endif

src/portable/synopsys/dwc2/dcd_dwc2.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@
2929

3030
#include "tusb_option.h"
3131

32-
#if CFG_TUD_ENABLED && \
33-
( defined(TUP_USBIP_DWC2) || \
34-
TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_GD32VF103) || \
35-
TU_CHECK_MCU(OPT_MCU_EFM32GG, OPT_MCU_BCM2711, OPT_MCU_BCM2835) || \
36-
TU_CHECK_MCU(OPT_MCU_BCM2837, OPT_MCU_XMC4000) )
32+
#if CFG_TUD_ENABLED && defined(TUP_USBIP_DWC2)
3733

3834
#include "device/dcd.h"
3935
#include "dwc2_type.h"

0 commit comments

Comments
 (0)