ARM926: more cleanup
authorDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 6 Nov 2009 04:35:47 +0000 (20:35 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 6 Nov 2009 04:35:47 +0000 (20:35 -0800)
An init_target() wrapper isn't needed, and target_create()
can shrink a bit.  Add a header comment and some doxygen.

Remove arm926ejs_catch_broken_irscan() which has been a NOP
for quite a few months now, and in any case duplicates logic
in the JTAG core to validate IR capture data.  But force the
capture mask to 0x0f, so those tests are most effective.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/target/arm926ejs.c

index 03adc774d7b7b7ace3e191e8518ee47ea71e14a8..7147dbfd8c55a8af554ded4d4fec7e27d64e1405 100644 (file)
 #include "target_type.h"
 
 
-#if 0
-#define _DEBUG_INSTRUCTION_EXECUTION_
-#endif
+/*
+ * The ARM926 is built around the ARM9EJ-S core, and most JTAG docs
+ * are in the ARM9EJ-S Technical Reference Manual (ARM DDI 0222B) not
+ * the ARM926 manual (ARM DDI 0198E).  The scan chains are:
+ *
+ *   1 ... core debugging
+ *   2 ... EmbeddedICE
+ *   3 ... external boundary scan (SoC-specific, unused here)
+ *   6 ... ETM
+ *   15 ... coprocessor 15
+ */
 
-static int arm926ejs_catch_broken_irscan(uint8_t *captured, void *priv,
-               scan_field_t *field)
-{
-       /* FIX!!!! this code should be reenabled. For now it does not check
-        * the queue...*/
-       return 0;
 #if 0
-       /* The ARM926EJ-S' instruction register is 4 bits wide */
-       uint8_t t = *captured & 0xf;
-       uint8_t t2 = *field->in_check_value & 0xf;
-       if (t == t2)
-       {
-               return ERROR_OK;
-       }
-       else if ((t == 0x0f) || (t == 0x00))
-       {
-               LOG_DEBUG("caught ARM926EJ-S invalid Capture-IR result after CP15 access");
-               return ERROR_OK;
-       }
-       return ERROR_JTAG_QUEUE_FAILED;;
+#define _DEBUG_INSTRUCTION_EXECUTION_
 #endif
-}
 
 #define ARM926EJS_CP15_ADDR(opcode_1, opcode_2, CRn, CRm) ((opcode_1 << 11) | (opcode_2 << 8) | (CRn << 4) | (CRm << 0))
 
@@ -136,7 +125,7 @@ static int arm926ejs_cp15_read(target_t *target, uint32_t op1, uint32_t op2,
        LOG_DEBUG("addr: 0x%x value: %8.8x", address, *value);
 #endif
 
-       arm_jtag_set_instr(jtag_info, 0xc, &arm926ejs_catch_broken_irscan);
+       arm_jtag_set_instr(jtag_info, 0xc, NULL);
 
        return ERROR_OK;
 }
@@ -227,7 +216,7 @@ static int arm926ejs_cp15_write(target_t *target, uint32_t op1, uint32_t op2,
        LOG_DEBUG("addr: 0x%x value: %8.8x", address, value);
 #endif
 
-       arm_jtag_set_instr(jtag_info, 0xf, &arm926ejs_catch_broken_irscan);
+       arm_jtag_set_instr(jtag_info, 0xf, NULL);
 
        return ERROR_OK;
 }
@@ -543,6 +532,7 @@ static int arm926ejs_get_arch_pointers(target_t *target,
        return ERROR_OK;
 }
 
+/** Logs summary of ARM926 state for a halted target. */
 int arm926ejs_arch_state(struct target_s *target)
 {
        armv4_5_common_t *armv4_5 = target->arch_info;
@@ -644,6 +634,7 @@ int arm926ejs_soft_reset_halt(struct target_s *target)
        return target_call_event_callbacks(target, TARGET_EVENT_HALTED);
 }
 
+/** Writes a buffer, in the specified word size, with current MMU settings. */
 int arm926ejs_write_memory(struct target_s *target, uint32_t address,
                uint32_t size, uint32_t count, uint8_t *buffer)
 {
@@ -732,14 +723,6 @@ static int arm926ejs_read_phys_memory(struct target_s *target,
        return armv4_5_mmu_read_physical(target, &arm926ejs->armv4_5_mmu, address, size, count, buffer);
 }
 
-static int arm926ejs_init_target(struct command_context_s *cmd_ctx,
-               struct target_s *target)
-{
-       arm9tdmi_init_target(cmd_ctx, target);
-
-       return ERROR_OK;
-}
-
 int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs,
                jtag_tap_t *tap)
 {
@@ -782,9 +765,10 @@ static int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp)
 {
        arm926ejs_common_t *arm926ejs = calloc(1,sizeof(arm926ejs_common_t));
 
-       arm926ejs_init_arch_info(target, arm926ejs, target->tap);
+       /* ARM9EJ-S core always reports 0x1 in Capture-IR */
+       target->tap->ir_capture_mask = 0x0f;
 
-       return ERROR_OK;
+       return arm926ejs_init_arch_info(target, arm926ejs, target->tap);
 }
 
 static int arm926ejs_handle_cp15_command(struct command_context_s *cmd_ctx,
@@ -915,6 +899,7 @@ static int arm926ejs_mmu(struct target_s *target, int *enabled)
        return ERROR_OK;
 }
 
+/** Registers commands to access coprocessor, cache, and debug resources.  */
 int arm926ejs_register_commands(struct command_context_s *cmd_ctx)
 {
        int retval;
@@ -938,6 +923,7 @@ int arm926ejs_register_commands(struct command_context_s *cmd_ctx)
        return retval;
 }
 
+/** Holds methods for ARM926 targets. */
 target_type_t arm926ejs_target =
 {
        .name = "arm926ejs",
@@ -972,7 +958,7 @@ target_type_t arm926ejs_target =
 
        .register_commands = arm926ejs_register_commands,
        .target_create = arm926ejs_target_create,
-       .init_target = arm926ejs_init_target,
+       .init_target = arm9tdmi_init_target,
        .examine = arm9tdmi_examine,
        .virt2phys = arm926ejs_virt2phys,
        .mmu = arm926ejs_mmu,
@@ -982,4 +968,3 @@ target_type_t arm926ejs_target =
        .mrc = arm926ejs_mrc,
        .mcr = arm926ejs_mcr,
 };
-

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)