OpenOCD
etm.c File Reference
Include dependency graph for etm.c:

Go to the source code of this file.

Data Structures

struct  etm_reg_info
 

Macros

#define ADDR_COMPARATOR(i)
 
#define DATA_COMPARATOR(i)
 
#define ETM_COUNTER(i)
 
#define ETM_OUTPUT(i)
 
#define ETM_SEQ(i)
 
#define TRACEMODE_MASK
 

Enumerations

enum  { RO , WO , RW }
 

Functions

 COMMAND_HANDLER (handle_etm_analyze_command)
 
 COMMAND_HANDLER (handle_etm_config_command)
 
 COMMAND_HANDLER (handle_etm_dump_command)
 
 COMMAND_HANDLER (handle_etm_image_command)
 
 COMMAND_HANDLER (handle_etm_info_command)
 
 COMMAND_HANDLER (handle_etm_load_command)
 
 COMMAND_HANDLER (handle_etm_start_command)
 
 COMMAND_HANDLER (handle_etm_status_command)
 
 COMMAND_HANDLER (handle_etm_stop_command)
 
 COMMAND_HANDLER (handle_etm_tracemode_command)
 
 COMMAND_HANDLER (handle_etm_trigger_debug_command)
 
static COMMAND_HELPER (handle_etm_tracemode_command_update, uint32_t *mode)
 
struct reg_cacheetm_build_reg_cache (struct target *target, struct arm_jtag *jtag_info, struct etm_context *etm_ctx)
 
static int etm_get_reg (struct reg *reg)
 
static int etm_read_instruction (struct etm_context *ctx, struct arm_instruction *instruction)
 
static int etm_read_reg (struct reg *reg)
 
static int etm_read_reg_w_check (struct reg *reg, uint8_t *check_value, uint8_t *check_mask)
 
static void etm_reg_add (unsigned bcd_vers, struct arm_jtag *jtag_info, struct reg_cache *cache, struct etm_reg *ereg, const struct etm_reg_info *r, unsigned nreg)
 
static struct regetm_reg_lookup (struct etm_context *etm_ctx, unsigned id)
 
static int etm_register_user_commands (struct command_context *cmd_ctx)
 
static int etm_set_reg (struct reg *reg, uint32_t value)
 
static int etm_set_reg_w_exec (struct reg *reg, uint8_t *buf)
 
int etm_setup (struct target *target)
 
static int etm_store_reg (struct reg *reg)
 
static int etm_write_reg (struct reg *reg, uint32_t value)
 
static int etmv1_analyze_trace (struct etm_context *ctx, struct command_invocation *cmd)
 
static int etmv1_branch_address (struct etm_context *ctx)
 
static int etmv1_data (struct etm_context *ctx, int size, uint32_t *data)
 
static int etmv1_next_packet (struct etm_context *ctx, uint8_t *packet, int apo)
 

Variables

static const struct etm_reg_info etm_addr_comp []
 
static const struct etm_reg_info etm_basic []
 
static struct etm_capture_driveretm_capture_drivers []
 
const struct command_registration etm_command_handlers []
 
static const struct command_registration etm_config_command_handlers []
 
static const struct etm_reg_info etm_core []
 
static const struct etm_reg_info etm_counters []
 
static const struct etm_reg_info etm_data_comp []
 
static const struct command_registration etm_exec_command_handlers []
 
static const struct etm_reg_info etm_fifofull []
 
static const struct etm_reg_info etm_outputs []
 
static const struct reg_arch_type etm_scan6_type
 
static const struct etm_reg_info etm_sequencer []
 

Macro Definition Documentation

◆ ADDR_COMPARATOR

