target/arm_cti: use adiv5_jim_mem_ap_spot_configure()

To avoid code duplication, reorganize the code to replace
cti_configure() with adiv5_jim_mem_ap_spot_configure().

Reorganize 'struct arm_cti_object' and its sub-'struct arm_cti'
moving DAP and mem-AP info in a 'struct adiv5_mem_ap_spot'.
Replace cti_configure() with adiv5_jim_mem_ap_spot_configure().
Deprecate the use of '-ctibase' in favor of '-baseaddr'.

Change-Id: I43740a37c80de67c0f5e4dc79c3400b91a12e9e8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5869
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2020-10-17 16:27:13 +02:00
parent 080fab2ecd
commit ec0c23a3ab
3 changed files with 48 additions and 102 deletions

View File

@@ -1481,12 +1481,14 @@ enum adiv5_cfg_param {
CFG_DAP,
CFG_AP_NUM,
CFG_BASEADDR,
CFG_CTIBASE, /* DEPRECATED */
};
static const Jim_Nvp nvp_config_opts[] = {
{ .name = "-dap", .value = CFG_DAP },
{ .name = "-ap-num", .value = CFG_AP_NUM },
{ .name = "-baseaddr", .value = CFG_BASEADDR },
{ .name = "-ctibase", .value = CFG_CTIBASE }, /* DEPRECATED */
{ .name = NULL, .value = -1 }
};
@@ -1505,7 +1507,7 @@ static int adiv5_jim_spot_configure(Jim_GetOptInfo *goi,
return JIM_CONTINUE;
/* base_p can be NULL, then '-baseaddr' option is treated as unknown */
if (!base_p && n->value == CFG_BASEADDR)
if (!base_p && (n->value == CFG_BASEADDR || n->value == CFG_CTIBASE))
return JIM_CONTINUE;
e = Jim_GetOpt_Obj(goi, NULL);
@@ -1564,6 +1566,9 @@ static int adiv5_jim_spot_configure(Jim_GetOptInfo *goi,
}
break;
case CFG_CTIBASE:
LOG_WARNING("DEPRECATED! use \'-baseaddr' not \'-ctibase\'");
/* fall through */
case CFG_BASEADDR:
if (goi->isconfigure) {
jim_wide base;