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_hub_scratch_memory
 
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_CREATE_OPTIONS   10
 
#define IPDBG_MIN_DR_LENGTH   11
 
#define IPDBG_MIN_NUM_OF_CREATE_OPTIONS   3
 
#define IPDBG_NUM_OF_QUEUE_OPTIONS   2
 
#define IPDBG_NUM_OF_START_OPTIONS   4
 
#define IPDBG_NUM_OF_STOP_OPTIONS   2
 
#define IPDBG_SCRATCH_MEMORY_SIZE   1024
 
#define IPDBG_TCP_PORT_STR_MAX_LENGTH   6
 

Functions

 COMMAND_HANDLER (handle_ipdbg_cfg_queuing_command)
 
 COMMAND_HANDLER (handle_ipdbg_create_hub_command)
 
 COMMAND_HANDLER (handle_ipdbg_start_command)
 
 COMMAND_HANDLER (handle_ipdbg_stop_command)
 
static COMMAND_HELPER (ipdbg_config_queuing, struct ipdbg_hub *hub, unsigned int size)
 
static void ipdbg_add_hub (struct ipdbg_hub *hub)
 
static void ipdbg_add_service (struct ipdbg_service *service)
 
static struct ipdbg_hubipdbg_allocate_hub (uint8_t data_register_length, struct ipdbg_virtual_ir_info *virtual_ir, const char *name)
 
static void ipdbg_append_to_fifo (struct ipdbg_fifo *fifo, char data)
 
static void ipdbg_check_for_xoff (struct ipdbg_hub *hub, size_t tool, uint32_t rx_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, const char *name, struct command_invocation *cmd)
 
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 int ipdbg_get_flow_control_info_from_hub (struct ipdbg_hub *hub)
 
static char ipdbg_get_from_fifo (struct ipdbg_fifo *fifo)
 
