blob: f73d6501b620494c886a974c7ed4a09bcffff0f5 [file] [log] [blame]
Barry Wardell84b509d2007-01-28 18:42:11 +00001/***************************************************************************
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 Stenberg2acc0ac2008-06-28 18:10:04 +000012 * 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 Wardell84b509d2007-01-28 18:42:11 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
Dave Chapman582d02d2007-03-06 09:11:22 +000022#include <stdbool.h>
23
Barry Wardell84b509d2007-01-28 18:42:11 +000024/* 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 Wardell14ed3ca2007-03-16 14:28:00 +000032#define EINVALID_FORMAT -7
Barry Wardell84b509d2007-01-28 18:42:11 +000033
Dave Chapman4d25bff2007-03-05 23:56:28 +000034/* Set this to true to enable lcd_update() in the printf function */
35extern bool verbose;
36
Barry Wardell23709982007-03-12 22:12:20 +000037/* Error types */
38#define EATA -1
39#define EDISK -2
40#define EBOOTFILE -3
41
Barry Wardell84b509d2007-01-28 18:42:11 +000042/* Functions common to all bootloaders */
43void reset_screen(void);
44void printf(const char *format, ...);
45char *strerror(int error);
Barry Wardell23709982007-03-12 22:12:20 +000046void error(int errortype, int error);
Barry Wardell84b509d2007-01-28 18:42:11 +000047int load_firmware(unsigned char* buf, char* firmware, int buffer_size);
48int load_raw_firmware(unsigned char* buf, char* firmware, int buffer_size);