Fix scrolling direction in the Nano2G __dbg_hw_info screen
[kugel-rb.git] / tools / mr500.h
blobf9a651f923f6f6bb44b5354774b99c7059f04891
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2009 by Karl Kurbjun
10 * $Id$
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include <stdlib.h>
21 extern int decrypt_array[];
22 extern int encrypt_array[];
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
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__));
42 /* Patch entries should be saved in little endian format */
43 struct patch_single {
44 off_t offset;
45 uint32_t value;
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);