diff options
author | Jiuyang Liu <liu@jiuyang.me> | 2020-09-02 01:32:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 10:32:31 -0700 |
commit | 57b57989b46f7dc0a09b6eba8d894ff5cce80d17 (patch) | |
tree | 6d0bf4eb0d4d1d09a73f3d7a548ea591f520db04 /src/target/riscv/riscv.c | |
parent | 0a63eda7f2e8aa340562990fca5e56667d6ba762 (diff) | |
download | riscv-openocd-57b57989b46f7dc0a09b6eba8d894ff5cce80d17.zip riscv-openocd-57b57989b46f7dc0a09b6eba8d894ff5cce80d17.tar.gz riscv-openocd-57b57989b46f7dc0a09b6eba8d894ff5cce80d17.tar.bz2 |
user4 0x23 should be MSB. (#519)
Signed-off-by: Jiuyang Liu <jiuyang.liu@sifive.com>
Diffstat (limited to 'src/target/riscv/riscv.c')
-rw-r--r-- | src/target/riscv/riscv.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index e99bfb5..f847016 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -178,7 +178,7 @@ int bscan_tunnel_ir_width; /* if zero, then tunneling is not present/active */ uint8_t bscan_zero[4] = {0}; uint8_t bscan_one[4] = {1}; -uint8_t ir_user4[4] = {0x23}; +uint8_t ir_user4[4]; struct scan_field select_user4 = { .in_value = NULL, .out_value = ir_user4 @@ -485,6 +485,12 @@ static int riscv_init_target(struct command_context *cmd_ctx, select_idcode.num_bits = target->tap->ir_length; if (bscan_tunnel_ir_width != 0) { + assert(target->tap->ir_length >= 6); + uint32_t ir_user4_raw = 0x23 << (target->tap->ir_length - 6); + ir_user4[0] = (uint8_t)ir_user4_raw; + ir_user4[1] = (uint8_t)(ir_user4_raw >>= 8); + ir_user4[2] = (uint8_t)(ir_user4_raw >>= 8); + ir_user4[3] = (uint8_t)(ir_user4_raw >>= 8); select_user4.num_bits = target->tap->ir_length; bscan_tunneled_ir_width[0] = bscan_tunnel_ir_width; if (bscan_tunnel_type == BSCAN_TUNNEL_DATA_REGISTER) |