Skip to content
Snippets Groups Projects
Commit 84ca4995 authored by Antonio Borneo's avatar Antonio Borneo Committed by Tomas Vanek
Browse files

drivers/bcm2835gpio: fix usage messages


The notation "(tck tms tdi tdo)* " is incorrect, because it means the
quadruple of gpio can be repeated on the command-line.
The correct syntax of the command requires instead to provide either
all the four gpio numbers (in order to set the values) or to pass an
empty command-line (to dump the values previously set).

Change the .usage field to "[tck tms tdi tdo]".
Change similarly the corresponding .usage field for SWD command.
Add the .usage field for the commands that individually set each gpio
or gpio property.
Dump the previously set values when commands bcm2835gpio_speed_coeffs
or bcm2835gpio_peripheral_base are executed with empty command-line.

Change-Id: Ie45d8268c1de331aded0bb52d5e6b8f0e8766a5b
Signed-off-by: default avatarAntonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5019


Reviewed-by: default avatarTomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
parent f9056d22
No related tags found
No related merge requests found
...@@ -300,6 +300,9 @@ COMMAND_HANDLER(bcm2835gpio_handle_speed_coeffs) ...@@ -300,6 +300,9 @@ COMMAND_HANDLER(bcm2835gpio_handle_speed_coeffs)
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], speed_coeff); COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], speed_coeff);
COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], speed_offset); COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], speed_offset);
} }
command_print(CMD_CTX, "BCM2835 GPIO: speed_coeffs = %d, speed_offset = %d",
speed_coeff, speed_offset);
return ERROR_OK; return ERROR_OK;
} }
...@@ -307,6 +310,9 @@ COMMAND_HANDLER(bcm2835gpio_handle_peripheral_base) ...@@ -307,6 +310,9 @@ COMMAND_HANDLER(bcm2835gpio_handle_peripheral_base)
{ {
if (CMD_ARGC == 1) if (CMD_ARGC == 1)
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bcm2835_peri_base); COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bcm2835_peri_base);
command_print(CMD_CTX, "BCM2835 GPIO: peripheral_base = 0x%08x",
bcm2835_peri_base);
return ERROR_OK; return ERROR_OK;
} }
...@@ -316,74 +322,84 @@ static const struct command_registration bcm2835gpio_command_handlers[] = { ...@@ -316,74 +322,84 @@ static const struct command_registration bcm2835gpio_command_handlers[] = {
.handler = &bcm2835gpio_handle_jtag_gpionums, .handler = &bcm2835gpio_handle_jtag_gpionums,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio numbers for tck, tms, tdi, tdo. (in that order)", .help = "gpio numbers for tck, tms, tdi, tdo. (in that order)",
.usage = "(tck tms tdi tdo)* ", .usage = "[tck tms tdi tdo]",
}, },
{ {
.name = "bcm2835gpio_tck_num", .name = "bcm2835gpio_tck_num",
.handler = &bcm2835gpio_handle_jtag_gpionum_tck, .handler = &bcm2835gpio_handle_jtag_gpionum_tck,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio number for tck.", .help = "gpio number for tck.",
.usage = "[tck]",
}, },
{ {
.name = "bcm2835gpio_tms_num", .name = "bcm2835gpio_tms_num",
.handler = &bcm2835gpio_handle_jtag_gpionum_tms, .handler = &bcm2835gpio_handle_jtag_gpionum_tms,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio number for tms.", .help = "gpio number for tms.",
.usage = "[tms]",
}, },
{ {
.name = "bcm2835gpio_tdo_num", .name = "bcm2835gpio_tdo_num",
.handler = &bcm2835gpio_handle_jtag_gpionum_tdo, .handler = &bcm2835gpio_handle_jtag_gpionum_tdo,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio number for tdo.", .help = "gpio number for tdo.",
.usage = "[tdo]",
}, },
{ {
.name = "bcm2835gpio_tdi_num", .name = "bcm2835gpio_tdi_num",
.handler = &bcm2835gpio_handle_jtag_gpionum_tdi, .handler = &bcm2835gpio_handle_jtag_gpionum_tdi,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio number for tdi.", .help = "gpio number for tdi.",
.usage = "[tdi]",
}, },
{ {
.name = "bcm2835gpio_swd_nums", .name = "bcm2835gpio_swd_nums",
.handler = &bcm2835gpio_handle_swd_gpionums, .handler = &bcm2835gpio_handle_swd_gpionums,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio numbers for swclk, swdio. (in that order)", .help = "gpio numbers for swclk, swdio. (in that order)",
.usage = "(swclk swdio)* ", .usage = "[swclk swdio]",
}, },
{ {
.name = "bcm2835gpio_swclk_num", .name = "bcm2835gpio_swclk_num",
.handler = &bcm2835gpio_handle_swd_gpionum_swclk, .handler = &bcm2835gpio_handle_swd_gpionum_swclk,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio number for swclk.", .help = "gpio number for swclk.",
.usage = "[swclk]",
}, },
{ {
.name = "bcm2835gpio_swdio_num", .name = "bcm2835gpio_swdio_num",
.handler = &bcm2835gpio_handle_swd_gpionum_swdio, .handler = &bcm2835gpio_handle_swd_gpionum_swdio,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio number for swdio.", .help = "gpio number for swdio.",
.usage = "[swdio]",
}, },
{ {
.name = "bcm2835gpio_srst_num", .name = "bcm2835gpio_srst_num",
.handler = &bcm2835gpio_handle_jtag_gpionum_srst, .handler = &bcm2835gpio_handle_jtag_gpionum_srst,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio number for srst.", .help = "gpio number for srst.",
.usage = "[srst]",
}, },
{ {
.name = "bcm2835gpio_trst_num", .name = "bcm2835gpio_trst_num",
.handler = &bcm2835gpio_handle_jtag_gpionum_trst, .handler = &bcm2835gpio_handle_jtag_gpionum_trst,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "gpio number for trst.", .help = "gpio number for trst.",
.usage = "[trst]",
}, },
{ {
.name = "bcm2835gpio_speed_coeffs", .name = "bcm2835gpio_speed_coeffs",
.handler = &bcm2835gpio_handle_speed_coeffs, .handler = &bcm2835gpio_handle_speed_coeffs,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "SPEED_COEFF and SPEED_OFFSET for delay calculations.", .help = "SPEED_COEFF and SPEED_OFFSET for delay calculations.",
.usage = "[SPEED_COEFF SPEED_OFFSET]",
}, },
{ {
.name = "bcm2835gpio_peripheral_base", .name = "bcm2835gpio_peripheral_base",
.handler = &bcm2835gpio_handle_peripheral_base, .handler = &bcm2835gpio_handle_peripheral_base,
.mode = COMMAND_CONFIG, .mode = COMMAND_CONFIG,
.help = "peripheral base to access GPIOs (RPi1 0x20000000, RPi2 0x3F000000).", .help = "peripheral base to access GPIOs (RPi1 0x20000000, RPi2 0x3F000000).",
.usage = "[base]",
}, },
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment