adiv6: add dap flags -adiv5 and -adiv6

Add flags to 'dap create' command and set the field adi_version
in struct adiv5_dap.

Actually only ADIv5 is functional. Other patches are needed to get
ADIv6 working.

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

Change-Id: I63d3902f99a7f139c15ee4e07c19eae9ed4534b9
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/+/6456
Tested-by: jenkins
This commit is contained in:
Kevin Burke
2021-08-06 15:01:34 +02:00
committed by Antonio Borneo
parent 35a503b08d
commit 1fe82f9f1d
3 changed files with 38 additions and 1 deletions

View File

@@ -129,6 +129,14 @@ static int dap_init_all(void)
} else
dap->ops = &jtag_dp_ops;
if (dap->adi_version == 0) {
LOG_DEBUG("DAP %s configured by default to use ADIv5 protocol", jtag_tap_name(dap->tap));
dap->adi_version = 5;
} else {
LOG_DEBUG("DAP %s configured to use %s protocol by user cfg file", jtag_tap_name(dap->tap),
is_adiv6(dap) ? "ADIv6" : "ADIv5");
}
retval = dap->ops->connect(dap);
if (retval != ERROR_OK)
return retval;
@@ -163,6 +171,8 @@ enum dap_cfg_param {
CFG_IGNORE_SYSPWRUPACK,
CFG_DP_ID,
CFG_INSTANCE_ID,
CFG_ADIV6,
CFG_ADIV5,
};
static const struct jim_nvp nvp_config_opts[] = {
@@ -170,6 +180,8 @@ static const struct jim_nvp nvp_config_opts[] = {
{ .name = "-ignore-syspwrupack", .value = CFG_IGNORE_SYSPWRUPACK },
{ .name = "-dp-id", .value = CFG_DP_ID },
{ .name = "-instance-id", .value = CFG_INSTANCE_ID },
{ .name = "-adiv6", .value = CFG_ADIV6 },
{ .name = "-adiv5", .value = CFG_ADIV5 },
{ .name = NULL, .value = -1 }
};
@@ -249,6 +261,12 @@ static int dap_configure(struct jim_getopt_info *goi, struct arm_dap_object *dap
dap->dap.multidrop_instance_id_valid = true;
break;
}
case CFG_ADIV6:
dap->dap.adi_version = 6;
break;
case CFG_ADIV5:
dap->dap.adi_version = 5;
break;
default:
break;
}