23 "ETB_ram_read_pointer",
24 "ETB_ram_write_pointer",
25 "ETB_trigger_counter",
95 LOG_ERROR(
"BUG: error scheduling ETB register read");
122 reg_list = calloc(num_regs,
sizeof(
struct reg));
123 arch_info = calloc(num_regs,
sizeof(
struct etb_reg));
132 for (i = 0; i < num_regs; i++) {
134 reg_list[i].
size = 32;
135 reg_list[i].
dirty =
false;
136 reg_list[i].
valid =
false;
137 reg_list[i].
value = calloc(1, 4);
140 reg_list[i].
size = 32;
141 arch_info[i].
addr = i;
150 uint8_t *in = (uint8_t *)arg;
181 for (i = 0; i < num_frames; i++) {
186 if (i < num_frames - 1)
191 fields[0].
in_value = (uint8_t *)(data + i);
259 LOG_ERROR(
"BUG: error scheduling ETB register write");
347 struct etb *
etb = malloc(
sizeof(
struct etb));
357 LOG_ERROR(
"ETM: target has no ETM defined, ETB left unconfigured");
393 if ((new_value < 2) || (new_value > 100))
395 "valid percentages are 2%% to 100%%");
412 .handler = handle_etb_config_command,
414 .help =
"Associate ETB with target and JTAG TAP.",
415 .usage =
"target tap",
418 .name =
"trigger_percent",
419 .handler = handle_etb_trigger_percent_command,
421 .help =
"Set percent of trace buffer to be filled "
422 "after the trigger occurs (2..100).",
423 .usage =
"[percent]",
431 .help =
"Embedded Trace Buffer command group",
463 int etb_timeout = 100;
489 if (etb_timeout == 0)
490 LOG_ERROR(
"ETB: DFEmpty won't go high, status 0x%02x",
494 LOG_WARNING(
"ETB: trace complete without triggering?");
514 uint32_t *trace_data =
NULL;
537 trace_data = malloc(
sizeof(uint32_t) * num_frames);
552 for (i = 0, j = 0; i < num_frames; i++) {
558 if ((trace_data[i] & 0x80) >> 7)
570 if ((trace_data[i] & 0x8000) >> 15)
582 if ((trace_data[i] & 0x800000) >> 23)
596 if ((trace_data[i] & 0x800) >> 11)
608 if ((trace_data[i] & 0x800000) >> 23)
622 if ((trace_data[i] & 0x80000) >> 19)
642 uint32_t etb_ctrl_value = 0x1;
643 uint32_t trigger_count;
647 LOG_ERROR(
"ETB can't run in demultiplexed mode with a 4 or 16 bit port");
650 etb_ctrl_value |= 0x2;
654 LOG_ERROR(
"ETB: can't run in multiplexed mode");
Holds the interface to ARM cores.
static bool is_arm(struct arm *arm)
static struct arm * target_to_arm(const struct target *target)
Convert target handle to generic ARM target state handle.
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
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 COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
#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 etb_set_reg_w_exec(struct reg *, uint8_t *)
struct reg_cache * etb_build_reg_cache(struct etb *etb)
static int etb_stop_capture(struct etm_context *etm_ctx)
static int etb_read_ram(struct etb *etb, uint32_t *data, int num_frames)
static int etb_write_reg(struct reg *, uint32_t)
static int etb_read_reg(struct reg *reg)
static int etb_get_reg(struct reg *reg)
static const struct reg_arch_type etb_reg_type
static const struct command_registration etb_config_command_handlers[]
static int etb_scann(struct etb *etb, uint32_t new_scan_chain)
static const struct command_registration etb_command_handlers[]
struct etm_capture_driver etb_capture_driver
static int etb_read_trace(struct etm_context *etm_ctx)
COMMAND_HANDLER(handle_etb_config_command)
static int etb_init(struct etm_context *etm_ctx)
static int etb_set_instr(struct etb *etb, uint32_t new_instr)
static trace_status_t etb_status(struct etm_context *etm_ctx)
static void etb_getbuf(jtag_callback_data_t arg)
static int etb_start_capture(struct etm_context *etm_ctx)
static int etb_read_reg_w_check(struct reg *, uint8_t *, uint8_t *)
static const char *const etb_reg_list[]
static int etb_set_reg(struct reg *reg, uint32_t value)
#define ERROR_ETM_PORTMODE_NOT_SUPPORTED
struct jtag_tap * jtag_tap_by_string(const char *s)
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
void jtag_add_dr_scan_check(struct jtag_tap *active, int in_num_fields, struct scan_field *in_fields, tap_state_t state)
A version of jtag_add_dr_scan() that uses the check_value/mask fields.
void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, tap_state_t state)
Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP.
void jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
Generate a DR SCAN using the fields passed to the function.
void jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0)
A simpler version of jtag_add_callback4().
intptr_t jtag_callback_data_t
Defines the type of data passed to the jtag_callback_t interface.
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
Represents a generic ARM core, with standard application registers.
struct etm_context * etm
Handle for the Embedded Trace Module, if one is present.
const char * usage
a string listing the options and arguments, required or optional
unsigned int trigger_percent
how much trace buffer to fill after trigger
struct reg_cache * reg_cache
struct etm_context * etm_ctx
struct etm_capture_driver * capture_driver
struct etmv1_trace_data * trace_data
trace_status_t capture_status
void * capture_driver_priv
uint8_t * cur_instr
current instruction
unsigned int ir_length
size of instruction register
int(* get)(struct reg *reg)
const struct reg_arch_type * type
This structure defines a single scan field in the scan.
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
uint8_t * check_value
The value used to check the data scanned out.
const uint8_t * out_value
A pointer to value to be scanned into the device.
unsigned int num_bits
The number of bits this field specifies.
uint8_t * check_mask
The mask to go with check_value.
struct target * get_target(const char *id)
struct target * get_current_target(struct command_context *cmd_ctx)
enum trace_status trace_status_t
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.