summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2008-01-08 18:11:45 +0100
committerWolfgang Denk <wd@denx.de>2008-02-07 01:12:56 +0100
commitaf13cdbc01eaf88880978bfb4f603e012818ba24 (patch)
tree87f9c7d3abf919f3ddf3dd22257b68b9bfe7505e /common
parent958fc48abddeab513ea4847e34f22a2e9fe67fe1 (diff)
downloadu-boot-imx-af13cdbc01eaf88880978bfb4f603e012818ba24.zip
u-boot-imx-af13cdbc01eaf88880978bfb4f603e012818ba24.tar.gz
u-boot-imx-af13cdbc01eaf88880978bfb4f603e012818ba24.tar.bz2
[new uImage] Add memmove_wd() common routine
Move common, watchdog sensible memmove code to a helper memmmove_wd() routine. Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_bootm.c20
-rw-r--r--common/image.c18
2 files changed, 22 insertions, 16 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index aa7c0f5..b059336 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -250,24 +250,12 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (image_get_load (hdr) == addr) {
printf (" XIP %s ... ", name);
} else {
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
- size_t l = len;
- void *to = (void *)image_get_load (hdr);
- void *from = (void *)data;
-
printf (" Loading %s ... ", name);
- while (l > 0) {
- size_t tail = (l > CHUNKSZ) ? CHUNKSZ : l;
- WATCHDOG_RESET();
- memmove (to, from, tail);
- to += tail;
- from += tail;
- l -= tail;
- }
-#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
- memmove ((void *)image_get_load (hdr), (uchar *)data, len);
-#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
+ memmove_wd ((void *)image_get_load (hdr),
+ (void *)data, len, CHUNKSZ);
+
+ puts("OK\n");
}
break;
case IH_COMP_GZIP:
diff --git a/common/image.c b/common/image.c
index 7a0a3d2..048b866 100644
--- a/common/image.c
+++ b/common/image.c
@@ -57,6 +57,7 @@ int image_check_dcrc (image_header_t *hdr)
return (dcrc == image_get_dcrc (hdr));
}
+#ifndef USE_HOSTCC
int image_check_dcrc_wd (image_header_t *hdr, ulong chunksz)
{
ulong dcrc = 0;
@@ -89,3 +90,20 @@ int getenv_verify (void)
char *s = getenv ("verify");
return (s && (*s == 'n')) ? 0 : 1;
}
+
+void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
+{
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+ while (len > 0) {
+ size_t tail = (len > chunksz) ? chunksz : len;
+ WATCHDOG_RESET ();
+ memmove (to, from, tail);
+ to += tail;
+ from += tail;
+ len -= tail;
+ }
+#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
+ memmove (to, from, len);
+#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
+}
+#endif /* USE_HOSTCC */