124 if (t->
id == transport_id) {
125 int retval = t->
select(ctx);
133 LOG_ERROR(
"Error selecting '%s' as transport",
139 LOG_ERROR(
"No transport named '%s' is available.",
150 unsigned int transport_preferred_id)
153 LOG_ERROR(
"Can't modify the set of allowed transports.");
163 if ((transport_ids & transport_preferred_id) == 0
165 LOG_ERROR(
"BUG: Invalid adapter transport_preferred_id");
169 unsigned int mask = transport_ids &
172 LOG_ERROR(
"BUG: Multiple JTAG transports");
176 mask = transport_ids &
179 LOG_ERROR(
"BUG: Multiple SWD transports");
216 LOG_ERROR(
"invalid transport ID 0x%x", new_transport->
id);
221 if (t->
id == new_transport->
id) {
222 LOG_ERROR(
"transport '%s' already registered",
228 if (!new_transport->
select || !new_transport->
init)
276 LOG_ERROR(
"session transport was not selected. Use 'transport select <transport>'");
288 LOG_WARNING(
"DEPRECATED: auto-selecting transport \"%s\". "
289 "Use 'transport select %s' to suppress this message.",
303 const char *prev_name =
NULL;
307 if (!prev_name || strcmp(prev_name,
name))
330 command_print(
CMD,
"Debug adapter does not support any transports? Check config file order.");
333 LOG_WARNING(
"DEPRECATED: auto-selecting transport \"%s\". "
334 "Use 'transport select %s' to suppress this message.",
358 command_print(
CMD,
"Can't change session's transport after the initial selection was made");
382 LOG_WARNING(
"DEPRECATED! use 'transport select %s', not 'transport select %s'",
395 .handler = handle_transport_init,
401 .help =
"Initialize this session's transport",
406 .handler = handle_transport_list,
408 .help =
"list all built-in transports",
413 .handler = handle_transport_select,
415 .help =
"Select this session's transport",
416 .usage =
"[transport_name]",
425 .help =
"Transport command group",
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define CMD_CTX
Use this macro to access the context of the command being handled, rather than accessing the variable...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
static int register_commands(struct command_context *cmd_ctx, const char *cmd_prefix, const struct command_registration *cmds)
Register one or more commands in the specified context, as children of parent (or top-level commends,...
static void list_add_tail(struct list_head *new, struct list_head *head)
#define list_for_each_entry(p, h, field)
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
static uint32_t lh(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
const char * usage
a string listing the options and arguments, required or optional
Wrapper for transport lifecycle operations.
int(* select)(struct command_context *ctx)
When a transport is selected, this method registers its commands and activates the transport (e....
int(* init)(struct command_context *ctx)
server startup uses this method to validate transport configuration.
unsigned int id
Each transport has a unique ID, used to select it from among the alternatives.
struct list_head lh
Transports are stored in a linked list.
static const struct command_registration transport_group[]
struct command_context * global_cmd_ctx
static bool transport_single_is_autoselected
Adapter supports a single transport; it has been auto-selected.
int allow_transports(struct command_context *ctx, unsigned int transport_ids, unsigned int transport_preferred_id)
Called by debug adapter drivers, or affiliated Tcl config scripts, to declare the set of transports s...
static const char * transport_deprecated_name(unsigned int id)
COMMAND_HANDLER(handle_transport_init)
static const char * transport_full_name(unsigned int id)
static const struct @128 transport_names[]
List of transports known to OpenOCD.
static unsigned int preferred_transport
Transport ID auto-selected when not specified by the user.
static OOCD_LIST_HEAD(transport_list)
List of transports registered in OpenOCD, alphabetically sorted per name.
static const struct command_registration transport_commands[]
const char * get_current_transport_name(void)
static unsigned int allowed_transports
Bitmask of transport IDs which the currently selected debug adapter supports.
int transport_register_commands(struct command_context *ctx)
static struct transport * session
static bool is_transport_id_valid(unsigned int id)
const char * transport_name(unsigned int id)
static int transport_select(struct command_context *ctx, unsigned int transport_id)
struct transport * get_current_transport(void)
Returns the transport currently being used by this debug or programming session.
int transport_register(struct transport *new_transport)
Registers a transport.
const char * deprecated_name
#define TRANSPORT_DAPDIRECT_JTAG
#define TRANSPORT_HLA_JTAG
#define TRANSPORT_VALID_MASK
#define TRANSPORT_DAPDIRECT_SWD
#define TRANSPORT_HLA_SWD
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.