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

Go to the source code of this file.

Data Structures

struct  ipdbg_connection
 
struct  ipdbg_fifo
 
struct  ipdbg_hub
 
struct  ipdbg_service
 
struct  ipdbg_virtual_ir_info
 

Macros

#define IPDBG_BUFFER_SIZE   16384
 
#define IPDBG_MAX_DR_LENGTH   13
 
#define IPDBG_MAX_NUM_OF_OPTIONS   14
 
#define IPDBG_MIN_DR_LENGTH   11
 
#define IPDBG_MIN_NUM_OF_OPTIONS   4
 
#define IPDBG_TCP_PORT_STR_MAX_LENGTH   6
 

Functions

 COMMAND_HANDLER (handle_ipdbg_command)
 
static void ipdbg_add_hub (struct ipdbg_hub *hub)
 
static void ipdbg_add_service (struct ipdbg_service *service)
 
static void ipdbg_append_to_fifo (struct ipdbg_fifo *fifo, char data)
 
static int ipdbg_create_hub (struct jtag_tap *tap, uint32_t user_instruction, uint8_t data_register_length, struct ipdbg_virtual_ir_info *virtual_ir, struct ipdbg_hub **hub)
 
static int ipdbg_create_service (struct ipdbg_hub *hub, uint8_t tool, struct ipdbg_service **service, uint16_t port)
 
static int ipdbg_distribute_data_from_hub (struct ipdbg_hub *hub, uint32_t up)
 
static bool ipdbg_fifo_is_empty (struct ipdbg_fifo *fifo)
 
static bool ipdbg_fifo_is_full (struct ipdbg_fifo *fifo)
 
static struct ipdbg_hubipdbg_find_hub (struct jtag_tap *tap, uint32_t user_instruction, struct ipdbg_virtual_ir_info *virtual_ir)
 
static struct ipdbg_serviceipdbg_find_service (struct ipdbg_hub *hub, uint8_t tool)
 
static void ipdbg_free_hub (struct ipdbg_hub *hub)
 
static char ipdbg_get_from_fifo (struct ipdbg_fifo *fifo)
 
static void ipdbg_init_fifo (struct ipdbg_fifo *fifo)
 
static void ipdbg_init_scan_field (struct scan_field *fields, uint8_t *in_value, int num_bits, const uint8_t *out_value)
 
static int ipdbg_jtag_transfer_byte (struct ipdbg_hub *hub, size_t tool, struct ipdbg_connection *connection)
 
static int ipdbg_max_tools_from_data_register_length (uint8_t data_register_length)
 
static int ipdbg_move_buffer_to_connection (struct connection *conn, struct ipdbg_fifo *fifo)
 
static int ipdbg_on_connection_closed (struct connection *connection)
 
static int ipdbg_on_connection_input (struct connection *connection)
 
static int ipdbg_on_new_connection (struct connection *connection)
 
static int ipdbg_polling_callback (void *priv)
 
int ipdbg_register_commands (struct command_context *cmd_ctx)
 
static int ipdbg_remove_hub (struct ipdbg_hub *hub)
 
static int ipdbg_remove_service (struct ipdbg_service *service)
 
static int ipdbg_shift_data (struct ipdbg_hub *hub, uint32_t dn_data, uint32_t *up_data)
 
static int ipdbg_shift_instr (struct ipdbg_hub *hub, uint32_t instr)
 
static int ipdbg_shift_vir (struct ipdbg_hub *hub)
 
static int ipdbg_start (uint16_t port, struct jtag_tap *tap, uint32_t user_instruction, uint8_t data_register_length, struct ipdbg_virtual_ir_info *virtual_ir, uint8_t tool)
 
static int ipdbg_start_polling (struct ipdbg_service *service, struct connection *connection)
 
static int ipdbg_stop (struct jtag_tap *tap, uint32_t user_instruction, struct ipdbg_virtual_ir_info *virtual_ir, uint8_t tool)
 
static int ipdbg_stop_polling (struct ipdbg_service *service)
 
static void ipdbg_zero_rd_idx (struct ipdbg_fifo *fifo)
 

Variables

static const struct command_registration ipdbg_command_handlers []
 
static struct ipdbg_hubipdbg_first_hub
 
static struct ipdbg_serviceipdbg_first_service
 
static const struct service_driver ipdbg_service_driver
 

Macro Definition Documentation

◆ IPDBG_BUFFER_SIZE

