diff options
author | Kirill Radkin <kirill.radkin@syntacore.com> | 2023-06-16 12:09:32 +0300 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2024-02-18 18:41:41 +0000 |
commit | b6ee13720688a9860f3397bb89ea171b0fc5ccce (patch) | |
tree | 2c7614d11af1dbe8cebaa98f4f14ffe32b0fab1e | |
parent | 9d5117a23e21fd0eba4662a7068e4e2ffb09b784 (diff) | |
download | riscv-openocd-b6ee13720688a9860f3397bb89ea171b0fc5ccce.zip riscv-openocd-b6ee13720688a9860f3397bb89ea171b0fc5ccce.tar.gz riscv-openocd-b6ee13720688a9860f3397bb89ea171b0fc5ccce.tar.bz2 |
driver: Add additional check for count of BYPASS devices
At least one TAP shouldn't be in BYPASS mode
Change-Id: Ic882acbfc9b6a9f4b0c3bb4741a49f3981503c8c
Signed-off-by: Kirill Radkin <kirill.radkin@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7741
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
-rw-r--r-- | src/jtag/drivers/driver.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/jtag/drivers/driver.c b/src/jtag/drivers/driver.c index fae2aad..e52816d 100644 --- a/src/jtag/drivers/driver.c +++ b/src/jtag/drivers/driver.c @@ -116,12 +116,21 @@ int interface_jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, /* count devices in bypass */ size_t bypass_devices = 0; + size_t all_devices = 0; for (struct jtag_tap *tap = jtag_tap_next_enabled(NULL); tap; tap = jtag_tap_next_enabled(tap)) { + all_devices++; + if (tap->bypass) bypass_devices++; } + if (all_devices == bypass_devices) { + LOG_ERROR("At least one TAP shouldn't be in BYPASS mode"); + + return ERROR_FAIL; + } + struct jtag_command *cmd = cmd_queue_alloc(sizeof(struct jtag_command)); struct scan_command *scan = cmd_queue_alloc(sizeof(struct scan_command)); struct scan_field *out_fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(struct scan_field)); |