From 4b97f3cbb9603c13f69f8d3b5371c12045593126 Mon Sep 17 00:00:00 2001 From: ntfreak Date: Sat, 16 Jun 2007 14:45:55 +0000 Subject: - added mingw elf patches from Vincent Palatin - added str9x programming using flash controller tap (str9xpec), including option bytes and device lock/unlock - inttypes.h now used for long long printf style declarations git-svn-id: svn://svn.berlios.de/openocd/trunk@174 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/flash/flash.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/flash/flash.c') diff --git a/src/flash/flash.c b/src/flash/flash.c index 3c368f3f..eaa1e17e 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -23,7 +23,6 @@ #include "flash.h" #include "command.h" -#include "log.h" #include "target.h" #include "time_support.h" @@ -36,6 +35,7 @@ #include #include +#include "log.h" /* command handlers */ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); @@ -56,6 +56,7 @@ extern flash_driver_t at91sam7_flash; extern flash_driver_t str7x_flash; extern flash_driver_t str9x_flash; extern flash_driver_t stellaris_flash; +extern flash_driver_t str9xpec_flash; flash_driver_t *flash_drivers[] = { @@ -65,6 +66,7 @@ flash_driver_t *flash_drivers[] = &str7x_flash, &str9x_flash, &stellaris_flash, + &str9xpec_flash, NULL, }; @@ -373,9 +375,10 @@ int handle_flash_erase_command(struct command_context_s *cmd_ctx, char *cmd, cha int last = strtoul(args[2], NULL, 0); int retval; flash_bank_t *p = get_flash_bank_by_num(strtoul(args[0], NULL, 0)); - struct timeval start, end, duration; - - gettimeofday(&start, NULL); + duration_t duration; + char *duration_text; + + duration_start_measure(&duration); if (!p) { @@ -411,10 +414,10 @@ int handle_flash_erase_command(struct command_context_s *cmd_ctx, char *cmd, cha } else { - gettimeofday(&end, NULL); - timeval_subtract(&duration, &end, &start); - - command_print(cmd_ctx, "erased sectors %i through %i on flash bank %i in %is %ius", first, last, strtoul(args[0], 0, 0), duration.tv_sec, duration.tv_usec); + duration_stop_measure(&duration, &duration_text); + + command_print(cmd_ctx, "erased sectors %i through %i on flash bank %i in %s", first, last, strtoul(args[0], 0, 0), duration_text); + free(duration_text); } } else -- cgit v1.2.3