All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] Add a flash programming end marker and progress dots
@ 2008-03-07  2:16 Jerry Van Baren
  2008-03-07  6:44 ` Stefan Roese
  0 siblings, 1 reply; 3+ messages in thread
From: Jerry Van Baren @ 2008-03-07  2:16 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot-Users] [PATCH] Add a flash programming end marker and progress dots
  2008-03-07  2:16 [U-Boot-Users] [PATCH] Add a flash programming end marker and progress dots Jerry Van Baren
@ 2008-03-07  6:44 ` Stefan Roese
  2008-03-07 14:08   ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Roese @ 2008-03-07  6:44 UTC (permalink / raw)
  To: u-boot

On Friday 07 March 2008, Jerry Van Baren wrote:
> Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
> ---
>
> OK, how about this for a compromise for end marker and progress dots?

Thanks. Nice work. But I see some problems on my PPC4xx system:

a) Crashes upon flashing 16MBytes

=> cp.b 100000 fe000000 1000000
Copy to Flash
   

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
Bad trap at PC: 20202020, SR: 29000, vector=1400
NIP: 20202020 XER: 0000005F LR: 20202020 REGS: 0ff15950 TRAP: 1400 DEAR: 
7F7F7FEF
MSR: 00029000 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 00


b) Strange output upon "saveenv" with redundant env sectors:

=> saveenv
Saving Environment to Flash...
. done
Un-Protected 1 sectors
. done
Un-Protected 1 sectors
Erasing Flash...
. done
Erased 1 sectors
Writing to Flash... |
|
|
|
done
.......|
. done
Protected 1 sectors
. done
Protected 1 sectors


It seems we have to restrict the output length somehow for this 16MByte 
problem. Or perhaps use a fixed length for all sizes.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot-Users] [PATCH] Add a flash programming end marker and progress dots
  2008-03-07  6:44 ` Stefan Roese
@ 2008-03-07 14:08   ` Wolfgang Denk
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2008-03-07 14:08 UTC (permalink / raw)
  To: u-boot

In message <200803070744.57697.sr@denx.de> you wrote:
>
> a) Crashes upon flashing 16MBytes

Nice :-(

> b) Strange output upon "saveenv" with redundant env sectors:
...
> It seems we have to restrict the output length somehow for this 16MByte 
> problem. Or perhaps use a fixed length for all sizes.

The important thing is that the string printed...

- must make no assumptions about starting in a specific column
  (i. e. \r will not work)
- must not emit any newlines (i. e. must be single-line).

A fixed (precalculated) length of the string should be used indeed (if
at all).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There are two ways of constructing a software design. One way  is  to
make  it  so  simple that there are obviously no deficiencies and the
other is to make it so complicated that there are  no  obvious  defi-
ciencies.                             - Charles Anthony Richard Hoare

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-07 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-07  2:16 [U-Boot-Users] [PATCH] Add a flash programming end marker and progress dots Jerry Van Baren
2008-03-07  6:44 ` Stefan Roese
2008-03-07 14:08   ` Wolfgang Denk

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.