Patch to remove reset run_and_halt/run_and_init

-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer
Index: C:/workspace/openocd/doc/openocd.texi
===================================================================
--- C:/workspace/openocd/doc/openocd.texi       (revision 874)
+++ C:/workspace/openocd/doc/openocd.texi       (working copy)
@@ -540,11 +540,6 @@
 @option{pre_resume} or @option{gdb_program_config}.
 @option{post_reset} and @option{reset} will produce the same results.
 
[EMAIL PROTECTED] @b{run_and_halt_time} <@var{target#}> <@var{time_in_ms}>
[EMAIL PROTECTED] run_and_halt_time
-The amount of time the debugger should wait after releasing reset before it 
asserts
-a debug request. This is used by the @option{run_and_halt} and 
@option{run_and_init}
-reset modes. 
 @item @b{working_area} <@var{target#}> <@var{address}> <@var{size}>
 <@var{backup}|@var{nobackup}>
 @cindex working_area
@@ -795,8 +790,7 @@
 @cindex step
 Single-step the target at its current code position, or at an optional 
address. 
 
[EMAIL PROTECTED] @b{reset} [EMAIL 
PROTECTED]|@option{halt}|@option{init}|@option{run_and_halt}
-|@option{run_and_init}]
[EMAIL PROTECTED] @b{reset} [EMAIL PROTECTED]|@option{halt}|@option{init}]
 @cindex reset
 Perform a hard-reset. The optional parameter specifies what should happen 
after the reset.
 
@@ -812,15 +806,7 @@
 @cindex reset init
 Immediately halt the target, and execute the reset script (works only with 
certain
 configurations)
[EMAIL PROTECTED] @b{run_and_halt}
[EMAIL PROTECTED] reset run_and_halt
-Let the target run for a certain amount of time, then request a halt.
[EMAIL PROTECTED] @b{run_and_init}
[EMAIL PROTECTED] reset run_and_init
-Let the target run for a certain amount of time, then request a halt. Execute 
the
-reset script once the target enters debug mode.
 @end itemize
-The runtime can be set using the @option{run_and_halt_time} command.
 @end itemize
 
 @subsection Memory access commands
Index: C:/workspace/openocd/src/target/target/at91r40008.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/at91r40008.cfg       (revision 874)
+++ C:/workspace/openocd/src/target/target/at91r40008.cfg       (working copy)
@@ -11,7 +11,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target arm7tdmi little 0 arm7tdmi
-run_and_halt_time 0 30
+
 
 target_script 0 reset event/at91r40008_reset.script
 
Index: C:/workspace/openocd/src/target/target/at91sam9260.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/at91sam9260.cfg      (revision 874)
+++ C:/workspace/openocd/src/target/target/at91sam9260.cfg      (working copy)
@@ -18,7 +18,7 @@
 target arm926ejs little 0 arm926ejs
 
 target_script 0 reset event/at91sam9260_reset.script
-run_and_halt_time 0 30
+
 
 #working area <target#> <address> <size> <backup|nobackup>
 working_area 0 0x00300000 0x1000 backup
Index: C:/workspace/openocd/src/target/target/at91sam9260minimal.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/at91sam9260minimal.cfg       
(revision 874)
+++ C:/workspace/openocd/src/target/target/at91sam9260minimal.cfg       
(working copy)
@@ -16,5 +16,5 @@
 
 #target <type> <endianess> <reset mode> <JTAG pos> <variant>
 target arm926ejs little 0 arm926ejs
-run_and_halt_time 0 30
+
 
Index: C:/workspace/openocd/src/target/target/eir-sam7se512.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/eir-sam7se512.cfg    (revision 874)
+++ C:/workspace/openocd/src/target/target/eir-sam7se512.cfg    (working copy)
@@ -6,7 +6,7 @@
 jtag_device 4 0x1 0xf 0xe
 
 target arm7tdmi little 0 arm7tdmi
-run_and_halt_time 0 30
+
 
 target_script 0 reset event/eir-sam7se512_reset.script
 
Index: C:/workspace/openocd/src/target/target/hammer.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/hammer.cfg   (revision 874)
+++ C:/workspace/openocd/src/target/target/hammer.cfg   (working copy)
@@ -18,7 +18,7 @@
 target_script 0 reset event/hammer_reset.script
 
 working_area 0 0x30800000 0x20000 nobackup
