Skip to content

Commit

Permalink
target/adi_v5_xxx: use ADIV5_DP_SELECT_APBANK
Browse files Browse the repository at this point in the history
and DP_SELECT_DPBANK.
Use the defined symbols instead of magic numbers.

Change-Id: I19c86b183e57e42b96f76eed180c0492cd67bee1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7539
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
  • Loading branch information
tom-van authored and borneoa committed Sep 23, 2023
1 parent f49bf1a commit 5fd4f29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/target/adi_v5_jtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/target/adi_v5_swd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5fd4f29

Please sign in to comment.