Skip to contentSkip to conversation

cp/cmp: Add WATCHDOG_RESET in copy and compare loop

PATCH Superseded Stefan Roese 2 participants 3 messages Sep 1, 2010 – Sep 9, 2010

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cp/cmp: Add WATCHDOG_RESET in copy and compare loop

On some boards with a very short watchdog timeout, the "cp" and "cmp" commands may reset the board. This patch adds some watchdog resets inside the loops. Otherwise for example the lwmon5 board will reset while doing something like this:

=> cp.b fc000000 1000000 100000

---
v2:
- Changed to power of 2 value to simplify the resulting code, 4096 seems to be enough for lwmon5.

 common/cmd_mem.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
common/cmd_mem.c +8 -0
index 44834ea..c426997 100644
@@ -337,6 +337,10 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		ngood++;
 		addr1 += size;
 		addr2 += size;
+
+		/* reset watchdog from time to time */
+		if ((count % 4096) == 0)
+			WATCHDOG_RESET();
 	}
 
 	printf("Total of %ld %s%s were the same\n",
@@ -447,6 +451,10 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			*((u_char *)dest) = *((u_char *)addr);
 		addr += size;
 		dest += size;
+
+		/* reset watchdog from time to time */
+		if ((count % 4096) == 0)
+			WATCHDOG_RESET();
 	}
 	return 0;
 }
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH v2 1/1 cp/cmp: Add WATCHDOG_RESET in copy and compare loop

Dear Stefan Roese,

Quoted 5 lines · In message <[email protected]> you wrote:

On some boards with a very short watchdog timeout, the "cp" and "cmp" commands may reset the board. This patch adds some watchdog resets inside the loops. Otherwise for example the lwmon5 board will reset while doing something like this:

Quoted 7 lines

=> cp.b fc000000 1000000 100000

---
v2:
- Changed to power of 2 value to simplify the resulting code, 4096 seems to be enough for lwmon5.

Hm... as mentioned before, the trigger interval is in the order of tens of microseconds. I don't think that the 440EX is _that_ slow?

Best regards,

Wolfgang Denk

Signature · 5 lines
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
"The pathology is to want control, not that you ever get it,  because
of course you never do."                            - Gregory Bateson
#2 lore raw

PATCH v2 1/1 cp/cmp: Add WATCHDOG_RESET in copy and compare loop

Quoted 6 lines · In message <[email protected]> I wrote:
Quoted 3 lines

- Changed to power of 2 value to simplify the resulting code, 4096 seems to be enough for lwmon5.

Hm... as mentioned before, the trigger interval is in the order of tens of microseconds. I don't think that the 440EX is _that_ slow?

Tens of milliseconds, that is.

Best regards,

Wolfgang Denk

Signature · 4 lines
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
Swap read error.  You lose your mind.