This is an automated email from Gerrit.

Spencer Oliver (s...@spen-soft.co.uk) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1134

-- gerrit

commit 4f1f8fc24731eb3d8e6ab28ac7133762e1c53977
Author: Spencer Oliver <s...@spen-soft.co.uk>
Date:   Thu Feb 7 12:12:18 2013 +0000

    target: hla correctly use target events
    
    Because we were always running using target state TARGET_RUNNING target
    algorithm's were a bit verbose compared to other targets.
    
    This brings the hla target inline with the other targets.
    
    Change-Id: I3a257fdc878b87660fac8b5eca22b421eee5b349
    Signed-off-by: Spencer Oliver <s...@spen-soft.co.uk>

diff --git a/src/target/hla_target.c b/src/target/hla_target.c
index e1e6815..937391b 100644
--- a/src/target/hla_target.c
+++ b/src/target/hla_target.c
@@ -381,6 +381,7 @@ static int adapter_poll(struct target *target)
        enum target_state state;
        struct hl_interface_s *adapter = target_to_adapter(target);
        struct armv7m_common *armv7m = target_to_armv7m(target);
+       enum target_state prev_target_state = target->state;
 
        state = adapter->layout->api->state(adapter->fd);
 
@@ -399,10 +400,15 @@ static int adapter_poll(struct target *target)
                if (retval != ERROR_OK)
                        return retval;
 
-               if (arm_semihosting(target, &retval) != 0)
-                       return retval;
+               if (prev_target_state == TARGET_DEBUG_RUNNING) {
+                       target_call_event_callbacks(target, 
TARGET_EVENT_DEBUG_HALTED);
+               } else {
+                       if (arm_semihosting(target, &retval) != 0)
+                               return retval;
+
+                       target_call_event_callbacks(target, 
TARGET_EVENT_HALTED);
+               }
 
-               target_call_event_callbacks(target, TARGET_EVENT_HALTED);
                LOG_DEBUG("halted: PC: 0x%08x", 
buf_get_u32(armv7m->arm.pc->value, 0, 32));
        }
 
@@ -603,10 +609,15 @@ static int adapter_resume(struct target *target, int 
current,
        if (res != ERROR_OK)
                return res;
 
-       target->state = TARGET_RUNNING;
        target->debug_reason = DBG_REASON_NOTHALTED;
 
-       target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
+       if (!debug_execution) {
+               target->state = TARGET_RUNNING;
+               target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
+       } else {
+               target->state = TARGET_DEBUG_RUNNING;
+               target_call_event_callbacks(target, TARGET_EVENT_DEBUG_RESUMED);
+       }
 
        return ERROR_OK;
 }

-- 

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to