summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-03-22 12:55:51 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-03-22 12:55:51 +0000
commitceb1e7a2fea714ac0d8f3fc6d7544ad7f60d9c9d (patch)
treecb1387a6c3037603fa464e22fa2b1778187bca2f /bootloader
parenta76947f2a20ceb49c3d457025a21a391feb4846d (diff)
downloadrockbox-ceb1e7a2fea714ac0d8f3fc6d7544ad7f60d9c9d.tar.gz
rockbox-ceb1e7a2fea714ac0d8f3fc6d7544ad7f60d9c9d.tar.bz2
rockbox-ceb1e7a2fea714ac0d8f3fc6d7544ad7f60d9c9d.zip
minor code cleanup and policing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12889 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/main-pp.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index c4000ea2f3..99200da1b9 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -19,6 +19,8 @@
* KIND, either express or implied.
*
****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
#include "common.h"
#include "cpu.h"
#include "file.h"
@@ -30,7 +32,29 @@
#include "button.h"
#include "disk.h"
#include <string.h>
+#ifdef SANSA_E200
+#include "usb.h"
+#endif
+
+
+/* Button definitions */
+#if CONFIG_KEYPAD == IRIVER_H10_PAD
+#define BOOTLOADER_BOOT_OF BUTTON_LEFT
+
+#elif CONFIG_KEYPAD == SANSA_E200_PAD
+#define BOOTLOADER_BOOT_OF BUTTON_LEFT
+
+#endif
+
+/* Maximum allowed firmware image size. 10MB is more than enough */
+#define MAX_LOADSIZE (10*1024*1024)
+/* A buffer to load the original firmware or Rockbox into */
+unsigned char *loadbuffer = (unsigned char *)DRAM_START;
+
+/* Bootloader version */
+char version[] = APPSVERSION;
+
/* Locations and sizes in hidden partition on Sansa */
#ifdef SANSA_E200
#define PPMI_SECTOR_OFFSET 1024
@@ -247,11 +271,7 @@ static int tea_find_key(struct mi4header_t *mi4header, int fd)
/* based on implementation by Finn Yannick Jacobs */
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef SANSA_E200
-#include "usb.h"
-#endif
+
/* crc_tab[] -- this crcTable is being build by chksum_crc32GenTab().
* so make sure, you call it before using the other
@@ -306,23 +326,6 @@ static void chksum_crc32gentab (void)
}
}
-/* Button definitions */
-#if CONFIG_KEYPAD == IRIVER_H10_PAD
-#define BOOTLOADER_BOOT_OF BUTTON_LEFT
-
-#elif CONFIG_KEYPAD == SANSA_E200_PAD
-#define BOOTLOADER_BOOT_OF BUTTON_LEFT
-
-#endif
-
-/* Maximum allowed firmware image size. 10MB is more than enough */
-#define MAX_LOADSIZE (10*1024*1024)
-
-/* A buffer to load the original firmware or Rockbox into */
-unsigned char *loadbuffer = (unsigned char *)DRAM_START;
-
-/* Bootloader version */
-char version[] = APPSVERSION;
/* Load mi4 format firmware image */
int load_mi4(unsigned char* buf, char* firmware, unsigned int buffer_size)
@@ -477,7 +480,8 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
sector = pinfo->start + 0x3c5c;
offset = 0x2;
}
- else return EOK;
+ else
+ return EOK;
ata_read_sectors(sector, 1, block);
block[offset] = 0;
ata_write_sectors(sector, 1, block);