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

Go to the source code of this file.

Macros

#define BIT_MASK(x)   ((1 << (x)) - 1)
 
#define CONTROL_FC   (1<<3) /* Flow Control */
 
#define CONTROL_FMT(x)   (((x) << 4) & 0x30) /* Format */
 
#define CONTROL_PCB(x)   (((x) << 10) & 0x7c00) /* PC Bits */
 
#define CONTROL_SP   (1<<1) /* Stop */
 
#define CONTROL_ST   (1<<0) /* Start */
 
#define CONTROL_W   (1<<2) /* Wrap */
 
#define STATUS_O   (1<<3) /* Overflow */
 
#define STATUS_T   (1<<0) /* Trace Started */
 
#define STATUS_TD   (1<<1) /* Trace Disabled */
 
#define STATUS_W   (1<<2) /* Wrapped */
 
#define TRIGGER_DSP   (1<<15) /* Delay Start */
 
#define TRIGGER_DST   (1<<7) /* Delay Start */
 
#define TRIGGER_TSP(x)   (((x) << 8) & 0xf00) /* Trigger Stop */
 
#define TRIGGER_TST(x)   (((x) << 0) & 0xf) /* Trigger Start */
 

Functions

 COMMAND_HANDLER (handle_esirisc_trace_analyze_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_buffer_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_dump_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_fifo_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_flow_control_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_format_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_info_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_init_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_start_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_status_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_stop_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_trigger_delay_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_trigger_start_command)
 
 COMMAND_HANDLER (handle_esirisc_trace_trigger_stop_command)
 
static int esirisc_trace_analyze (struct command_invocation *cmd, uint8_t *buffer, uint32_t size)
 
static int esirisc_trace_analyze_buffer (struct command_invocation *cmd)
 
static int esirisc_trace_analyze_full (struct command_invocation *cmd, uint8_t *buffer, uint32_t size)
 
static int esirisc_trace_analyze_memory (struct command_invocation *cmd, target_addr_t address, uint32_t size)
 
static int esirisc_trace_analyze_simple (struct command_invocation *cmd, uint8_t *buffer, uint32_t size)
 
static int esirisc_trace_buf_get_pc (struct target *target, uint8_t *buffer, uint32_t size, unsigned *pos, uint32_t *value)
 
static int esirisc_trace_buf_get_u32 (uint8_t *buffer, uint32_t size, unsigned *pos, unsigned count, uint32_t *value)
 
static int esirisc_trace_clear_status (struct target *target)
 
static int esirisc_trace_dump (struct command_invocation *cmd, const char *filename, uint8_t *buffer, uint32_t size)
 
static int esirisc_trace_dump_buffer (struct command_invocation *cmd, const char *filename)
 
static int esirisc_trace_dump_memory (struct command_invocation *cmd, const char *filename, target_addr_t address, uint32_t size)
 
static int esirisc_trace_get_status (struct target *target, uint32_t *status)
 
static int esirisc_trace_init (struct target *target)
 
static int esirisc_trace_read_buffer (struct target *target, uint8_t *buffer)
 
