summaryrefslogtreecommitdiffstats
path: root/common/image.c
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/image.c
parent958fc48abddeab513ea4847e34f22a2e9fe67fe1 (diff)
downloadtalos-obmc-uboot-af13cdbc01eaf88880978bfb4f603e012818ba24.tar.gz
talos-obmc-uboot-af13cdbc01eaf88880978bfb4f603e012818ba24.zip
[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/image.c')
-rw-r--r--common/image.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/image.c b/common/image.c
index 7a0a3d2a90..048b866ce6 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 */
OpenPOWER on IntegriCloud