55 .name =
"debug_status",
70 .name =
"watch_0_addr_value",
75 .name =
"watch_0_addr_mask",
80 .name =
"watch_0_data_value",
85 .name =
"watch_0_data_mask",
90 .name =
"watch_0_control_value",
95 .name =
"watch_0_control_mask",
100 .name =
"watch_1_addr_value",
105 .name =
"watch_1_addr_mask",
110 .name =
"watch_1_data_value",
115 .name =
"watch_1_data_mask",
120 .name =
"watch_1_control_value",
125 .name =
"watch_1_control_mask",
131 .name =
"vector_catch",
141 LOG_ERROR(
"error queueing EmbeddedICE register read");
147 LOG_ERROR(
"EmbeddedICE register read failed");
172 int eice_version = 0;
179 reg_list = calloc(num_regs,
sizeof(
struct reg));
194 for (i = 0; i < num_regs; i++) {
197 reg_list[i].
dirty =
false;
198 reg_list[i].
valid =
false;
199 reg_list[i].
value = calloc(1, 4);
210 for (i = 0; i < num_regs; i++)
211 free(reg_list[i].value);
219 LOG_INFO(
"Embedded ICE version %d", eice_version);
221 switch (eice_version) {
239 LOG_ERROR(
"EmbeddedICE v%d handling might be broken",
267 LOG_ERROR(
"EmbeddedICE v%d handling might be broken",
283 "(comms ctrl: 0x%8.8" PRIx32
")",
288 LOG_INFO(
"%s: hardware has %d breakpoint/watchpoint unit%s",
343 uint8_t *check_value, uint8_t *check_mask)
346 uint8_t reg_addr = ice_reg->
addr & 0x1f;
348 uint8_t field1_out[1];
349 uint8_t field2_out[1];
371 field1_out[0] = reg_addr;
415 uint8_t field1_out[1];
416 uint8_t field2_out[1];
449 fields[0].
in_value = (uint8_t *)data;
511 uint8_t reg_addr = ice_reg->
addr & 0x1f;
535 uint8_t field0_out[4];
536 uint8_t field1_out[1];
537 uint8_t field2_out[1];
580 uint8_t field0_in[4];
581 uint8_t field1_out[1];
582 uint8_t field2_out[1];
633 LOG_ERROR(
"embeddedice handshake timeout");
641 int reg_addr,
const uint8_t *
buffer,
int little,
int count)
645 for (i = 0; i <
count; i++) {
static struct arm7_9_common * target_to_arm7_9(struct target *target)
static int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
static int arm_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
static void arm_le_to_h_u32(jtag_callback_data_t arg)
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.
static uint32_t fast_target_buffer_get_u32(const void *p, bool le)
#define ERROR_COMMAND_SYNTAX_ERROR
int embeddedice_handshake(struct arm_jtag *jtag_info, int hsbit, uint32_t timeout)
Poll DCC control register until read or write handshake completes.
void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, const uint8_t *buffer, int little, int count)
This is an inner loop of the open loop DCC write of data to target.
static const struct reg_arch_type eice_reg_type
void embeddedice_set_reg(struct reg *reg, uint32_t value)
Queue a write for an EmbeddedICE register, updating the register cache.
static const struct @87 eice_regs[]
static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf)
Write an EmbeddedICE register, updating the register cache.
int embeddedice_send(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size)
Send a block of size 32-bit words to the DCC.
void embeddedice_free_reg_cache(struct reg_cache *reg_cache)
Free all memory allocated for EmbeddedICE register cache.
int embeddedice_setup(struct target *target)
Initialize EmbeddedICE module, if needed.
struct reg_cache * embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9)
Probe EmbeddedICE module and set up local records of its registers.
static int embeddedice_get_reg(struct reg *reg)
void embeddedice_write_reg(struct reg *reg, uint32_t value)
Queue a write for an EmbeddedICE register, bypassing the register cache.
int embeddedice_receive(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size)
Receive a block of size 32-bit words from the DCC.
void embeddedice_store_reg(struct reg *reg)
Queue a write for an EmbeddedICE register, using cached value.
int embeddedice_read_reg(struct reg *reg)
Queue a read for an EmbeddedICE register into the register cache, not checking the value read.
int embeddedice_read_reg_w_check(struct reg *reg, uint8_t *check_value, uint8_t *check_mask)
Queue a read for an EmbeddedICE register into the register cache, optionally checking the value read.
static void embeddedice_write_reg_inner(struct jtag_tap *tap, int reg_addr, uint32_t value)
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_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_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
int gettimeofday(struct timeval *tv, struct timezone *tz)
size_t size
Size of the control block search area.
Structure for items that are common between both ARM7 and ARM9 targets.
bool has_vector_catch
Specifies if the target has a reset vector catch.
struct arm_jtag jtag_info
JTAG information for target.
struct reg_cache * eice_cache
Embedded ICE register cache.
int wp_available_max
Maximum number of available watchpoint units.
struct arm_jtag * jtag_info
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.
const char * target_type_name(const struct target *target)
Get the target type name.
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
#define ERROR_TARGET_TIMEOUT
int timeval_compare(const struct timeval *x, const struct timeval *y)
int timeval_add_time(struct timeval *result, long sec, long usec)
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.