OpenOCD
transport.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /*
4  * Copyright (c) 2010 by David Brownell
5  * Copyright (C) 2011 Tomasz Boleslaw CEDRO (http://www.tomek.cedro.info)
6  */
7 
8 #ifndef OPENOCD_TRANSPORT_TRANSPORT_H
9 #define OPENOCD_TRANSPORT_TRANSPORT_H
10 
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif
14 
15 #include "helper/command.h"
16 
35 struct transport {
41  const char *name;
42 
51  int (*select)(struct command_context *ctx);
52 
58  int (*init)(struct command_context *ctx);
59 
66  int (*override_target)(const char **targetname);
67 
71  struct transport *next;
72 };
73 
74 int transport_register(struct transport *new_transport);
75 
76 struct transport *get_current_transport(void);
77 
79 
80 COMMAND_HELPER(transport_list_parse, char ***vector);
81 
82 int allow_transports(struct command_context *ctx, const char * const *vector);
83 
84 bool transport_is_jtag(void);
85 bool transport_is_swd(void);
88 bool transport_is_swim(void);
89 
90 #if BUILD_HLADAPTER
91 bool transport_is_hla(void);
92 #else
93 static inline bool transport_is_hla(void)
94 {
95  return false;
96 }
97 #endif
98 
99 #endif /* OPENOCD_TRANSPORT_TRANSPORT_H */
Wrapper for transport lifecycle operations.
Definition: transport.h:35
int(* select)(struct command_context *ctx)
When a transport is selected, this method registers its commands and activates the transport (e....
Definition: transport.h:51
int(* override_target)(const char **targetname)
Optional.
Definition: transport.h:66
int(* init)(struct command_context *ctx)
server startup uses this method to validate transport configuration.
Definition: transport.h:58
struct transport * next
Transports are stored in a singly linked list.
Definition: transport.h:71
const char * name
Each transport has a unique name, used to select it from among the alternatives.
Definition: transport.h:41
bool transport_is_dapdirect_swd(void)
Returns true if the current debug session is using SWD as its transport.
bool transport_is_dapdirect_jtag(void)
Returns true if the current debug session is using JTAG as its transport.
bool transport_is_swim(void)
Definition: swim.c:150
int allow_transports(struct command_context *ctx, const char *const *vector)
Called by debug adapter drivers, or affiliated Tcl config scripts, to declare the set of transports s...
Definition: transport.c:86
static bool transport_is_hla(void)
Definition: transport.h:93
bool transport_is_jtag(void)
Returns true if the current debug session is using JTAG as its transport.
Definition: jtag/core.c:1828
COMMAND_HELPER(transport_list_parse, char ***vector)
Makes and stores a copy of a set of transports passed as parameters to a command.
Definition: transport.c:176
bool transport_is_swd(void)
Returns true if the current debug session is using SWD as its transport.
Definition: adi_v5_swd.c:728
int transport_register_commands(struct command_context *ctx)
Definition: transport.c:355
struct transport * get_current_transport(void)
Returns the transport currently being used by this debug or programming session.
Definition: transport.c:157
int transport_register(struct transport *new_transport)
Registers a transport.
Definition: transport.c:129