[RFC] target: Move bulk_write_memory to arm7_9
[openocd.git] / src / target / fa526.c
index 9e7b00da8792523938b91ab485d79a193bd8b289..a33b4a1c678fd4265c136d70ce1a97d7b8d1f13b 100644 (file)
@@ -15,7 +15,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
  ***************************************************************************/
 
 /*
@@ -33,6 +33,7 @@
 
 #include "arm920t.h"
 #include "target_type.h"
+#include "arm_opcodes.h"
 
 static void fa526_change_to_arm(struct target *target, uint32_t *r0, uint32_t *pc)
 {
@@ -40,7 +41,7 @@ static void fa526_change_to_arm(struct target *target, uint32_t *r0, uint32_t *p
 }
 
 static void fa526_read_core_regs(struct target *target,
-               uint32_t mask, uint32_tcore_regs[16])
+               uint32_t mask, uint32_t *core_regs[16])
 {
        int i;
        struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
@@ -58,8 +59,7 @@ static void fa526_read_core_regs(struct target *target,
        /* fetch NOP, STM in EXECUTE stage (1st cycle) */
        arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0);
 
-       for (i = 0; i <= 15; i++)
-       {
+       for (i = 0; i <= 15; i++) {
                if (mask & (1 << i))
                        /* nothing fetched, STM in MEMORY (i'th cycle) */
                        arm9tdmi_clock_data_in(jtag_info, core_regs[i]);
@@ -67,7 +67,7 @@ static void fa526_read_core_regs(struct target *target,
 }
 
 static void fa526_read_core_regs_target_buffer(struct target *target,
-               uint32_t mask, voidbuffer, int size)
+               uint32_t mask, void *buffer, int size)
 {
        int i;
        struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
@@ -89,12 +89,10 @@ static void fa526_read_core_regs_target_buffer(struct target *target,
        /* fetch NOP, STM in EXECUTE stage (1st cycle) */
        arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0);
 
-       for (i = 0; i <= 15; i++)
-       {
+       for (i = 0; i <= 15; i++) {
                if (mask & (1 << i))
                        /* nothing fetched, STM in MEMORY (i'th cycle) */
-                       switch (size)
-                       {
+                       switch (size) {
                                case 4:
                                        arm9tdmi_clock_data_in_endianness(jtag_info, buf_u32++, 4, be);
                                        break;
@@ -187,8 +185,7 @@ static void fa526_write_xpsr_im8(struct target *target,
        arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0);
 
        /* rot == 4 writes flags, which takes only one cycle */
-       if (rot != 4)
-       {
+       if (rot != 4) {
                /* nothing fetched, MSR in EXECUTE (2) */
                arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0);
                /* nothing fetched, MSR in EXECUTE (3) */
@@ -215,8 +212,7 @@ static void fa526_write_core_regs(struct target *target,
        /* fetch NOP, LDM in EXECUTE stage (1st cycle) */
        arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0);
 
-       for (i = 0; i <= 15; i++)
-       {
+       for (i = 0; i <= 15; i++) {
                if (mask & (1 << i))
                        /* nothing fetched, LDM still in EXECUTE (1 + i cycle) */
                        arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, core_regs[i], NULL, 0);
@@ -256,12 +252,8 @@ static void fa526_branch_resume_thumb(struct target *target)
 }
 
 static int fa526_init_arch_info_2(struct target *target,
-               struct arm9tdmi_common *arm9tdmi, struct jtag_tap *tap)
+               struct arm7_9_common *arm7_9, struct jtag_tap *tap)
 {
-       struct arm7_9_common *arm7_9;
-
-       arm7_9 = &arm9tdmi->arm7_9_common;
-
        /* prepare JTAG information for the new target */
        arm7_9->jtag_info.tap = tap;
        arm7_9->jtag_info.scann_size = 5;
@@ -292,10 +284,11 @@ static int fa526_init_arch_info_2(struct target *target,
        arm7_9->enable_single_step = arm9tdmi_enable_single_step;
        arm7_9->disable_single_step = arm9tdmi_disable_single_step;
 
+       arm7_9->bulk_write_memory = arm7_9_bulk_write_memory;
+
        arm7_9->post_debug_entry = NULL;
 
        arm7_9->pre_restore_context = NULL;
-       arm7_9->post_restore_context = NULL;
 
        /* initialize arch-specific breakpoint handling */
        arm7_9->arm_bkpt = 0xdeeedeee;
@@ -317,12 +310,10 @@ static int fa526_init_arch_info_2(struct target *target,
 static int fa526_init_arch_info(struct target *target,
                struct arm920t_common *arm920t, struct jtag_tap *tap)
 {
-       struct arm9tdmi_common *arm9tdmi = &arm920t->arm9tdmi_common;
-       struct arm7_9_common *arm7_9 = &arm9tdmi->arm7_9_common;
+       struct arm7_9_common *arm7_9 = &arm920t->arm7_9_common;
 
-       /* initialize arm9tdmi specific info (including arm7_9 and armv4_5)
-        */
-       fa526_init_arch_info_2(target, arm9tdmi, tap);
+       /* initialize arm7/arm9 specific info (including armv4_5) */
+       fa526_init_arch_info_2(target, arm7_9, tap);
 
        arm920t->common_magic = ARM920T_COMMON_MAGIC;
 
@@ -352,14 +343,13 @@ static int fa526_init_arch_info(struct target *target,
 
 static int fa526_target_create(struct target *target, Jim_Interp *interp)
 {
-       struct arm920t_common *arm920t = calloc(1,sizeof(struct arm920t_common));
+       struct arm920t_common *arm920t = calloc(1, sizeof(struct arm920t_common));
 
        return fa526_init_arch_info(target, arm920t, target->tap);
 }
 
 /** Holds methods for FA526 targets. */
-struct target_type fa526_target =
-{
+struct target_type fa526_target = {
        .name = "fa526",
 
        .poll = arm7_9_poll,
@@ -375,13 +365,13 @@ struct target_type fa526_target =
        .deassert_reset = arm7_9_deassert_reset,
        .soft_reset_halt = arm920t_soft_reset_halt,
 
-       .get_gdb_reg_list = armv4_5_get_gdb_reg_list,
+       .get_gdb_reg_list = arm_get_gdb_reg_list,
 
        .read_memory = arm920t_read_memory,
-       .write_memory = arm920t_write_memory,
-       .bulk_write_memory = arm7_9_bulk_write_memory,
-       .checksum_memory = arm7_9_checksum_memory,
-       .blank_check_memory = arm7_9_blank_check_memory,
+       .write_memory = arm920t_write_memory_opt,
+
+       .checksum_memory = arm_checksum_memory,
+       .blank_check_memory = arm_blank_check_memory,
 
        .run_algorithm = armv4_5_run_algorithm,
 
@@ -390,8 +380,9 @@ struct target_type fa526_target =
        .add_watchpoint = arm7_9_add_watchpoint,
        .remove_watchpoint = arm7_9_remove_watchpoint,
 
-       .register_commands = arm920t_register_commands,
+       .commands = arm920t_command_handlers,
        .target_create = fa526_target_create,
        .init_target = arm9tdmi_init_target,
        .examine = arm7_9_examine,
+       .check_reset = arm7_9_check_reset,
 };

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)