aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2019-01-22 16:31:18 +0100
committerTomas Vanek <vanekt@fbl.cz>2020-01-14 11:39:37 +0000
commitefd1d642220a4f6d3b9a9607c186452b265400d2 (patch)
tree13272d92e149e66524d420111fe740868a7e30ce /src/target
parent7268ff22c399832ee09ca3216753f17473ae9fab (diff)
downloadriscv-openocd-efd1d642220a4f6d3b9a9607c186452b265400d2.zip
riscv-openocd-efd1d642220a4f6d3b9a9607c186452b265400d2.tar.gz
riscv-openocd-efd1d642220a4f6d3b9a9607c186452b265400d2.tar.bz2
adapter: switch from struct jtag_interface to adapter_driver
To reorganize the adapters code, introduce an adapter_driver struct that contains all the adapter generic part, while keeping in two separate struct the specific API jtag_ops and swd_ops. Move the allocation of *adapter_driver from the JTAG-specific file core.c to the more adapter-specific file adapter.c While splitting the old jtag_interface for every driver, put the fields in the same order as in the struct declaration so we keep a consistent code across all the drivers. While other transport specific API could/would be added as separate ops, nothing is done here for HLA. Change-Id: I2d60f97ac514c0dd2d93a6ec9be66fd9d388dad5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4900 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/target')
-rw-r--r--src/target/adi_v5_swd.c6
-rw-r--r--src/target/arm_dap.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c
index 68a50b1..8d11537 100644
--- a/src/target/adi_v5_swd.c
+++ b/src/target/adi_v5_swd.c
@@ -368,9 +368,9 @@ static const struct command_registration swd_handlers[] = {
static int swd_select(struct command_context *ctx)
{
- /* FIXME: only place where global 'jtag_interface' is still needed */
- extern struct jtag_interface *jtag_interface;
- const struct swd_driver *swd = jtag_interface->swd;
+ /* FIXME: only place where global 'adapter_driver' is still needed */
+ extern struct adapter_driver *adapter_driver;
+ const struct swd_driver *swd = adapter_driver->swd_ops;
int retval;
retval = register_commands(ctx, NULL, swd_handlers);
diff --git a/src/target/arm_dap.c b/src/target/arm_dap.c
index 0f29578..4be94b4 100644
--- a/src/target/arm_dap.c
+++ b/src/target/arm_dap.c
@@ -34,7 +34,7 @@ static LIST_HEAD(all_dap);
extern const struct dap_ops swd_dap_ops;
extern const struct dap_ops jtag_dp_ops;
-extern struct jtag_interface *jtag_interface;
+extern struct adapter_driver *adapter_driver;
/* DAP command support */
struct arm_dap_object {
@@ -118,7 +118,7 @@ static int dap_init_all(void)
if (transport_is_swd()) {
dap->ops = &swd_dap_ops;
- obj->swd = jtag_interface->swd;
+ obj->swd = adapter_driver->swd_ops;
} else
dap->ops = &jtag_dp_ops;