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

Go to the source code of this file.

Macros

#define REMOTE_BITBANG_HOST_MAX   255
 

Enumerations

enum  block_bool { NO_BLOCK , BLOCK }
 
enum  flush_bool_t { NO_FLUSH , FLUSH_SEND_BUF }
 

Functions

static bb_value_t char_to_int (int c)
 
 COMMAND_HANDLER (remote_bitbang_handle_remote_bitbang_host_command)
 
 COMMAND_HANDLER (remote_bitbang_handle_remote_bitbang_port_command)
 
 COMMAND_HANDLER (remote_bitbang_handle_remote_bitbang_use_remote_sleep_command)
 
static int remote_bitbang_blink (bool on)
 
static int remote_bitbang_execute_queue (struct jtag_command *cmd_queue)
 
static int remote_bitbang_fill_buf (enum block_bool block)
 
static int remote_bitbang_flush (void)
 
static int remote_bitbang_init (void)
 
static int remote_bitbang_init_tcp (void)
 
static int remote_bitbang_init_unix (void)
 
static int remote_bitbang_queue (int c, flush_bool_t flush)
 
static int remote_bitbang_quit (void)
 
static bb_value_t remote_bitbang_read_sample (void)
 
static unsigned int remote_bitbang_recv_buf_contiguous_available_space (void)
 
static bool remote_bitbang_recv_buf_empty (void)
 
static bool remote_bitbang_recv_buf_full (void)
 
static int remote_bitbang_reset (int trst, int srst)
 
static int remote_bitbang_sample (void)
 
static int remote_bitbang_sleep (unsigned int microseconds)
 
static int remote_bitbang_swd_write (int swclk, int swdio)
 
static void remote_bitbang_swdio_drive (bool is_output)
 
static int remote_bitbang_swdio_read (void)
 
static int remote_bitbang_write (int tck, int tms, int tdi)
 

Variables

struct adapter_driver remote_bitbang_adapter_driver
 
static struct bitbang_interface remote_bitbang_bitbang
 
static const struct command_registration remote_bitbang_command_handlers []
 
static int remote_bitbang_fd
 
static char * remote_bitbang_host
 
static struct jtag_interface remote_bitbang_interface
 
static char * remote_bitbang_port
 
static char remote_bitbang_recv_buf [256]
 
static unsigned int remote_bitbang_recv_buf_end
 
static unsigned int remote_bitbang_recv_buf_start
 
static uint8_t remote_bitbang_send_buf [512]
 
static unsigned int remote_bitbang_send_buf_used
 
static const struct command_registration remote_bitbang_subcommand_handlers []
 
static const char *const remote_bitbang_transports [] = { "jtag", "swd", NULL }
 
static bool use_remote_sleep
 

Macro Definition Documentation

◆ REMOTE_BITBANG_HOST_MAX

#define REMOTE_BITBANG_HOST_MAX   255

Definition at line 25 of file remote_bitbang.c.

Enumeration Type Documentation

◆ block_bool

enum block_bool
Enumerator
NO_BLOCK 
BLOCK 

Definition at line 87 of file remote_bitbang.c.

◆ flush_bool_t

Enumerator
NO_FLUSH 
FLUSH_SEND_BUF 

Definition at line 148 of file remote_bitbang.c.

Function Documentation

◆ char_to_int()

static bb_value_t char_to_int ( int  c)
static

Definition at line 179 of file remote_bitbang.c.

References BB_ERROR, BB_HIGH, BB_LOW, LOG_ERROR, and remote_bitbang_quit().

Referenced by remote_bitbang_read_sample().

◆ COMMAND_HANDLER() [1/3]

COMMAND_HANDLER ( remote_bitbang_handle_remote_bitbang_host_command  )

◆ COMMAND_HANDLER() [2/3]

COMMAND_HANDLER ( remote_bitbang_handle_remote_bitbang_port_command  )

◆ COMMAND_HANDLER() [3/3]

COMMAND_HANDLER ( remote_bitbang_handle_remote_bitbang_use_remote_sleep_command  )

◆ remote_bitbang_blink()

static int remote_bitbang_blink ( bool  on)
static

Definition at line 254 of file remote_bitbang.c.

References FLUSH_SEND_BUF, and remote_bitbang_queue().

◆ remote_bitbang_execute_queue()

static int remote_bitbang_execute_queue ( struct jtag_command cmd_queue)
static

Definition at line 466 of file remote_bitbang.c.

◆ remote_bitbang_fill_buf()

◆ remote_bitbang_flush()

◆ remote_bitbang_init()

◆ remote_bitbang_init_tcp()

static int remote_bitbang_init_tcp ( void  )
static

◆ remote_bitbang_init_unix()

static int remote_bitbang_init_unix ( void  )
static

Definition at line 344 of file remote_bitbang.c.

References addr, ERROR_FAIL, LOG_ERROR, LOG_INFO, log_socket_error(), and remote_bitbang_host.

Referenced by remote_bitbang_init().

◆ remote_bitbang_queue()

◆ remote_bitbang_quit()

static int remote_bitbang_quit ( void  )
static

◆ remote_bitbang_read_sample()

◆ remote_bitbang_recv_buf_contiguous_available_space()

static unsigned int remote_bitbang_recv_buf_contiguous_available_space ( void  )
static

◆ remote_bitbang_recv_buf_empty()

static bool remote_bitbang_recv_buf_empty ( void  )
static

◆ remote_bitbang_recv_buf_full()

static bool remote_bitbang_recv_buf_full ( void  )
static

◆ remote_bitbang_reset()

static int remote_bitbang_reset ( int  trst,
int  srst 
)
static

Definition at line 220 of file remote_bitbang.c.

