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

Go to the source code of this file.

Data Structures

struct  shift_result
 

Macros

#define MAX_BUF_SIZE   (BIT(31) - 11)
 
#define MAX_SHIFT_RESULTS   256
 

Functions

 COMMAND_HANDLER (xvc_handle_host_command)
 
 COMMAND_HANDLER (xvc_handle_port_command)
 
static int read_frame (int sock_id, unsigned char *ptr, unsigned int size)
 
static unsigned int xvc_bits_to_bytes (unsigned int bits)
 
static int xvc_fill_buffer (void)
 
static int xvc_flush (void)
 
static int xvc_getinfo (void)
 
static int xvc_init (void)
 
static int xvc_init_tcp (int *fd)
 
static int xvc_init_unix (int *fd)
 
static int xvc_khz (int khz, int *jtag_speed)
 
static int xvc_queue (const uint8_t *tms, unsigned int tms_offset, const uint8_t *tdi, unsigned int tdi_offset, uint8_t *tdo, unsigned int tdo_offset, unsigned int length)
 
static int xvc_quit (void)
 
static int xvc_reset (int trst, int srst)
 
static int xvc_set_tck (void)
 
static int xvc_speed (int speed)
 
static int xvc_speed_div (int speed, int *khz)
 
static void xvc_tap_end_state (enum tap_state state)
 
static int xvc_tap_execute_queue (struct jtag_command *cmd_queue)
 
static int xvc_tap_execute_tms (struct jtag_command *cmd)
 
static int xvc_tap_path_move (struct pathmove_command *cmd)
 
static int xvc_tap_runtest (unsigned int num_cycles)
 
static int xvc_tap_scan_write (struct scan_command *cmd)
 
static unsigned int xvc_tap_stableclocks (unsigned int num_cycles)
 
static int xvc_tap_state_move (int skip)
 

Variables

static unsigned int last_used_bits
 
static unsigned int pending_shift_results
 
static struct shift_result shift_result_buffer [MAX_SHIFT_RESULTS]
 
struct adapter_driver xvc_adapter_driver
 
static const struct command_registration xvc_command_handlers []
 
static int xvc_fd
 
static char * xvc_host
 
static struct jtag_interface xvc_interface
 
static unsigned int xvc_max_usable_vector_size
 
static unsigned int xvc_max_vector_size
 
static char * xvc_port
 
static uint8_t * xvc_send_buf
 
static const struct command_registration xvc_subcommand_handlers []
 
static uint32_t xvc_tck
 
static uint8_t * xvc_tdi_buf
 
static uint8_t * xvc_tdo_buf
 
static uint8_t * xvc_tms_buf
 
static uint32_t xvc_used_bits
 

Macro Definition Documentation

◆ MAX_BUF_SIZE

#define MAX_BUF_SIZE   (BIT(31) - 11)

Definition at line 68 of file xvc.c.

◆ MAX_SHIFT_RESULTS

#define MAX_SHIFT_RESULTS   256

Definition at line 69 of file xvc.c.

Function Documentation

◆ COMMAND_HANDLER() [1/2]

COMMAND_HANDLER ( xvc_handle_host_command  )

Definition at line 418 of file xvc.c.

References CMD_ARGC, CMD_ARGV, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and xvc_host.

◆ COMMAND_HANDLER() [2/2]

COMMAND_HANDLER ( xvc_handle_port_command  )

Definition at line 407 of file xvc.c.

References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, NULL, and xvc_port.

◆ read_frame()

static int read_frame ( int  sock_id,
unsigned char *  ptr,
unsigned int  size 
)
static

Definition at line 104 of file xvc.c.

References ERROR_FAIL, ERROR_OK, LOG_ERROR, read_socket(), size, and state.

Referenced by xvc_fill_buffer().

◆ xvc_bits_to_bytes()

static unsigned int xvc_bits_to_bytes ( unsigned int  bits)
static

Definition at line 77 of file xvc.c.

References bits, and DIV_ROUND_UP.

Referenced by xvc_fill_buffer(), and xvc_flush().

◆ xvc_fill_buffer()

◆ xvc_flush()

◆ xvc_getinfo()

static int xvc_getinfo ( void  )
static

◆ xvc_init()

static int xvc_init ( void  )
static

◆ xvc_init_tcp()

static int xvc_init_tcp ( int *  fd)
static

Definition at line 325 of file xvc.c.

References close_socket(), ERROR_FAIL, ERROR_OK, LOG_ERROR, LOG_INFO, xvc_host, and xvc_port.

