diff options
author | Daniel Anselmi <danselmi@gmx.ch> | 2023-04-15 01:13:12 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-07-08 18:03:18 +0000 |
commit | 373d7eaa706b4895cb94e5f563526aec865c8814 (patch) | |
tree | c22fa0a79a8ed12a5ff28c4718b17eb881658934 /src/pld | |
parent | e95f8e2b25c36fd290c29b4b553da5d16dfc620f (diff) | |
download | riscv-openocd-373d7eaa706b4895cb94e5f563526aec865c8814.zip riscv-openocd-373d7eaa706b4895cb94e5f563526aec865c8814.tar.gz riscv-openocd-373d7eaa706b4895cb94e5f563526aec865c8814.tar.bz2 |
pld/virtex2: add program/refresh command
Change-Id: If6d237a6f27c4232849f73d08e7ca74276e6d464
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7714
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Diffstat (limited to 'src/pld')
-rw-r--r-- | src/pld/virtex2.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c index dfcf4cf..9007a55 100644 --- a/src/pld/virtex2.c +++ b/src/pld/virtex2.c @@ -143,6 +143,35 @@ static int virtex2_read_stat(struct pld_device *pld_device, uint32_t *status) return retval; } +static int virtex2_program(struct pld_device *pld_device) +{ + struct virtex2_pld_device *virtex2_info = pld_device->driver_priv; + if (!virtex2_info) + return ERROR_FAIL; + + int retval = virtex2_set_instr(virtex2_info->tap, virtex2_info->command_set.jshutdown); + if (retval != ERROR_OK) + return retval; + + retval = virtex2_set_instr(virtex2_info->tap, virtex2_info->command_set.jprog_b); + if (retval != ERROR_OK) + return retval; + + jtag_add_runtest(62000, TAP_IDLE); + if (!(virtex2_info->no_jstart)) { + retval = virtex2_set_instr(virtex2_info->tap, virtex2_info->command_set.jstart); + if (retval != ERROR_OK) + return retval; + } + + retval = virtex2_set_instr(virtex2_info->tap, virtex2_info->command_set.bypass); + if (retval != ERROR_OK) + return retval; + jtag_add_runtest(2000, TAP_IDLE); + + return jtag_execute_queue(); +} + static int virtex2_load_prepare(struct pld_device *pld_device) { struct virtex2_pld_device *virtex2_info = pld_device->driver_priv; @@ -236,6 +265,22 @@ static int virtex2_load(struct pld_device *pld_device, const char *filename) return retval; } +COMMAND_HANDLER(virtex2_handle_program_command) +{ + struct pld_device *device; + + if (CMD_ARGC != 1) + return ERROR_COMMAND_SYNTAX_ERROR; + + device = get_pld_device_by_name_or_numstr(CMD_ARGV[0]); + if (!device) { + command_print(CMD, "pld device '#%s' is out of bounds or unknown", CMD_ARGV[0]); + return ERROR_FAIL; + } + + return virtex2_program(device); +} + COMMAND_HANDLER(virtex2_handle_read_stat_command) { struct pld_device *device; @@ -368,6 +413,12 @@ static const struct command_registration virtex2_exec_command_handlers[] = { .handler = virtex2_handle_set_user_codes_command, .help = "set instructions codes used for jtag-hub", .usage = "pld_name user1 [user2 [user3 [user4]]]", + }, { + .name = "program", + .mode = COMMAND_EXEC, + .handler = virtex2_handle_program_command, + .help = "start loading of configuration (refresh)", + .usage = "pld_name", }, COMMAND_REGISTRATION_DONE }; |