All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerry Van Baren <gvb.uboot@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Add a flash programming end marker and progress dots
Date: Thu, 6 Mar 2008 21:16:51 -0500	[thread overview]
Message-ID: <20080307021651.GA32706@cideas.com> (raw)

Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
---

OK, how about this for a compromise for end marker and progress dots?

 common/cmd_mem.c        |    2 +-
 drivers/mtd/cfi_flash.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 4262e26..b55d243 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -422,7 +422,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	   ) {
 		int rc;
 
-		puts ("Copy to Flash... ");
+		puts ("Copy to Flash\n");
 
 		rc = flash_write ((char *)addr, dest, count*size);
 		if (rc != 0) {
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 439c950..eebe86a 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1188,6 +1188,7 @@ void flash_print_info (flash_info_t * info)
 int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 {
 	ulong wp;
+	ulong dots = 0;
 	uchar *p;
 	int aln;
 	cfiword_t cword;
@@ -1196,6 +1197,10 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 #ifdef CFG_FLASH_USE_BUFFER_WRITE
 	int buffered_size;
 #endif
+
+	/* print an end marker for visible feedback */
+	printf("%*c\r", (cnt + (1 << 14) - 1) / (1 << 14), '|');
+
 	/* get lower aligned address */
 	wp = (addr & ~(info->portwidth - 1));
 
@@ -1248,6 +1253,9 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 		wp += i;
 		src += i;
 		cnt -= i;
+		dots += i;
+		if ((dots % (1 << 14)) == 0)
+			putc ('.');
 	}
 #else
 	while (cnt >= info->portwidth) {
@@ -1259,8 +1267,13 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 			return rc;
 		wp += info->portwidth;
 		cnt -= info->portwidth;
+		dots += info->portwidth;
+		if ((dots % (1 << 14)) == 0)
+			putc ('.');
 	}
 #endif /* CFG_FLASH_USE_BUFFER_WRITE */
+	putc ('\n');
+
 	if (cnt == 0) {
 		return (0);
 	}
-- 
1.5.4.1

             reply	other threads:[~2008-03-07  2:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-07  2:16 Jerry Van Baren [this message]
2008-03-07  6:44 ` [U-Boot-Users] [PATCH] Add a flash programming end marker and progress dots Stefan Roese
2008-03-07 14:08   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080307021651.GA32706@cideas.com \
    --to=gvb.uboot@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.