-run_and_halt_time 0 1000
+
 
 #flash configuration
 #flash bank <driver> <base> <size> <chip_width> <bus_width> [driver_options 
...]
Index: C:/workspace/openocd/src/target/target/ipx42x.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/ipx42x.cfg   (revision 874)
+++ C:/workspace/openocd/src/target/target/ipx42x.cfg   (working copy)
@@ -6,4 +6,4 @@
 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
 jtag_device 7 0x1 0x7f 0x7e
 target xscale big 0 IXP42x
-run_and_halt_time 0 30
+
Index: C:/workspace/openocd/src/target/target/lpc2129.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/lpc2129.cfg  (revision 874)
+++ C:/workspace/openocd/src/target/target/lpc2129.cfg  (working copy)
@@ -5,7 +5,7 @@
 #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
 jtag_device 4 0x1 0xf 0xe
 target arm7tdmi little 0 arm7tdmi-s_r4
-run_and_halt_time 0 30
+
 working_area 0 0x40000000 0x4000 nobackup
 #flash bank <driver> <base> <size> <chip_width> <bus_width>
 flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 14765 calc_checksum
Index: C:/workspace/openocd/src/target/target/lpc2148.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/lpc2148.cfg  (revision 874)
+++ C:/workspace/openocd/src/target/target/lpc2148.cfg  (working copy)
@@ -16,7 +16,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target arm7tdmi little 0 arm7tdmi-s_r4
-run_and_halt_time 0 30
+
 
 target_script 0 reset event/lpc2148_reset.script
 
Index: C:/workspace/openocd/src/target/target/lpc2294.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/lpc2294.cfg  (revision 874)
+++ C:/workspace/openocd/src/target/target/lpc2294.cfg  (working copy)
@@ -8,7 +8,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target arm7tdmi little 0 arm7tdmi-s_r4
-run_and_halt_time 0 30
+
 
 working_area 0 0x40000000 0x4000 nobackup
 
Index: C:/workspace/openocd/src/target/target/mx31.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/mx31.cfg     (revision 874)
+++ C:/workspace/openocd/src/target/target/mx31.cfg     (working copy)
@@ -12,5 +12,5 @@
 
 #target <type> <endianess> <reset mode>
 target arm11 little 1
-run_and_halt_time 0 0
+
 
Index: C:/workspace/openocd/src/target/target/netx500.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/netx500.cfg  (revision 874)
+++ C:/workspace/openocd/src/target/target/netx500.cfg  (working copy)
@@ -7,4 +7,4 @@
 jtag_nsrst_delay 100
 jtag_ntrst_delay 100
 target arm926ejs little 0 arm926ejs
-run_and_halt_time 0 500
+
Index: C:/workspace/openocd/src/target/target/nslu2.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/nslu2.cfg    (revision 874)
+++ C:/workspace/openocd/src/target/target/nslu2.cfg    (working copy)
@@ -7,7 +7,7 @@
 
 # target configuration
 target xscale big 0 ixp42x
-run_and_halt_time 0 30
+
 
 # maps to PXA internal RAM.  If you are using a PXA255
 # you must initialize SDRAM or leave this option off
Index: C:/workspace/openocd/src/target/target/omap5912.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/omap5912.cfg (revision 874)
+++ C:/workspace/openocd/src/target/target/omap5912.cfg (working copy)
@@ -12,7 +12,7 @@
 
 target arm926ejs little 1 arm926ejs
 target_script 0 reset event/omap5912_reset.script
-run_and_halt_time 0 30
+
 
 # omap5912 lcd frame buffer as working area
 working_area 0 0x20000000 0x3e800 nobackup
Index: C:/workspace/openocd/src/target/target/pic32mx.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/pic32mx.cfg  (revision 874)
+++ C:/workspace/openocd/src/target/target/pic32mx.cfg  (working copy)
@@ -11,7 +11,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target mips_m4k little 0
-run_and_halt_time 0 30
+
 
 working_area 0 0xa0000000 16384 nobackup
 
Index: C:/workspace/openocd/src/target/target/pxa255.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/pxa255.cfg   (revision 874)
+++ C:/workspace/openocd/src/target/target/pxa255.cfg   (working copy)
@@ -3,7 +3,7 @@
 jtag_ntrst_delay 200
 target xscale little 0 pxa255
 reset_config trst_and_srst
