jtag/drivers/cmsis_dap: improve USB packets filling
commit40bac8e8c4e556faaf9c8adc1a030dbc52080fdb
authorTomas Vanek <vanekt@fbl.cz>
Sat, 19 Nov 2022 06:21:10 +0000 (19 07:21 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 15 Jan 2023 15:09:07 +0000 (15 15:09 +0000)
treeb671277a9e21c7ca8ff0ca8a9f0c9ba8a7d0ee15
parent3d3d35c9b87243a14b37478f1120c4c8d0a6d0bb
jtag/drivers/cmsis_dap: improve USB packets filling

DAP write transaction occupies 5 bytes of a command packet.
DAP read transaction needs just one byte in a command packet
and expect 4 bytes in a response.

The fixed maximal number of transactions in a packet caused
packet filling less than optimal.

Compute both command and expected response sizes based on
read or write direction of each transaction.
Run the queue if one of sizes does not fit into a packet.

The change increases the speed of the mostly read transfer
from 36 KiB/s to almost 40 KiB/s @ USB FS, adapter speed 1000
due to reduction of adapter inserted RDBUFF reads.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ib70812600eaae0403b8ee8673b6f897348496569
Reviewed-on: https://review.openocd.org/c/openocd/+/7364
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/jtag/drivers/cmsis_dap.c
src/jtag/drivers/cmsis_dap.h