Browse Source

drivers/linuxgpiod: Group adapter commands

Use a command group 'linuxgpiod' with subcommands instead of individual
commands with 'linuxgpiod_' prefix.

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

Change-Id: Iad9b330363f81128ab1ec1cbc498df28ba2ca152
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6400
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
jim
Marc Schink 10 months ago
committed by Antonio Borneo
parent
commit
620211bec6
2 changed files with 96 additions and 13 deletions
  1. +24
    -13
      src/jtag/drivers/linuxgpiod.c
  2. +72
    -0
      src/jtag/startup.tcl

+ 24
- 13
src/jtag/drivers/linuxgpiod.c View File

@@ -524,86 +524,86 @@ COMMAND_HANDLER(linuxgpiod_handle_gpiochip)
return ERROR_OK;
}

static const struct command_registration linuxgpiod_command_handlers[] = {
static const struct command_registration linuxgpiod_subcommand_handlers[] = {
{
.name = "linuxgpiod_jtag_nums",
.name = "jtag_nums",
.handler = linuxgpiod_handle_jtag_gpionums,
.mode = COMMAND_CONFIG,
.help = "gpio numbers for tck, tms, tdi, tdo. (in that order)",
.usage = "tck tms tdi tdo",
},
{
.name = "linuxgpiod_tck_num",
.name = "tck_num",
.handler = linuxgpiod_handle_jtag_gpionum_tck,
.mode = COMMAND_CONFIG,
.help = "gpio number for tck.",
.usage = "tck",
},
{
.name = "linuxgpiod_tms_num",
.name = "tms_num",
.handler = linuxgpiod_handle_jtag_gpionum_tms,
.mode = COMMAND_CONFIG,
.help = "gpio number for tms.",
.usage = "tms",
},
{
.name = "linuxgpiod_tdo_num",
.name = "tdo_num",
.handler = linuxgpiod_handle_jtag_gpionum_tdo,
.mode = COMMAND_CONFIG,
.help = "gpio number for tdo.",
.usage = "tdo",
},
{
.name = "linuxgpiod_tdi_num",
.name = "tdi_num",
.handler = linuxgpiod_handle_jtag_gpionum_tdi,
.mode = COMMAND_CONFIG,
.help = "gpio number for tdi.",
.usage = "tdi",
},
{
.name = "linuxgpiod_srst_num",
.name = "srst_num",
.handler = linuxgpiod_handle_jtag_gpionum_srst,
.mode = COMMAND_CONFIG,
.help = "gpio number for srst.",
.usage = "srst",
},
{
.name = "linuxgpiod_trst_num",
.name = "trst_num",
.handler = linuxgpiod_handle_jtag_gpionum_trst,
.mode = COMMAND_CONFIG,
.help = "gpio number for trst.",
.usage = "trst",
},
{
.name = "linuxgpiod_swd_nums",
.name = "swd_nums",
.handler = linuxgpiod_handle_swd_gpionums,
.mode = COMMAND_CONFIG,
.help = "gpio numbers for swclk, swdio. (in that order)",
.usage = "swclk swdio",
},
{
.name = "linuxgpiod_swclk_num",
.name = "swclk_num",
.handler = linuxgpiod_handle_swd_gpionum_swclk,
.mode = COMMAND_CONFIG,
.help = "gpio number for swclk.",
.usage = "swclk",
},
{
.name = "linuxgpiod_swdio_num",
.name = "swdio_num",
.handler = linuxgpiod_handle_swd_gpionum_swdio,
.mode = COMMAND_CONFIG,
.help = "gpio number for swdio.",
.usage = "swdio",
},
{
.name = "linuxgpiod_led_num",
.name = "led_num",
.handler = linuxgpiod_handle_gpionum_led,
.mode = COMMAND_CONFIG,
.help = "gpio number for LED.",
.usage = "led",
},
{
.name = "linuxgpiod_gpiochip",
.name = "gpiochip",
.handler = linuxgpiod_handle_gpiochip,
.mode = COMMAND_CONFIG,
.help = "number of the gpiochip.",
@@ -612,6 +612,17 @@ static const struct command_registration linuxgpiod_command_handlers[] = {
COMMAND_REGISTRATION_DONE
};

static const struct command_registration linuxgpiod_command_handlers[] = {
{
.name = "linuxgpiod",
.mode = COMMAND_ANY,
.help = "perform linuxgpiod management",
.chain = linuxgpiod_subcommand_handlers,
.usage = "",
},
COMMAND_REGISTRATION_DONE
};

static const char *const linuxgpiod_transport[] = { "swd", "jtag", NULL };

static struct jtag_interface linuxgpiod_interface = {


+ 72
- 0
src/jtag/startup.tcl View File

@@ -471,4 +471,76 @@ proc bcm2835gpio_peripheral_base args {
eval bcm2835gpio peripheral_base $args
}

lappend _telnet_autocomplete_skip linuxgpiod_jtag_nums
proc linuxgpiod_jtag_nums args {
echo "DEPRECATED! use 'linuxgpiod jtag_nums' not 'linuxgpiod_jtag_nums'"
eval linuxgpiod jtag_nums $args
}

lappend _telnet_autocomplete_skip linuxgpiod_tck_num
proc linuxgpiod_tck_num args {
echo "DEPRECATED! use 'linuxgpiod tck_num' not 'linuxgpiod_tck_num'"
eval linuxgpiod tck_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_tms_num
proc linuxgpiod_tms_num args {
echo "DEPRECATED! use 'linuxgpiod tms_num' not 'linuxgpiod_tms_num'"
eval linuxgpiod tms_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_tdo_num
proc linuxgpiod_tdo_num args {
echo "DEPRECATED! use 'linuxgpiod tdo_num' not 'linuxgpiod_tdo_num'"
eval linuxgpiod tdo_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_tdi_num
proc linuxgpiod_tdi_num args {
echo "DEPRECATED! use 'linuxgpiod tdi_num' not 'linuxgpiod_tdi_num'"
eval linuxgpiod tdi_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_srst_num
proc linuxgpiod_srst_num args {
echo "DEPRECATED! use 'linuxgpiod srst_num' not 'linuxgpiod_srst_num'"
eval linuxgpiod srst_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_trst_num
proc linuxgpiod_trst_num args {
echo "DEPRECATED! use 'linuxgpiod trst_num' not 'linuxgpiod_trst_num'"
eval linuxgpiod trst_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_swd_nums
proc linuxgpiod_swd_nums args {
echo "DEPRECATED! use 'linuxgpiod swd_nums' not 'linuxgpiod_swd_nums'"
eval linuxgpiod swd_nums $args
}

lappend _telnet_autocomplete_skip linuxgpiod_swclk_num
proc linuxgpiod_swclk_num args {
echo "DEPRECATED! use 'linuxgpiod swclk_num' not 'linuxgpiod_swclk_num'"
eval linuxgpiod swclk_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_swdio_num
proc linuxgpiod_swdio_num args {
echo "DEPRECATED! use 'linuxgpiod swdio_num' not 'linuxgpiod_swdio_num'"
eval linuxgpiod swdio_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_led_num
proc linuxgpiod_led_num args {
echo "DEPRECATED! use 'linuxgpiod led_num' not 'linuxgpiod_led_num'"
eval linuxgpiod led_num $args
}

lappend _telnet_autocomplete_skip linuxgpiod_gpiochip
proc linuxgpiod_gpiochip args {
echo "DEPRECATED! use 'linuxgpiod gpiochip' not 'linuxgpiod_gpiochip'"
eval linuxgpiod gpiochip $args
}

# END MIGRATION AIDS

Loading…
Cancel
Save