-run_and_halt_time 0 30
+
 
 target_script 0 reset event/pxa255_reset.script
 
Index: C:/workspace/openocd/src/target/target/pxa270.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/pxa270.cfg   (revision 874)
+++ C:/workspace/openocd/src/target/target/pxa270.cfg   (working copy)
@@ -14,7 +14,7 @@
 # maps to PXA internal RAM. If you are using a PXA255
 # you must initialize SDRAM or leave this option off
 working_area 0 0x5c000000 0x10000 nobackup
-run_and_halt_time 0 30
+
 #flash bank <driver> <base> <size> <chip_width> <bus_width>
 # works for P30 flash
 flash bank cfi 0x00000000 0x1000000 2 4 0
Index: C:/workspace/openocd/src/target/target/sam7s256.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/sam7s256.cfg (revision 874)
+++ C:/workspace/openocd/src/target/target/sam7s256.cfg (working copy)
@@ -8,7 +8,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target arm7tdmi little 0 arm7tdmi
-run_and_halt_time 0 30
+
 
 target_script 0 reset event/sam7s256_reset.script
 
Index: C:/workspace/openocd/src/target/target/sam7x256.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/sam7x256.cfg (revision 874)
+++ C:/workspace/openocd/src/target/target/sam7x256.cfg (working copy)
@@ -8,7 +8,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target arm7tdmi little 0 arm7tdmi
-run_and_halt_time 0 30
+
 
 target_script 0 reset event/sam7x256_reset.script
 
Index: C:/workspace/openocd/src/target/target/stm32.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/stm32.cfg    (revision 874)
+++ C:/workspace/openocd/src/target/target/stm32.cfg    (working copy)
@@ -17,7 +17,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target cortex_m3 little 0
-run_and_halt_time 0 30
+
 
 working_area 0 0x20000000 16384 nobackup
 
Index: C:/workspace/openocd/src/target/target/stm32stick.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/stm32stick.cfg       (revision 874)
+++ C:/workspace/openocd/src/target/target/stm32stick.cfg       (working copy)
@@ -18,7 +18,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target cortex_m3 little 0
-run_and_halt_time 0 30
+
 
 working_area 0 0x20000000 16384 nobackup
 
Index: C:/workspace/openocd/src/target/target/str710.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/str710.cfg   (revision 874)
+++ C:/workspace/openocd/src/target/target/str710.cfg   (working copy)
@@ -17,7 +17,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target arm7tdmi little 0 arm7tdmi
-run_and_halt_time 0 30
+
 
 target_script 0 gdb_program_config event/str710_program.script
 
Index: C:/workspace/openocd/src/target/target/str730.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/str730.cfg   (revision 874)
+++ C:/workspace/openocd/src/target/target/str730.cfg   (working copy)
@@ -24,7 +24,7 @@
 
 target arm7tdmi little 0 arm7tdmi
 
-run_and_halt_time 0 30
+
 
 target_script 0 gdb_program_config event/str730_program.script
 
Index: C:/workspace/openocd/src/target/target/str750.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/str750.cfg   (revision 874)
+++ C:/workspace/openocd/src/target/target/str750.cfg   (working copy)
@@ -25,7 +25,7 @@
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target arm7tdmi little 0 arm7tdmi
 
-run_and_halt_time 0 30
+
 
 target_script 0 gdb_program_config event/str750_program.script
 
Index: C:/workspace/openocd/src/target/target/str912.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/str912.cfg   (revision 874)
+++ C:/workspace/openocd/src/target/target/str912.cfg   (working copy)
@@ -37,7 +37,7 @@
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
 target arm966e little 1 arm966e
-run_and_halt_time 0 30
+
 
 
 working_area 0 0x50000000 16384 nobackup
Index: C:/workspace/openocd/src/target/target/str9comstick.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/str9comstick.cfg     (revision 874)
+++ C:/workspace/openocd/src/target/target/str9comstick.cfg     (working copy)
@@ -13,7 +13,7 @@
 jtag_device 4 0x1 0xf 0xe
 jtag_device 5 0x1 0x1 0x1e
 target arm966e little 1 arm966e
-run_and_halt_time 0 30
+
 working_area 0 0x50000000 16384 nobackup
 #flash bank <driver> <base> <size> <chip_width> <bus_width>
 flash bank str9x 0x00000000 0x00080000 0 0 0
