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>
This commit is contained in:
parent
9d5117a23e
commit
b6ee137206
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue