It's possible for the Windows CDC-ACM driver to ignore the IN endpoint
for long periods of time - multiple frames - if the host application
doesn't consume uart RX data. Boost buffer sizes to compensate.
Also prevent usb_thread from potentially being idle for a tick when
there's work to do.
alongside bit counts. Also, don't return RX data on write commands.
These two changes allow the probe code to return early after
pushing write commands into the FIFO, which improves throughput.
CMSIS-DAP is a complete superset of the Picoprobe protocol, so
now we default to DAPv2 there's no need to keep the downstream
code.
Also make setting up the reset pin conditional and in the correct place.
Limitations:
- Power LED doesn't yet do anything sensible
- The level-shifted SWDIO input isn't utilised by the PIO SM, so only 3.3v I/O
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
OpenOCD is fond of calling PORT_OFF and PORT_SWD_SETUP frequently, which
played havoc with caching both adapter khz and the DAP delay.
Revert to caching just the DAP delay and reset it when PORT_OFF is called.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
- Run out of SRAM, it goes quite a lot faster
- Cache the DAP clock frequency
- Read RDATA and write WDATA all in one go, and merge the turnaround
into the ACK phase. Reduces the number of missed PIO SM cycles during an
SWD transfer
Also fix a compiler warning and demote the loglevel of some debug messages.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
CMSIS-DAP v1 is a pseudo-HID device which allows "driver-less" use on
Windows. DAP v2 is a vendor-specific bulk protocol, so there needs to be
a companion MS OS 2.0 descriptor for the debug interface with
DeviceInterfaceGUID set to the Keil GUID.
Allow for selection between these and the openocd protocol at compile time.
Parts of the v1 implementation are derived from the DapperMime project, so
add credit where due.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
CMSIS-DAP implementations explicitly use CPU bitbash to control SWD and
SWDIO, but we can do better. Transfers are handed off to PIO in phases,
which gets us deterministic clock timing as well as freeing the CPU up
for other tasks.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
This commit fixes a few deadlock scenarios and makes cdc_task more
amenable to being called in a threadable context. Full-duplex is now
reliable at fast and slow baudrates.
There is still an annoyance where if the CDC interface is deactivated
while the UART RX is still active, buffers queued to the endpoint
hardware aren't flushed. This is a tinyUSB interface bug.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>