#define ADDR_COMPARATOR (   i)
Value:
{ ETM_ADDR_COMPARATOR_VALUE + (i) - 1, 32, WO, 0x10, \
"ETM_addr_" #i "_comparator_value", }, \
{ ETM_ADDR_ACCESS_TYPE + (i) - 1, 7, WO, 0x10, \
"ETM_addr_" #i "_access_type", }
@ WO
Definition: etm.c:43
@ ETM_ADDR_ACCESS_TYPE
Definition: etm.h:41
@ ETM_ADDR_COMPARATOR_VALUE
Definition: etm.h:40

◆ DATA_COMPARATOR

#define DATA_COMPARATOR (   i)
Value:
{ ETM_DATA_COMPARATOR_VALUE + 2*(i) - 1, 32, WO, 0x10, \
"ETM_data_" #i "_comparator_value", }, \
{ ETM_DATA_COMPARATOR_MASK + 2*(i) - 1, 32, WO, 0x10, \
"ETM_data_" #i "_comparator_mask", }
@ ETM_DATA_COMPARATOR_MASK
Definition: etm.h:44
@ ETM_DATA_COMPARATOR_VALUE
Definition: etm.h:43

◆ ETM_COUNTER

#define ETM_COUNTER (   i)
Value:
{ ETM_COUNTER_RELOAD_VALUE + (i) - 1, 16, WO, 0x10, \
"ETM_counter_" #i "_reload_value", }, \
{ ETM_COUNTER_ENABLE + (i) - 1, 18, WO, 0x10, \
"ETM_counter_" #i "_enable", }, \
{ ETM_COUNTER_RELOAD_EVENT + (i) - 1, 17, WO, 0x10, \
"ETM_counter_" #i "_reload_event", }, \
{ ETM_COUNTER_VALUE + (i) - 1, 16, RO, 0x10, \
"ETM_counter_" #i "_value", }
@ RO
Definition: etm.c:42
@ ETM_COUNTER_ENABLE
Definition: etm.h:47
@ ETM_COUNTER_RELOAD_EVENT
Definition: etm.h:48
@ ETM_COUNTER_RELOAD_VALUE
Definition: etm.h:46
@ ETM_COUNTER_VALUE
Definition: etm.h:49

◆ ETM_OUTPUT

#define ETM_OUTPUT (   i)
Value:
{ ETM_EXTERNAL_OUTPUT + (i) - 1, 17, WO, 0x10, \
"ETM_external_output" #i, }
@ ETM_EXTERNAL_OUTPUT
Definition: etm.h:54

◆ ETM_SEQ

#define ETM_SEQ (   i)
Value:
{ ETM_SEQUENCER_EVENT + (i), 17, WO, 0x10, \
"ETM_sequencer_event" #i, }
@ ETM_SEQUENCER_EVENT
Definition: etm.h:51

◆ TRACEMODE_MASK

#define TRACEMODE_MASK
Value:
( \
ETM_CTRL_CONTEXTID_MASK \
)
@ ETM_CTRL_BRANCH_OUTPUT
Definition: etm.h:95
@ ETM_CTRL_CYCLE_ACCURATE
Definition: etm.h:99
@ ETM_CTRL_TRACE_MASK
Definition: etm.h:80

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RO 
WO 
RW 

Definition at line 41 of file etm.c.

Function Documentation

◆ COMMAND_HANDLER() [1/11]

◆ COMMAND_HANDLER() [2/11]

◆ COMMAND_HANDLER() [3/11]

◆ COMMAND_HANDLER() [4/11]

◆ COMMAND_HANDLER() [5/11]

◆ COMMAND_HANDLER() [6/11]

◆ COMMAND_HANDLER() [7/11]

◆ COMMAND_HANDLER() [8/11]

◆ COMMAND_HANDLER() [9/11]

◆ COMMAND_HANDLER() [10/11]

◆ COMMAND_HANDLER() [11/11]

◆ COMMAND_HELPER()

◆ etm_build_reg_cache()

◆ etm_get_reg()

static int etm_get_reg ( struct reg reg)
static

Definition at line 467 of file etm.c.

References ERROR_OK, etm_read_reg(), jtag_execute_queue(), and LOG_ERROR.

Referenced by COMMAND_HANDLER(), etm_build_reg_cache(), and etm_setup().

◆ etm_read_instruction()

◆ etm_read_reg()

static int etm_read_reg ( struct reg reg)
static

Definition at line 407 of file etm.c.

References etm_read_reg_w_check(), and NULL.

Referenced by etm_get_reg().

◆ etm_read_reg_w_check()

◆ etm_reg_add()

static void etm_reg_add ( unsigned  bcd_vers,
struct arm_jtag jtag_info,
struct reg_cache cache,
struct etm_reg ereg,
const struct etm_reg_info r,
unsigned  nreg 
)
static

◆ etm_reg_lookup()

static struct reg* etm_reg_lookup ( struct etm_context etm_ctx,
unsigned  id 
)
static

◆ etm_register_user_commands()

static int etm_register_user_commands ( struct command_context cmd_ctx)
static

Definition at line 2096 of file etm.c.

References etm_exec_command_handlers, and register_commands().

Referenced by COMMAND_HANDLER().

◆ etm_set_reg()

static int etm_set_reg ( struct reg reg,
uint32_t  value 
)
static

Definition at line 546 of file etm.c.

References buf_set_u32(), reg::dirty, ERROR_OK, etm_write_reg(), LOG_ERROR, reg::size, reg::valid, and reg::value.

Referenced by etm_set_reg_w_exec().

◆ etm_set_reg_w_exec()

static int etm_set_reg_w_exec ( struct reg reg,
uint8_t *  buf 
)
static

Definition at line 561 of file etm.c.

References buf_get_u32(), ERROR_OK, etm_set_reg(), jtag_execute_queue(), LOG_ERROR, and reg::size.

◆ etm_setup()

◆ etm_store_reg()

static int etm_store_reg ( struct reg reg)
static

Definition at line 412 of file etm.c.

References buf_get_u32(), etm_write_reg(), reg::size, and reg::value.

Referenced by COMMAND_HANDLER(), and etm_setup().

◆ etm_write_reg()

◆ etmv1_analyze_trace()

◆ etmv1_branch_address()

◆ etmv1_data()

static int etmv1_data ( struct etm_context ctx,
int  size,
uint32_t *  data 
)
static

◆ etmv1_next_packet()

Variable Documentation

◆ etm_addr_comp

const struct etm_reg_info etm_addr_comp[]
static
Initial value:
= {
#define ADDR_COMPARATOR(i)
{ 0, 0, 0, 0, NULL }
}
#define ADDR_COMPARATOR(i)
#define NULL
Definition: usb.h:16

Definition at line 1 of file etm.c.

Referenced by etm_build_reg_cache().

◆ etm_basic

const struct etm_reg_info etm_basic[]
static
Initial value:
= {
{ ETM_CTRL, 32, RW, 0x10, "ETM_ctrl", },
{ ETM_TRIG_EVENT, 17, WO, 0x10, "ETM_trig_event", },
{ ETM_ASIC_CTRL, 8, WO, 0x10, "ETM_asic_ctrl", },
{ ETM_STATUS, 3, RO, 0x11, "ETM_status", },
{ ETM_SYS_CONFIG, 9, RO, 0x12, "ETM_sys_config", },
{ ETM_TRACE_RESOURCE_CTRL, 32, WO, 0x12, "ETM_trace_resource_ctrl", },
{ ETM_TRACE_EN_CTRL2, 16, WO, 0x12, "ETM_trace_en_ctrl2", },
{ ETM_TRACE_EN_EVENT, 17, WO, 0x10, "ETM_trace_en_event", },
{ ETM_TRACE_EN_CTRL1, 26, WO, 0x10, "ETM_trace_en_ctrl1", },
{ ETM_VIEWDATA_EVENT, 17, WO, 0x10, "ETM_viewdata_event", },
{ ETM_VIEWDATA_CTRL1, 32, WO, 0x10, "ETM_viewdata_ctrl1", },
{ ETM_VIEWDATA_CTRL2, 32, WO, 0x10, "ETM_viewdata_ctrl2", },
{ ETM_VIEWDATA_CTRL3, 17, WO, 0x10, "ETM_viewdata_ctrl3", },
{ 0x78, 12, WO, 0x20, "ETM_sync_freq", },
{ 0x7a, 22, RO, 0x31, "ETM_config_code_ext", },
{ 0x7b, 32, WO, 0x31, "ETM_ext_input_select", },
{ 0x7c, 32, WO, 0x34, "ETM_trace_start_stop", },
{ 0x7d, 8, WO, 0x34, "ETM_behavior_control", },
}
@ RW
Definition: etm.c:44
@ ETM_VIEWDATA_CTRL3
Definition: etm.h:38
@ ETM_STATUS
Definition: etm.h:25
@ ETM_VIEWDATA_CTRL2
Definition: etm.h:37
@ ETM_ASIC_CTRL
Definition: etm.h:24
@ ETM_TRACE_EN_EVENT
Definition: etm.h:29
@ ETM_TRIG_EVENT
Definition: etm.h:23
@ ETM_VIEWDATA_CTRL1
Definition: etm.h:36
@ ETM_TRACE_RESOURCE_CTRL
Definition: etm.h:27
@ ETM_TRACE_EN_CTRL2
Definition: etm.h:28
@ ETM_TRACE_EN_CTRL1
Definition: etm.h:30
@ ETM_CTRL
Definition: etm.h:21
@ ETM_VIEWDATA_EVENT
Definition: etm.h:35
@ ETM_SYS_CONFIG
Definition: etm.h:26

Definition at line 1 of file etm.c.

Referenced by etm_build_reg_cache().

◆ etm_capture_drivers

struct etm_capture_driver* etm_capture_drivers[]
static
Initial value:
= {
}
struct etm_capture_driver etb_capture_driver
Definition: etb.c:685
struct etm_capture_driver etm_dummy_capture_driver
Definition: etm_dummy.c:88

Definition at line 626 of file etm.c.

Referenced by COMMAND_HANDLER().

◆ etm_command_handlers

const struct command_registration etm_command_handlers[]
Initial value:
= {
{
.name = "etm",
.mode = COMMAND_ANY,
.help = "Embedded Trace Macrocell command group",
.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 etm_config_command_handlers[]
Definition: etm.c:1993

Definition at line 1950 of file etm.c.

◆ etm_config_command_handlers

const struct command_registration etm_config_command_handlers[]
static
Initial value:
= {
{
.name = "config",
.handler = handle_etm_config_command,
.mode = COMMAND_CONFIG,
.help = "Set up ETM output port.",
.usage = "target port_width port_mode clocking capture_driver",
},
}
@ COMMAND_CONFIG
Definition: command.h:41

Definition at line 1950 of file etm.c.

◆ etm_core

const struct etm_reg_info etm_core[]
static
Initial value:
= {
{ ETM_CONFIG, 32, RO, 0x10, "ETM_config", },
{ ETM_ID, 32, RO, 0x20, "ETM_id", },
}
@ ETM_CONFIG
Definition: etm.h:22
@ ETM_ID
Definition: etm.h:58

Definition at line 1 of file etm.c.

Referenced by etm_build_reg_cache().

◆ etm_counters

const struct etm_reg_info etm_counters[]
static
Initial value:
= {
#define ETM_COUNTER(i)
{ 0, 0, 0, 0, NULL }
}
#define ETM_COUNTER(i)

Definition at line 1 of file etm.c.

Referenced by etm_build_reg_cache().

◆ etm_data_comp

const struct etm_reg_info etm_data_comp[]
static
Initial value:
= {
#define DATA_COMPARATOR(i)
{ 0, 0, 0, 0, NULL }
}
#define DATA_COMPARATOR(i)

Definition at line 1 of file etm.c.

Referenced by etm_build_reg_cache().

◆ etm_exec_command_handlers

const struct command_registration etm_exec_command_handlers[]
static

Definition at line 1950 of file etm.c.

Referenced by etm_register_user_commands().

◆ etm_fifofull

const struct etm_reg_info etm_fifofull[]
static
Initial value:
= {
{ ETM_FIFOFULL_REGION, 25, WO, 0x10, "ETM_fifofull_region", },
{ ETM_FIFOFULL_LEVEL, 8, WO, 0x10, "ETM_fifofull_level", },
}
@ ETM_FIFOFULL_REGION
Definition: etm.h:32
@ ETM_FIFOFULL_LEVEL
Definition: etm.h:33

Definition at line 1 of file etm.c.

Referenced by etm_build_reg_cache().

◆ etm_outputs

const struct etm_reg_info etm_outputs[]
static
Initial value:
= {
#define ETM_OUTPUT(i)
{ 0, 0, 0, 0, NULL }
}
#define ETM_OUTPUT(i)

Definition at line 1 of file etm.c.

Referenced by etm_build_reg_cache().

◆ etm_scan6_type

const struct reg_arch_type etm_scan6_type
static
Initial value:
= {
.get = etm_get_reg,
}
static int etm_get_reg(struct reg *reg)
Definition: etm.c:467
static int etm_set_reg_w_exec(struct reg *reg, uint8_t *buf)
Definition: etm.c:561

Definition at line 213 of file etm.c.

Referenced by etm_reg_add().

◆ etm_sequencer

const struct etm_reg_info etm_sequencer[]
static
Initial value:
= {
#define ETM_SEQ(i)
ETM_SEQ(0),
ETM_SEQ(1),
ETM_SEQ(2),
ETM_SEQ(3),
ETM_SEQ(4),
ETM_SEQ(5),
{ ETM_SEQUENCER_STATE, 2, RO, 0x10, "ETM_sequencer_state", },
}
#define ETM_SEQ(i)
@ ETM_SEQUENCER_STATE
Definition: etm.h:52

Definition at line 1 of file etm.c.

Referenced by etm_build_reg_cache().