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

Go to the source code of this file.

Macros

#define SERVER_ADDRESS   "127.0.0.1"
 
#define SERVER_PORT   5555
 

Functions

 COMMAND_HANDLER (jtag_dpi_set_address)
 
 COMMAND_HANDLER (jtag_dpi_set_port)
 
static int jtag_dpi_execute_queue (void)
 
static int jtag_dpi_init (void)
 
static int jtag_dpi_quit (void)
 
static int jtag_dpi_reset (int trst, int srst)
 jtag_dpi_reset - ask to reset the JTAG device More...
 
static int jtag_dpi_runtest (int cycles)
 
static int jtag_dpi_scan (struct scan_command *cmd)
 jtag_dpi_scan - launches a DR-scan or IR-scan More...
 
static int jtag_dpi_stableclocks (int cycles)
 
static int read_sock (char *buf, size_t len)
 
static int write_sock (char *buf, size_t len)
 

Variables

struct adapter_driver jtag_dpi_adapter_driver
 
static const struct command_registration jtag_dpi_command_handlers []
 
static struct jtag_interface jtag_dpi_interface
 
static const struct command_registration jtag_dpi_subcommand_handlers []
 
static uint8_t * last_ir_buf
 
static int last_ir_num_bits
 
static struct sockaddr_in serv_addr
 
static char * server_address
 
static uint16_t server_port = SERVER_PORT
 
static int sockfd
 

Macro Definition Documentation

◆ SERVER_ADDRESS

#define SERVER_ADDRESS   "127.0.0.1"

Definition at line 27 of file jtag_dpi.c.

◆ SERVER_PORT

#define SERVER_PORT   5555

Definition at line 28 of file jtag_dpi.c.

Function Documentation

◆ COMMAND_HANDLER() [1/2]

COMMAND_HANDLER ( jtag_dpi_set_address  )

◆ COMMAND_HANDLER() [2/2]

COMMAND_HANDLER ( jtag_dpi_set_port  )

◆ jtag_dpi_execute_queue()

◆ jtag_dpi_init()

static int jtag_dpi_init ( void  )
static

◆ jtag_dpi_quit()

static int jtag_dpi_quit ( void  )
static

Definition at line 315 of file jtag_dpi.c.

References NULL, server_address, and sockfd.

◆ jtag_dpi_reset()

static int jtag_dpi_reset ( int  trst,
int  srst 
)
static

jtag_dpi_reset - ask to reset the JTAG device

Parameters
trst1 if TRST is to be asserted
srst1 if SRST is to be asserted

Definition at line 74 of file jtag_dpi.c.

References ERROR_FAIL, ERROR_OK, LOG_DEBUG_IO, LOG_ERROR, and write_sock().

Referenced by jtag_dpi_execute_queue().

◆ jtag_dpi_runtest()

static int jtag_dpi_runtest ( int  cycles)
static

◆ jtag_dpi_scan()

static int jtag_dpi_scan ( struct scan_command cmd)
static

jtag_dpi_scan - launches a DR-scan or IR-scan

Parameters
cmdthe command to launch

Launch a JTAG IR-scan or DR-scan

Returns ERROR_OK if OK, ERROR_xxx if a read/write error occurred.

Definition at line 107 of file jtag_dpi.c.

References cmd, DIV_ROUND_UP, ERROR_FAIL, ERROR_OK, jtag_build_buffer(), jtag_read_buffer(), last_ir_buf, last_ir_num_bits, LOG_ERROR, read_sock(), and write_sock().

Referenced by jtag_dpi_execute_queue().

◆ jtag_dpi_stableclocks()

static int jtag_dpi_stableclocks ( int  cycles)
static

Definition at line 220 of file jtag_dpi.c.

References jtag_dpi_runtest().

Referenced by jtag_dpi_execute_queue().

◆ read_sock()

static int read_sock ( char *  buf,
size_t  len 
)
static

