forked from auracaster/openocd
target/arm_adi_v5,arm_dap: introduce multidrop_targetsel and its configuration
Add multidrop_targetsel to struct adiv5_dap. Add option -dp-id and -instance-id to dap create command. Add convenience function dap_is_multidrop() Change-Id: Ibb93abb5f50b3665c320a10c1497421035762134 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6140 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
bb78fa10c7
commit
b973a76d86
@@ -155,11 +155,15 @@ int dap_cleanup_all(void)
|
||||
enum dap_cfg_param {
|
||||
CFG_CHAIN_POSITION,
|
||||
CFG_IGNORE_SYSPWRUPACK,
|
||||
CFG_DP_ID,
|
||||
CFG_INSTANCE_ID,
|
||||
};
|
||||
|
||||
static const struct jim_nvp nvp_config_opts[] = {
|
||||
{ .name = "-chain-position", .value = CFG_CHAIN_POSITION },
|
||||
{ .name = "-chain-position", .value = CFG_CHAIN_POSITION },
|
||||
{ .name = "-ignore-syspwrupack", .value = CFG_IGNORE_SYSPWRUPACK },
|
||||
{ .name = "-dp-id", .value = CFG_DP_ID },
|
||||
{ .name = "-instance-id", .value = CFG_INSTANCE_ID },
|
||||
{ .name = NULL, .value = -1 }
|
||||
};
|
||||
|
||||
@@ -197,6 +201,48 @@ static int dap_configure(struct jim_getopt_info *goi, struct arm_dap_object *dap
|
||||
case CFG_IGNORE_SYSPWRUPACK:
|
||||
dap->dap.ignore_syspwrupack = true;
|
||||
break;
|
||||
case CFG_DP_ID: {
|
||||
jim_wide w;
|
||||
e = jim_getopt_wide(goi, &w);
|
||||
if (e != JIM_OK) {
|
||||
Jim_SetResultFormatted(goi->interp,
|
||||
"create %s: bad parameter %s",
|
||||
dap->name, n->name);
|
||||
return JIM_ERR;
|
||||
}
|
||||
if (w < 0 || w > DP_TARGETSEL_DPID_MASK) {
|
||||
Jim_SetResultFormatted(goi->interp,
|
||||
"create %s: %s out of range",
|
||||
dap->name, n->name);
|
||||
return JIM_ERR;
|
||||
}
|
||||
dap->dap.multidrop_targetsel =
|
||||
(dap->dap.multidrop_targetsel & DP_TARGETSEL_INSTANCEID_MASK)
|
||||
| (w & DP_TARGETSEL_DPID_MASK);
|
||||
dap->dap.multidrop_dp_id_valid = true;
|
||||
break;
|
||||
}
|
||||
case CFG_INSTANCE_ID: {
|
||||
jim_wide w;
|
||||
e = jim_getopt_wide(goi, &w);
|
||||
if (e != JIM_OK) {
|
||||
Jim_SetResultFormatted(goi->interp,
|
||||
"create %s: bad parameter %s",
|
||||
dap->name, n->name);
|
||||
return JIM_ERR;
|
||||
}
|
||||
if (w < 0 || w > 15) {
|
||||
Jim_SetResultFormatted(goi->interp,
|
||||
"create %s: %s out of range",
|
||||
dap->name, n->name);
|
||||
return JIM_ERR;
|
||||
}
|
||||
dap->dap.multidrop_targetsel =
|
||||
(dap->dap.multidrop_targetsel & DP_TARGETSEL_DPID_MASK)
|
||||
| ((w << DP_TARGETSEL_INSTANCEID_SHIFT) & DP_TARGETSEL_INSTANCEID_MASK);
|
||||
dap->dap.multidrop_instance_id_valid = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user