Index: C:/workspace/openocd/src/target/target/wi-9c.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/wi-9c.cfg    (revision 874)
+++ C:/workspace/openocd/src/target/target/wi-9c.cfg    (working copy)
@@ -18,7 +18,7 @@
 target arm926ejs big 0 arm926ejs
 
 target_script 0 reset event/wi-9c_reset.script
-run_and_halt_time 0 30
+
 
 #working area <target#> <address> <size> <backup|nobackup>
 working_area 0 0x00000000 0x1000 backup
Index: C:/workspace/openocd/src/target/target/xba_revA3.cfg
===================================================================
--- C:/workspace/openocd/src/target/target/xba_revA3.cfg        (revision 874)
+++ C:/workspace/openocd/src/target/target/xba_revA3.cfg        (working copy)
@@ -12,7 +12,6 @@
 target  xscale big           0          ixp42x
 target_script 0 reset event/xba_revA3.script
 
-run_and_halt_time 0 100
 
 flash bank cfi 0x50000000 0x400000 2 2 0
 working_area 0 0x20010000 0x8060 nobackup
Index: C:/workspace/openocd/src/target/target.c
===================================================================
--- C:/workspace/openocd/src/target/target.c    (revision 875)
+++ C:/workspace/openocd/src/target/target.c    (working copy)
@@ -55,7 +55,6 @@
 int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char 
**args, int argc);
 int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char 
**args, int argc);
 
-int handle_run_and_halt_time_command(struct command_context_s *cmd_ctx, char 
*cmd, char **args, int argc);
 int handle_working_area_command(struct command_context_s *cmd_ctx, char *cmd, 
char **args, int argc);
 
 int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char 
**args, int argc);
@@ -220,31 +219,6 @@
        return target;
 }
 
-/* Process target initialization, when target entered debug out of reset
- * the handler is unregistered at the end of this function, so it's only 
called once
- */
-int target_init_handler(struct target_s *target, enum target_event event, void 
*priv)
-{
-       struct command_context_s *cmd_ctx = priv;
-       
-       if (event == TARGET_EVENT_HALTED)
-       {
-               target_unregister_event_callback(target_init_handler, priv);
-               target_invoke_script(cmd_ctx, target, "post_reset");
-               jtag_execute_queue();
-       }
-       
-       return ERROR_OK;
-}
-
-int target_run_and_halt_handler(void *priv)
-{
-       target_t *target = priv;
-       
-       target_halt(target);
-       
-       return ERROR_OK;
-}
 
 int target_poll(struct target_s *target)
 {
@@ -343,31 +317,10 @@
        target = targets;
        while (target)
        {
-               switch (reset_mode)
+               if (reset_mode!=RESET_RUN)
                {
-                       case RESET_RUN:
-                               /* nothing to do if target just wants to be run 
*/
-                               break;
-                       case RESET_RUN_AND_HALT:
-                               /* schedule halt */
-                               
target_register_timer_callback(target_run_and_halt_handler, 
target->run_and_halt_time, 0, target);
-                               break;
-                       case RESET_RUN_AND_INIT:
-                               /* schedule halt */
-                               
target_register_timer_callback(target_run_and_halt_handler, 
target->run_and_halt_time, 0, target);
-                               
target_register_event_callback(target_init_handler, cmd_ctx);
-                               break;
-                       case RESET_HALT:
-                               if ((jtag_reset_config & 
RESET_SRST_PULLS_TRST)==0)
-                                       target_halt(target);
-                               break;
-                       case RESET_INIT:
-                               if ((jtag_reset_config & 
RESET_SRST_PULLS_TRST)==0)
-                                       target_halt(target);
-                               
target_register_event_callback(target_init_handler, cmd_ctx);
-                               break;
-                       default:
-                               LOG_ERROR("BUG: unknown target->reset_mode");
+                       if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)
+                               target_halt(target);
                }
                target = target->next;
        }
@@ -408,60 +361,15 @@
        
        LOG_DEBUG("Waiting for halted stated as appropriate");
        
