openocd/src/jtag
Adrian Negreanu fed42ccfd3 cmsis-dap: don't update the packet size across backends.
The hidapi cmsis-dap backend is using a packet_size of
64+1: 64 is the bMaxPacketSize0 and 1 is the hid Report-Id.

In hidapi::hid_write(), the packet_size is decremented by 1 and
stored for the next transfer.
The packet_size is now valid bMaxPacketSize0=64,
so when hid_read() is called, libusb_bulk_transfer() finishes w/o timeout.

For the libusb bulk backend, the same packet_size of 64+1 is used,
but there's no hid_write() to decrement and store it for the next read.

So the next time a read is done, it will try to read 64+1 bytes.

Fix this by putting the packet logic within each backend.
Use calloc() to allocate the struct cmsis_dap to be on safer side.

Change-Id: I0c450adbc7674d5fcd8208dd23062d5cdd209efd
Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/5920
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-04-10 20:51:30 +01:00
..
aice openocd: drop dependency from libusb0 2021-04-05 23:25:34 +01:00
drivers cmsis-dap: don't update the packet size across backends. 2021-04-10 20:51:30 +01:00
hla stlink: support of ST-LINK TCP server using stlink-dap and hla 2021-03-10 21:29:06 +00:00
adapter.c jtag: remove minidriver code and minidriver-dummy 2021-03-19 21:56:06 +00:00
commands.c Fix debug prints when loading to flash 2020-09-05 16:48:08 +01:00
commands.h jtag: make cmd_queue_scan_field_clone public 2018-10-16 11:58:17 +01:00
core.c jtag: remove minidriver code and minidriver-dummy 2021-03-19 21:56:06 +00:00
driver.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
interface.c coding style: prototype of functions with no parameters 2020-05-09 14:39:59 +01:00
interface.h armv7m_trace: get rid of the old tpiu code 2021-03-10 21:34:04 +00:00
interfaces.c jtag: remove minidriver code and minidriver-dummy 2021-03-19 21:56:06 +00:00
interfaces.h jtag: remove unused function adapter_driver_modules_load() 2020-05-02 15:41:21 +01:00
jtag.h jtag: remove minidriver code and minidriver-dummy 2021-03-19 21:56:06 +00:00
Makefile.am jtag: remove minidriver code and minidriver-dummy 2021-03-19 21:56:06 +00:00
minidriver.h jtag: remove minidriver code and minidriver-dummy 2021-03-19 21:56:06 +00:00
startup.tcl zy1000: drop the code, deprecated in v0.10.0 2021-03-19 21:55:50 +00:00
swd.h swd: get rid of jtag queue to assert/deassert srst 2020-01-14 11:15:12 +00:00
swim.c swim: add new transport 2020-05-24 21:32:05 +01:00
swim.h swim: fix adapter speed handling 2020-05-24 21:31:21 +01:00
tcl.c jtag/tcl: fix memory leak in error return 2020-11-04 17:35:25 +00:00
tcl.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00