Barry Wardell | 84b509d | 2007-01-28 18:42:11 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id: main.c 11997 2007-01-13 09:08:18Z miipekk $ |
| 9 | * |
| 10 | * Copyright (C) 2005 by Linus Nielsen Feltzing |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Barry Wardell | 84b509d | 2007-01-28 18:42:11 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | |
Dave Chapman | 582d02d | 2007-03-06 09:11:22 +0000 | [diff] [blame] | 22 | #include <stdbool.h> |
| 23 | |
Barry Wardell | 84b509d | 2007-01-28 18:42:11 +0000 | [diff] [blame] | 24 | /* Error codes */ |
| 25 | #define EOK 0 |
| 26 | #define EFILE_NOT_FOUND -1 |
| 27 | #define EREAD_CHKSUM_FAILED -2 |
| 28 | #define EREAD_MODEL_FAILED -3 |
| 29 | #define EREAD_IMAGE_FAILED -4 |
| 30 | #define EBAD_CHKSUM -5 |
| 31 | #define EFILE_TOO_BIG -6 |
Barry Wardell | 14ed3ca | 2007-03-16 14:28:00 +0000 | [diff] [blame] | 32 | #define EINVALID_FORMAT -7 |
Barry Wardell | 84b509d | 2007-01-28 18:42:11 +0000 | [diff] [blame] | 33 | |
Dave Chapman | 4d25bff | 2007-03-05 23:56:28 +0000 | [diff] [blame] | 34 | /* Set this to true to enable lcd_update() in the printf function */ |
| 35 | extern bool verbose; |
| 36 | |
Barry Wardell | 2370998 | 2007-03-12 22:12:20 +0000 | [diff] [blame] | 37 | /* Error types */ |
| 38 | #define EATA -1 |
| 39 | #define EDISK -2 |
| 40 | #define EBOOTFILE -3 |
| 41 | |
Barry Wardell | 84b509d | 2007-01-28 18:42:11 +0000 | [diff] [blame] | 42 | /* Functions common to all bootloaders */ |
| 43 | void reset_screen(void); |
| 44 | void printf(const char *format, ...); |
| 45 | char *strerror(int error); |
Barry Wardell | 2370998 | 2007-03-12 22:12:20 +0000 | [diff] [blame] | 46 | void error(int errortype, int error); |
Barry Wardell | 84b509d | 2007-01-28 18:42:11 +0000 | [diff] [blame] | 47 | int load_firmware(unsigned char* buf, char* firmware, int buffer_size); |
| 48 | int load_raw_firmware(unsigned char* buf, char* firmware, int buffer_size); |