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
This commit is contained in:
Daniel Anselmi 2023-04-15 01:13:12 +02:00 committed by Antonio Borneo
parent e95f8e2b25
commit 373d7eaa70
6 changed files with 60 additions and 0 deletions

View File

@ -8638,6 +8638,10 @@ SSI devices are using different values.
Change values for boundary scan instructions selecting the registers USER1 to USER4.
Description of the arguments can be found at command @command{virtex2 set_instr_codes}.
@end deffn
@deffn {Command} {virtex2 program} pld_name
Load the bitstream from external memory for FPGA @var{pld_name}. A.k.a. refresh.
@end deffn
@end deffn

View File

@ -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
};

View File

@ -35,6 +35,7 @@ set XC6S_JSTART 0x0c
set XC6S_BYPASS 0x3f
proc xc6s_program {tap} {
echo "DEPRECATED! use 'virtex2 program ...' not 'xc6s_program'"
global XC6S_JSHUTDOWN XC6S_JPROGRAM XC6S_JSTART XC6S_BYPASS
irscan $tap $XC6S_JSHUTDOWN
irscan $tap $XC6S_JPROGRAM
@ -44,6 +45,7 @@ proc xc6s_program {tap} {
#xtp038 and xc3sprog approach
proc xc6s_program_iprog {tap} {
echo "DEPRECATED! use 'virtex2 program ...' not 'xc6s_program_iprog'"
global XC6S_JSHUTDOWN XC6S_JSTART XC6S_BYPASS XC6S_CFG_IN
irscan $tap $XC6S_JSHUTDOWN
runtest 16

View File

@ -58,6 +58,7 @@ set XC7_JSTART 0x0c
set XC7_BYPASS 0x3f
proc xc7_program {tap} {
echo "DEPRECATED! use 'virtex2 program ...' not 'xc7_program'"
global XC7_JSHUTDOWN XC7_JPROGRAM XC7_JSTART XC7_BYPASS
irscan $tap $XC7_JSHUTDOWN
irscan $tap $XC7_JPROGRAM

View File

@ -62,6 +62,7 @@ set XCU_JSTART 0x0c
set XCU_BYPASS 0x3f
proc xcu_program {tap} {
echo "DEPRECATED! use 'virtex2 program ...' not 'xcu_program'"
global XCU_JSHUTDOWN XCU_JPROGRAM XCU_JSTART XCU_BYPASS
irscan $tap $XCU_JSHUTDOWN
irscan $tap $XCU_JPROGRAM

View File

@ -55,6 +55,7 @@ set XC7_JSTART 0x0c
set XC7_BYPASS 0x3f
proc zynqpl_program {tap} {
echo "DEPRECATED! use 'virtex2 program ...' not 'zynqpl_program'"
global XC7_JSHUTDOWN XC7_JPROGRAM XC7_JSTART XC7_BYPASS
irscan $tap $XC7_JSHUTDOWN
irscan $tap $XC7_JPROGRAM