Referenced by xvc_init().

◆ xvc_init_unix()

static int xvc_init_unix ( int *  fd)
static

Definition at line 379 of file xvc.c.

References addr, ERROR_FAIL, ERROR_OK, LOG_ERROR, LOG_INFO, and xvc_host.

Referenced by xvc_init().

◆ xvc_khz()

static int xvc_khz ( int  khz,
int *  jtag_speed 
)
static

Definition at line 97 of file xvc.c.

References ERROR_OK.

◆ xvc_queue()

static int xvc_queue ( const uint8_t *  tms,
unsigned int  tms_offset,
const uint8_t *  tdi,
unsigned int  tdi_offset,
uint8_t *  tdo,
unsigned int  tdo_offset,
unsigned int  length 
)
static

◆ xvc_quit()

static int xvc_quit ( void  )
static

◆ xvc_reset()

static int xvc_reset ( int  trst,
int  srst 
)
static

Definition at line 313 of file xvc.c.

References ERROR_OK, and LOG_WARNING.

◆ xvc_set_tck()

static int xvc_set_tck ( void  )
static

Definition at line 270 of file xvc.c.

References ERROR_FAIL, ERROR_OK, h_u32_to_le(), le_to_h_u32(), LOG_ERROR, LOG_INFO, read_socket(), write_socket(), xvc_fd, and xvc_tck.

Referenced by xvc_init(), and xvc_speed().

◆ xvc_speed()

static int xvc_speed ( int  speed)
static

Definition at line 82 of file xvc.c.

References xvc_set_tck(), and xvc_tck.

◆ xvc_speed_div()

static int xvc_speed_div ( int  speed,
int *  khz 
)
static

Definition at line 90 of file xvc.c.

References ERROR_OK.

◆ xvc_tap_end_state()

static void xvc_tap_end_state ( enum tap_state  state)
static

Definition at line 506 of file xvc.c.

References state, tap_is_state_stable(), and tap_set_end_state().

Referenced by xvc_tap_runtest(), and xvc_tap_scan_write().

◆ xvc_tap_execute_queue()

static int xvc_tap_execute_queue ( struct jtag_command cmd_queue)
static

Definition at line 667 of file xvc.c.

◆ xvc_tap_execute_tms()

static int xvc_tap_execute_tms ( struct jtag_command cmd)
static

Definition at line 527 of file xvc.c.

References bits, cmd, ERROR_FAIL, ERROR_OK, LOG_DEBUG_IO, NULL, and xvc_queue().

◆ xvc_tap_path_move()

static int xvc_tap_path_move ( struct pathmove_command cmd)
static

◆ xvc_tap_runtest()

static int xvc_tap_runtest ( unsigned int  num_cycles)
static

◆ xvc_tap_scan_write()

◆ xvc_tap_stableclocks()

static unsigned int xvc_tap_stableclocks ( unsigned int  num_cycles)
static

Definition at line 572 of file xvc.c.

References ERROR_OK, NULL, tap_get_state(), TAP_RESET, and xvc_queue().

Referenced by xvc_tap_runtest().

◆ xvc_tap_state_move()

static int xvc_tap_state_move ( int  skip)
static

Variable Documentation

◆ last_used_bits

unsigned int last_used_bits
static

Definition at line 70 of file xvc.c.

Referenced by xvc_fill_buffer(), xvc_flush(), and xvc_init().

◆ pending_shift_results

unsigned int pending_shift_results
static

Definition at line 71 of file xvc.c.

Referenced by xvc_fill_buffer(), xvc_init(), and xvc_queue().

◆ shift_result_buffer

struct shift_result shift_result_buffer[MAX_SHIFT_RESULTS]
static

Definition at line 71 of file xvc.c.

Referenced by xvc_fill_buffer(), and xvc_queue().

◆ xvc_adapter_driver

struct adapter_driver xvc_adapter_driver
Initial value:
= {
.name = "xvc",
.transport_ids = TRANSPORT_JTAG,
.transport_preferred_id = TRANSPORT_JTAG,
.commands = xvc_command_handlers,
.init = xvc_init,
.quit = xvc_quit,
.reset = &xvc_reset,
.speed = &xvc_speed,
.khz = &xvc_khz,
.speed_div = &xvc_speed_div,
.jtag_ops = &xvc_interface,
}
#define TRANSPORT_JTAG
Definition: transport.h:19
static int xvc_reset(int trst, int srst)
Definition: xvc.c:313
static int xvc_quit(void)
Definition: xvc.c:490
static struct jtag_interface xvc_interface
Definition: xvc.c:730
static int xvc_khz(int khz, int *jtag_speed)
Definition: xvc.c:97
static int xvc_speed_div(int speed, int *khz)
Definition: xvc.c:90
static const struct command_registration xvc_command_handlers[]
Definition: xvc.c:447
static int xvc_init(void)
Definition: xvc.c:458
static int xvc_speed(int speed)
Definition: xvc.c:82

