From 0b29691324e5700f15ea653592bf29f8552d47d7 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Sun, 4 Mar 2012 15:34:29 +0100 Subject: Move load_firmware() to separate file The idea is to share loading code between bootloaders and rolo(). Change-Id: I1656ed91946d7a05cb7c9fa7a16793c3c862a5cd Reviewed-on: http://gerrit.rockbox.org/190 Reviewed-by: Marcin Bukat --- bootloader/iaudio_coldfire.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'bootloader/iaudio_coldfire.c') diff --git a/bootloader/iaudio_coldfire.c b/bootloader/iaudio_coldfire.c index b22af0e006..95060e458f 100644 --- a/bootloader/iaudio_coldfire.c +++ b/bootloader/iaudio_coldfire.c @@ -43,6 +43,8 @@ #include "powermgmt.h" #include "file.h" #include "version.h" +#include "loader_strerror.h" +#include "rb-loader.h" #include "pcf50606.h" @@ -129,7 +131,6 @@ int initial_gpio_read; void main(void) { - int i; int rc; bool rc_on_button = false; bool on_button = false; @@ -194,35 +195,22 @@ void main(void) rc = storage_init(); if(rc) - { - printf("ATA error: %d", rc); - sleep(HZ*5); - power_off(); - } + error(EATA, rc, true); disk_init(); rc = disk_mount_all(); if (rc<=0) - { - printf("No partition found"); - sleep(HZ*5); - power_off(); - } + error(EDISK, rc, true); printf("Loading firmware"); - i = load_firmware((unsigned char *)DRAM_START, BOOTFILE, MAX_LOADSIZE); - printf("Result: %s", strerror(i)); - - if (i < EOK) { - printf("Error!"); - printf("Can't load " BOOTFILE ": "); - printf(strerror(rc)); - sleep(HZ*3); - power_off(); - } else { - start_firmware(); - } + + rc = load_firmware((unsigned char *)DRAM_START, BOOTFILE, MAX_LOADSIZE); + + if (rc <= EFILE_EMPTY) + error(EBOOTFILE, rc, true); + + start_firmware(); } /* These functions are present in the firmware library, but we reimplement -- cgit v1.2.3