adiv6: read ROM Table address size

Required for parsing ADIv6 ROM tables.

Split from change https://review.openocd.org/6077/

Change-Id: I849543b7b4a4455b10bd9fc7da38a37849d71700
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6458
Tested-by: jenkins
This commit is contained in:
Kevin Burke 2021-08-21 23:59:38 +02:00 committed by Antonio Borneo
parent a6e4aabc66
commit 513aba1930
2 changed files with 20 additions and 0 deletions

View File

@ -395,6 +395,9 @@ struct adiv5_dap {
/** Indicates ADI version (5, 6 or 0 for unknown) being used */
unsigned int adi_version;
/* ADIv6 only field indicating ROM Table address size */
unsigned int asize;
};
/**

View File

@ -140,6 +140,23 @@ static int dap_init_all(void)
retval = dap->ops->connect(dap);
if (retval != ERROR_OK)
return retval;
/* see if address size of ROM Table is greater than 32-bits */
if (is_adiv6(dap)) {
uint32_t dpidr1;
retval = dap->ops->queue_dp_read(dap, DP_DPIDR1, &dpidr1);
if (retval != ERROR_OK) {
LOG_ERROR("DAP read of DPIDR1 failed...");
return retval;
}
retval = dap_run(dap);
if (retval != ERROR_OK) {
LOG_ERROR("DAP read of DPIDR1 failed...");
return retval;
}
dap->asize = dpidr1 & DP_DPIDR1_ASIZE_MASK;
}
}
return ERROR_OK;