From ceb1e7a2fea714ac0d8f3fc6d7544ad7f60d9c9d Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Thu, 22 Mar 2007 12:55:51 +0000 Subject: minor code cleanup and policing git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12889 a1c6a512-1295-4272-9138-f99709370657 --- bootloader/main-pp.c | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'bootloader') 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 +#include #include "common.h" #include "cpu.h" #include "file.h" @@ -30,7 +32,29 @@ #include "button.h" #include "disk.h" #include +#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 -#include -#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); -- cgit