drivers/buspirate: Group adapter commands

Use a command group 'buspirate' with subcommands instead of individual
commands with 'buspirate_' prefix.

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

Change-Id: Id999d4ba276af576fb22b76052f3c0a1f3e1b876
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6404
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marc Schink
2021-08-01 14:04:49 +02:00
committed by Antonio Borneo
parent 8d70a67b20
commit 8399cbc958
3 changed files with 73 additions and 20 deletions

View File

@@ -473,51 +473,51 @@ COMMAND_HANDLER(buspirate_handle_port_command)
}
static const struct command_registration buspirate_command_handlers[] = {
static const struct command_registration buspirate_subcommand_handlers[] = {
{
.name = "buspirate_adc",
.name = "adc",
.handler = &buspirate_handle_adc_command,
.mode = COMMAND_EXEC,
.help = "reads voltages on adc pins",
.usage = "",
},
{
.name = "buspirate_vreg",
.name = "vreg",
.usage = "<1|0>",
.handler = &buspirate_handle_vreg_command,
.mode = COMMAND_CONFIG,
.help = "changes the state of voltage regulators",
},
{
.name = "buspirate_pullup",
.name = "pullup",
.usage = "<1|0>",
.handler = &buspirate_handle_pullup_command,
.mode = COMMAND_CONFIG,
.help = "changes the state of pullup",
},
{
.name = "buspirate_led",
.name = "led",
.usage = "<1|0>",
.handler = &buspirate_handle_led_command,
.mode = COMMAND_EXEC,
.help = "changes the state of led",
},
{
.name = "buspirate_speed",
.name = "speed",
.usage = "<normal|fast>",
.handler = &buspirate_handle_speed_command,
.mode = COMMAND_CONFIG,
.help = "speed of the interface",
},
{
.name = "buspirate_mode",
.name = "mode",
.usage = "<normal|open-drain>",
.handler = &buspirate_handle_mode_command,
.mode = COMMAND_CONFIG,
.help = "pin mode of the interface",
},
{
.name = "buspirate_port",
.name = "port",
.usage = "/dev/ttyUSB0",
.handler = &buspirate_handle_port_command,
.mode = COMMAND_CONFIG,
@@ -526,6 +526,17 @@ static const struct command_registration buspirate_command_handlers[] = {
COMMAND_REGISTRATION_DONE
};
static const struct command_registration buspirate_command_handlers[] = {
{
.name = "buspirate",
.mode = COMMAND_ANY,
.help = "perform buspirate management",
.chain = buspirate_subcommand_handlers,
.usage = "",
},
COMMAND_REGISTRATION_DONE
};
static const struct swd_driver buspirate_swd = {
.init = buspirate_swd_init,
.switch_seq = buspirate_swd_switch_seq,

View File

@@ -603,4 +603,46 @@ proc sysfsgpio_swdio_num args {
eval sysfsgpio swdio_num $args
}
lappend _telnet_autocomplete_skip buspirate_adc
proc buspirate_adc args {
echo "DEPRECATED! use 'buspirate adc' not 'buspirate_adc'"
eval buspirate adc $args
}
lappend _telnet_autocomplete_skip buspirate_vreg
proc buspirate_vreg args {
echo "DEPRECATED! use 'buspirate vreg' not 'buspirate_vreg'"
eval buspirate vreg $args
}
lappend _telnet_autocomplete_skip buspirate_pullup
proc buspirate_pullup args {
echo "DEPRECATED! use 'buspirate pullup' not 'buspirate_pullup'"
eval buspirate pullup $args
}
lappend _telnet_autocomplete_skip buspirate_led
proc buspirate_led args {
echo "DEPRECATED! use 'buspirate led' not 'buspirate_led'"
eval buspirate led $args
}
lappend _telnet_autocomplete_skip buspirate_speed
proc buspirate_speed args {
echo "DEPRECATED! use 'buspirate speed' not 'buspirate_speed'"
eval buspirate speed $args
}
lappend _telnet_autocomplete_skip buspirate_mode
proc buspirate_mode args {
echo "DEPRECATED! use 'buspirate mode' not 'buspirate_mode'"
eval buspirate mode $args
}
lappend _telnet_autocomplete_skip buspirate_port
proc buspirate_port args {
echo "DEPRECATED! use 'buspirate port' not 'buspirate_port'"
eval buspirate port $args
}
# END MIGRATION AIDS