mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 16:13:05 -04:00
USB mass storage writes ran at 0.03 MB/s in the firmware - to the NAND and to the SD card alike - while the bootloader, with the same driver, wrote the same NAND at 2 MB/s. The firmware adds a HID interface, and without it writes ran at full speed. The UDC's endpoints come in groups of three - bulk OUT, bulk IN, interrupt IN: 1-3, 4-6 and so on - and allocation handed out the first free endpoint of each type, so HID's interrupt endpoint 3 landed in the group of mass storage's bulk endpoints 1 and 2. The host polls it every 16 ms, the idle endpoint NAKs, and each poll costs the group's bulk traffic: writes advanced about one packet per poll. Polled every 125 us instead, they all but stopped; moved to endpoint 6, in a group of its own, they ran at 2.36 MB/s, as without HID. Never give an interrupt endpoint a group with bulk endpoints in use, or the other way round, whichever class asks first. Since which endpoints are available then depends on what is already allocated, the driver tracks the allocation itself - option 2 of usb_drv.h, as usb-designware does - with its context in usb-rk27xx.h, which usb_core.c includes before usb_drv.h. HID keeps working. Tested on a generic rk2705 with ums_stress.py over USB mass storage to the SD card: 0.03 MB/s with HID on endpoint 3, 2.36 MB/s with it on endpoint 6 - the allocation this change produces for mass storage plus HID. (Measured with the driver's earlier allocator, before the USB core took allocation over; this carries the same rule into the new scheme.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Change-Id: Ib80ed206a3705f2c76fc8457b5c0a54d60a46402 |
||
|---|---|---|
| .. | ||
| iap | ||
| usb_audio.c | ||
| usb_audio.h | ||
| usb_audio_def.h | ||
| usb_charging_only.c | ||
| usb_charging_only.h | ||
| usb_class_driver.h | ||
| usb_core.c | ||
| usb_hid.c | ||
| usb_hid.h | ||
| usb_hid_def.h | ||
| usb_hid_usage_tables.h | ||
| usb_iap.c | ||
| usb_iap.h | ||
| usb_serial.c | ||
| usb_serial.h | ||
| usb_storage.c | ||
| usb_storage.h | ||