forked from auracaster/openocd
target/arm_adi_v5: introduce adiv5_jim_configure_ext()
Allow direct pointer to struct adiv5_private_config for targets with adiv5_private_config inside of a bigger private config container. Use it instead of the private_config pointer toggling hack in aarch64.c Allow optional use of -dap parameter and use it instead of the static variable hack in xtensa_chip.c Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I7260c79332940adfa49d57b45cae39325cdaf432 Reviewed-on: https://review.openocd.org/c/openocd/+/8138 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
348b79aafe
commit
263dbc1472
@@ -2424,23 +2424,26 @@ err_no_param:
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
||||
int adiv5_jim_configure(struct target *target, struct jim_getopt_info *goi)
|
||||
int adiv5_jim_configure_ext(struct target *target, struct jim_getopt_info *goi,
|
||||
struct adiv5_private_config *pc, enum adiv5_configure_dap_optional optional)
|
||||
{
|
||||
struct adiv5_private_config *pc;
|
||||
int e;
|
||||
|
||||
pc = (struct adiv5_private_config *)target->private_config;
|
||||
if (!pc) {
|
||||
pc = calloc(1, sizeof(struct adiv5_private_config));
|
||||
pc = (struct adiv5_private_config *)target->private_config;
|
||||
if (!pc) {
|
||||
LOG_ERROR("Out of memory");
|
||||
return JIM_ERR;
|
||||
pc = calloc(1, sizeof(struct adiv5_private_config));
|
||||
if (!pc) {
|
||||
LOG_ERROR("Out of memory");
|
||||
return JIM_ERR;
|
||||
}
|
||||
pc->ap_num = DP_APSEL_INVALID;
|
||||
target->private_config = pc;
|
||||
}
|
||||
pc->ap_num = DP_APSEL_INVALID;
|
||||
target->private_config = pc;
|
||||
}
|
||||
|
||||
target->has_dap = true;
|
||||
if (optional == ADI_CONFIGURE_DAP_COMPULSORY)
|
||||
target->has_dap = true;
|
||||
|
||||
e = adiv5_jim_spot_configure(goi, &pc->dap, &pc->ap_num, NULL);
|
||||
if (e != JIM_OK)
|
||||
@@ -2455,11 +2458,17 @@ int adiv5_jim_configure(struct target *target, struct jim_getopt_info *goi)
|
||||
}
|
||||
target->tap = pc->dap->tap;
|
||||
target->dap_configured = true;
|
||||
target->has_dap = true;
|
||||
}
|
||||
|
||||
return JIM_OK;
|
||||
}
|
||||
|
||||
int adiv5_jim_configure(struct target *target, struct jim_getopt_info *goi)
|
||||
{
|
||||
return adiv5_jim_configure_ext(target, goi, NULL, ADI_CONFIGURE_DAP_COMPULSORY);
|
||||
}
|
||||
|
||||
int adiv5_verify_config(struct adiv5_private_config *pc)
|
||||
{
|
||||
if (!pc)
|
||||
|
||||
Reference in New Issue
Block a user