]> git.sur5r.net Git - openocd/commitdiff
Update Embedded ICE registers explicitly during target->type->examine() instead
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 16 Apr 2008 09:17:22 +0000 (09:17 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 16 Apr 2008 09:17:22 +0000 (09:17 +0000)
of as a side effect of target->type->poll(). This makes it clearer when things
happen during reset/examine.

git-svn-id: svn://svn.berlios.de/openocd/trunk@585 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/target/arm7_9_common.c
src/target/arm7_9_common.h
src/target/arm7tdmi.c
src/target/arm9tdmi.c
src/target/etm.h

index 191e91c5f610d757baeeeb89eb1824ff38e9d610..0c63d9209aed41d95cf42a78b1fad80731d85639 100644 (file)
@@ -84,27 +84,17 @@ int arm7_9_reinit_embeddedice(target_t *target)
                arm7_9_enable_sw_bkpts(target);
        }
        
-       arm7_9->reinit_embeddedice = 0;
-       
        return ERROR_OK;
 }
 
-int arm7_9_jtag_callback(enum jtag_event event, void *priv)
+/* set things up after a reset / on startup */
+int arm7_9_setup(target_t *target)
 {
-       target_t *target = priv;
-       armv4_5_common_t *armv4_5 = target->arch_info;
-       arm7_9_common_t *arm7_9 = armv4_5->arch_info;
-       
-       /* a test-logic reset occured
+       /* a test-logic reset have occured
         * the EmbeddedICE registers have been reset
         * hardware breakpoints have been cleared
         */
-       if (event == JTAG_TRST_ASSERTED)
-       {
-               arm7_9->reinit_embeddedice = 1;
-       }
-       
-       return ERROR_OK;
+       return arm7_9_reinit_embeddedice(target);
 }
 
 int arm7_9_get_arch_pointers(target_t *target, armv4_5_common_t **armv4_5_p, arm7_9_common_t **arm7_9_p)
@@ -686,11 +676,6 @@ int arm7_9_poll(target_t *target)
        arm7_9_common_t *arm7_9 = armv4_5->arch_info;
        reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT];
 
-       if (arm7_9->reinit_embeddedice)
-       {
-               arm7_9_reinit_embeddedice(target);
-       }
-       
        /* read debug status register */
        embeddedice_read_reg(dbg_stat);
        if ((retval = jtag_execute_queue()) != ERROR_OK)
@@ -2635,8 +2620,6 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9)
        arm7_9->has_monitor_mode = 0;
        arm7_9->has_vector_catch = 0;
        
-       arm7_9->reinit_embeddedice = 0;
-       
        arm7_9->debug_entry_from_reset = 0;
        
        arm7_9->dcc_working_area = NULL;
@@ -2644,8 +2627,6 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9)
        arm7_9->fast_memory_access = 0;
        arm7_9->dcc_downloads = 0;
 
-       jtag_register_event_callback(arm7_9_jtag_callback, target);
-
        armv4_5->arch_info = arm7_9;
        armv4_5->read_core_reg = arm7_9_read_core_reg;
        armv4_5->write_core_reg = arm7_9_write_core_reg;
index b95516e6e5b96f4b6dd13ca808dd580c084bb0bb..21992faf28691e98d3d33d178d262951b0641aab 100644 (file)
@@ -53,7 +53,6 @@ typedef struct arm7_9_common_s
        int has_monitor_mode;
        int has_vector_catch;
        
-       int reinit_embeddedice;
        int debug_entry_from_reset;
        
        struct working_area_s *dcc_working_area;
@@ -105,6 +104,7 @@ int arm7_9_poll(target_t *target);
 
 int arm7_9_target_request_data(target_t *target, u32 size, u8 *buffer);
 
+int arm7_9_setup(target_t *target);
 int arm7_9_assert_reset(target_t *target);
 int arm7_9_deassert_reset(target_t *target);
 int arm7_9_reset_request_halt(target_t *target);
index 214eea05ac2ee17246fc3b59bcf4f8dec8de69da..53559a231f8e542e6a36536e480693fa9a2af713 100644 (file)
@@ -769,6 +769,8 @@ int arm7tdmi_examine(struct command_context_s *cmd_ctx, struct target_s *target)
        }
        if ((retval=embeddedice_setup(target))!=ERROR_OK)
                return retval;
+       if ((retval=arm7_9_setup(target))!=ERROR_OK)
+               return retval;
        if (arm7_9->etm_ctx)
        {
                if ((retval=etm_setup(target))!=ERROR_OK)
index 30034311fd5a3851a98d30d26dd30b3e6e47458d..24f3b2eb366975d7f2cf571f7faf79ca9e7dda28 100644 (file)
@@ -876,6 +876,8 @@ int arm9tdmi_examine(struct command_context_s *cmd_ctx, struct target_s *target)
        }
        if ((retval=embeddedice_setup(target))!=ERROR_OK)
                return retval;
+       if ((retval=arm7_9_setup(target))!=ERROR_OK)
+               return retval;
        if (arm7_9->etm_ctx)
        {
                if ((retval=etm_setup(target))!=ERROR_OK)
index da47ff13ab9f67b559b6f9f5ec79ba7d81ab783b..8e5812b84906d3266e0791f69c1f5e0f49059fc7 100644 (file)
@@ -201,6 +201,7 @@ extern int etm_read_reg_w_check(reg_t *reg, u8* check_value, u8* check_mask);
 extern int etm_store_reg(reg_t *reg);
 extern int etm_set_reg(reg_t *reg, u32 value);
 extern int etm_set_reg_w_exec(reg_t *reg, u8 *buf);
+extern int etm_setup(target_t *target);
 
 int etm_register_commands(struct command_context_s *cmd_ctx);
 int etm_register_user_commands(struct command_context_s *cmd_ctx);