OpenOCD
linuxgpiod.c File Reference
Include dependency graph for linuxgpiod.c:

Go to the source code of this file.

Functions

static int helper_get_line (enum adapter_gpio_config_index idx)
 
static void helper_release (enum adapter_gpio_config_index idx)
 
static bool is_gpio_config_valid (enum adapter_gpio_config_index idx)
 
static int linuxgpiod_blink (int on)
 
static int linuxgpiod_init (void)
 
static bool linuxgpiod_jtag_mode_possible (void)
 
static int linuxgpiod_quit (void)
 
static bb_value_t linuxgpiod_read (void)
 
static int linuxgpiod_reset (int trst, int srst)
 
static bool linuxgpiod_swd_mode_possible (void)
 
static int linuxgpiod_swd_write (int swclk, int swdio)
 
static void linuxgpiod_swdio_drive (bool is_output)
 
static int linuxgpiod_swdio_read (void)
 
static int linuxgpiod_write (int tck, int tms, int tdi)
 

Variables

static const struct adapter_gpio_configadapter_gpio_config
 
static struct gpiod_chip * gpiod_chip [ADAPTER_GPIO_IDX_NUM] = {}
 
static struct gpiod_line * gpiod_line [ADAPTER_GPIO_IDX_NUM] = {}
 
static bool last_stored
 
static int last_swclk
 
static int last_swdio
 
struct adapter_driver linuxgpiod_adapter_driver
 
static struct bitbang_interface linuxgpiod_bitbang
 
static struct jtag_interface linuxgpiod_interface
 
static const char *const linuxgpiod_transport [] = { "swd", "jtag", NULL }
 
static bool swdio_input
 

Function Documentation

◆ helper_get_line()

◆ helper_release()

static void helper_release ( enum adapter_gpio_config_index  idx)
inlinestatic

Definition at line 257 of file linuxgpiod.c.

References gpiod_chip, gpiod_line, and NULL.

Referenced by linuxgpiod_quit().

◆ is_gpio_config_valid()

static bool is_gpio_config_valid ( enum adapter_gpio_config_index  idx)
static

◆ linuxgpiod_blink()

static int linuxgpiod_blink ( int  on)
static

Definition at line 183 of file linuxgpiod.c.

◆ linuxgpiod_init()

◆ linuxgpiod_jtag_mode_possible()

static bool linuxgpiod_jtag_mode_possible ( void  )
static

◆ linuxgpiod_quit()

static int linuxgpiod_quit ( void  )
static

Definition at line 269 of file linuxgpiod.c.

References ADAPTER_GPIO_IDX_NUM, ERROR_OK, helper_release(), and LOG_DEBUG.

Referenced by linuxgpiod_init().

◆ linuxgpiod_read()

static bb_value_t linuxgpiod_read ( void  )
static

Definition at line 47 of file linuxgpiod.c.

References ADAPTER_GPIO_IDX_TDO, BB_HIGH, BB_LOW, gpiod_line, and LOG_WARNING.

◆ linuxgpiod_reset()

static int linuxgpiod_reset ( int  trst,
int  srst 
)
static

◆ linuxgpiod_swd_mode_possible()

static bool linuxgpiod_swd_mode_possible ( void  )
static

Definition at line 248 of file linuxgpiod.c.

References ADAPTER_GPIO_IDX_SWCLK, ADAPTER_GPIO_IDX_SWDIO, and is_gpio_config_valid().

Referenced by linuxgpiod_init().

◆ linuxgpiod_swd_write()

static int linuxgpiod_swd_write ( int  swclk,
int  swdio 
)
static

◆ linuxgpiod_swdio_drive()

static void linuxgpiod_swdio_drive ( bool  is_output)
static

◆ linuxgpiod_swdio_read()

static int linuxgpiod_swdio_read ( void  )
static

Definition at line 109 of file linuxgpiod.c.

References ADAPTER_GPIO_IDX_SWDIO, gpiod_line, and LOG_WARNING.

◆ linuxgpiod_write()

static int linuxgpiod_write ( int  tck,
int  tms,
int  tdi 
)
static

Variable Documentation

◆ adapter_gpio_config

Definition at line 30 of file linuxgpiod.c.

◆ gpiod_chip

struct gpiod_chip* gpiod_chip[ADAPTER_GPIO_IDX_NUM] = {}
static

Definition at line 22 of file linuxgpiod.c.

Referenced by helper_get_line(), and helper_release().

◆ gpiod_line

◆ last_stored

bool last_stored
static

Definition at line 27 of file linuxgpiod.c.

Referenced by linuxgpiod_swd_write(), and linuxgpiod_swdio_drive().

◆ last_swclk

int last_swclk
static

Definition at line 25 of file linuxgpiod.c.

Referenced by linuxgpiod_swd_write().

◆ last_swdio

int last_swdio
static

Definition at line 26 of file linuxgpiod.c.

Referenced by linuxgpiod_swd_write().

◆ linuxgpiod_adapter_driver

struct adapter_driver linuxgpiod_adapter_driver
Initial value:
= {
.name = "linuxgpiod",
.transports = linuxgpiod_transport,
.init = linuxgpiod_init,
.quit = linuxgpiod_quit,
.reset = linuxgpiod_reset,
.jtag_ops = &linuxgpiod_interface,
.swd_ops = &bitbang_swd,
}
const struct swd_driver bitbang_swd
Definition: bitbang.c:569
static int linuxgpiod_quit(void)
Definition: linuxgpiod.c:269
static const char *const linuxgpiod_transport[]
Definition: linuxgpiod.c:430
static struct jtag_interface linuxgpiod_interface
Definition: linuxgpiod.c:432
static int linuxgpiod_reset(int trst, int srst)
Definition: linuxgpiod.c:210
static int linuxgpiod_init(void)
Definition: linuxgpiod.c:365

Definition at line 430 of file linuxgpiod.c.

◆ linuxgpiod_bitbang

struct bitbang_interface linuxgpiod_bitbang
static
Initial value:
= {
.read = linuxgpiod_read,
.write = linuxgpiod_write,
.swdio_read = linuxgpiod_swdio_read,
.swdio_drive = linuxgpiod_swdio_drive,
.swd_write = linuxgpiod_swd_write,
.blink = linuxgpiod_blink,
}
static bb_value_t linuxgpiod_read(void)
Definition: linuxgpiod.c:47
static int linuxgpiod_swdio_read(void)
Definition: linuxgpiod.c:109
static void linuxgpiod_swdio_drive(bool is_output)
Definition: linuxgpiod.c:122
static int linuxgpiod_write(int tck, int tms, int tdi)
Definition: linuxgpiod.c:66
static int linuxgpiod_swd_write(int swclk, int swdio)
Definition: linuxgpiod.c:157
static int linuxgpiod_blink(int on)
Definition: linuxgpiod.c:183

Definition at line 183 of file linuxgpiod.c.

Referenced by linuxgpiod_init().

◆ linuxgpiod_interface

struct jtag_interface linuxgpiod_interface
static
Initial value:
= {
.supported = DEBUG_CAP_TMS_SEQ,
.execute_queue = bitbang_execute_queue,
}
int bitbang_execute_queue(void)
Definition: bitbang.c:281
#define DEBUG_CAP_TMS_SEQ
Definition: interface.h:189

Definition at line 430 of file linuxgpiod.c.

◆ linuxgpiod_transport

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

Definition at line 430 of file linuxgpiod.c.

◆ swdio_input

bool swdio_input
static

Definition at line 28 of file linuxgpiod.c.

Referenced by linuxgpiod_swd_write(), and linuxgpiod_swdio_drive().