aboutsummaryrefslogtreecommitdiff
path: root/src/lmi.c
diff options
context:
space:
mode:
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;