diff options
Diffstat (limited to 'src/jtag/hla')
-rw-r--r-- | src/jtag/hla/hla_interface.c | 32 | ||||
-rw-r--r-- | src/jtag/hla/hla_interface.h | 1 | ||||
-rw-r--r-- | src/jtag/hla/hla_layout.h | 4 | ||||
-rw-r--r-- | src/jtag/hla/hla_tcl.c | 24 | ||||
-rw-r--r-- | src/jtag/hla/hla_transport.c | 8 |
5 files changed, 65 insertions, 4 deletions
diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c index a33be54..964b074 100644 --- a/src/jtag/hla/hla_interface.c +++ b/src/jtag/hla/hla_interface.c @@ -145,6 +145,35 @@ int hl_interface_init_reset(void) return ERROR_OK; } +static int dummy_khz(int khz, int *jtag_speed) +{ + *jtag_speed = khz; + return ERROR_OK; +} + +static int dummy_speed_div(int speed, int *khz) +{ + *khz = speed; + return ERROR_OK; +} + +static int dummy_speed(int speed) +{ + return ERROR_OK; +} + +int hl_interface_override_target(const char **targetname) +{ + if (hl_if.layout->api->override_target) { + if (hl_if.layout->api->override_target(*targetname)) { + *targetname = "hla_target"; + return ERROR_OK; + } else + return ERROR_FAIL; + } + return ERROR_FAIL; +} + COMMAND_HANDLER(hl_interface_handle_device_desc_command) { LOG_DEBUG("hl_interface_handle_device_desc_command"); @@ -286,4 +315,7 @@ struct jtag_interface hl_interface = { .init = hl_interface_init, .quit = hl_interface_quit, .execute_queue = hl_interface_execute_queue, + .speed = &dummy_speed, + .khz = &dummy_khz, + .speed_div = &dummy_speed_div, }; diff --git a/src/jtag/hla/hla_interface.h b/src/jtag/hla/hla_interface.h index 13c169f..f83269b 100644 --- a/src/jtag/hla/hla_interface.h +++ b/src/jtag/hla/hla_interface.h @@ -67,5 +67,6 @@ int hl_interface_open(enum hl_transports tr); int hl_interface_init_target(struct target *t); int hl_interface_init_reset(void); +int hl_interface_override_target(const char **targetname); #endif /* _HL_INTERFACE */ diff --git a/src/jtag/hla/hla_layout.h b/src/jtag/hla/hla_layout.h index 9a991b6..6d79d58 100644 --- a/src/jtag/hla/hla_layout.h +++ b/src/jtag/hla/hla_layout.h @@ -74,7 +74,9 @@ struct hl_layout_api_s { */ int (*idcode) (void *handle, uint32_t *idcode); /** */ - enum target_state (*state) (void *handle); + int (*override_target) (const char *targetname); + /** */ + enum target_state (*state) (void *fd); }; /** */ diff --git a/src/jtag/hla/hla_tcl.c b/src/jtag/hla/hla_tcl.c index 88cfc59..20082f3 100644 --- a/src/jtag/hla/hla_tcl.c +++ b/src/jtag/hla/hla_tcl.c @@ -59,7 +59,13 @@ static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi, return JIM_OK; } -#define NTAP_OPT_EXPECTED_ID 0 +#define NTAP_OPT_IRLEN 0 +#define NTAP_OPT_IRMASK 1 +#define NTAP_OPT_IRCAPTURE 2 +#define NTAP_OPT_ENABLED 3 +#define NTAP_OPT_DISABLED 4 +#define NTAP_OPT_EXPECTED_ID 5 +#define NTAP_OPT_VERSION 6 static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi) { @@ -69,8 +75,14 @@ static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi) Jim_Nvp *n; char *cp; const Jim_Nvp opts[] = { - {.name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID}, - {.name = NULL, .value = -1}, + { .name = "-irlen", .value = NTAP_OPT_IRLEN }, + { .name = "-irmask", .value = NTAP_OPT_IRMASK }, + { .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE }, + { .name = "-enable", .value = NTAP_OPT_ENABLED }, + { .name = "-disable", .value = NTAP_OPT_DISABLED }, + { .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID }, + { .name = "-ignore-version", .value = NTAP_OPT_VERSION }, + { .name = NULL, .value = -1}, }; pTap = calloc(1, sizeof(struct jtag_tap)); @@ -121,6 +133,12 @@ static int jim_hl_newtap_cmd(Jim_GetOptInfo *goi) return e; } break; + case NTAP_OPT_IRLEN: + case NTAP_OPT_IRMASK: + case NTAP_OPT_IRCAPTURE: + /* dummy read to ignore the next argument */ + Jim_GetOpt_Wide(goi, NULL); + break; } /* switch (n->value) */ } /* while (goi->argc) */ diff --git a/src/jtag/hla/hla_transport.c b/src/jtag/hla/hla_transport.c index e3c003d..ae7cbb1 100644 --- a/src/jtag/hla/hla_transport.c +++ b/src/jtag/hla/hla_transport.c @@ -134,6 +134,12 @@ static const struct command_registration stlink_transport_command_handlers[] = { .usage = "", .chain = hl_transport_jtag_subcommand_handlers, }, + { + .name = "jtag_ntrst_delay", + .mode = COMMAND_ANY, + .handler = hl_transport_jtag_command, + .usage = "", + }, COMMAND_REGISTRATION_DONE }; @@ -204,12 +210,14 @@ static struct transport hl_swd_transport = { .name = "hla_swd", .select = hl_transport_select, .init = hl_transport_init, + .override_target = hl_interface_override_target, }; static struct transport hl_jtag_transport = { .name = "hla_jtag", .select = hl_transport_select, .init = hl_transport_init, + .override_target = hl_interface_override_target, }; static struct transport stlink_swim_transport = { |