aboutsummaryrefslogtreecommitdiff
path: root/src/lmi.c
diff options
context:
space:
mode:
authorGareth McMullin2015-03-14 18:03:04 -0700
committerGareth McMullin2015-03-14 18:03:04 -0700
commit2e785e56fa4e77549878eac88f2c4891af043e64 (patch)
tree3edffa5f46f577d440f8a10fe989db1bd2537a6b /src/lmi.c
parent6f5b1873d7b986fe7b3bc1f267bae9f7649630a5 (diff)
adiv5: Encode APnDP into register definition.
Clean up magic numbers in adiv5 calls. Removed old adiv5_dp_write_ap and adiv5_dp_read_ap.
Diffstat (limited to 'src/lmi.c')
-rw-r--r--src/lmi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lmi.c b/src/lmi.c
index 0f16db4..9359458 100644
--- a/src/lmi.c
+++ b/src/lmi.c
@@ -131,17 +131,18 @@ int lmi_flash_erase(struct target_s *target, uint32_t addr, size_t len)
adiv5_ap_write(ap, 0x00, 0xA2000052);
/* select Flash Control */
- adiv5_dp_low_access(ap->dp, 1, 0, 0x04, 0x400FD000);
+ adiv5_dp_low_access(ap->dp, ADIV5_LOW_WRITE, 0x04, 0x400FD000);
while(len) {
/* write address to FMA */
- adiv5_ap_write(ap, 0x10, addr); /* Required to switch banks */
+ adiv5_ap_write(ap, ADIV5_AP_DB(0), addr); /* Required to switch banks */
/* set ERASE bit in FMC */
- adiv5_dp_low_access(ap->dp, 1, 0, 0x08, 0xA4420002);
+ adiv5_dp_low_access(ap->dp, ADIV5_LOW_WRITE, ADIV5_AP_DB(2), 0xA4420002);
/* Read FMC to poll for ERASE bit */
- adiv5_dp_low_access(ap->dp, 1, 1, 0x08, 0);
+ adiv5_dp_low_access(ap->dp, ADIV5_LOW_READ, ADIV5_AP_DB(2), 0);
do {
- tmp = adiv5_dp_low_access(ap->dp, 1, 1, 0x08, 0);
+ tmp = adiv5_dp_low_access(ap->dp, ADIV5_LOW_READ,
+ ADIV5_AP_DB(2), 0);
} while (tmp & 2);
len -= 0x400;