OpenOCD
rtt_server.c File Reference

RTT server. More...

Include dependency graph for rtt_server.c:

Go to the source code of this file.

Data Structures

struct  rtt_service
 

Functions

 COMMAND_HANDLER (handle_rtt_start_command)
 
 COMMAND_HANDLER (handle_rtt_stop_command)
 
static int read_callback (unsigned int channel, const uint8_t *buffer, size_t length, void *user_data)
 
static int rtt_connection_closed (struct connection *connection)
 
static int rtt_input (struct connection *connection)
 
static int rtt_new_connection (struct connection *connection)
 
int rtt_server_register_commands (struct command_context *ctx)
 

Variables

static const struct command_registration rtt_command_handlers []
 
static const struct command_registration rtt_server_command_handlers []
 
static const struct command_registration rtt_server_subcommand_handlers []
 
static const struct service_driver rtt_service_driver
 

Detailed Description

RTT server.

This server allows access to Real Time Transfer (RTT) channels via TCP connections.

Definition in file rtt_server.c.

Function Documentation

◆ COMMAND_HANDLER() [1/2]

COMMAND_HANDLER ( handle_rtt_start_command  )

◆ COMMAND_HANDLER() [2/2]

COMMAND_HANDLER ( handle_rtt_stop_command  )

Definition at line 140 of file rtt_server.c.

References CMD_ARGC, CMD_ARGV, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and remove_service().

◆ read_callback()

static int read_callback ( unsigned int  channel,
const uint8_t *  buffer,
size_t  length,
void *  user_data 
)
static

Definition at line 30 of file rtt_server.c.

References buffer, connection_write(), ERROR_FAIL, ERROR_OK, length, LOG_ERROR, and offset.

Referenced by rtt_connection_closed(), and rtt_new_connection().

◆ rtt_connection_closed()

static int rtt_connection_closed ( struct connection connection)
static

◆ rtt_input()

static int rtt_input ( struct connection connection)
static

◆ rtt_new_connection()

static int rtt_new_connection ( struct connection connection)
static

◆ rtt_server_register_commands()

int rtt_server_register_commands ( struct command_context ctx)

Definition at line 190 of file rtt_server.c.

References NULL, register_commands(), and rtt_command_handlers.

Referenced by setup_command_handler().

Variable Documentation

◆ rtt_command_handlers

const struct command_registration rtt_command_handlers[]
static
Initial value:
= {
{
.name = "rtt",
.mode = COMMAND_ANY,
.help = "RTT",
.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 rtt_server_command_handlers[]
Definition: rtt_server.c:168

Definition at line 140 of file rtt_server.c.

Referenced by rtt_server_register_commands().

◆ rtt_server_command_handlers

const struct command_registration rtt_server_command_handlers[]
static
Initial value:
= {
{
.name = "server",
.mode = COMMAND_ANY,
.help = "RTT server",
.usage = "",
},
}
static const struct command_registration rtt_server_subcommand_handlers[]
Definition: rtt_server.c:150

Definition at line 140 of file rtt_server.c.

◆ rtt_server_subcommand_handlers

const struct command_registration rtt_server_subcommand_handlers[]
static
Initial value:
= {
{
.name = "start",
.handler = handle_rtt_start_command,
.mode = COMMAND_ANY,
.help = "Start a RTT server",
.usage = "<port> <channel>"
},
{
.name = "stop",
.handler = handle_rtt_stop_command,
.mode = COMMAND_ANY,
.help = "Stop a RTT server",
.usage = "<port>"
},
}

Definition at line 140 of file rtt_server.c.

◆ rtt_service_driver

const struct service_driver rtt_service_driver
static
Initial value:
= {
.name = "rtt",
.new_connection_during_keep_alive_handler = NULL,
.new_connection_handler = rtt_new_connection,
.input_handler = rtt_input,
.connection_closed_handler = rtt_connection_closed,
.keep_client_alive_handler = NULL,
}
static int rtt_connection_closed(struct connection *connection)
Definition: rtt_server.c:71
static int rtt_new_connection(struct connection *connection)
Definition: rtt_server.c:54
static int rtt_input(struct connection *connection)
Definition: rtt_server.c:83
#define NULL
Definition: usb.h:16

Definition at line 83 of file rtt_server.c.

Referenced by COMMAND_HANDLER().