#define IPDBG_BUFFER_SIZE   16384

Definition at line 16 of file ipdbg.c.

◆ IPDBG_MAX_DR_LENGTH

#define IPDBG_MAX_DR_LENGTH   13

Definition at line 20 of file ipdbg.c.

◆ IPDBG_MAX_NUM_OF_OPTIONS

#define IPDBG_MAX_NUM_OF_OPTIONS   14

Definition at line 18 of file ipdbg.c.

◆ IPDBG_MIN_DR_LENGTH

#define IPDBG_MIN_DR_LENGTH   11

Definition at line 19 of file ipdbg.c.

◆ IPDBG_MIN_NUM_OF_OPTIONS

#define IPDBG_MIN_NUM_OF_OPTIONS   4

Definition at line 17 of file ipdbg.c.

◆ IPDBG_TCP_PORT_STR_MAX_LENGTH

#define IPDBG_TCP_PORT_STR_MAX_LENGTH   6

Definition at line 21 of file ipdbg.c.

Function Documentation

◆ COMMAND_HANDLER()

◆ ipdbg_add_hub()

static void ipdbg_add_hub ( struct ipdbg_hub hub)
static

Definition at line 222 of file ipdbg.c.

References ipdbg_first_hub, and ipdbg_hub::next.

Referenced by ipdbg_start().

◆ ipdbg_add_service()

static void ipdbg_add_service ( struct ipdbg_service service)
static

Definition at line 159 of file ipdbg.c.

References ipdbg_first_service, and ipdbg_service::next.

Referenced by ipdbg_start().

◆ ipdbg_append_to_fifo()

static void ipdbg_append_to_fifo ( struct ipdbg_fifo fifo,
char  data 
)
static

◆ ipdbg_create_hub()

static int ipdbg_create_hub ( struct jtag_tap tap,
uint32_t  user_instruction,
uint8_t  data_register_length,
struct ipdbg_virtual_ir_info virtual_ir,
struct ipdbg_hub **  hub 
)
static

◆ ipdbg_create_service()

static int ipdbg_create_service ( struct ipdbg_hub hub,
uint8_t  tool,
struct ipdbg_service **  service,
uint16_t  port 
)
static

Definition at line 170 of file ipdbg.c.

References ERROR_FAIL, ERROR_OK, ipdbg_service::hub, LOG_ERROR, ipdbg_service::port, and ipdbg_service::tool.

Referenced by ipdbg_start().

◆ ipdbg_distribute_data_from_hub()

static int ipdbg_distribute_data_from_hub ( struct ipdbg_hub hub,
uint32_t  up 
)
static

◆ ipdbg_fifo_is_empty()

static bool ipdbg_fifo_is_empty ( struct ipdbg_fifo fifo)
static

◆ ipdbg_fifo_is_full()

static bool ipdbg_fifo_is_full ( struct ipdbg_fifo fifo)
static

◆ ipdbg_find_hub()

static struct ipdbg_hub* ipdbg_find_hub ( struct jtag_tap tap,
uint32_t  user_instruction,
struct ipdbg_virtual_ir_info virtual_ir 
)
static

◆ ipdbg_find_service()

static struct ipdbg_service* ipdbg_find_service ( struct ipdbg_hub hub,
uint8_t  tool 
)
static

Definition at line 149 of file ipdbg.c.

References ipdbg_service::hub, ipdbg_first_service, service::next, and ipdbg_service::tool.

Referenced by ipdbg_stop().

◆ ipdbg_free_hub()

static void ipdbg_free_hub ( struct ipdbg_hub hub)
static

Definition at line 266 of file ipdbg.c.

References ipdbg_hub::connections, and ipdbg_hub::virtual_ir.

Referenced by ipdbg_start(), and ipdbg_stop().

◆ ipdbg_get_from_fifo()

static char ipdbg_get_from_fifo ( struct ipdbg_fifo fifo)
static

◆ ipdbg_init_fifo()

static void ipdbg_init_fifo ( struct ipdbg_fifo fifo)
static

Definition at line 71 of file ipdbg.c.

References ipdbg_fifo::count, and ipdbg_fifo::rd_idx.

Referenced by ipdbg_on_new_connection().

◆ ipdbg_init_scan_field()

static void ipdbg_init_scan_field ( struct scan_field fields,
uint8_t *  in_value,
int  num_bits,
const uint8_t *  out_value 
)
static

