summaryrefslogtreecommitdiffstats
path: root/bootloader/main-pp.c
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2007-06-04 13:48:21 +0000
committerBarry Wardell <rockbox@barrywardell.net>2007-06-04 13:48:21 +0000
commit54c73a24b6841efb06ee812831892960e5584e26 (patch)
treef235c11a81ee29a8b826cef7908b8a5fd50dfc8c /bootloader/main-pp.c
parent3611b4c8d8498c808bb0c6c26975e166e637a0aa (diff)
downloadrockbox-54c73a24b6841efb06ee812831892960e5584e26.tar.gz
rockbox-54c73a24b6841efb06ee812831892960e5584e26.tar.bz2
rockbox-54c73a24b6841efb06ee812831892960e5584e26.zip
Bring back rolo for mi4-based targets (H10 and Sansa).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13550 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/main-pp.c')
-rw-r--r--bootloader/main-pp.c76
1 files changed, 1 insertions, 75 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index b95b7a10f4..49d7f0a2f7 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -31,6 +31,7 @@
#include "ata.h"
#include "button.h"
#include "disk.h"
+#include "crc32-mi4.h"
#include <string.h>
#ifdef SANSA_E200
#include "usb.h"
@@ -250,81 +251,6 @@ static int tea_find_key(struct mi4header_t *mi4header, int fd)
return key_found;
}
-
-/*
- * We can't use the CRC32 implementation in the firmware library as it uses a
- * different polynomial. The polynomial needed is 0xEDB88320L
- *
- * CRC32 implementation taken from:
- *
- * efone - Distributed internet phone system.
- *
- * (c) 1999,2000 Krzysztof Dabrowski
- * (c) 1999,2000 ElysiuM deeZine
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- */
-
-/* based on implementation by Finn Yannick Jacobs */
-
-
-
-/* crc_tab[] -- this crcTable is being build by chksum_crc32GenTab().
- * so make sure, you call it before using the other
- * functions!
- */
-static unsigned int crc_tab[256];
-
-/* chksum_crc() -- to a given block, this one calculates the
- * crc32-checksum until the length is
- * reached. the crc32-checksum will be
- * the result.
- */
-unsigned int chksum_crc32 (unsigned char *block, unsigned int length)
-{
- register unsigned long crc;
- unsigned long i;
-
- crc = 0;
- for (i = 0; i < length; i++)
- {
- crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_tab[(crc ^ *block++) & 0xFF];
- }
- return (crc);
-}
-
-/* chksum_crc32gentab() -- to a global crc_tab[256], this one will
- * calculate the crcTable for crc32-checksums.
- * it is generated to the polynom [..]
- */
-
-static void chksum_crc32gentab (void)
-{
- unsigned long crc, poly;
- int i, j;
-
- poly = 0xEDB88320L;
- for (i = 0; i < 256; i++)
- {
- crc = i;
- for (j = 8; j > 0; j--)
- {
- if (crc & 1)
- {
- crc = (crc >> 1) ^ poly;
- }
- else
- {
- crc >>= 1;
- }
- }
- crc_tab[i] = crc;
- }
-}
/* Load mi4 format firmware image */