static int esirisc_trace_read_memory (struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
 
static int esirisc_trace_start (struct target *target)
 
static int esirisc_trace_stop (struct target *target)
 

Variables

static const struct command_registration esirisc_trace_any_command_handlers []
 
const struct command_registration esirisc_trace_command_handlers []
 
static const char *const esirisc_trace_delay_strings []
 
static const struct command_registration esirisc_trace_exec_command_handlers []
 
static const char *const esirisc_trace_ext_id_strings []
 
static const char *const esirisc_trace_format_strings []
 
static const char *const esirisc_trace_id_strings []
 
static const struct command_registration esirisc_trace_trigger_any_command_handlers []
 
static const char *const esirisc_trace_trigger_strings []
 

Macro Definition Documentation

◆ BIT_MASK

#define BIT_MASK (   x)    ((1 << (x)) - 1)

Definition at line 21 of file esirisc_trace.c.

◆ CONTROL_FC

#define CONTROL_FC   (1<<3) /* Flow Control */

Definition at line 27 of file esirisc_trace.c.

◆ CONTROL_FMT

#define CONTROL_FMT (   x)    (((x) << 4) & 0x30) /* Format */

Definition at line 28 of file esirisc_trace.c.

◆ CONTROL_PCB

#define CONTROL_PCB (   x)    (((x) << 10) & 0x7c00) /* PC Bits */

Definition at line 29 of file esirisc_trace.c.

◆ CONTROL_SP

#define CONTROL_SP   (1<<1) /* Stop */

Definition at line 25 of file esirisc_trace.c.

◆ CONTROL_ST

#define CONTROL_ST   (1<<0) /* Start */

Definition at line 24 of file esirisc_trace.c.

◆ CONTROL_W

#define CONTROL_W   (1<<2) /* Wrap */

Definition at line 26 of file esirisc_trace.c.

◆ STATUS_O

#define STATUS_O   (1<<3) /* Overflow */

Definition at line 35 of file esirisc_trace.c.

◆ STATUS_T

#define STATUS_T   (1<<0) /* Trace Started */

Definition at line 32 of file esirisc_trace.c.

◆ STATUS_TD

#define STATUS_TD   (1<<1) /* Trace Disabled */

Definition at line 33 of file esirisc_trace.c.

◆ STATUS_W

#define STATUS_W   (1<<2) /* Wrapped */

Definition at line 34 of file esirisc_trace.c.

◆ TRIGGER_DSP

#define TRIGGER_DSP   (1<<15) /* Delay Start */

Definition at line 41 of file esirisc_trace.c.

◆ TRIGGER_DST

#define TRIGGER_DST   (1<<7) /* Delay Start */

Definition at line 39 of file esirisc_trace.c.

◆ TRIGGER_TSP

#define TRIGGER_TSP (   x)    (((x) << 8) & 0xf00) /* Trigger Stop */

Definition at line 40 of file esirisc_trace.c.

◆ TRIGGER_TST

#define TRIGGER_TST (   x)    (((x) << 0) & 0xf) /* Trigger Start */

Definition at line 38 of file esirisc_trace.c.

Function Documentation

◆ COMMAND_HANDLER() [1/14]

◆ COMMAND_HANDLER() [2/14]

◆ COMMAND_HANDLER() [3/14]

◆ COMMAND_HANDLER() [4/14]

◆ COMMAND_HANDLER() [5/14]

COMMAND_HANDLER ( handle_esirisc_trace_flow_control_command  )

◆ COMMAND_HANDLER() [6/14]

◆ COMMAND_HANDLER() [7/14]

◆ COMMAND_HANDLER() [8/14]

COMMAND_HANDLER ( handle_esirisc_trace_init_command  )

◆ COMMAND_HANDLER() [9/14]

COMMAND_HANDLER ( handle_esirisc_trace_start_command  )

◆ COMMAND_HANDLER() [10/14]

COMMAND_HANDLER ( handle_esirisc_trace_status_command  )

◆ COMMAND_HANDLER() [11/14]

COMMAND_HANDLER ( handle_esirisc_trace_stop_command  )

◆ COMMAND_HANDLER() [12/14]

◆ COMMAND_HANDLER() [13/14]

◆ COMMAND_HANDLER() [14/14]

◆ esirisc_trace_analyze()

◆ esirisc_trace_analyze_buffer()

◆ esirisc_trace_analyze_full()

◆ esirisc_trace_analyze_memory()

static int esirisc_trace_analyze_memory ( struct command_invocation cmd,
target_addr_t  address,
uint32_t  size 
)
static

◆ esirisc_trace_analyze_simple()

static int esirisc_trace_analyze_simple ( struct command_invocation cmd,
uint8_t *  buffer,
uint32_t  size 
)
static

◆ esirisc_trace_buf_get_pc()

static int esirisc_trace_buf_get_pc ( struct target target,
uint8_t *  buffer,
uint32_t  size,
unsigned *  pos,
uint32_t *  value 
)
static

◆ esirisc_trace_buf_get_u32()

static int esirisc_trace_buf_get_u32 ( uint8_t *  buffer,
uint32_t  size,
unsigned *  pos,
unsigned  count,
uint32_t *  value 
)
static

Definition at line 289 of file esirisc_trace.c.

References buf_get_u32(), buffer, count, ERROR_FAIL, ERROR_OK, and size.

Referenced by esirisc_trace_analyze_full(), and esirisc_trace_buf_get_pc().

◆ esirisc_trace_clear_status()

static int esirisc_trace_clear_status ( struct target target)
static

◆ esirisc_trace_dump()

static int esirisc_trace_dump ( struct command_invocation cmd,
const char *  filename,
uint8_t *  buffer,
uint32_t  size 
)
static

◆ esirisc_trace_dump_buffer()

static int esirisc_trace_dump_buffer ( struct command_invocation cmd,
const char *  filename 
)
static

◆ esirisc_trace_dump_memory()

static int esirisc_trace_dump_memory ( struct command_invocation cmd,
const char *  filename,
target_addr_t  address,
uint32_t  size 
)
static

◆ esirisc_trace_get_status()

static int esirisc_trace_get_status ( struct target target,
uint32_t *  status 
)
static

◆ esirisc_trace_init()

◆ esirisc_trace_read_buffer()

◆ esirisc_trace_read_memory()

static int esirisc_trace_read_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint8_t *  buffer 
)
static

