From a4ee80edfec53208b2b03cf619ac97d8b86228bb Mon Sep 17 00:00:00 2001 From: dragonmux Date: Wed, 27 Jul 2022 11:39:22 +0100 Subject: [PATCH] jtag_scan: Cleaned up and reworked jtag_dev_shift_dr() --- src/target/jtag_scan.c | 13 +++++++------ src/target/jtag_scan.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/target/jtag_scan.c b/src/target/jtag_scan.c index c93e4e6d..4f46f8f2 100644 --- a/src/target/jtag_scan.c +++ b/src/target/jtag_scan.c @@ -250,15 +250,16 @@ void jtag_dev_write_ir(jtag_proc_t *jp, const uint8_t jd_index, const uint32_t i jtagtap_return_idle(1); } -void jtag_dev_shift_dr(jtag_proc_t *jp, uint8_t jd_index, uint8_t *dout, const uint8_t *din, int ticks) +void jtag_dev_shift_dr( + jtag_proc_t *jp, const uint8_t jd_index, uint8_t *dout, const uint8_t *din, const size_t clock_cycles) { jtag_dev_t *d = &jtag_devs[jd_index]; jtagtap_shift_dr(); - jp->jtagtap_tdi_seq(0, ones, d->dr_prescan); - if(dout) - jp->jtagtap_tdi_tdo_seq((void*)dout, d->dr_postscan?0:1, (void*)din, ticks); + jp->jtagtap_tdi_seq(false, ones, d->dr_prescan); + if (dout) + jp->jtagtap_tdi_tdo_seq((uint8_t *)dout, !d->dr_postscan, (const uint8_t *)din, clock_cycles); else - jp->jtagtap_tdi_seq(d->dr_postscan?0:1, (void*)din, ticks); - jp->jtagtap_tdi_seq(1, ones, d->dr_postscan); + jp->jtagtap_tdi_seq(!d->dr_postscan, (const uint8_t *)din, clock_cycles); + jp->jtagtap_tdi_seq(true, ones, d->dr_postscan); jtagtap_return_idle(1); } diff --git a/src/target/jtag_scan.h b/src/target/jtag_scan.h index d820036d..21abf21e 100644 --- a/src/target/jtag_scan.h +++ b/src/target/jtag_scan.h @@ -45,7 +45,7 @@ extern struct jtag_dev_s jtag_devs[JTAG_MAX_DEVS + 1]; extern uint32_t jtag_dev_count; void jtag_dev_write_ir(jtag_proc_t *jp, uint8_t jd_index, uint32_t ir); -void jtag_dev_shift_dr(jtag_proc_t *jp, uint8_t jd_index, uint8_t *dout, const uint8_t *din, int ticks); +void jtag_dev_shift_dr(jtag_proc_t *jp, uint8_t jd_index, uint8_t *dout, const uint8_t *din, size_t ticks); void jtag_add_device(uint32_t dev_index, const jtag_dev_t *jtag_dev); #endif /*__JTAG_SCAN_H*/