Definition at line 667 of file xvc.c.

◆ xvc_command_handlers

const struct command_registration xvc_command_handlers[]
static
Initial value:
= {
{
.name = "xvc",
.mode = COMMAND_ANY,
.help = "perform XVC driver configuration",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:256
@ COMMAND_ANY
Definition: command.h:42
const char * usage
a string listing the options and arguments, required or optional
Definition: command.h:244
static const struct command_registration xvc_subcommand_handlers[]
Definition: xvc.c:427

Definition at line 418 of file xvc.c.

◆ xvc_fd

int xvc_fd
static

Definition at line 40 of file xvc.c.

Referenced by xvc_fill_buffer(), xvc_flush(), xvc_getinfo(), xvc_init(), xvc_quit(), and xvc_set_tck().

◆ xvc_host

char* xvc_host
static

Definition at line 36 of file xvc.c.

Referenced by COMMAND_HANDLER(), xvc_init_tcp(), xvc_init_unix(), and xvc_quit().

◆ xvc_interface

struct jtag_interface xvc_interface
static
Initial value:
= {
.execute_queue = &xvc_tap_execute_queue,
.supported = DEBUG_CAP_TMS_SEQ,
}
#define DEBUG_CAP_TMS_SEQ
Definition: interface.h:188
static int xvc_tap_execute_queue(struct jtag_command *cmd_queue)
Definition: xvc.c:667

Definition at line 667 of file xvc.c.

◆ xvc_max_usable_vector_size

unsigned int xvc_max_usable_vector_size
static

Definition at line 50 of file xvc.c.

Referenced by xvc_fill_buffer(), xvc_flush(), xvc_getinfo(), and xvc_queue().

◆ xvc_max_vector_size

unsigned int xvc_max_vector_size
static

Definition at line 48 of file xvc.c.

Referenced by xvc_getinfo().

◆ xvc_port

char* xvc_port
static

Definition at line 37 of file xvc.c.

Referenced by COMMAND_HANDLER(), xvc_init(), xvc_init_tcp(), and xvc_quit().

◆ xvc_send_buf

uint8_t* xvc_send_buf
static

Definition at line 43 of file xvc.c.

Referenced by xvc_flush(), xvc_getinfo(), and xvc_quit().

◆ xvc_subcommand_handlers

const struct command_registration xvc_subcommand_handlers[]
static
Initial value:
= {
{
.name = "port",
.handler = xvc_handle_port_command,
.mode = COMMAND_CONFIG,
.help =
"Set the port to use to connect to the XVC remote server.\n"
" If 0 or unset, use unix sockets to connect to the remote server.",
.usage = "port_number",
},
{
.name = "host",
.handler = xvc_handle_host_command,
.mode = COMMAND_CONFIG,
.help = "Set the host to use or UNIX socket to connect to the remote XVC server.",
.usage = "host_name",
},
}
@ COMMAND_CONFIG
Definition: command.h:41

Definition at line 418 of file xvc.c.

◆ xvc_tck

uint32_t xvc_tck
static

Definition at line 38 of file xvc.c.

Referenced by xvc_init(), xvc_set_tck(), and xvc_speed().

◆ xvc_tdi_buf

uint8_t* xvc_tdi_buf
static

Definition at line 42 of file xvc.c.

Referenced by xvc_flush(), xvc_getinfo(), xvc_queue(), and xvc_quit().

◆ xvc_tdo_buf

uint8_t* xvc_tdo_buf
static

Definition at line 44 of file xvc.c.

Referenced by xvc_fill_buffer(), xvc_getinfo(), and xvc_quit().

◆ xvc_tms_buf

uint8_t* xvc_tms_buf
static

Definition at line 41 of file xvc.c.

Referenced by xvc_flush(), xvc_getinfo(), xvc_queue(), and xvc_quit().

◆ xvc_used_bits

uint32_t xvc_used_bits
static

Definition at line 45 of file xvc.c.

Referenced by xvc_flush(), xvc_init(), and xvc_queue().