-       /* Wait for reset to complete, maximum 5 seconds. */    
-       gettimeofday(&timeout, NULL);
-       timeval_add_time(&timeout, 5, 0);
-       for(;;)
+       if ((reset_mode == RESET_HALT) || (reset_mode == RESET_INIT))
        {
-               gettimeofday(&now, NULL);
-               
-               target_call_timer_callbacks_now();
-               
-               target = targets;
-               while (target)
-               {
-                       LOG_DEBUG("Polling target");
-                       target_poll(target);
-                       if ((reset_mode == RESET_RUN_AND_INIT) || 
-                                       (reset_mode == RESET_RUN_AND_HALT) ||
-                                       (reset_mode == RESET_HALT) ||
-                                       (reset_mode == RESET_INIT))
-                       {
-                               if (target->state != TARGET_HALTED)
-                               {
-                                       if ((now.tv_sec > timeout.tv_sec) || 
((now.tv_sec == timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec)))
-                                       {
-                                               LOG_USER("Timed out waiting for 
halt after reset");
-                                               goto done;
-                                       }
-                                       /* this will send alive messages on 
e.g. GDB remote protocol. */
-                                       usleep(500*1000); 
-                                       LOG_USER_N("%s", ""); /* avoid warning 
about zero length formatting message*/ 
-                                       goto again;
-                               }
-                       }
-                       target = target->next;
-               }
-               /* All targets we're waiting for are halted */
-               break;
-               
-               again:;
+               /* Wait for reset to complete, maximum 5 seconds. */    
+               target_wait_state(target, TARGET_HALTED, 5000);
+               if (reset_mode == RESET_INIT)
+                       target_invoke_script(cmd_ctx, target, "post_reset");
        }
-       done:
        
        
-       /* We want any events to be processed before the prompt */
-       target_call_timer_callbacks_now();
-
-       /* if we timed out we need to unregister these handlers */
-       target = targets;
-       while (target)
-       {
-               target_unregister_timer_callback(target_run_and_halt_handler, 
target);
-               target = target->next;
-       }
-       target_unregister_event_callback(target_init_handler, cmd_ctx);
-       
        return retval;
 }
 
