From 5fd4f2954d6673e5b2fd740da681439425794abc Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Tue, 14 Mar 2023 14:31:30 +0100 Subject: [PATCH] target/adi_v5_xxx: use ADIV5_DP_SELECT_APBANK and DP_SELECT_DPBANK. Use the defined symbols instead of magic numbers. Change-Id: I19c86b183e57e42b96f76eed180c0492cd67bee1 Signed-off-by: Tomas Vanek Reviewed-on: https://review.openocd.org/c/openocd/+/7539 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/target/adi_v5_jtag.c | 4 ++-- src/target/adi_v5_swd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c index 9f66adc688..afdc0e5775 100644 --- a/src/target/adi_v5_jtag.c +++ b/src/target/adi_v5_jtag.c @@ -350,7 +350,7 @@ static int adi_jtag_dp_scan_u32(struct adiv5_dap *dap, { uint8_t out_value_buf[4]; int retval; - uint64_t sel = (reg_addr >> 4) & 0xf; + uint64_t sel = (reg_addr >> 4) & DP_SELECT_DPBANK; /* No need to change SELECT or RDBUFF as they are not banked */ if (instr == JTAG_DP_DPACC && reg_addr != DP_SELECT && reg_addr != DP_RDBUFF && @@ -775,7 +775,7 @@ static int jtag_ap_q_bankselect(struct adiv5_ap *ap, unsigned reg) } /* ADIv5 */ - sel = (ap->ap_num << 24) | (reg & 0x000000F0); + sel = (ap->ap_num << 24) | (reg & ADIV5_DP_SELECT_APBANK); if (sel == dap->select) return ERROR_OK; diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c index 5f40588d2f..1b743657c2 100644 --- a/src/target/adi_v5_swd.c +++ b/src/target/adi_v5_swd.c @@ -523,7 +523,7 @@ static int swd_queue_ap_bankselect(struct adiv5_ap *ap, unsigned reg) } /* ADIv5 */ - sel = (ap->ap_num << 24) | (reg & 0x000000F0); + sel = (ap->ap_num << 24) | (reg & ADIV5_DP_SELECT_APBANK); if (dap->select != DP_SELECT_INVALID) sel |= dap->select & DP_SELECT_DPBANK;