adapter: Add 'user0' GPIO signal

Add a user-specific signal 'user0' which can be used for custom
functionality.

For now, only a single user-specific signal is supported. Additional
signals 'userX' or a more generic handling can be added in the future.
Also, the signal state can only be configured during the adapter
initialization and termination. Commands to change the signal state at
run-time may be added in the future.

Change-Id: I3f31242f6a693e11565542c3bd4521a245b4ff95
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9088
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Marc Schink
2025-07-31 07:48:46 +00:00
committed by Antonio Borneo
parent d02389bbfa
commit 3bec165e25
3 changed files with 4 additions and 1 deletions

View File

@@ -2440,7 +2440,7 @@ dict get [adapter list] ftdi
@deffn {Config Command} {adapter gpio [ @
@option{tdo} | @option{tdi} | @option{tms} | @option{tck} | @option{trst} | @
@option{swdio} | @option{swdio_dir} | @option{swclk} | @option{srst} | @
@option{led} @
@option{led} | @option{user0} @
[ @
gpio_number | @option{-chip} chip_number | @
@option{-active-high} | @option{-active-low} | @
@@ -2460,6 +2460,7 @@ JTAG transport signals
@item @option{swdio_dir}: optional swdio buffer control signal
@item @option{srst}: system reset signal
@item @option{led}: optional activity led
@item @option{user0}: optional, user-specific signal
@end itemize

View File

@@ -65,6 +65,7 @@ static const struct gpio_map {
[ADAPTER_GPIO_IDX_TRST] = { "trst", ADAPTER_GPIO_DIRECTION_OUTPUT, false, true, true },
[ADAPTER_GPIO_IDX_SRST] = { "srst", ADAPTER_GPIO_DIRECTION_OUTPUT, false, true, true },
[ADAPTER_GPIO_IDX_LED] = { "led", ADAPTER_GPIO_DIRECTION_OUTPUT, true, true, true },
[ADAPTER_GPIO_IDX_USER0] = { "user0", ADAPTER_GPIO_DIRECTION_BIDIRECTIONAL, true, true, true },
};
static int adapter_config_khz(unsigned int khz);

View File

@@ -60,6 +60,7 @@ enum adapter_gpio_config_index {
ADAPTER_GPIO_IDX_SWCLK,
ADAPTER_GPIO_IDX_SRST,
ADAPTER_GPIO_IDX_LED,
ADAPTER_GPIO_IDX_USER0,
ADAPTER_GPIO_IDX_NUM, /* must be the last item */
};