drivers/ft232r: Group adapter commands

Use a command group 'ft232r' with subcommands instead of individual
commands with 'ft232r_' prefix.

The old commands are still available for backward compatibility but
marked as deprecated.

Change-Id: I0dbeb4716330c83f8ce89b0d054eb0286b887bdf
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6409
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marc Schink 2021-08-01 14:20:22 +02:00 committed by Antonio Borneo
parent ae5c438b00
commit 186ed3311d
3 changed files with 92 additions and 21 deletions

View File

@ -2632,47 +2632,47 @@ FT232R
These interfaces have several commands, used to configure the driver
before initializing the JTAG scan chain:
@deffn {Config Command} {ft232r_vid_pid} @var{vid} @var{pid}
@deffn {Config Command} {ft232r vid_pid} @var{vid} @var{pid}
The vendor ID and product ID of the adapter. If not specified, default
0x0403:0x6001 is used.
@end deffn
@deffn {Config Command} {ft232r_serial_desc} @var{serial}
@deffn {Config Command} {ft232r serial_desc} @var{serial}
Specifies the @var{serial} of the adapter to use, in case the
vendor provides unique IDs and more than one adapter is connected to
the host. If not specified, serial numbers are not considered.
@end deffn
@deffn {Config Command} {ft232r_jtag_nums} @var{tck} @var{tms} @var{tdi} @var{tdo}
@deffn {Config Command} {ft232r jtag_nums} @var{tck} @var{tms} @var{tdi} @var{tdo}
Set four JTAG GPIO numbers at once.
If not specified, default 0 3 1 2 or TXD CTS RXD RTS is used.
@end deffn
@deffn {Config Command} {ft232r_tck_num} @var{tck}
@deffn {Config Command} {ft232r tck_num} @var{tck}
Set TCK GPIO number. If not specified, default 0 or TXD is used.
@end deffn
@deffn {Config Command} {ft232r_tms_num} @var{tms}
@deffn {Config Command} {ft232r tms_num} @var{tms}
Set TMS GPIO number. If not specified, default 3 or CTS is used.
@end deffn
@deffn {Config Command} {ft232r_tdi_num} @var{tdi}
@deffn {Config Command} {ft232r tdi_num} @var{tdi}
Set TDI GPIO number. If not specified, default 1 or RXD is used.
@end deffn
@deffn {Config Command} {ft232r_tdo_num} @var{tdo}
@deffn {Config Command} {ft232r tdo_num} @var{tdo}
Set TDO GPIO number. If not specified, default 2 or RTS is used.
@end deffn
@deffn {Config Command} {ft232r_trst_num} @var{trst}
@deffn {Config Command} {ft232r trst_num} @var{trst}
Set TRST GPIO number. If not specified, default 4 or DTR is used.
@end deffn
@deffn {Config Command} {ft232r_srst_num} @var{srst}
@deffn {Config Command} {ft232r srst_num} @var{srst}
Set SRST GPIO number. If not specified, default 6 or DCD is used.
@end deffn
@deffn {Config Command} {ft232r_restore_serial} @var{word}
@deffn {Config Command} {ft232r restore_serial} @var{word}
Restore serial port after JTAG. This USB bitmode control word
(16-bit) will be sent before quit. Lower byte should
set GPIO direction register to a "sane" state:

View File

@ -560,72 +560,72 @@ COMMAND_HANDLER(ft232r_handle_restore_serial_command)
return ERROR_OK;
}
static const struct command_registration ft232r_command_handlers[] = {
static const struct command_registration ft232r_subcommand_handlers[] = {
{
.name = "ft232r_serial_desc",
.name = "serial_desc",
.handler = ft232r_handle_serial_desc_command,
.mode = COMMAND_CONFIG,
.help = "USB serial descriptor of the adapter",
.usage = "serial string",
},
{
.name = "ft232r_vid_pid",
.name = "vid_pid",
.handler = ft232r_handle_vid_pid_command,
.mode = COMMAND_CONFIG,
.help = "USB VID and PID of the adapter",
.usage = "vid pid",
},
{
.name = "ft232r_jtag_nums",
.name = "jtag_nums",
.handler = ft232r_handle_jtag_nums_command,
.mode = COMMAND_CONFIG,
.help = "gpio numbers for tck, tms, tdi, tdo. (in that order)",
.usage = "<0-7|TXD-RI> <0-7|TXD-RI> <0-7|TXD-RI> <0-7|TXD-RI>",
},
{
.name = "ft232r_tck_num",
.name = "tck_num",
.handler = ft232r_handle_tck_num_command,
.mode = COMMAND_CONFIG,
.help = "gpio number for tck.",
.usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
},
{
.name = "ft232r_tms_num",
.name = "tms_num",
.handler = ft232r_handle_tms_num_command,
.mode = COMMAND_CONFIG,
.help = "gpio number for tms.",
.usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
},
{
.name = "ft232r_tdo_num",
.name = "tdo_num",
.handler = ft232r_handle_tdo_num_command,
.mode = COMMAND_CONFIG,
.help = "gpio number for tdo.",
.usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
},
{
.name = "ft232r_tdi_num",
.name = "tdi_num",
.handler = ft232r_handle_tdi_num_command,
.mode = COMMAND_CONFIG,
.help = "gpio number for tdi.",
.usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
},
{
.name = "ft232r_srst_num",
.name = "srst_num",
.handler = ft232r_handle_srst_num_command,
.mode = COMMAND_CONFIG,
.help = "gpio number for srst.",
.usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
},
{
.name = "ft232r_trst_num",
.name = "trst_num",
.handler = ft232r_handle_trst_num_command,
.mode = COMMAND_CONFIG,
.help = "gpio number for trst.",
.usage = "<0-7|TXD|RXD|RTS|CTS|DTR|DSR|DCD|RI>",
},
{
.name = "ft232r_restore_serial",
.name = "restore_serial",
.handler = ft232r_handle_restore_serial_command,
.mode = COMMAND_CONFIG,
.help = "bitmode control word that restores serial port.",
@ -634,6 +634,17 @@ static const struct command_registration ft232r_command_handlers[] = {
COMMAND_REGISTRATION_DONE
};
static const struct command_registration ft232r_command_handlers[] = {
{
.name = "ft232r",
.mode = COMMAND_ANY,
.help = "perform ft232r management",
.chain = ft232r_subcommand_handlers,
.usage = "",
},
COMMAND_REGISTRATION_DONE
};
/*
* Synchronous bitbang protocol implementation.
*/

View File

@ -675,4 +675,64 @@ proc usb_blaster_firmware args {
eval usb_blaster firmware $args
}
lappend _telnet_autocomplete_skip ft232r_serial_desc
proc ft232r_serial_desc args {
echo "DEPRECATED! use 'ft232r serial_desc' not 'ft232r_serial_desc'"
eval ft232r serial_desc $args
}
lappend _telnet_autocomplete_skip ft232r_vid_pid
proc ft232r_vid_pid args {
echo "DEPRECATED! use 'ft232r vid_pid' not 'ft232r_vid_pid'"
eval ft232r vid_pid $args
}
lappend _telnet_autocomplete_skip ft232r_jtag_nums
proc ft232r_jtag_nums args {
echo "DEPRECATED! use 'ft232r jtag_nums' not 'ft232r_jtag_nums'"
eval ft232r jtag_nums $args
}
lappend _telnet_autocomplete_skip ft232r_tck_num
proc ft232r_tck_num args {
echo "DEPRECATED! use 'ft232r tck_num' not 'ft232r_tck_num'"
eval ft232r tck_num $args
}
lappend _telnet_autocomplete_skip ft232r_tms_num
proc ft232r_tms_num args {
echo "DEPRECATED! use 'ft232r tms_num' not 'ft232r_tms_num'"
eval ft232r tms_num $args
}
lappend _telnet_autocomplete_skip ft232r_tdo_num
proc ft232r_tdo_num args {
echo "DEPRECATED! use 'ft232r tdo_num' not 'ft232r_tdo_num'"
eval ft232r tdo_num $args
}
lappend _telnet_autocomplete_skip ft232r_tdi_num
proc ft232r_tdi_num args {
echo "DEPRECATED! use 'ft232r tdi_num' not 'ft232r_tdi_num'"
eval ft232r tdi_num $args
}
lappend _telnet_autocomplete_skip ft232r_srst_num
proc ft232r_srst_num args {
echo "DEPRECATED! use 'ft232r srst_num' not 'ft232r_srst_num'"
eval ft232r srst_num $args
}
lappend _telnet_autocomplete_skip ft232r_trst_num
proc ft232r_trst_num args {
echo "DEPRECATED! use 'ft232r trst_num' not 'ft232r_trst_num'"
eval ft232r trst_num $args
}
lappend _telnet_autocomplete_skip ft232r_restore_serial
proc ft232r_restore_serial args {
echo "DEPRECATED! use 'ft232r restore_serial' not 'ft232r_restore_serial'"
eval ft232r restore_serial $args
}
# END MIGRATION AIDS