drivers/buspirate: Group adapter commands
authorMarc Schink <dev@zapb.de>
Sun, 1 Aug 2021 12:04:49 +0000 (14:04 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 14 Aug 2021 12:36:47 +0000 (13:36 +0100)
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>
doc/openocd.texi
src/jtag/drivers/buspirate.c
src/jtag/startup.tcl

index 5aab4ba1df0b6adde60c6b53ec3aa81a218209ae..65252d69ef24a8169bff06651db073708799d1c2 100644 (file)
@@ -3339,21 +3339,21 @@ It uses a simple data protocol over a serial port connection.
 Most hardware development boards have a UART, a real serial port, or a virtual USB serial device, so this driver
 allows you to start building your own JTAG adapter without the complexity of a custom USB connection.
 
-@deffn {Config Command} {buspirate_port} serial_port
+@deffn {Config Command} {buspirate port} serial_port
 Specify the serial port's filename. For example:
 @example
-buspirate_port /dev/ttyUSB0
+buspirate port /dev/ttyUSB0
 @end example
 @end deffn
 
-@deffn {Config Command} {buspirate_speed} (normal|fast)
+@deffn {Config Command} {buspirate speed} (normal|fast)
 Set the communication speed to 115k (normal) or 1M (fast). For example:
 @example
-buspirate_mode normal
+buspirate mode normal
 @end example
 @end deffn
 
-@deffn {Config Command} {buspirate_mode} (normal|open-drain)
+@deffn {Config Command} {buspirate mode} (normal|open-drain)
 Set the Bus Pirate output mode.
 @itemize @minus
 @item In normal mode (push/pull), do not enable the pull-ups, and do not connect I/O header pin VPU to JTAG VREF.
@@ -3361,33 +3361,33 @@ Set the Bus Pirate output mode.
 @end itemize
 For example:
 @example
-buspirate_mode normal
+buspirate mode normal
 @end example
 @end deffn
 
-@deffn {Config Command} {buspirate_pullup} (0|1)
+@deffn {Config Command} {buspirate pullup} (0|1)
 Whether to connect (1) or not (0) the I/O header pin VPU (JTAG VREF)
 to the pull-up/pull-down resistors on MOSI (JTAG TDI), CLK (JTAG TCK), MISO (JTAG TDO) and CS (JTAG TMS).
 For example:
 @example
-buspirate_pullup 0
+buspirate pullup 0
 @end example
 @end deffn
 
-@deffn {Config Command} {buspirate_vreg} (0|1)
+@deffn {Config Command} {buspirate vreg} (0|1)
 Whether to enable (1) or disable (0) the built-in voltage regulator,
 which can be used to supply power to a test circuit through
 I/O header pins +3V3 and +5V. For example:
 @example
-buspirate_vreg 0
+buspirate vreg 0
 @end example
 @end deffn
 
-@deffn {Command} {buspirate_led} (0|1)
+@deffn {Command} {buspirate led} (0|1)
 Turns the Bus Pirate's LED on (1) or off (0). For example:
 @end deffn
 @example
-buspirate_led 1
+buspirate led 1
 @end example
 
 @end deffn
index 0864c60b325cdae8930144ba713b0b7f145e8491..51ace615fe7522421a836c86058ce9524c1943ce 100644 (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,
index 9e5ac26f471b65a2a1d37c25a5a43a3ad33d2e5c..80d21e7bde1e7ef44651ea313342f822f9e3e0fa 100644 (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