diff options
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/arm926ejs.c | 22 | ||||
-rw-r--r-- | src/target/arm9tdmi.c | 9 | ||||
-rw-r--r-- | src/target/arm_jtag.c | 49 | ||||
-rw-r--r-- | src/target/arm_jtag.h | 26 | ||||
-rw-r--r-- | src/target/trace.c | 2 |
5 files changed, 36 insertions, 72 deletions
diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index ef225145..efead81b 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -94,12 +94,14 @@ target_type_t arm926ejs_target = .quit = arm926ejs_quit }; -int arm926ejs_catch_broken_irscan(u8 *in_value, void *priv) + +int arm926ejs_catch_broken_irscan(u8 *captured, void *priv, scan_field_t *field) { - /* The ARM926EJ-S' instruction register is 4 bits wide */ - *in_value &= 0xf; + u8 *in_value=field->in_check_value; - if ((*in_value == 0x0f) || (*in_value == 0x00)) + /* The ARM926EJ-S' instruction register is 4 bits wide */ + u8 t=*in_value & 0xf; + if ((t == 0x0f) || (t == 0x00)) { DEBUG("caught ARM926EJ-S invalid Capture-IR result after CP15 access"); return ERROR_OK; @@ -119,7 +121,6 @@ int arm926ejs_read_cp15(target_t *target, u32 address, u32 *value) u8 address_buf[2]; u8 nr_w_buf = 0; u8 access = 1; - error_handler_t error_handler; buf_set_u32(address_buf, 0, 14, address); @@ -184,11 +185,8 @@ int arm926ejs_read_cp15(target_t *target, u32 address, u32 *value) #ifdef _DEBUG_INSTRUCTION_EXECUTION_ DEBUG("addr: 0x%x value: %8.8x", address, *value); #endif - - error_handler.error_handler = arm926ejs_catch_broken_irscan; - error_handler.error_handler_priv = NULL; - arm_jtag_set_instr(jtag_info, 0xc, &error_handler); + arm_jtag_set_instr(jtag_info, 0xc, &arm926ejs_catch_broken_irscan); return ERROR_OK; } @@ -203,7 +201,6 @@ int arm926ejs_write_cp15(target_t *target, u32 address, u32 value) u8 address_buf[2]; u8 nr_w_buf = 1; u8 access = 1; - error_handler_t error_handler; buf_set_u32(address_buf, 0, 14, address); buf_set_u32(value_buf, 0, 32, value); @@ -267,10 +264,7 @@ int arm926ejs_write_cp15(target_t *target, u32 address, u32 value) DEBUG("addr: 0x%x value: %8.8x", address, value); #endif - error_handler.error_handler = arm926ejs_catch_broken_irscan; - error_handler.error_handler_priv = NULL; - - arm_jtag_set_instr(jtag_info, 0xf, &error_handler); + arm_jtag_set_instr(jtag_info, 0xf, &arm926ejs_catch_broken_irscan); return ERROR_OK; } diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 5bb7e399..5f808cdb 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -101,15 +101,6 @@ arm9tdmi_vector_t arm9tdmi_vectors[] = {0, 0}, }; -int arm9tdmi_jtag_error_handler(u8 *in_value, void *priv) -{ - char *caller = priv; - - DEBUG("caller: %s", caller); - - return ERROR_JTAG_QUEUE_FAILED; -} - int arm9tdmi_examine_debug_reason(target_t *target) { /* get pointers to arch-specific information */ diff --git a/src/target/arm_jtag.c b/src/target/arm_jtag.c index edc1bd88..070af213 100644 --- a/src/target/arm_jtag.c +++ b/src/target/arm_jtag.c @@ -33,14 +33,7 @@ #define _ARM_JTAG_SCAN_N_CHECK_ #endif -int arm_jtag_set_instr_error_handler(u8 *in_value, void *priv) -{ - ERROR("setting the new JTAG instruction failed, debugging is likely to be broken"); - - return ERROR_OK; -} - -int arm_jtag_set_instr(arm_jtag_t *jtag_info, u32 new_instr, error_handler_t *caller_error_handler) +int arm_jtag_set_instr(arm_jtag_t *jtag_info, u32 new_instr, in_handler_t handler) { jtag_device_t *device = jtag_get_device(jtag_info->chain_pos); @@ -56,22 +49,8 @@ int arm_jtag_set_instr(arm_jtag_t *jtag_info, u32 new_instr, error_handler_t *ca field.in_value = NULL; field.in_check_value = NULL; field.in_check_mask = NULL; - field.in_handler = NULL; + field.in_handler = handler; field.in_handler_priv = NULL; - - - - if (caller_error_handler) - { - jtag_set_check_value(&field, NULL, NULL, caller_error_handler); - } - else - { - error_handler_t error_handler; - error_handler.error_handler = arm_jtag_set_instr_error_handler; - error_handler.error_handler_priv = NULL; - jtag_set_check_value(&field, NULL, NULL, &error_handler); - } jtag_add_ir_scan(1, &field, -1, NULL); @@ -139,7 +118,7 @@ int arm_jtag_setup_connection(arm_jtag_t *jtag_info) } /* read JTAG buffer into host-endian u32, flipping bit-order */ -int arm_jtag_buf_to_u32_flip(u8 *in_buf, void *priv) +int arm_jtag_buf_to_u32_flip(u8 *in_buf, void *priv, struct scan_field_s *field) { u32 *dest = priv; *dest = flip_u32(le_to_h_u32(in_buf), 32); @@ -147,35 +126,35 @@ int arm_jtag_buf_to_u32_flip(u8 *in_buf, void *priv) } /* read JTAG buffer into little-endian u32, flipping bit-order */ -int arm_jtag_buf_to_le32_flip(u8 *in_buf, void *priv) +int arm_jtag_buf_to_le32_flip(u8 *in_buf, void *priv, struct scan_field_s *field) { h_u32_to_le(((u8*)priv), flip_u32(le_to_h_u32(in_buf), 32)); return ERROR_OK; } /* read JTAG buffer into little-endian u16, flipping bit-order */ -int arm_jtag_buf_to_le16_flip(u8 *in_buf, void *priv) +int arm_jtag_buf_to_le16_flip(u8 *in_buf, void *priv, struct scan_field_s *field) { h_u16_to_le(((u8*)priv), flip_u32(le_to_h_u32(in_buf), 32) & 0xffff); return ERROR_OK; } /* read JTAG buffer into big-endian u32, flipping bit-order */ -int arm_jtag_buf_to_be32_flip(u8 *in_buf, void *priv) +int arm_jtag_buf_to_be32_flip(u8 *in_buf, void *priv, struct scan_field_s *field) { h_u32_to_be(((u8*)priv), flip_u32(le_to_h_u32(in_buf), 32)); return ERROR_OK; } /* read JTAG buffer into big-endian u16, flipping bit-order */ -int arm_jtag_buf_to_be16_flip(u8 *in_buf, void *priv) +int arm_jtag_buf_to_be16_flip(u8 *in_buf, void *priv, struct scan_field_s *field) { h_u16_to_be(((u8*)priv), flip_u32(le_to_h_u32(in_buf), 32) & 0xffff); return ERROR_OK; } /* read JTAG buffer into u8, flipping bit-order */ -int arm_jtag_buf_to_8_flip(u8 *in_buf, void *priv) +int arm_jtag_buf_to_8_flip(u8 *in_buf, void *priv, struct scan_field_s *field) { u8 *dest = priv; *dest = flip_u32(le_to_h_u32(in_buf), 32) & 0xff; @@ -184,7 +163,7 @@ int arm_jtag_buf_to_8_flip(u8 *in_buf, void *priv) /* not-flipping variants */ /* read JTAG buffer into host-endian u32 */ -int arm_jtag_buf_to_u32(u8 *in_buf, void *priv) +int arm_jtag_buf_to_u32(u8 *in_buf, void *priv, struct scan_field_s *field) { u32 *dest = priv; *dest = le_to_h_u32(in_buf); @@ -192,35 +171,35 @@ int arm_jtag_buf_to_u32(u8 *in_buf, void *priv) } /* read JTAG buffer into little-endian u32 */ -int arm_jtag_buf_to_le32(u8 *in_buf, void *priv) +int arm_jtag_buf_to_le32(u8 *in_buf, void *priv, struct scan_field_s *field) { h_u32_to_le(((u8*)priv), le_to_h_u32(in_buf)); return ERROR_OK; } /* read JTAG buffer into little-endian u16 */ -int arm_jtag_buf_to_le16(u8 *in_buf, void *priv) +int arm_jtag_buf_to_le16(u8 *in_buf, void *priv, struct scan_field_s *field) { h_u16_to_le(((u8*)priv), le_to_h_u32(in_buf) & 0xffff); return ERROR_OK; } /* read JTAG buffer into big-endian u32 */ -int arm_jtag_buf_to_be32(u8 *in_buf, void *priv) +int arm_jtag_buf_to_be32(u8 *in_buf, void *priv, struct scan_field_s *field) { h_u32_to_be(((u8*)priv), le_to_h_u32(in_buf)); return ERROR_OK; } /* read JTAG buffer into big-endian u16 */ -int arm_jtag_buf_to_be16(u8 *in_buf, void *priv) +int arm_jtag_buf_to_be16(u8 *in_buf, void *priv, struct scan_field_s *field) { h_u16_to_be(((u8*)priv), le_to_h_u32(in_buf) & 0xffff); return ERROR_OK; } /* read JTAG buffer into u8 */ -int arm_jtag_buf_to_8(u8 *in_buf, void *priv) +int arm_jtag_buf_to_8(u8 *in_buf, void *priv, struct scan_field_s *field) { u8 *dest = priv; *dest = le_to_h_u32(in_buf) & 0xff; diff --git a/src/target/arm_jtag.h b/src/target/arm_jtag.h index f2f55878..227a8d58 100644 --- a/src/target/arm_jtag.h +++ b/src/target/arm_jtag.h @@ -34,25 +34,25 @@ typedef struct arm_jtag_s u32 intest_instr; } arm_jtag_t; -extern int arm_jtag_set_instr(arm_jtag_t *jtag_info, u32 new_instr, error_handler_t *error_handler); +extern int arm_jtag_set_instr(arm_jtag_t *jtag_info, u32 new_instr, in_handler_t handler); extern int arm_jtag_scann(arm_jtag_t *jtag_info, u32 new_scan_chain); extern int arm_jtag_setup_connection(arm_jtag_t *jtag_info); /* JTAG buffers to host, be and le buffers, flipping variants */ -int arm_jtag_buf_to_u32_flip(u8 *in_buf, void *priv); -int arm_jtag_buf_to_le32_flip(u8 *in_buf, void *priv); -int arm_jtag_buf_to_le16_flip(u8 *in_buf, void *priv); -int arm_jtag_buf_to_be32_flip(u8 *in_buf, void *priv); -int arm_jtag_buf_to_be16_flip(u8 *in_buf, void *priv); -int arm_jtag_buf_to_8_flip(u8 *in_buf, void *priv); +int arm_jtag_buf_to_u32_flip(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_le32_flip(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_le16_flip(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_be32_flip(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_be16_flip(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_8_flip(u8 *in_buf, void *priv, struct scan_field_s *field); /* JTAG buffers to host, be and le buffers */ -int arm_jtag_buf_to_u32(u8 *in_buf, void *priv); -int arm_jtag_buf_to_le32(u8 *in_buf, void *priv); -int arm_jtag_buf_to_le16(u8 *in_buf, void *priv); -int arm_jtag_buf_to_be32(u8 *in_buf, void *priv); -int arm_jtag_buf_to_be16(u8 *in_buf, void *priv); -int arm_jtag_buf_to_8(u8 *in_buf, void *priv); +int arm_jtag_buf_to_u32(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_le32(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_le16(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_be32(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_be16(u8 *in_buf, void *priv, struct scan_field_s *field); +int arm_jtag_buf_to_8(u8 *in_buf, void *priv, struct scan_field_s *field); #endif /* ARM_JTAG */ diff --git a/src/target/trace.c b/src/target/trace.c index 73f01332..536e34a5 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -76,7 +76,7 @@ int handle_trace_point_command(struct command_context_s *cmd_ctx, char *cmd, cha { if (trace->trace_points) free(trace->trace_points); - trace->num_trace_points = NULL; + trace->num_trace_points = 0; trace->trace_points_size = 0; return ERROR_OK; |