70 static int first_time;
81 if (tdi != last_tdi) {
94 if (tck != last_tck) {
210 int retval1 = 0, retval2 = 0;
281 int dir = GPIOD_LINE_REQUEST_DIRECTION_INPUT, flags = 0, val = 0, retval;
298 dir = GPIOD_LINE_REQUEST_DIRECTION_INPUT;
301 dir = GPIOD_LINE_REQUEST_DIRECTION_OUTPUT;
305 dir = GPIOD_LINE_REQUEST_DIRECTION_OUTPUT;
314 flags |= GPIOD_LINE_REQUEST_FLAG_OPEN_DRAIN;
317 flags |= GPIOD_LINE_REQUEST_FLAG_OPEN_SOURCE;
323 #ifdef HAVE_LIBGPIOD1_FLAGS_BIAS
324 flags |= GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE;
328 #ifdef HAVE_LIBGPIOD1_FLAGS_BIAS
329 flags |= GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP;
331 LOG_WARNING(
"linuxgpiod: ignoring request for pull-up on %s: not supported by gpiod v%s",
336 #ifdef HAVE_LIBGPIOD1_FLAGS_BIAS
337 flags |= GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN;
339 LOG_WARNING(
"linuxgpiod: ignoring request for pull-down on %s: not supported by gpiod v%s",
346 flags |= GPIOD_LINE_REQUEST_FLAG_ACTIVE_LOW;
348 struct gpiod_line_request_config
config = {
349 .consumer =
"OpenOCD",
365 LOG_INFO(
"Linux GPIOD JTAG/SWD bitbang driver");
377 LOG_ERROR(
"Require tck, tms, tdi and tdo gpios for JTAG mode");
390 int retval1, retval2;
392 LOG_ERROR(
"Require swclk and swdio gpio for SWD mode");
436 .
name =
"linuxgpiod",
const struct adapter_gpio_config * adapter_gpio_get_config(void)
Retrieves gpio configuration set with command "adapter gpio <signal_name>".
const char * adapter_gpio_get_name(enum adapter_gpio_config_index idx)
Retrieves gpio name.
@ ADAPTER_GPIO_INIT_STATE_ACTIVE
@ ADAPTER_GPIO_INIT_STATE_INPUT
@ ADAPTER_GPIO_INIT_STATE_INACTIVE
adapter_gpio_config_index
Adapter GPIO.
@ ADAPTER_GPIO_IDX_SWDIO_DIR
@ ADAPTER_GPIO_DRIVE_MODE_OPEN_SOURCE
@ ADAPTER_GPIO_DRIVE_MODE_OPEN_DRAIN
@ ADAPTER_GPIO_DRIVE_MODE_PUSH_PULL
bool transport_is_swd(void)
Returns true if the current debug session is using SWD as its transport.
int bitbang_execute_queue(struct jtag_command *cmd_queue)
const struct swd_driver bitbang_swd
#define DEBUG_CAP_TMS_SEQ
static struct device_config config
bool transport_is_jtag(void)
Returns true if the current debug session is using JTAG as its transport.
#define ERROR_JTAG_INIT_FAILED
static int linuxgpiod_quit(void)
static int linuxgpiod_blink(bool on)
struct adapter_driver linuxgpiod_adapter_driver
static const char *const linuxgpiod_transport[]
static bb_value_t linuxgpiod_read(void)
static void helper_release(enum adapter_gpio_config_index idx)
static bool linuxgpiod_jtag_mode_possible(void)
static struct bitbang_interface linuxgpiod_bitbang
static bool is_gpio_config_valid(enum adapter_gpio_config_index idx)
static struct gpiod_line * gpiod_line[ADAPTER_GPIO_IDX_NUM]
static struct jtag_interface linuxgpiod_interface
static int linuxgpiod_swdio_read(void)
static int helper_get_line(enum adapter_gpio_config_index idx)
static const struct adapter_gpio_config * adapter_gpio_config
static void linuxgpiod_swdio_drive(bool is_output)
static int linuxgpiod_write(int tck, int tms, int tdi)
static struct gpiod_chip * gpiod_chip[ADAPTER_GPIO_IDX_NUM]
static int linuxgpiod_swd_write(int swclk, int swdio)
static int linuxgpiod_reset(int trst, int srst)
static int linuxgpiod_init(void)
static bool linuxgpiod_swd_mode_possible(void)
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
Represents a driver for a debugging interface.
const char *const name
The name of the interface driver.
Configuration options for a single GPIO.
Low level callbacks (for bitbang).
bb_value_t(* read)(void)
Sample TDO and return the value.
Represents a driver for a debugging interface.
unsigned int supported
Bit vector listing capabilities exposed by this driver.