@@ -932,7 +840,6 @@
 {
        register_command(cmd_ctx, NULL, "target", handle_target_command, 
COMMAND_CONFIG, "target <cpu> [reset_init default - DEPRECATED] <chainpos> 
<endianness> <variant> [cpu type specifc args]");
        register_command(cmd_ctx, NULL, "targets", handle_targets_command, 
COMMAND_EXEC, NULL);
-       register_command(cmd_ctx, NULL, "run_and_halt_time", 
handle_run_and_halt_time_command, COMMAND_CONFIG, "<target> <run time ms>");
        register_command(cmd_ctx, NULL, "working_area", 
handle_working_area_command, COMMAND_ANY, "working_area <target#> <address> 
<size> <'backup'|'nobackup'> [virtual address]");
        register_command(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, 
COMMAND_ANY, "virt2phys <virtual address>");
        register_command(cmd_ctx, NULL, "profile", handle_profile_command, 
COMMAND_EXEC, "PRELIMINARY! - profile <seconds> <gmon.out>");
@@ -1307,7 +1214,7 @@
        register_command(cmd_ctx,  NULL, "halt", handle_halt_command, 
COMMAND_EXEC, "halt target");
        register_command(cmd_ctx,  NULL, "resume", handle_resume_command, 
COMMAND_EXEC, "resume target [addr]");
        register_command(cmd_ctx,  NULL, "step", handle_step_command, 
COMMAND_EXEC, "step one instruction from current PC or [addr]");
-       register_command(cmd_ctx,  NULL, "reset", handle_reset_command, 
COMMAND_EXEC, "reset target [run|halt|init|run_and_halt|run_and_init]");
+       register_command(cmd_ctx,  NULL, "reset", handle_reset_command, 
COMMAND_EXEC, "reset target [run|halt|init]");
        register_command(cmd_ctx,  NULL, "soft_reset_halt", 
handle_soft_reset_halt_command, COMMAND_EXEC, "halt the target and do a soft 
reset");
 
        register_command(cmd_ctx,  NULL, "mdw", handle_md_command, 
COMMAND_EXEC, "display memory words <addr> [count]");
@@ -1445,7 +1352,6 @@
                                        args--;
                                        argc++;
                                }
-                               (*last_target_p)->run_and_halt_time = 1000; /* 
default 1s */
                                
                                (*last_target_p)->working_area = 0x0;
                                (*last_target_p)->working_area_size = 0x0;
@@ -1498,26 +1404,6 @@
                        get_num_by_target(target), name);
 }
 
-int handle_run_and_halt_time_command(struct command_context_s *cmd_ctx, char 
*cmd, char **args, int argc)
-{
-       target_t *target = NULL;
-       
-       if (argc < 2)
-       {
-               return ERROR_COMMAND_SYNTAX_ERROR;
-       }
-       
-       target = get_target_by_num(strtoul(args[0], NULL, 0));
-       if (!target)
-       {
-               return ERROR_COMMAND_SYNTAX_ERROR;
-       }
-       
-       target->run_and_halt_time = strtoul(args[1], NULL, 0);
-       
-       return ERROR_OK;
-}
-
 int handle_working_area_command(struct command_context_s *cmd_ctx, char *cmd, 
char **args, int argc)
 {
        target_t *target = NULL;
@@ -1815,8 +1701,6 @@
        target_t *target = get_current_target(cmd_ctx);
        enum target_reset_mode reset_mode = RESET_RUN;
        
-       LOG_DEBUG("-");
-       
        if (argc >= 1)
        {
                if (strcmp("run", args[0]) == 0)
@@ -1825,26 +1709,9 @@
                        reset_mode = RESET_HALT;
                else if (strcmp("init", args[0]) == 0)
                        reset_mode = RESET_INIT;
-               else if (strcmp("run_and_halt", args[0]) == 0)
-               {
-                       reset_mode = RESET_RUN_AND_HALT;
-                       if (argc >= 2)
-                       {
-                               target->run_and_halt_time = strtoul(args[1], 
NULL, 0);
-                       }
-               }
-               else if (strcmp("run_and_init", args[0]) == 0)
-               {
-                       reset_mode = RESET_RUN_AND_INIT;
-                       if (argc >= 2)
-                       {
-                               target->run_and_halt_time = strtoul(args[1], 
NULL, 0);
-                       }
-               }
                else
                {
-                       command_print(cmd_ctx, "usage: reset ['run', 'halt', 
'init', 'run_and_halt', 'run_and_init]");
-                       return ERROR_OK;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
        }
        
Index: C:/workspace/openocd/src/target/target.h
===================================================================
--- C:/workspace/openocd/src/target/target.h    (revision 874)
+++ C:/workspace/openocd/src/target/target.h    (working copy)
@@ -62,8 +62,6 @@
        RESET_RUN = 0,          /* reset and let target run */
        RESET_HALT = 1,         /* reset and halt target out of reset */
        RESET_INIT = 2,         /* reset and halt target out of reset, then run 
init script */
-       RESET_RUN_AND_HALT = 3, /* reset and let target run, halt after n 
milliseconds */
-       RESET_RUN_AND_INIT = 4, /* reset and let target run, halt after n 
milliseconds, then run init script */
 };
 
 enum target_debug_reason
@@ -202,7 +200,6 @@
 {
        target_type_t *type;                            /* target type 
definition (name, access functions) */
        int reset_halt;                                         /* attempt 
resetting the CPU into the halted mode? */
-       int run_and_halt_time;                          /* how long the target 
should run after a run_and_halt reset */
        u32 working_area;                                       /* working area 
(initialized RAM). Evaluated 
                                                                                
   upon first allocation from virtual/physical address. */
        u32 working_area_virt;                          /* virtual address */
Index: 
C:/workspace/openocd/testing/examples/AT91R40008Test/prj/at91r40008_turtle.cfg
===================================================================
--- 
C:/workspace/openocd/testing/examples/AT91R40008Test/prj/at91r40008_turtle.cfg  
    (revision 874)
+++ 
C:/workspace/openocd/testing/examples/AT91R40008Test/prj/at91r40008_turtle.cfg  
    (working copy)
@@ -28,8 +28,7 @@
 
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm7tdmi little run_and_init 0 arm7tdmi
-run_and_halt_time 0 30
+target arm7tdmi little 0 arm7tdmi
 
 target_script 0 reset .\prj\at91r40008_reset.script
 
Index: C:/workspace/openocd/testing/examples/LPC2148Test/prj/lpc2148_jtagkey.cfg
===================================================================
--- C:/workspace/openocd/testing/examples/LPC2148Test/prj/lpc2148_jtagkey.cfg   
(revision 874)
+++ C:/workspace/openocd/testing/examples/LPC2148Test/prj/lpc2148_jtagkey.cfg   
(working copy)
@@ -26,8 +26,7 @@
 
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
-run_and_halt_time 0 30
+target arm7tdmi little 0 arm7tdmi-s_r4
 
 working_area 0 0x40000000 0x4000 nobackup
 
Index: C:/workspace/openocd/testing/examples/LPC2294Test/prj/lpc2294_jtagkey.cfg
===================================================================
--- C:/workspace/openocd/testing/examples/LPC2294Test/prj/lpc2294_jtagkey.cfg   
(revision 874)
+++ C:/workspace/openocd/testing/examples/LPC2294Test/prj/lpc2294_jtagkey.cfg   
(working copy)
@@ -26,8 +26,7 @@
 
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
-run_and_halt_time 0 30
+target arm7tdmi little 0 arm7tdmi-s_r4
 
 working_area 0 0x40000000 0x4000 nobackup
 
Index: 
C:/workspace/openocd/testing/examples/SAM7S256Test/prj/sam7s256_jtagkey.cfg
===================================================================
--- C:/workspace/openocd/testing/examples/SAM7S256Test/prj/sam7s256_jtagkey.cfg 
(revision 874)
+++ C:/workspace/openocd/testing/examples/SAM7S256Test/prj/sam7s256_jtagkey.cfg 
(working copy)
@@ -29,8 +29,7 @@
 
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm7tdmi little run_and_init 0 arm7tdmi
-run_and_halt_time 0 30
+target arm7tdmi little 0 arm7tdmi
 
 target_script 0 reset .\prj\sam7s256_reset.script
 
Index: 
C:/workspace/openocd/testing/examples/SAM7X256Test/prj/sam7x256_jtagkey.cfg
===================================================================
--- C:/workspace/openocd/testing/examples/SAM7X256Test/prj/sam7x256_jtagkey.cfg 
(revision 874)
+++ C:/workspace/openocd/testing/examples/SAM7X256Test/prj/sam7x256_jtagkey.cfg 
(working copy)
@@ -29,8 +29,7 @@
 
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm7tdmi little run_and_init 0 arm7tdmi
-run_and_halt_time 0 30
+target arm7tdmi little 0 arm7tdmi
 
 target_script 0 reset .\prj\sam7x256_reset.script
 
Index: 
C:/workspace/openocd/testing/examples/STR710JtagSpeed/prj/str710_jtagkey.cfg
===================================================================
--- 
C:/workspace/openocd/testing/examples/STR710JtagSpeed/prj/str710_jtagkey.cfg    
    (revision 874)
+++ 
C:/workspace/openocd/testing/examples/STR710JtagSpeed/prj/str710_jtagkey.cfg    
    (working copy)
@@ -26,8 +26,7 @@
 
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm7tdmi little run_and_halt 0 arm7tdmi
-run_and_halt_time 0 30
+target arm7tdmi little 0 arm7tdmi
 
 working_area 0 0x2000C000 0x4000 nobackup
 
Index: C:/workspace/openocd/testing/examples/STR710Test/prj/str710_jtagkey.cfg
===================================================================
--- C:/workspace/openocd/testing/examples/STR710Test/prj/str710_jtagkey.cfg     
(revision 874)
+++ C:/workspace/openocd/testing/examples/STR710Test/prj/str710_jtagkey.cfg     
(working copy)
@@ -26,8 +26,7 @@
 
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm7tdmi little run_and_halt 0 arm7tdmi
-run_and_halt_time 0 30
+target arm7tdmi little 0 arm7tdmi
 
 target_script 0 gdb_program_config .\prj\str710_program.script
 
Index: C:/workspace/openocd/testing/examples/STR912Test/prj/str912_jtagkey.cfg
===================================================================
--- C:/workspace/openocd/testing/examples/STR912Test/prj/str912_jtagkey.cfg     
(revision 874)
+++ C:/workspace/openocd/testing/examples/STR912Test/prj/str912_jtagkey.cfg     
(working copy)
@@ -31,8 +31,7 @@
 
 #target <type> <startup mode>
 #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
-target arm966e little reset_halt 1 arm966e
-run_and_halt_time 0 30
+target arm966e little 1 arm966e
 
 target_script 0 gdb_program_config .\prj\str912_program.script
 
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to