]> git.sur5r.net Git - u-boot/blobdiff - lib_generic/crc32.c
Merge branch 'master' of git://www.denx.de/git/u-boot-nand-flash
[u-boot] / lib_generic / crc32.c
index 58cd22eb7d8f98d2376ca3ac6089797bcc0a23b7..83d1d1d3a0d180d85a2e6d7af7c73ec15a2f5651 100644 (file)
@@ -14,6 +14,9 @@
 #include <stdint.h>
 #endif
 
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+#include <watchdog.h>
+#endif
 #include "zlib.h"
 
 #define local static
@@ -53,7 +56,7 @@ local void make_crc_table()
 {
   uint32_t c;
   int n, k;
-  uLong poly;            /* polynomial exclusive-or pattern */
+  uLong poly;          /* polynomial exclusive-or pattern */
   /* terms of polynomial defining this crc (except x^32): */
   static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
 
@@ -151,10 +154,7 @@ const uint32_t * ZEXPORT get_crc_table()
 #define DO8(buf)  DO4(buf); DO4(buf);
 
 /* ========================================================================= */
-uint32_t ZEXPORT crc32(crc, buf, len)
-    uint32_t crc;
-    const Bytef *buf;
-    uInt len;
+uint32_t ZEXPORT crc32 (uint32_t crc, const Bytef *buf, uInt len)
 {
 #ifdef DYNAMIC_CRC_TABLE
     if (crc_table_empty)
@@ -203,7 +203,9 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
  * Calculate the crc32 checksum triggering the watchdog every 'chunk_sz' bytes
  * of input.
  */
-ulong crc32_wd (ulong crc, const unsigned char *buf, uint len, uint chunk_sz)
+uint32_t ZEXPORT crc32_wd (uint32_t crc,
+                          const unsigned char *buf,
+                          uInt len, uInt chunk_sz)
 {
 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
        const unsigned char *end, *curr;
@@ -220,7 +222,7 @@ ulong crc32_wd (ulong crc, const unsigned char *buf, uint len, uint chunk_sz)
                WATCHDOG_RESET ();
        }
 #else
-        crc = crc32 (crc, buf, len);
+       crc = crc32 (crc, buf, len);
 #endif
 
        return crc;