fix jtag_add_callback() args. The first argument is nothing special, it's just anothe...
[openocd.git] / src / target / arm720t.c
index 5c4ba16a00df77b3e7d2c284dc3ba94efd63f3f9..f160c9d55da331e6663de9da9e445e9057cc1fa7 100644 (file)
 #endif
 
 #include "arm720t.h"
-#include "jtag.h"
-#include "log.h"
 #include "time_support.h"
+#include "target_type.h"
 
-#include <stdlib.h>
-#include <string.h>
 
 #if 0
 #define _DEBUG_INSTRUCTION_EXECUTION_
@@ -46,8 +43,8 @@ int arm720t_target_create(struct target_s *target,Jim_Interp *interp);
 int arm720t_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
 int arm720t_quit(void);
 int arm720t_arch_state(struct target_s *target);
-int arm720t_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
-int arm720t_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);
+int arm720t_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
+int arm720t_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
 int arm720t_soft_reset_halt(struct target_s *target);
 
 target_type_t arm720t_target =
@@ -87,19 +84,19 @@ target_type_t arm720t_target =
        .quit = arm720t_quit
 };
 
-int arm720t_scan_cp15(target_t *target, u32 out, u32 *in, int instruction, int clock)
+int arm720t_scan_cp15(target_t *target, uint32_t out, uint32_t *in, int instruction, int clock)
 {
        int retval = ERROR_OK;
        armv4_5_common_t *armv4_5 = target->arch_info;
        arm7_9_common_t *arm7_9 = armv4_5->arch_info;
        arm_jtag_t *jtag_info = &arm7_9->jtag_info;
        scan_field_t fields[2];
-       u8 out_buf[4];
-       u8 instruction_buf = instruction;
+       uint8_t out_buf[4];
+       uint8_t instruction_buf = instruction;
 
        buf_set_u32(out_buf, 0, 32, flip_u32(out, 32));
 
-       jtag_add_end_state(TAP_DRPAUSE);
+       jtag_set_end_state(TAP_DRPAUSE);
        if((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
        {
                return retval;
@@ -113,26 +110,24 @@ int arm720t_scan_cp15(target_t *target, u32 out, u32 *in, int instruction, int c
        fields[0].num_bits = 1;
        fields[0].out_value = &instruction_buf;
        fields[0].in_value = NULL;
-       
 
        fields[1].tap = jtag_info->tap;
        fields[1].num_bits = 32;
        fields[1].out_value = out_buf;
        fields[1].in_value = NULL;
-       
+
        if (in)
        {
-               u8 tmp[4];
-               fields[1].in_value = tmp;
-               jtag_add_dr_scan_now(2, fields, TAP_INVALID);
-               *in=flip_u32(le_to_h_u32(tmp), 32);
+               fields[1].in_value = (uint8_t *)in;
+               jtag_add_dr_scan(2, fields, jtag_get_end_state());
+               jtag_add_callback(arm7flip32, (jtag_callback_data_t)in);
        } else
        {
-               jtag_add_dr_scan(2, fields, TAP_INVALID);
+               jtag_add_dr_scan(2, fields, jtag_get_end_state());
        }
 
        if (clock)
-               jtag_add_runtest(0, TAP_INVALID);
+               jtag_add_runtest(0, jtag_get_end_state());
 
 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
        if((retval = jtag_execute_queue()) != ERROR_OK)
@@ -151,7 +146,7 @@ int arm720t_scan_cp15(target_t *target, u32 out, u32 *in, int instruction, int c
        return ERROR_OK;
 }
 
-int arm720t_read_cp15(target_t *target, u32 opcode, u32 *value)
+int arm720t_read_cp15(target_t *target, uint32_t opcode, uint32_t *value)
 {
        /* fetch CP15 opcode */
        arm720t_scan_cp15(target, opcode, NULL, 1, 1);
@@ -168,7 +163,7 @@ int arm720t_read_cp15(target_t *target, u32 opcode, u32 *value)
        return ERROR_OK;
 }
 
-int arm720t_write_cp15(target_t *target, u32 opcode, u32 value)
+int arm720t_write_cp15(target_t *target, uint32_t opcode, uint32_t value)
 {
        /* fetch CP15 opcode */
        arm720t_scan_cp15(target, opcode, NULL, 1, 1);
@@ -184,9 +179,9 @@ int arm720t_write_cp15(target_t *target, u32 opcode, u32 value)
        return ERROR_OK;
 }
 
-u32 arm720t_get_ttb(target_t *target)
+uint32_t arm720t_get_ttb(target_t *target)
 {
-       u32 ttb = 0x0;
+       uint32_t ttb = 0x0;
 
        arm720t_read_cp15(target, 0xee120f10, &ttb);
        jtag_execute_queue();
@@ -198,7 +193,7 @@ u32 arm720t_get_ttb(target_t *target)
 
 void arm720t_disable_mmu_caches(target_t *target, int mmu, int d_u_cache, int i_cache)
 {
-       u32 cp15_control;
+       uint32_t cp15_control;
 
        /* read cp15 control register */
        arm720t_read_cp15(target, 0xee110f10, &cp15_control);
@@ -215,7 +210,7 @@ void arm720t_disable_mmu_caches(target_t *target, int mmu, int d_u_cache, int i_
 
 void arm720t_enable_mmu_caches(target_t *target, int mmu, int d_u_cache, int i_cache)
 {
-       u32 cp15_control;
+       uint32_t cp15_control;
 
        /* read cp15 control register */
        arm720t_read_cp15(target, 0xee110f10, &cp15_control);
@@ -334,7 +329,7 @@ int arm720t_arch_state(struct target_s *target)
        return ERROR_OK;
 }
 
-int arm720t_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer)
+int arm720t_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 {
        int retval;
        armv4_5_common_t *armv4_5 = target->arch_info;
@@ -354,7 +349,7 @@ int arm720t_read_memory(struct target_s *target, u32 address, u32 size, u32 coun
        return retval;
 }
 
-int arm720t_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer)
+int arm720t_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 {
        int retval;
 
@@ -532,11 +527,11 @@ int arm720t_handle_cp15_command(struct command_context_s *cmd_ctx, char *cmd, ch
        /* one or more argument, access a single register (write if second argument is given */
        if (argc >= 1)
        {
-               u32 opcode = strtoul(args[0], NULL, 0);
+               uint32_t opcode = strtoul(args[0], NULL, 0);
 
                if (argc == 1)
                {
-                       u32 value;
+                       uint32_t value;
                        if ((retval = arm720t_read_cp15(target, opcode, &value)) != ERROR_OK)
                        {
                                command_print(cmd_ctx, "couldn't access cp15 with opcode 0x%8.8x", opcode);
@@ -552,7 +547,7 @@ int arm720t_handle_cp15_command(struct command_context_s *cmd_ctx, char *cmd, ch
                }
                else if (argc == 2)
                {
-                       u32 value = strtoul(args[1], NULL, 0);
+                       uint32_t value = strtoul(args[1], NULL, 0);
                        if ((retval = arm720t_write_cp15(target, opcode, value)) != ERROR_OK)
                        {
                                command_print(cmd_ctx, "couldn't access cp15 with opcode 0x%8.8x", opcode);

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)