◆ esirisc_trace_start()

◆ esirisc_trace_stop()

Variable Documentation

◆ esirisc_trace_any_command_handlers

const struct command_registration esirisc_trace_any_command_handlers[]
static

Definition at line 1029 of file esirisc_trace.c.

◆ esirisc_trace_command_handlers

const struct command_registration esirisc_trace_command_handlers[]
Initial value:
= {
{
.name = "trace",
.mode = COMMAND_ANY,
.help = "eSi-Trace 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 esirisc_trace_any_command_handlers[]

Definition at line 1029 of file esirisc_trace.c.

◆ esirisc_trace_delay_strings

const char* const esirisc_trace_delay_strings[]
static
Initial value:
= {
"none", "start", "stop", "both",
}

Definition at line 43 of file esirisc_trace.c.

Referenced by COMMAND_HANDLER().

◆ esirisc_trace_exec_command_handlers

const struct command_registration esirisc_trace_exec_command_handlers[]
static

Definition at line 1029 of file esirisc_trace.c.

◆ esirisc_trace_ext_id_strings

const char* const esirisc_trace_ext_id_strings[]
static
Initial value:
= {
"",
"exception",
"eret",
"stop instruction",
"wait instruction",
"multicycle instruction",
"count",
"initial",
"indirect branch",
"end of trace",
"final",
}

Definition at line 58 of file esirisc_trace.c.

Referenced by esirisc_trace_analyze_full().

◆ esirisc_trace_format_strings

const char* const esirisc_trace_format_strings[]
static
Initial value:
= {
"full", "branch", "icache",
}

Definition at line 47 of file esirisc_trace.c.

Referenced by COMMAND_HANDLER().

◆ esirisc_trace_id_strings

const char* const esirisc_trace_id_strings[]
static
Initial value:
= {
"sequential instruction",
"pipeline stall",
"direct branch",
"extended ID",
}

Definition at line 51 of file esirisc_trace.c.

Referenced by esirisc_trace_analyze_full().

◆ esirisc_trace_trigger_any_command_handlers

const struct command_registration esirisc_trace_trigger_any_command_handlers[]
static
Initial value:
= {
{
.name = "start",
.handler = handle_esirisc_trace_trigger_start_command,
.mode = COMMAND_ANY,
.help = "configure trigger start condition",
.usage = "('none'|'pc'|'load'|'store'|'exception'|'eret'|'wait'|'stop'|'high'|'low')"
" [start_data start_mask]",
},
{
.name = "stop",
.handler = handle_esirisc_trace_trigger_stop_command,
.mode = COMMAND_ANY,
.help = "configure trigger stop condition",
.usage = "('none'|'pc'|'load'|'store'|'exception'|'eret'|'wait'|'stop')"
" [stop_data stop_mask]",
},
{
.name = "delay",
.handler = handle_esirisc_trace_trigger_delay_command,
.mode = COMMAND_ANY,
.help = "configure trigger start/stop delay in clock cycles",
.usage = "('none'|'start'|'stop'|'both') [cycles]",
},
}

Definition at line 1029 of file esirisc_trace.c.

◆ esirisc_trace_trigger_strings

const char* const esirisc_trace_trigger_strings[]
static
Initial value:
= {
"none", "pc", "load", "store", "exception", "eret", "wait", "stop",
"high", "low",
}

Definition at line 72 of file esirisc_trace.c.

Referenced by COMMAND_HANDLER().