X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Fetm.h;h=bfa1252b761ca4284da449754785a326c1d0b73e;hb=55f2fe830a541a297d6bf3906c6a28df81acbf05;hp=595917885a56dcd93518a42dc81def870c62a410;hpb=237e894805dd757cc24029af1b4b1e824c51712b;p=openocd.git diff --git a/src/target/etm.h b/src/target/etm.h index 595917885a..bfa1252b76 100644 --- a/src/target/etm.h +++ b/src/target/etm.h @@ -23,6 +23,7 @@ #ifndef ETM_H #define ETM_H +#include "image.h" #include "trace.h" #include "target.h" #include "register.h" @@ -102,7 +103,8 @@ typedef enum ETMV1_CONTEXTID_32 = 0x30, ETMV1_CONTEXTID_MASK = 0x30, /* Misc */ - ETMV1_CYCLE_ACCURATE = 0x100 + ETMV1_CYCLE_ACCURATE = 0x100, + ETMV1_BRANCH_OUTPUT = 0x200 } etmv1_tracemode_t; /* forward-declare ETM context */ @@ -119,11 +121,17 @@ typedef struct etm_capture_driver_s int (*stop_capture)(struct etm_context_s *etm_ctx); } etm_capture_driver_t; +enum +{ + ETMV1_TRACESYNC_CYCLE = 0x1, + ETMV1_TRIGGER_CYCLE = 0x2, +}; + typedef struct etmv1_trace_data_s { - u8 pipestat; /* pipeline cycle this packet belongs to */ - u16 packet; /* packet data (4, 8 or 16 bit) */ - int tracesync; /* 1 if tracesync was set on this packet */ + u8 pipestat; /* bits 0-2 pipeline status */ + u16 packet; /* packet data (4, 8 or 16 bit) */ + int flags; /* ETMV1_TRACESYNC_CYCLE, ETMV1_TRIGGER_CYCLE */ } etmv1_trace_data_t; /* describe a trace context @@ -133,23 +141,29 @@ typedef struct etmv1_trace_data_s */ typedef struct etm_context_s { + target_t *target; /* target this ETM is connected to */ reg_cache_t *reg_cache; /* ETM register cache */ etm_capture_driver_t *capture_driver; /* driver used to access ETM data */ void *capture_driver_priv; /* capture driver private data */ + u32 trigger_percent; /* percent of trace buffer to be filled after the trigger */ trace_status_t capture_status; /* current state of capture run */ etmv1_trace_data_t *trace_data; /* trace data */ u32 trace_depth; /* number of trace cycles to be analyzed, 0 if no trace data available */ etm_portmode_t portmode; /* normal, multiplexed or demultiplexed */ etmv1_tracemode_t tracemode; /* type of information the trace contains (data, addres, contextID, ...) */ armv4_5_state_t core_state; /* current core state (ARM, Thumb, Jazelle) */ -// trace_image_provider_t image_provider; /* source for target opcodes */ + image_t *image; /* source for target opcodes */ u32 pipe_index; /* current trace cycle */ u32 data_index; /* cycle holding next data packet */ + int data_half; /* port half on a 16 bit port */ u32 current_pc; /* current program counter */ u32 pc_ok; /* full PC has been acquired */ u32 last_branch; /* last branch address output */ + u32 last_branch_reason; /* branch reason code for the last branch encountered */ u32 last_ptr; /* address of the last data access */ + u32 ptr_ok; /* whether last_ptr is valid */ u32 context_id; /* context ID of the code being traced */ + u32 last_instruction; /* index of last instruction executed (to calculate cycle timings) */ } etm_context_t; /* PIPESTAT values */ @@ -195,5 +209,6 @@ extern etm_context_t* etm_create_context(etm_portmode_t portmode, char *capture_ #define ERROR_ETM_INVALID_DRIVER (-1300) #define ERROR_ETM_PORTMODE_NOT_SUPPORTED (-1301) #define ERROR_ETM_CAPTURE_INIT_FAILED (-1302) +#define ERROR_ETM_ANALYSIS_FAILED (-1303) #endif /* ETM_H */