summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/target/arm9tdmi.c108
1 files changed, 50 insertions, 58 deletions
diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c
index e8e1991c..6e136444 100644
--- a/src/target/arm9tdmi.c
+++ b/src/target/arm9tdmi.c
@@ -128,32 +128,32 @@ int arm9tdmi_examine_debug_reason(target_t *target)
fields[0].tap = arm7_9->jtag_info.tap;
fields[0].num_bits = 32;
fields[0].out_value = NULL;
-
+
fields[0].in_value = databus;
-
-
+
+
fields[0].in_handler = NULL;
-
+
fields[1].tap = arm7_9->jtag_info.tap;
fields[1].num_bits = 3;
fields[1].out_value = NULL;
-
+
fields[1].in_value = &debug_reason;
-
-
+
+
fields[1].in_handler = NULL;
-
+
fields[2].tap = arm7_9->jtag_info.tap;
fields[2].num_bits = 32;
fields[2].out_value = NULL;
-
+
fields[2].in_value = instructionbus;
-
-
+
+
fields[2].in_handler = NULL;
-
+
if((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK)
{
@@ -216,42 +216,34 @@ int arm9tdmi_clock_out(arm_jtag_t *jtag_info, u32 instr, u32 out, u32 *in, int s
fields[0].tap = jtag_info->tap;
fields[0].num_bits = 32;
fields[0].out_value = out_buf;
-
fields[0].in_value = NULL;
- if (in)
- {
- fields[0].in_handler = arm_jtag_buf_to_u32; /* deprecated! invoke this from user code! */
- fields[0].in_handler_priv = in;
- }
- else
- {
- fields[0].in_handler = NULL;
-
- }
-
-
+ fields[0].in_handler = NULL;
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 3;
fields[1].out_value = &sysspeed_buf;
-
fields[1].in_value = NULL;
-
-
fields[1].in_handler = NULL;
-
+
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 32;
fields[2].out_value = instr_buf;
-
fields[2].in_value = NULL;
-
-
fields[2].in_handler = NULL;
-
- jtag_add_dr_scan(3, fields, TAP_INVALID);
+ if (in)
+ {
+ u8 tmp[4];
+ fields[0].in_value=tmp;
+ jtag_add_dr_scan_now(3, fields, TAP_INVALID);
+
+ *in=flip_u32(le_to_h_u32(tmp), 32);
+ }
+ else
+ {
+ jtag_add_dr_scan(3, fields, TAP_INVALID);
+ }
jtag_add_runtest(0, TAP_INVALID);
@@ -291,32 +283,32 @@ int arm9tdmi_clock_data_in(arm_jtag_t *jtag_info, u32 *in)
fields[0].tap = jtag_info->tap;
fields[0].num_bits = 32;
fields[0].out_value = NULL;
-
+
fields[0].in_value = NULL;
fields[0].in_handler = arm_jtag_buf_to_u32; /* deprecated! invoke this from user code! */
fields[0].in_handler_priv = in;
-
-
+
+
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 3;
fields[1].out_value = NULL;
-
+
fields[1].in_value = NULL;
fields[1].in_handler = NULL;
-
-
-
+
+
+
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 32;
fields[2].out_value = NULL;
-
+
fields[2].in_value = NULL;
-
-
+
+
fields[2].in_handler = NULL;
-
+
jtag_add_dr_scan(3, fields, TAP_INVALID);
@@ -363,7 +355,7 @@ int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size,
fields[0].tap = jtag_info->tap;
fields[0].num_bits = 32;
fields[0].out_value = NULL;
-
+
fields[0].in_value = NULL;
switch (size)
{
@@ -378,28 +370,28 @@ int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size,
break;
}
fields[0].in_handler_priv = in;
-
-
+
+
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 3;
fields[1].out_value = NULL;
-
+
fields[1].in_value = NULL;
fields[1].in_handler = NULL;
-
-
-
+
+
+
fields[2].tap = jtag_info->tap;
fields[2].num_bits = 32;
fields[2].out_value = NULL;
-
+
fields[2].in_value = NULL;
-
-
+
+
fields[2].in_handler = NULL;
-
+
jtag_add_dr_scan(3, fields, TAP_INVALID);
@@ -1032,11 +1024,11 @@ int arm9tdmi_register_commands(struct command_context_s *cmd_ctx)
{
int retval;
command_t *arm9tdmi_cmd;
-
+
retval = arm7_9_register_commands(cmd_ctx);
arm9tdmi_cmd = register_command(cmd_ctx, NULL, "arm9tdmi", NULL, COMMAND_ANY, "arm9tdmi specific commands");
register_command(cmd_ctx, arm9tdmi_cmd, "vector_catch", handle_arm9tdmi_catch_vectors_command, COMMAND_EXEC, "catch arm920t vectors ['all'|'none'|'<vec1 vec2 ...>']");
-
+
return retval;
}