25
25
#define CONFIG_USB_ALIGN_SIZE 4
26
26
#endif
27
27
28
+ // #define CONFIG_USB_DCACHE_ENABLE
29
+
28
30
/* attribute data into no cache ram */
29
31
#define USB_NOCACHE_RAM_SECTION
30
32
33
+ /* use usb_memcpy default for high performance but cost more flash memory.
34
+ * And, arm libc has a bug that memcpy() may cause data misalignment when the size is not a multiple of 4.
35
+ */
36
+ // #define CONFIG_USB_MEMCPY_DISABLE
37
+
31
38
/* ================= USB Device Stack Configuration ================ */
32
39
33
40
/* Ep0 in and out transfer buffer */
49
56
/* Enable test mode */
50
57
// #define CONFIG_USBDEV_TEST_MODE
51
58
59
+ /* enable advance desc register api */
60
+ #define CONFIG_USBDEV_ADVANCE_DESC
61
+
52
62
/* move ep0 setup handler from isr to thread */
53
63
// #define CONFIG_USBDEV_EP0_THREAD
54
64
84
94
// #define CONFIG_USBDEV_MSC_POLLING
85
95
86
96
/* move msc read & write from isr to thread */
87
- // #define CONFIG_USBDEV_MSC_THREAD
97
+ #define CONFIG_USBDEV_MSC_THREAD
88
98
89
99
#ifndef CONFIG_USBDEV_MSC_PRIO
90
100
#define CONFIG_USBDEV_MSC_PRIO 4
94
104
#define CONFIG_USBDEV_MSC_STACKSIZE 2048
95
105
#endif
96
106
107
+ #ifndef CONFIG_USBDEV_MTP_MAX_BUFSIZE
108
+ #define CONFIG_USBDEV_MTP_MAX_BUFSIZE 2048
109
+ #endif
110
+
111
+ #ifndef CONFIG_USBDEV_MTP_MAX_OBJECTS
112
+ #define CONFIG_USBDEV_MTP_MAX_OBJECTS 256
113
+ #endif
114
+
115
+ #ifndef CONFIG_USBDEV_MTP_MAX_PATHNAME
116
+ #define CONFIG_USBDEV_MTP_MAX_PATHNAME 256
117
+ #endif
118
+
119
+ #define CONFIG_USBDEV_MTP_THREAD
120
+
121
+ #ifndef CONFIG_USBDEV_MTP_PRIO
122
+ #define CONFIG_USBDEV_MTP_PRIO 4
123
+ #endif
124
+
125
+ #ifndef CONFIG_USBDEV_MTP_STACKSIZE
126
+ #define CONFIG_USBDEV_MTP_STACKSIZE 4096
127
+ #endif
128
+
97
129
#ifndef CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE
98
130
#define CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE 156
99
131
#endif
112
144
#endif
113
145
114
146
#define CONFIG_USBDEV_RNDIS_USING_LWIP
147
+ #define CONFIG_USBDEV_CDC_ECM_USING_LWIP
115
148
116
149
/* ================ USB HOST Stack Configuration ================== */
117
150
137
170
#define CONFIG_USBHOST_PSC_STACKSIZE 2048
138
171
#endif
139
172
140
- // #define CONFIG_USBHOST_GET_STRING_DESC
173
+ //#define CONFIG_USBHOST_GET_STRING_DESC
141
174
142
175
// #define CONFIG_USBHOST_MSOS_ENABLE
143
176
#ifndef CONFIG_USBHOST_MSOS_VENDOR_CODE
236
269
237
270
#define CONFIG_USB_DWC2_DMA_ENABLE
238
271
239
- #elif CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32P4
272
+ #elif CONFIG_IDF_TARGET_ESP32P4
273
+ #define ESP_USBD_BASE 0x50000000UL
274
+
275
+ #define CONFIG_USBDEV_MAX_BUS 1
276
+ #define CONFIG_USBDEV_EP_NUM 7 // 16
277
+
278
+ /* ---------------- DWC2 Configuration ---------------- */
279
+ //esp32s2/s3 can support up to 5 IN endpoints(include ep0) at the same time
280
+ #define CONFIG_USB_DWC2_RXALL_FIFO_SIZE (1024 / 4)
281
+ #define CONFIG_USB_DWC2_TX0_FIFO_SIZE (64 / 4)
282
+ #define CONFIG_USB_DWC2_TX1_FIFO_SIZE (512 / 4)
283
+ #define CONFIG_USB_DWC2_TX2_FIFO_SIZE (512 / 4)
284
+ #define CONFIG_USB_DWC2_TX3_FIFO_SIZE (512 / 4)
285
+ #define CONFIG_USB_DWC2_TX4_FIFO_SIZE (512 / 4)
286
+ #define CONFIG_USB_DWC2_TX5_FIFO_SIZE (64 / 4)
287
+ #define CONFIG_USB_DWC2_TX6_FIFO_SIZE (64 / 4)
288
+ #define CONFIG_USB_DWC2_TX7_FIFO_SIZE (0 / 4)
289
+ #define CONFIG_USB_DWC2_TX8_FIFO_SIZE (0 / 4)
290
+
291
+ #define CONFIG_USB_DWC2_DMA_ENABLE
240
292
#define CONFIG_USB_HS
241
- #define ESP_USBD_BASE 0x60080000
242
- // todo: check c5, p4 in later
243
- #define CONFIG_USBDEV_EP_NUM 7
244
293
#else
245
294
#error "Unsupported SoC"
246
295
#endif
265
314
*/
266
315
#define CONFIG_USB_DWC2_RX_FIFO_SIZE ((200 - CONFIG_USB_DWC2_NPTX_FIFO_SIZE - CONFIG_USB_DWC2_PTX_FIFO_SIZE))
267
316
268
- #elif CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32P4
269
- // todo: check c5, p4 in later
270
- #define ESP_USBH_BASE 0x60080000
271
- #define CONFIG_USBHOST_PIPE_NUM 8
317
+ #elif CONFIG_IDF_TARGET_ESP32P4
318
+ #define ESP_USBH_BASE 0x50000000UL
319
+
320
+ #define CONFIG_USBHOST_MAX_BUS 1
321
+ #define CONFIG_USBHOST_PIPE_NUM 16
322
+
323
+ /* ---------------- DWC2 Configuration ---------------- */
324
+ /* largest non-periodic USB packet used / 4 */
325
+ #define CONFIG_USB_DWC2_NPTX_FIFO_SIZE (512 / 4)
326
+ /* largest periodic USB packet used / 4 */
327
+ #define CONFIG_USB_DWC2_PTX_FIFO_SIZE (512 / 4)
328
+ /*
329
+ * (largest USB packet used / 4) + 1 for status information + 1 transfer complete +
330
+ * 1 location each for Bulk/Control endpoint for handling NAK/NYET scenario
331
+ */
332
+ #define CONFIG_USB_DWC2_RX_FIFO_SIZE ((896 - CONFIG_USB_DWC2_NPTX_FIFO_SIZE - CONFIG_USB_DWC2_PTX_FIFO_SIZE))
333
+
334
+ #define CONFIG_USB_HS
272
335
#else
273
336
#error "Unsupported SoC"
274
- #endif
275
-
276
- #define CONFIG_USBDEV_ADVANCE_DESC
337
+ #endif
0 commit comments