References FLUSH_SEND_BUF, and remote_bitbang_queue().

◆ remote_bitbang_sample()

static int remote_bitbang_sample ( void  )
static

◆ remote_bitbang_sleep()

static int remote_bitbang_sleep ( unsigned int  microseconds)
static

◆ remote_bitbang_swd_write()

static int remote_bitbang_swd_write ( int  swclk,
int  swdio 
)
static

Definition at line 275 of file remote_bitbang.c.

◆ remote_bitbang_swdio_drive()

static void remote_bitbang_swdio_drive ( bool  is_output)
static

Definition at line 260 of file remote_bitbang.c.

References ERROR_FAIL, FLUSH_SEND_BUF, LOG_ERROR, and remote_bitbang_queue().

◆ remote_bitbang_swdio_read()

static int remote_bitbang_swdio_read ( void  )
static

◆ remote_bitbang_write()

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

Definition at line 214 of file remote_bitbang.c.

References NO_FLUSH, and remote_bitbang_queue().

Variable Documentation

◆ remote_bitbang_adapter_driver

struct adapter_driver remote_bitbang_adapter_driver
Initial value:
= {
.name = "remote_bitbang",
.swd_ops = &bitbang_swd,
}
const struct swd_driver bitbang_swd
Definition: bitbang.c:614
static const char *const remote_bitbang_transports[]
static int remote_bitbang_init(void)
static struct jtag_interface remote_bitbang_interface
static int remote_bitbang_reset(int trst, int srst)
static const struct command_registration remote_bitbang_command_handlers[]
static int remote_bitbang_quit(void)

Definition at line 466 of file remote_bitbang.c.

◆ remote_bitbang_bitbang

struct bitbang_interface remote_bitbang_bitbang
static
Initial value:
= {
.buf_size = sizeof(remote_bitbang_recv_buf) - 1,
.read_sample = &remote_bitbang_read_sample,
.swdio_read = &remote_bitbang_swdio_read,
.swdio_drive = &remote_bitbang_swdio_drive,
.swd_write = &remote_bitbang_swd_write,
}
static int remote_bitbang_swdio_read(void)
static char remote_bitbang_recv_buf[256]
static int remote_bitbang_sample(void)
static int remote_bitbang_swd_write(int swclk, int swdio)
static int remote_bitbang_blink(bool on)
static void remote_bitbang_swdio_drive(bool is_output)
static int remote_bitbang_sleep(unsigned int microseconds)
static bb_value_t remote_bitbang_read_sample(void)
static int remote_bitbang_write(int tck, int tms, int tdi)
static int remote_bitbang_flush(void)

Definition at line 275 of file remote_bitbang.c.

Referenced by remote_bitbang_init().

◆ remote_bitbang_command_handlers

const struct command_registration remote_bitbang_command_handlers[]
static
Initial value:
= {
{
.name = "remote_bitbang",
.mode = COMMAND_ANY,
.help = "perform remote_bitbang management",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:253
@ COMMAND_ANY
Definition: command.h:42
static const struct command_registration remote_bitbang_subcommand_handlers[]
const char * usage
a string listing the options and arguments, required or optional
Definition: command.h:241

Definition at line 417 of file remote_bitbang.c.

◆ remote_bitbang_fd

int remote_bitbang_fd
static

◆ remote_bitbang_host

char* remote_bitbang_host
static

◆ remote_bitbang_interface

struct jtag_interface remote_bitbang_interface
static
Initial value:
= {
.execute_queue = &remote_bitbang_execute_queue,
}
static int remote_bitbang_execute_queue(struct jtag_command *cmd_queue)

Definition at line 466 of file remote_bitbang.c.

◆ remote_bitbang_port

char* remote_bitbang_port
static

◆ remote_bitbang_recv_buf

◆ remote_bitbang_recv_buf_end

◆ remote_bitbang_recv_buf_start

◆ remote_bitbang_send_buf

uint8_t remote_bitbang_send_buf[512]
static

Definition at line 31 of file remote_bitbang.c.

Referenced by remote_bitbang_flush(), and remote_bitbang_queue().

◆ remote_bitbang_send_buf_used

unsigned int remote_bitbang_send_buf_used
static

Definition at line 32 of file remote_bitbang.c.

Referenced by remote_bitbang_flush(), and remote_bitbang_queue().

◆ remote_bitbang_subcommand_handlers

const struct command_registration remote_bitbang_subcommand_handlers[]
static
Initial value:
= {
{
.name = "port",
.handler = remote_bitbang_handle_remote_bitbang_port_command,
.mode = COMMAND_CONFIG,
.help = "Set the port to use to connect to the remote jtag.\n"
" if 0 or unset, use unix sockets to connect to the remote jtag.",
.usage = "port_number",
},
{
.name = "host",
.handler = remote_bitbang_handle_remote_bitbang_host_command,
.mode = COMMAND_CONFIG,
.help = "Set the host to use to connect to the remote jtag.\n"
" if port is 0 or unset, this is the name of the unix socket to use.",
.usage = "host_name",
},
{
.name = "use_remote_sleep",
.handler = remote_bitbang_handle_remote_bitbang_use_remote_sleep_command,
.mode = COMMAND_CONFIG,
.help = "Rather than executing sleep locally, include delays in the "
"instruction stream for the remote host.",
.usage = "(on|off)",
},
}
@ COMMAND_CONFIG
Definition: command.h:41

Definition at line 417 of file remote_bitbang.c.

◆ remote_bitbang_transports

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

Definition at line 415 of file remote_bitbang.c.

◆ use_remote_sleep

bool use_remote_sleep
static

Definition at line 34 of file remote_bitbang.c.

Referenced by COMMAND_HANDLER(), and remote_bitbang_sleep().