|
6 | 6 | #ifndef CHERRYUSB_CONFIG_H |
7 | 7 | #define CHERRYUSB_CONFIG_H |
8 | 8 |
|
9 | | -#include <rtthread.h> |
10 | | - |
11 | 9 | /* ================ USB common Configuration ================ */ |
12 | 10 |
|
| 11 | +#ifdef __RTTHREAD__ |
| 12 | +#include <rtthread.h> |
| 13 | + |
13 | 14 | #define CONFIG_USB_PRINTF(...) rt_kprintf(__VA_ARGS__) |
| 15 | +#else |
| 16 | +#define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__) |
| 17 | +#endif |
14 | 18 |
|
15 | 19 | #ifndef CONFIG_USB_DBG_LEVEL |
16 | 20 | #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO |
|
19 | 23 | /* Enable print with color */ |
20 | 24 | #define CONFIG_USB_PRINTF_COLOR_ENABLE |
21 | 25 |
|
22 | | -/* data align size when use dma */ |
23 | | -#ifndef CONFIG_USB_ALIGN_SIZE |
| 26 | +#define CONFIG_USB_DCACHE_ENABLE |
| 27 | + |
| 28 | +/* data align size when use dma or use dcache */ |
| 29 | +#ifdef CONFIG_USB_DCACHE_ENABLE |
| 30 | +#define CONFIG_USB_ALIGN_SIZE 32 // 32 or 64 |
| 31 | +#else |
24 | 32 | #define CONFIG_USB_ALIGN_SIZE 4 |
25 | 33 | #endif |
26 | 34 |
|
27 | 35 | /* attribute data into no cache ram */ |
28 | 36 | #define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) |
29 | 37 |
|
| 38 | +/* use usb_memcpy default for high performance but cost more flash memory. |
| 39 | + * And, arm libc has a bug that memcpy() may cause data misalignment when the size is not a multiple of 4. |
| 40 | +*/ |
| 41 | +// #define CONFIG_USB_MEMCPY_DISABLE |
| 42 | + |
30 | 43 | /* ================= USB Device Stack Configuration ================ */ |
31 | 44 |
|
32 | 45 | /* Ep0 in and out transfer buffer */ |
|
48 | 61 | /* Enable test mode */ |
49 | 62 | // #define CONFIG_USBDEV_TEST_MODE |
50 | 63 |
|
| 64 | +/* enable advance desc register api */ |
| 65 | +#define CONFIG_USBDEV_ADVANCE_DESC |
| 66 | + |
| 67 | +/* move ep0 setup handler from isr to thread */ |
| 68 | +// #define CONFIG_USBDEV_EP0_THREAD |
| 69 | + |
| 70 | +#ifndef CONFIG_USBDEV_EP0_PRIO |
| 71 | +#define CONFIG_USBDEV_EP0_PRIO 4 |
| 72 | +#endif |
| 73 | + |
| 74 | +#ifndef CONFIG_USBDEV_EP0_STACKSIZE |
| 75 | +#define CONFIG_USBDEV_EP0_STACKSIZE 2048 |
| 76 | +#endif |
| 77 | + |
51 | 78 | #ifndef CONFIG_USBDEV_MSC_MAX_LUN |
52 | 79 | #define CONFIG_USBDEV_MSC_MAX_LUN 1 |
53 | 80 | #endif |
|
82 | 109 | #define CONFIG_USBDEV_MSC_STACKSIZE 2048 |
83 | 110 | #endif |
84 | 111 |
|
| 112 | +#ifndef CONFIG_USBDEV_MTP_MAX_BUFSIZE |
| 113 | +#define CONFIG_USBDEV_MTP_MAX_BUFSIZE 2048 |
| 114 | +#endif |
| 115 | + |
| 116 | +#ifndef CONFIG_USBDEV_MTP_MAX_OBJECTS |
| 117 | +#define CONFIG_USBDEV_MTP_MAX_OBJECTS 256 |
| 118 | +#endif |
| 119 | + |
| 120 | +#ifndef CONFIG_USBDEV_MTP_MAX_PATHNAME |
| 121 | +#define CONFIG_USBDEV_MTP_MAX_PATHNAME 256 |
| 122 | +#endif |
| 123 | + |
| 124 | +#define CONFIG_USBDEV_MTP_THREAD |
| 125 | + |
| 126 | +#ifndef CONFIG_USBDEV_MTP_PRIO |
| 127 | +#define CONFIG_USBDEV_MTP_PRIO 4 |
| 128 | +#endif |
| 129 | + |
| 130 | +#ifndef CONFIG_USBDEV_MTP_STACKSIZE |
| 131 | +#define CONFIG_USBDEV_MTP_STACKSIZE 4096 |
| 132 | +#endif |
| 133 | + |
85 | 134 | #ifndef CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE |
86 | 135 | #define CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE 156 |
87 | 136 | #endif |
|
100 | 149 | #endif |
101 | 150 |
|
102 | 151 | #define CONFIG_USBDEV_RNDIS_USING_LWIP |
| 152 | +#define CONFIG_USBDEV_CDC_ECM_USING_LWIP |
103 | 153 |
|
104 | 154 | /* ================ USB HOST Stack Configuration ================== */ |
105 | 155 |
|
|
210 | 260 | #define CONFIG_USBDEV_EP_NUM 5 |
211 | 261 | #endif |
212 | 262 |
|
| 263 | +// #define CONFIG_USBDEV_SOF_ENABLE |
| 264 | + |
| 265 | +/* When your chip hardware supports high-speed and wants to initialize it in high-speed mode, the relevant IP will configure the internal or external high-speed PHY according to CONFIG_USB_HS. */ |
| 266 | +#define CONFIG_USB_HS |
| 267 | + |
213 | 268 | /* ---------------- FSDEV Configuration ---------------- */ |
214 | 269 | //#define CONFIG_USBDEV_FSDEV_PMA_ACCESS 2 // maybe 1 or 2, many chips may have a difference |
215 | 270 |
|
|
220 | 275 | // #define CONFIG_USB_DWC2_RXALL_FIFO_SIZE (1024 / 4) |
221 | 276 | /* IN Endpoints Max packet Size / 4 */ |
222 | 277 | // #define CONFIG_USB_DWC2_TX0_FIFO_SIZE (64 / 4) |
223 | | -// #define CONFIG_USB_DWC2_TX1_FIFO_SIZE (512 / 4) |
| 278 | +// #define CONFIG_USB_DWC2_TX1_FIFO_SIZE (1024 / 4) |
224 | 279 | // #define CONFIG_USB_DWC2_TX2_FIFO_SIZE (64 / 4) |
225 | 280 | // #define CONFIG_USB_DWC2_TX3_FIFO_SIZE (64 / 4) |
226 | 281 | // #define CONFIG_USB_DWC2_TX4_FIFO_SIZE (0 / 4) |
|
229 | 284 | // #define CONFIG_USB_DWC2_TX7_FIFO_SIZE (0 / 4) |
230 | 285 | // #define CONFIG_USB_DWC2_TX8_FIFO_SIZE (0 / 4) |
231 | 286 |
|
| 287 | +// #define CONFIG_USB_DWC2_DMA_ENABLE |
| 288 | + |
232 | 289 | /* ---------------- MUSB Configuration ---------------- */ |
233 | 290 | // #define CONFIG_USB_MUSB_SUNXI |
234 | 291 |
|
|
246 | 303 | #define CONFIG_USB_EHCI_HCCR_OFFSET (0x0) |
247 | 304 | #define CONFIG_USB_EHCI_FRAME_LIST_SIZE 1024 |
248 | 305 | #define CONFIG_USB_EHCI_QH_NUM CONFIG_USBHOST_PIPE_NUM |
249 | | -#define CONFIG_USB_EHCI_QTD_NUM 3 |
250 | | -#define CONFIG_USB_EHCI_ITD_NUM 20 |
| 306 | +#define CONFIG_USB_EHCI_QTD_NUM (CONFIG_USB_EHCI_QH_NUM * 3) |
| 307 | +#define CONFIG_USB_EHCI_ITD_NUM 4 |
251 | 308 | #define CONFIG_USB_EHCI_HCOR_RESERVED_DISABLE |
252 | 309 | // #define CONFIG_USB_EHCI_CONFIGFLAG |
253 | 310 | // #define CONFIG_USB_EHCI_ISO |
254 | 311 | // #define CONFIG_USB_EHCI_WITH_OHCI |
| 312 | +// #define CONFIG_USB_EHCI_DESC_DCACHE_ENABLE |
255 | 313 |
|
256 | 314 | /* ---------------- OHCI Configuration ---------------- */ |
257 | 315 | #define CONFIG_USB_OHCI_HCOR_OFFSET (0x0) |
| 316 | +#define CONFIG_USB_OHCI_ED_NUM CONFIG_USBHOST_PIPE_NUM |
| 317 | +#define CONFIG_USB_OHCI_TD_NUM 3 |
| 318 | +// #define CONFIG_USB_OHCI_DESC_DCACHE_ENABLE |
258 | 319 |
|
259 | 320 | /* ---------------- XHCI Configuration ---------------- */ |
260 | 321 | #define CONFIG_USB_XHCI_HCCR_OFFSET (0x0) |
|
268 | 329 | * (largest USB packet used / 4) + 1 for status information + 1 transfer complete + |
269 | 330 | * 1 location each for Bulk/Control endpoint for handling NAK/NYET scenario |
270 | 331 | */ |
271 | | -// #define CONFIG_USB_DWC2_RX_FIFO_SIZE ((1012 - CONFIG_USB_DWC2_NPTX_FIFO_SIZE - CONFIG_USB_DWC2_PTX_FIFO_SIZE) / 4) |
| 332 | +// #define CONFIG_USB_DWC2_RX_FIFO_SIZE ((1012 - CONFIG_USB_DWC2_NPTX_FIFO_SIZE - CONFIG_USB_DWC2_PTX_FIFO_SIZE)) |
272 | 333 |
|
273 | 334 | /* ---------------- MUSB Configuration ---------------- */ |
274 | 335 | // #define CONFIG_USB_MUSB_SUNXI |
275 | 336 |
|
| 337 | +#ifndef usb_phyaddr2ramaddr |
| 338 | +#define usb_phyaddr2ramaddr(addr) (addr) |
| 339 | +#endif |
| 340 | + |
| 341 | +#ifndef usb_ramaddr2phyaddr |
| 342 | +#define usb_ramaddr2phyaddr(addr) (addr) |
| 343 | +#endif |
| 344 | + |
276 | 345 | #endif |
0 commit comments