adi_v5: Rename AP_REG_* to MEM_AP_REG_* and add LA support
This is a TODO in the src/target/arm_adi_v5.h for MEM-AP registers. Some new registers are introduced in ADIv5.2 specification. MEM_AP_REG_MGT (0x20) // Memory Barrier Transfer register MEM_AP_REG_TAR64 (0x08) // Bits[63:32] of Transfer Address MEM_AP_REG_BASE64 (0xF0) // Bits[63:32] of Debug Base Address Refer to 7.5 MEM-AP register summary in IHI0031C: ARM Debug Interface Architecture Specification ADIv5.0 to ADIv5.2 Change-Id: I3bc4296a04c35f5c64f851e5865d3099922613fa Signed-off-by: Alamy Liu <alamy.liu@gmail.com> Reviewed-on: http://openocd.zylin.com/2904 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
This commit is contained in:
committed by
Andreas Fritiofson
parent
f1dac60894
commit
4dc012865f
@@ -125,7 +125,7 @@ static int dap_setup_accessport_csw(struct adiv5_dap *dap, uint32_t csw)
|
||||
|
||||
if (csw != dap->ap_csw_value) {
|
||||
/* LOG_DEBUG("DAP: Set CSW %x",csw); */
|
||||
int retval = dap_queue_ap_write(dap, AP_REG_CSW, csw);
|
||||
int retval = dap_queue_ap_write(dap, MEM_AP_REG_CSW, csw);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
dap->ap_csw_value = csw;
|
||||
@@ -137,7 +137,7 @@ static int dap_setup_accessport_tar(struct adiv5_dap *dap, uint32_t tar)
|
||||
{
|
||||
if (tar != dap->ap_tar_value || dap->ap_csw_value & CSW_ADDRINC_MASK) {
|
||||
/* LOG_DEBUG("DAP: Set TAR %x",tar); */
|
||||
int retval = dap_queue_ap_write(dap, AP_REG_TAR, tar);
|
||||
int retval = dap_queue_ap_write(dap, MEM_AP_REG_TAR, tar);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
dap->ap_tar_value = tar;
|
||||
@@ -149,7 +149,7 @@ static int dap_setup_accessport_tar(struct adiv5_dap *dap, uint32_t tar)
|
||||
* Queue transactions setting up transfer parameters for the
|
||||
* currently selected MEM-AP.
|
||||
*
|
||||
* Subsequent transfers using registers like AP_REG_DRW or AP_REG_BD2
|
||||
* Subsequent transfers using registers like MEM_AP_REG_DRW or MEM_AP_REG_BD2
|
||||
* initiate data reads or writes using memory or peripheral addresses.
|
||||
* If the CSW is configured for it, the TAR may be automatically
|
||||
* incremented after each transfer.
|
||||
@@ -200,7 +200,7 @@ int mem_ap_read_u32(struct adiv5_dap *dap, uint32_t address,
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
return dap_queue_ap_read(dap, AP_REG_BD0 | (address & 0xC), value);
|
||||
return dap_queue_ap_read(dap, MEM_AP_REG_BD0 | (address & 0xC), value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,7 +251,7 @@ int mem_ap_write_u32(struct adiv5_dap *dap, uint32_t address,
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
return dap_queue_ap_write(dap, AP_REG_BD0 | (address & 0xC),
|
||||
return dap_queue_ap_write(dap, MEM_AP_REG_BD0 | (address & 0xC),
|
||||
value);
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ int mem_ap_write(struct adiv5_dap *dap, const uint8_t *buffer, uint32_t size, ui
|
||||
|
||||
nbytes -= this_size;
|
||||
|
||||
retval = dap_queue_ap_write(dap, AP_REG_DRW, outvalue);
|
||||
retval = dap_queue_ap_write(dap, MEM_AP_REG_DRW, outvalue);
|
||||
if (retval != ERROR_OK)
|
||||
break;
|
||||
|
||||
@@ -397,7 +397,7 @@ int mem_ap_write(struct adiv5_dap *dap, const uint8_t *buffer, uint32_t size, ui
|
||||
|
||||
if (retval != ERROR_OK) {
|
||||
uint32_t tar;
|
||||
if (dap_queue_ap_read(dap, AP_REG_TAR, &tar) == ERROR_OK
|
||||
if (dap_queue_ap_read(dap, MEM_AP_REG_TAR, &tar) == ERROR_OK
|
||||
&& dap_run(dap) == ERROR_OK)
|
||||
LOG_ERROR("Failed to write memory at 0x%08"PRIx32, tar);
|
||||
else
|
||||
@@ -480,7 +480,7 @@ int mem_ap_read(struct adiv5_dap *dap, uint8_t *buffer, uint32_t size, uint32_t
|
||||
if (retval != ERROR_OK)
|
||||
break;
|
||||
|
||||
retval = dap_queue_ap_read(dap, AP_REG_DRW, read_ptr++);
|
||||
retval = dap_queue_ap_read(dap, MEM_AP_REG_DRW, read_ptr++);
|
||||
if (retval != ERROR_OK)
|
||||
break;
|
||||
|
||||
@@ -507,7 +507,7 @@ int mem_ap_read(struct adiv5_dap *dap, uint8_t *buffer, uint32_t size, uint32_t
|
||||
* at least give the caller what we have. */
|
||||
if (retval != ERROR_OK) {
|
||||
uint32_t tar;
|
||||
if (dap_queue_ap_read(dap, AP_REG_TAR, &tar) == ERROR_OK
|
||||
if (dap_queue_ap_read(dap, MEM_AP_REG_TAR, &tar) == ERROR_OK
|
||||
&& dap_run(dap) == ERROR_OK) {
|
||||
LOG_ERROR("Failed to read memory at 0x%08"PRIx32, tar);
|
||||
if (nbytes > tar - address)
|
||||
@@ -718,11 +718,11 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
|
||||
if (retval != ERROR_OK)
|
||||
continue;
|
||||
|
||||
retval = dap_queue_ap_read(dap, AP_REG_CSW, &csw);
|
||||
retval = dap_queue_ap_read(dap, MEM_AP_REG_CSW, &csw);
|
||||
if (retval != ERROR_OK)
|
||||
continue;
|
||||
|
||||
retval = dap_queue_ap_read(dap, AP_REG_CFG, &cfg);
|
||||
retval = dap_queue_ap_read(dap, MEM_AP_REG_CFG, &cfg);
|
||||
if (retval != ERROR_OK)
|
||||
continue;
|
||||
|
||||
@@ -847,7 +847,7 @@ int dap_get_debugbase(struct adiv5_dap *dap, int ap,
|
||||
ap_old = dap_ap_get_select(dap);
|
||||
dap_ap_select(dap, ap);
|
||||
|
||||
retval = dap_queue_ap_read(dap, AP_REG_BASE, dbgbase);
|
||||
retval = dap_queue_ap_read(dap, MEM_AP_REG_BASE, dbgbase);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
retval = dap_queue_ap_read(dap, AP_REG_IDR, apid);
|
||||
@@ -1499,7 +1499,7 @@ COMMAND_HANDLER(dap_baseaddr_command)
|
||||
* though they're not common for now. This should
|
||||
* use the ID register to verify it's a MEM-AP.
|
||||
*/
|
||||
retval = dap_queue_ap_read(dap, AP_REG_BASE, &baseaddr);
|
||||
retval = dap_queue_ap_read(dap, MEM_AP_REG_BASE, &baseaddr);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
retval = dap_run(dap);
|
||||
|
||||
Reference in New Issue
Block a user