static struct ipdbg_hubipdbg_get_hub_by_name (const char *name)
 
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_jtag_transfer_bytes (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_register_hub_command (struct ipdbg_hub *hub, struct command_invocation *cmd)
 
static int ipdbg_remove_hub (struct ipdbg_hub *hub)
 
static int ipdbg_remove_service (struct ipdbg_service *service)
 
int ipdbg_server_free (void)
 
static int ipdbg_shift_data (struct ipdbg_hub *hub, uint32_t dn_data, uint32_t *up_data)
 
static int ipdbg_shift_empty_data (struct ipdbg_hub *hub)
 
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 (struct ipdbg_hub *hub, uint16_t port, uint8_t tool)
 
static int ipdbg_start_polling (struct ipdbg_service *service, struct connection *connection)
 
static int ipdbg_stop (struct ipdbg_hub *hub, uint8_t tool)
 
static int ipdbg_stop_polling (struct ipdbg_service *service)
 
static int ipdbg_stop_service (struct ipdbg_service *service)
 
static void ipdbg_zero_rd_idx (struct ipdbg_fifo *fifo)
 

Variables

static const struct command_registration ipdbg_command_handlers []
 
static const struct command_registration ipdbg_config_command_handlers []
 
static struct ipdbg_hubipdbg_first_hub
 
static struct ipdbg_serviceipdbg_first_service
 
static const struct command_registration ipdbg_hostserver_subcommand_handlers []
 
static const struct command_registration ipdbg_hub_subcommand_handlers []
 
static const struct service_driver ipdbg_service_driver
 

Macro Definition Documentation

◆ IPDBG_BUFFER_SIZE

#define IPDBG_BUFFER_SIZE   16384

Definition at line 17 of file ipdbg.c.

◆ IPDBG_MAX_DR_LENGTH

#define IPDBG_MAX_DR_LENGTH   13

Definition at line 24 of file ipdbg.c.

◆ IPDBG_MAX_NUM_OF_CREATE_OPTIONS

#define IPDBG_MAX_NUM_OF_CREATE_OPTIONS   10

Definition at line 19 of file ipdbg.c.

◆ IPDBG_MIN_DR_LENGTH

#define IPDBG_MIN_DR_LENGTH   11

Definition at line 23 of file ipdbg.c.

◆ IPDBG_MIN_NUM_OF_CREATE_OPTIONS

#define IPDBG_MIN_NUM_OF_CREATE_OPTIONS   3

Definition at line 18 of file ipdbg.c.

◆ IPDBG_NUM_OF_QUEUE_OPTIONS

#define IPDBG_NUM_OF_QUEUE_OPTIONS   2

Definition at line 22 of file ipdbg.c.

◆ IPDBG_NUM_OF_START_OPTIONS

#define IPDBG_NUM_OF_START_OPTIONS   4

Definition at line 20 of file ipdbg.c.

◆ IPDBG_NUM_OF_STOP_OPTIONS

#define IPDBG_NUM_OF_STOP_OPTIONS   2

Definition at line 21 of file ipdbg.c.

◆ IPDBG_SCRATCH_MEMORY_SIZE

#define IPDBG_SCRATCH_MEMORY_SIZE   1024

Definition at line 26 of file ipdbg.c.

◆ IPDBG_TCP_PORT_STR_MAX_LENGTH

#define IPDBG_TCP_PORT_STR_MAX_LENGTH   6

Definition at line 25 of file ipdbg.c.

Function Documentation

◆ COMMAND_HANDLER() [1/4]

COMMAND_HANDLER ( handle_ipdbg_cfg_queuing_command  )

◆ COMMAND_HANDLER() [2/4]

◆ COMMAND_HANDLER() [3/4]

COMMAND_HANDLER ( handle_ipdbg_start_command  )

◆ COMMAND_HANDLER() [4/4]

COMMAND_HANDLER ( handle_ipdbg_stop_command  )

◆ COMMAND_HELPER()

static COMMAND_HELPER ( ipdbg_config_queuing  ,
struct ipdbg_hub hub,
unsigned int  size 
)
static

◆ ipdbg_add_hub()

static void ipdbg_add_hub ( struct ipdbg_hub hub)
static

Definition at line 238 of file ipdbg.c.

References ipdbg_first_hub, and ipdbg_hub::next.

Referenced by ipdbg_create_hub().

◆ ipdbg_add_service()

static void ipdbg_add_service ( struct ipdbg_service service)
static

Definition at line 175 of file ipdbg.c.

References ipdbg_first_service, and ipdbg_service::next.

Referenced by ipdbg_start().

◆ ipdbg_allocate_hub()

◆ ipdbg_append_to_fifo()

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

◆ ipdbg_check_for_xoff()

static void ipdbg_check_for_xoff ( struct ipdbg_hub hub,
size_t  tool,
uint32_t  rx_data 
)
static

◆ ipdbg_create_hub()

◆ 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 186 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()

◆ 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 165 of file ipdbg.c.

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

Referenced by ipdbg_server_free(), and ipdbg_stop().

◆ ipdbg_free_hub()

◆ ipdbg_get_flow_control_info_from_hub()

static int ipdbg_get_flow_control_info_from_hub ( struct ipdbg_hub hub)
static

◆ ipdbg_get_from_fifo()

static char ipdbg_get_from_fifo ( struct ipdbg_fifo fifo)
static

◆ ipdbg_get_hub_by_name()

static struct ipdbg_hub* ipdbg_get_hub_by_name ( const char *  name)
static

Definition at line 750 of file ipdbg.c.

References ipdbg_first_hub, ipdbg_hub::name, name, ipdbg_hub::next, and NULL.

Referenced by COMMAND_HANDLER().

◆ ipdbg_init_fifo()

static void ipdbg_init_fifo ( struct ipdbg_fifo fifo)
static

Definition at line 87 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_jtag_transfer_bytes()

◆ 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 154 of file ipdbg.c.

Referenced by ipdbg_allocate_hub(), 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 1155 of file ipdbg.c.

References ipdbg_command_handlers, NULL, and register_commands().

Referenced by jtag_select().

◆ ipdbg_register_hub_command()

static int ipdbg_register_hub_command ( struct ipdbg_hub hub,
struct command_invocation cmd 
)
static

◆ ipdbg_remove_hub()

static int ipdbg_remove_hub ( struct ipdbg_hub hub)
static

Definition at line 250 of file ipdbg.c.

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

Referenced by ipdbg_server_free().

◆ ipdbg_remove_service()

static int ipdbg_remove_service ( struct ipdbg_service service)
static

Definition at line 201 of file ipdbg.c.

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

Referenced by ipdbg_stop_service().

◆ ipdbg_server_free()

◆ ipdbg_shift_data()

◆ ipdbg_shift_empty_data()

◆ ipdbg_shift_instr()

◆ ipdbg_shift_vir()

◆ ipdbg_start()

◆ ipdbg_start_polling()

◆ ipdbg_stop()

static int ipdbg_stop ( struct ipdbg_hub hub,
uint8_t  tool 
)
static

◆ ipdbg_stop_polling()

static int ipdbg_stop_polling ( struct ipdbg_service service)
static

◆ ipdbg_stop_service()

static int ipdbg_stop_service ( 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",
.mode = COMMAND_ANY,
.help = "IPDBG Hub/Host commands.",
.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 ipdbg_config_command_handlers[]
Definition: ipdbg.c:1132

Definition at line 1019 of file ipdbg.c.

Referenced by ipdbg_register_commands().

◆ ipdbg_config_command_handlers

const struct command_registration ipdbg_config_command_handlers[]
static
Initial value:
= {
{
.name = "create-hub",
.mode = COMMAND_ANY,
.handler = handle_ipdbg_create_hub_command,
.help = "create a IPDBG Hub",
.usage = "name.ipdbghub (-tap device.tap -ir ir_value [dr_length] |"
" -pld name.pld [user]) [-vir [vir_value [length [instr_code]]]]",
},
}

Definition at line 1019 of file ipdbg.c.

◆ ipdbg_first_hub

struct ipdbg_hub* ipdbg_first_hub
static

◆ ipdbg_first_service

struct ipdbg_service* ipdbg_first_service
static

Definition at line 85 of file ipdbg.c.

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

◆ ipdbg_hostserver_subcommand_handlers

const struct command_registration ipdbg_hostserver_subcommand_handlers[]
static
Initial value:
= {
{
.name = "start",
.mode = COMMAND_EXEC,
.handler = handle_ipdbg_start_command,
.help = "Starts a IPDBG Host server.",
.usage = "-tool number -port port"
}, {
.name = "stop",
.mode = COMMAND_EXEC,
.handler = handle_ipdbg_stop_command,
.help = "Stops a IPDBG Host server.",
.usage = "-tool number"
},
}
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 867 of file ipdbg.c.

◆ ipdbg_hub_subcommand_handlers

const struct command_registration ipdbg_hub_subcommand_handlers[]
static
Initial value:
= {
{
.name = "ipdbg",
.mode = COMMAND_EXEC,
.help = "IPDBG Hub commands.",
.usage = "",
},
{
.name = "queuing",
.handler = handle_ipdbg_cfg_queuing_command,
.mode = COMMAND_ANY,
.help = "configures queuing between IPDBG Host and Hub.",
.usage = "-size size",
},
}
static const struct command_registration ipdbg_hostserver_subcommand_handlers[]
Definition: ipdbg.c:888
const char * name
Definition: command.h:235

Definition at line 924 of file ipdbg.c.

Referenced by ipdbg_register_hub_command().

◆ 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:711
static int ipdbg_on_new_connection(struct connection *connection)
Definition: ipdbg.c:689
static int ipdbg_on_connection_closed(struct connection *connection)
Definition: ipdbg.c:732
#define NULL
Definition: usb.h:16

Definition at line 732 of file ipdbg.c.

Referenced by ipdbg_start().