OpenOCD
transport.h File Reference
Include dependency graph for transport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  transport
 Wrapper for transport lifecycle operations. More...
 

Macros

#define TRANSPORT_DAPDIRECT_JTAG   BIT(4)
 
#define TRANSPORT_DAPDIRECT_SWD   BIT(5)
 
#define TRANSPORT_HLA_JTAG   BIT(2)
 
#define TRANSPORT_HLA_SWD   BIT(3)
 
#define TRANSPORT_JTAG   BIT(0)
 
#define TRANSPORT_SWD   BIT(1)
 
#define TRANSPORT_SWIM   BIT(6)
 
#define TRANSPORT_VALID_MASK
 

Functions

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 supported by an adapter. More...
 
struct transportget_current_transport (void)
 Returns the transport currently being used by this debug or programming session. More...
 
const char * get_current_transport_name (void)
 
bool transport_is_dapdirect_jtag (void)
 Returns true if the current debug session is using JTAG as its transport. More...
 
bool transport_is_dapdirect_swd (void)
 Returns true if the current debug session is using SWD as its transport. More...
 
static bool transport_is_hla (void)
 
bool transport_is_jtag (void)
 Returns true if the current debug session is using JTAG as its transport. More...
 
bool transport_is_swd (void)
 Returns true if the current debug session is using SWD as its transport. More...
 
bool transport_is_swim (void)
 
const char * transport_name (unsigned int id)
 
int transport_register (struct transport *new_transport)
 Registers a transport. More...
 
int transport_register_commands (struct command_context *ctx)
 

Macro Definition Documentation

◆ TRANSPORT_DAPDIRECT_JTAG

#define TRANSPORT_DAPDIRECT_JTAG   BIT(4)

Definition at line 23 of file transport.h.

◆ TRANSPORT_DAPDIRECT_SWD

#define TRANSPORT_DAPDIRECT_SWD   BIT(5)

Definition at line 24 of file transport.h.

◆ TRANSPORT_HLA_JTAG

#define TRANSPORT_HLA_JTAG   BIT(2)

Definition at line 21 of file transport.h.

◆ TRANSPORT_HLA_SWD

#define TRANSPORT_HLA_SWD   BIT(3)

Definition at line 22 of file transport.h.

◆ TRANSPORT_JTAG

#define TRANSPORT_JTAG   BIT(0)

Definition at line 19 of file transport.h.

◆ TRANSPORT_SWD

#define TRANSPORT_SWD   BIT(1)

Definition at line 20 of file transport.h.

◆ TRANSPORT_SWIM

#define TRANSPORT_SWIM   BIT(6)

Definition at line 25 of file transport.h.

◆ TRANSPORT_VALID_MASK

#define TRANSPORT_VALID_MASK
Value:
TRANSPORT_SWD | \
TRANSPORT_HLA_JTAG | \
TRANSPORT_HLA_SWD | \
TRANSPORT_DAPDIRECT_JTAG | \
TRANSPORT_DAPDIRECT_SWD | \
TRANSPORT_SWIM)
#define TRANSPORT_JTAG
Definition: transport.h:19

Definition at line 28 of file transport.h.

Function Documentation

◆ allow_transports()

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 supported by an adapter.

When there is only one member of that set, it is automatically selected.

Definition at line 149 of file transport.c.

References allowed_transports, ERROR_FAIL, ERROR_OK, IS_PWR_OF_2, LOG_DEBUG, LOG_ERROR, mask, preferred_transport, session, TRANSPORT_DAPDIRECT_JTAG, TRANSPORT_DAPDIRECT_SWD, TRANSPORT_HLA_JTAG, TRANSPORT_HLA_SWD, TRANSPORT_JTAG, transport_name(), transport_select(), transport_single_is_autoselected, TRANSPORT_SWD, and TRANSPORT_VALID_MASK.

Referenced by COMMAND_HANDLER().

◆ get_current_transport()

struct transport* get_current_transport ( void  )

Returns the transport currently being used by this debug or programming session.

Returns
handle to the read-only transport entity.

Definition at line 252 of file transport.c.

References session.

Referenced by adapter_assert_reset(), adapter_deassert_reset(), adapter_resets(), COMMAND_HANDLER(), hl_transport_init(), transport_is_dapdirect_jtag(), transport_is_dapdirect_swd(), transport_is_hla(), transport_is_jtag(), transport_is_swd(), and transport_is_swim().

◆ get_current_transport_name()

const char* get_current_transport_name ( void  )

◆ transport_is_dapdirect_jtag()

bool transport_is_dapdirect_jtag ( void  )

Returns true if the current debug session is using JTAG as its transport.

Definition at line 232 of file adi_v5_dapdirect.c.

References dapdirect_jtag_transport, and get_current_transport().

Referenced by adapter_assert_reset(), adapter_deassert_reset(), adapter_resets(), dap_check_config(), dap_init_all(), and stlink_dap_init().

◆ transport_is_dapdirect_swd()

bool transport_is_dapdirect_swd ( void  )

Returns true if the current debug session is using SWD as its transport.

Definition at line 241 of file adi_v5_dapdirect.c.

References dapdirect_swd_transport, and get_current_transport().

Referenced by adapter_assert_reset(), adapter_deassert_reset(), adapter_resets(), COMMAND_HANDLER(), dap_check_config(), dap_init_all(), and stlink_dap_init().

◆ transport_is_hla()

static bool transport_is_hla ( void  )
inlinestatic

Definition at line 115 of file transport.h.

◆ transport_is_jtag()

◆ transport_is_swd()

bool transport_is_swd ( void  )

◆ transport_is_swim()

bool transport_is_swim ( void  )

◆ transport_name()

const char* transport_name ( unsigned int  id)

Definition at line 86 of file transport.c.

References ARRAY_SIZE, NULL, and transport_names.

Referenced by allow_transports(), COMMAND_HANDLER(), and transport_register().

◆ transport_register()

int transport_register ( struct transport new_transport)

Registers a transport.

There are general purpose transports (such as JTAG), as well as relatively proprietary ones which are specific to a given chip (or chip family).

Code implementing a transport needs to register it before it can be selected and then activated. This is a dynamic process, so that chips (and families) can define transports as needed (without needing error-prone static tables).

Parameters
new_transportthe transport being registered. On a successful return, this memory is owned by the transport framework.
Returns
ERROR_OK on success, else a fault code.

Definition at line 211 of file transport.c.

References ERROR_FAIL, ERROR_OK, transport::id, transport::init, is_transport_id_valid(), lh(), transport::lh, list_add_tail(), list_for_each_entry, LOG_DEBUG, LOG_ERROR, transport::select, transport_full_name(), and transport_name().

◆ transport_register_commands()

int transport_register_commands ( struct command_context ctx)

Definition at line 432 of file transport.c.

References NULL, register_commands(), and transport_group.