bscan_spi: implement bscan_spi_xfer over the jtagspi proxy

One CS-framed transaction: marker + 32-bit count + MOSI + read-latency
skip + MISO, MSB-first on the wire, matching OpenOCD's jtagspi so the
quartiq proxy bitstreams work unchanged. Half-duplex (tx,txlen,rx,rxlen)
signature, single-device chain.

NOT yet validated on hardware — protocol follows the OpenOCD reference
but has not been confirmed against a live proxy + flash. Validation
(read JEDEC ID on the KCU105) is the next step.
This commit is contained in:
2026-05-23 17:16:19 +02:00
parent ba9372c8b2
commit 0c9cc679f1
2 changed files with 88 additions and 15 deletions

View File

@@ -50,10 +50,14 @@ int bscan_load_bitstream(jtag_core *jc, const fpga_target *t,
int bscan_load_bitstream_file(jtag_core *jc, const fpga_target *t,
const char *path);
/* Transfer `nbytes` of SPI data through the BSCAN proxy (USER1 DR).
* Placeholder: protocol details deferred until an actual proxy
* bitstream is available for testing. */
/* One CS-framed SPI transaction through the BSCAN proxy (USER1 DR):
* clock out `txlen` MOSI bytes (e.g. command + address + write data),
* then read `rxlen` MISO bytes into `rx`. Either length may be 0.
* Bytes are MSB-first on the wire; bit-order juggling is internal.
* Follows the quartiq/OpenOCD jtagspi proxy framing. Single-device
* chain only. Requires a proxy bitstream already loaded (USER1 live). */
int bscan_spi_xfer(jtag_core *jc, const fpga_target *t,
const uint8_t *tx, uint8_t *rx, size_t nbytes);
const uint8_t *tx, size_t txlen,
uint8_t *rx, size_t rxlen);
#endif