This is useful but equally useful, and not dependent on,  if we accept 
my or Öyvinds ideas about some design issues.

Regards
Magnus


Øyvind Harboe wrote:
> Committed.
>
> Profiling feature that counts # of times that the queue is flushed.
>
> The nice thing about this feature is that it works across all
> interface types.
>
> Adding a 1ms delay where the counter is incremented can be used
> to emulate long delays of USB or JTAG over TCP/IP....
>
>   
>> help flush
>>     
>  flush_count               returns number of times the JTAG queue has been
>                           flushed
>
>   
>> puts [flush_count]
>>     
>  290
>   
>> reset init
>>     
>  JTAG tap: lpc2148.cpu tap/device found: 0x4f1f0f0f (Manufacturer: 0x787, 
> Part:
> 0xf1f0, Version: 0x4)
> JTAG Tap/device matched
> srst pulls trst - can not reset into halted mode. Issuing halt after reset.
> target state: halted
> target halted in Thumb state due to debug-request, current mode: Supervisor
> cpsr: 0xa00000f3 pc: 0x7fffd2d8
> requesting target halt and executing a soft reset
> target state: halted
> target halted in ARM state due to debug-request, current mode: Supervisor
> cpsr: 0xa00000d3 pc: 0x00000000
>   
>> puts [flush_count]
>>     
>  385
>
>
>
> ### Eclipse Workspace Patch 1.0
> #P openocd
> Index: src/jtag/jtag.c
> ===================================================================
> --- src/jtag/jtag.c   (revision 1673)
> +++ src/jtag/jtag.c   (working copy)
> @@ -43,7 +43,7 @@
>  #endif
>  #include <assert.h>
>
> -
> +int jtag_flush_queue_count; /* count # of flushes for profiling /
> debugging purposes */
>
>  /* note that this is not marked as static as it must be available
> from outside jtag.c for those
>     that implement the jtag_xxx() minidriver layer
> @@ -243,6 +243,7 @@
>  static int handle_runtest_command(struct command_context_s *cmd_ctx,
> char *cmd, char **args, int argc);
>  static int handle_irscan_command(struct command_context_s *cmd_ctx,
> char *cmd, char **args, int argc);
>  static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj
> *const *argv);
> +static int Jim_Command_flush_count(Jim_Interp *interp, int argc,
> Jim_Obj *const *args);
>
>  static int handle_verify_ircapture_command(struct command_context_s
> *cmd_ctx, char *cmd, char **args, int argc);
>
> @@ -1446,6 +1447,11 @@
>
>  void jtag_execute_queue_noclear(void)
>  {
> +     /* each flush can take as much as 1-2ms on high bandwidth low
> latency interfaces.
> +      * E.g. a JTAG over TCP/IP or USB....
> +      */
> +     jtag_flush_queue_count++;
> +
>       int retval=interface_jtag_execute_queue();
>       /* we keep the first error */
>       if ((jtag_error==ERROR_OK)&&(retval!=ERROR_OK))
> @@ -2180,6 +2186,7 @@
>       register_command(cmd_ctx, NULL, "irscan", handle_irscan_command,
>               COMMAND_EXEC, "execute IR scan <device> <instr> [dev2] [instr2] 
> ...");
>       register_jim(cmd_ctx, "drscan", Jim_Command_drscan, "execute DR scan
> <device> <num_bits> <value> <num_bits1> <value2> ...");
> +     register_jim(cmd_ctx, "flush_count", Jim_Command_flush_count,
> "returns number of times the JTAG queue has been flushed");
>
>       register_command(cmd_ctx, NULL, "verify_ircapture",
> handle_verify_ircapture_command,
>               COMMAND_ANY, "verify value captured during Capture-IR 
> <enable|disable>");
> @@ -2945,6 +2952,15 @@
>       return JIM_OK;
>  }
>
> +
> +static int Jim_Command_flush_count(Jim_Interp *interp, int argc,
> Jim_Obj *const *args)
> +{
> +     Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_flush_queue_count));
> +
> +     return JIM_OK;
> +}
> +
> +
>  static int handle_verify_ircapture_command(struct command_context_s
> *cmd_ctx, char *cmd, char **args, int argc)
>  {
>       if (argc == 1)
>
>
>   

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to