浏览代码

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

Signed-off-by: Stefan Roese <sr@denx.de>
Stefan Roese 14 年之前
父节点
当前提交
eaadb44edf
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      common/cmd_mem.c

+ 8 - 0
common/cmd_mem.c

@@ -337,6 +337,10 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		ngood++;
 		ngood++;
 		addr1 += size;
 		addr1 += size;
 		addr2 += size;
 		addr2 += size;
+
+		/* reset watchdog from time to time */
+		if ((count % (64 << 10)) == 0)
+			WATCHDOG_RESET();
 	}
 	}
 
 
 	printf("Total of %ld %s%s were the same\n",
 	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);
 			*((u_char *)dest) = *((u_char *)addr);
 		addr += size;
 		addr += size;
 		dest += size;
 		dest += size;
+
+		/* reset watchdog from time to time */
+		if ((count % (64 << 10)) == 0)
+			WATCHDOG_RESET();
 	}
 	}
 	return 0;
 	return 0;
 }
 }