diff options
Diffstat (limited to 'tools/mr500.h')
-rw-r--r-- | tools/mr500.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tools/mr500.h b/tools/mr500.h new file mode 100644 index 0000000000..f9a651f923 --- /dev/null +++ b/tools/mr500.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2009 by Karl Kurbjun | ||
10 | * $Id$ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <stdlib.h> | ||
21 | extern int decrypt_array[]; | ||
22 | extern int encrypt_array[]; | ||
23 | |||
24 | /* Notes about the header: | ||
25 | * The magic_name should always be "OIMCFWUP" | ||
26 | * Header length is always 18 bytes | ||
27 | * The flags have the following mask: | ||
28 | * CHECK_CRC 0x01 : Tells the firmware whether or not to check CRC | ||
29 | * ENDIAN_MODE 0x02 : Tells the OF whether to re-order the bytes | ||
30 | * The rest are unknown | ||
31 | * The image length is in bytes and is always 0x007F0000 | ||
32 | */ | ||
33 | struct olympus_header { | ||
34 | int8_t magic_name[8]; | ||
35 | uint32_t unknown; | ||
36 | uint16_t header_length; | ||
37 | uint16_t flags; | ||
38 | uint32_t unknown_zeros; | ||
39 | uint32_t image_length; | ||
40 | } __attribute__((__packed__)); | ||
41 | |||
42 | /* Patch entries should be saved in little endian format */ | ||
43 | struct patch_single { | ||
44 | off_t offset; | ||
45 | uint32_t value; | ||
46 | }; | ||
47 | |||
48 | int mr500_patch_file(char *, struct patch_single *, int); | ||
49 | int mr500_save_header(char *, struct olympus_header *); | ||
50 | int mr500_read_header(char *, struct olympus_header *); | ||
51 | int mr500_save_crc(char *, off_t, uint32_t *); | ||
52 | int mr500_read_crc(char *, off_t, uint32_t *); | ||
53 | int mr500_calculate_crc(char *, off_t, unsigned int, uint32_t *); | ||
54 | int mr500_save_data(char *, char *, off_t, unsigned int, int*); | ||
55 | int mr500_init(void); | ||
56 | |||