◆ ipdbg_jtag_transfer_byte()

static int ipdbg_jtag_transfer_byte ( struct ipdbg_hub hub,
size_t  tool,
struct ipdbg_connection connection 
)
static

◆ ipdbg_max_tools_from_data_register_length()

static int ipdbg_max_tools_from_data_register_length ( uint8_t  data_register_length)
static

Definition at line 138 of file ipdbg.c.

Referenced by COMMAND_HANDLER(), and ipdbg_create_hub().

◆ ipdbg_move_buffer_to_connection()

static int ipdbg_move_buffer_to_connection ( struct connection conn,
struct ipdbg_fifo fifo 
)
static

◆ ipdbg_on_connection_closed()

static int ipdbg_on_connection_closed ( struct connection connection)
static

◆ ipdbg_on_connection_input()

static int ipdbg_on_connection_input ( struct connection connection)
static

◆ ipdbg_on_new_connection()

static int ipdbg_on_new_connection ( struct connection connection)
static

◆ ipdbg_polling_callback()

◆ ipdbg_register_commands()

int ipdbg_register_commands ( struct command_context cmd_ctx)

Definition at line 787 of file ipdbg.c.

References ipdbg_command_handlers, NULL, and register_commands().

Referenced by jtag_select().

◆ ipdbg_remove_hub()

static int ipdbg_remove_hub ( struct ipdbg_hub hub)
static

Definition at line 275 of file ipdbg.c.

References ERROR_FAIL, ERROR_OK, ipdbg_first_hub, and ipdbg_hub::next.

Referenced by ipdbg_stop().

◆ ipdbg_remove_service()

static int ipdbg_remove_service ( struct ipdbg_service service)
static

Definition at line 185 of file ipdbg.c.

References ERROR_FAIL, ERROR_OK, ipdbg_first_service, ipdbg_service::next, and service::next.

Referenced by ipdbg_stop().

◆ ipdbg_shift_data()

static int ipdbg_shift_data ( struct ipdbg_hub hub,
uint32_t  dn_data,
uint32_t *  up_data 
)
static

◆ ipdbg_shift_instr()

◆ ipdbg_shift_vir()

◆ ipdbg_start()

◆ ipdbg_start_polling()

◆ ipdbg_stop()

◆ ipdbg_stop_polling()

static int ipdbg_stop_polling ( struct ipdbg_service service)
static

◆ ipdbg_zero_rd_idx()

static void ipdbg_zero_rd_idx ( struct ipdbg_fifo fifo)
static

Variable Documentation

◆ ipdbg_command_handlers

const struct command_registration ipdbg_command_handlers[]
static
Initial value:
= {
{
.name = "ipdbg",
.handler = handle_ipdbg_command,
.mode = COMMAND_EXEC,
.help = "Starts or stops an IPDBG JTAG-Host server.",
.usage = "[-start|-stop] -tap device.tap -hub ir_value [dr_length]"
" [-port number] [-tool number] [-vir [vir_value [length [instr_code]]]]",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 684 of file ipdbg.c.

Referenced by ipdbg_register_commands().

◆ ipdbg_first_hub

struct ipdbg_hub* ipdbg_first_hub
static

Definition at line 67 of file ipdbg.c.

Referenced by ipdbg_add_hub(), ipdbg_find_hub(), and ipdbg_remove_hub().

◆ ipdbg_first_service

struct ipdbg_service* ipdbg_first_service
static

Definition at line 69 of file ipdbg.c.

Referenced by ipdbg_add_service(), ipdbg_find_service(), and ipdbg_remove_service().

◆ ipdbg_service_driver

const struct service_driver ipdbg_service_driver
static
Initial value:
= {
.name = "ipdbg",
.new_connection_during_keep_alive_handler = NULL,
.new_connection_handler = ipdbg_on_new_connection,
.input_handler = ipdbg_on_connection_input,
.connection_closed_handler = ipdbg_on_connection_closed,
.keep_client_alive_handler = NULL,
}
static int ipdbg_on_connection_input(struct connection *connection)
Definition: ipdbg.c:560
static int ipdbg_on_new_connection(struct connection *connection)
Definition: ipdbg.c:538
static int ipdbg_on_connection_closed(struct connection *connection)
Definition: ipdbg.c:581
#define NULL
Definition: usb.h:16

Definition at line 581 of file ipdbg.c.

Referenced by ipdbg_start().