Definition at line 54 of file jtag_dpi.c.

References ERROR_FAIL, ERROR_OK, LOG_ERROR, and sockfd.

Referenced by jtag_dpi_runtest(), and jtag_dpi_scan().

◆ write_sock()

static int write_sock ( char *  buf,
size_t  len 
)
static

Definition at line 39 of file jtag_dpi.c.

References ERROR_FAIL, ERROR_OK, LOG_ERROR, and sockfd.

Referenced by jtag_dpi_reset(), jtag_dpi_runtest(), and jtag_dpi_scan().

Variable Documentation

◆ jtag_dpi_adapter_driver

struct adapter_driver jtag_dpi_adapter_driver
Initial value:
= {
.name = "jtag_dpi",
.transports = jtag_only,
.init = jtag_dpi_init,
.quit = jtag_dpi_quit,
.reset = jtag_dpi_reset,
.jtag_ops = &jtag_dpi_interface,
}
const char *const jtag_only[]
Definition: adapter.c:31
static struct jtag_interface jtag_dpi_interface
Definition: jtag_dpi.c:394
static int jtag_dpi_reset(int trst, int srst)
jtag_dpi_reset - ask to reset the JTAG device
Definition: jtag_dpi.c:74
static const struct command_registration jtag_dpi_command_handlers[]
Definition: jtag_dpi.c:383
static int jtag_dpi_quit(void)
Definition: jtag_dpi.c:315
static int jtag_dpi_init(void)
Definition: jtag_dpi.c:267

Definition at line 337 of file jtag_dpi.c.

◆ jtag_dpi_command_handlers

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

Definition at line 337 of file jtag_dpi.c.

◆ jtag_dpi_interface

struct jtag_interface jtag_dpi_interface
static
Initial value:
= {
.supported = DEBUG_CAP_TMS_SEQ,
.execute_queue = jtag_dpi_execute_queue,
}
#define DEBUG_CAP_TMS_SEQ
Definition: interface.h:189
static int jtag_dpi_execute_queue(void)
Definition: jtag_dpi.c:225

Definition at line 337 of file jtag_dpi.c.

◆ jtag_dpi_subcommand_handlers

const struct command_registration jtag_dpi_subcommand_handlers[]
static
Initial value:
= {
{
.name = "set_port",
.handler = &jtag_dpi_set_port,
.mode = COMMAND_CONFIG,
.help = "set the port of the DPI server",
.usage = "[port]",
},
{
.name = "set_address",
.handler = &jtag_dpi_set_address,
.mode = COMMAND_CONFIG,
.help = "set the address of the DPI server",
.usage = "[address]",
},
}
@ COMMAND_CONFIG
Definition: command.h:41

Definition at line 337 of file jtag_dpi.c.

◆ last_ir_buf

uint8_t* last_ir_buf
static

Definition at line 36 of file jtag_dpi.c.

Referenced by jtag_dpi_runtest(), and jtag_dpi_scan().

◆ last_ir_num_bits

int last_ir_num_bits
static

Definition at line 37 of file jtag_dpi.c.

Referenced by jtag_dpi_runtest(), and jtag_dpi_scan().

◆ serv_addr

struct sockaddr_in serv_addr
static

Definition at line 33 of file jtag_dpi.c.

Referenced by jtag_dpi_init().

◆ server_address

char* server_address
static

Definition at line 31 of file jtag_dpi.c.

Referenced by COMMAND_HANDLER(), jtag_dpi_init(), and jtag_dpi_quit().

◆ server_port

uint16_t server_port = SERVER_PORT
static

Definition at line 30 of file jtag_dpi.c.

Referenced by COMMAND_HANDLER(), and jtag_dpi_init().

◆ sockfd

int sockfd
static

Definition at line 33 of file jtag_dpi.c.

Referenced by jtag_dpi_init(), jtag_dpi_quit(), read_sock(), and write_sock().