diff options
author | Amaury Pouly <pamaury@rockbox.org> | 2011-04-16 18:22:37 +0000 |
---|---|---|
committer | Amaury Pouly <pamaury@rockbox.org> | 2011-04-16 18:22:37 +0000 |
commit | d9b050ee2b069d65a57e2a65638a6ff1bf63ff17 (patch) | |
tree | 4625b39d0949c9846053211489de3d7cd4030983 /utils/sbinfo/sb.h | |
parent | ff1f2e24156bc8a34eccfa9e0af4dcebdc6cf1d2 (diff) | |
download | rockbox-d9b050ee2b069d65a57e2a65638a6ff1bf63ff17.tar.gz rockbox-d9b050ee2b069d65a57e2a65638a6ff1bf63ff17.zip |
sbinfo: move sb specific bits of its own header
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29722 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/sbinfo/sb.h')
-rw-r--r-- | utils/sbinfo/sb.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/utils/sbinfo/sb.h b/utils/sbinfo/sb.h new file mode 100644 index 0000000000..c4d705c14b --- /dev/null +++ b/utils/sbinfo/sb.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2011 Amaury Pouly | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #define _ISOC99_SOURCE /* snprintf() */ | ||
23 | #include <sys/types.h> | ||
24 | #include <sys/stat.h> | ||
25 | |||
26 | struct sb_version_t | ||
27 | { | ||
28 | uint16_t major; | ||
29 | uint16_t pad0; | ||
30 | uint16_t minor; | ||
31 | uint16_t pad1; | ||
32 | uint16_t revision; | ||
33 | uint16_t pad2; | ||
34 | }; | ||
35 | |||
36 | struct sb_header_t | ||
37 | { | ||
38 | uint8_t sha1_header[20]; /* SHA-1 of the rest of the header */ | ||
39 | uint8_t signature[4]; /* Signature "STMP" */ | ||
40 | uint8_t major_ver; /* Should be 1 */ | ||
41 | uint8_t minor_ver; /* Should be 1 */ | ||
42 | uint16_t flags; | ||
43 | uint32_t image_size; /* In blocks (=16bytes) */ | ||
44 | uint32_t first_boot_tag_off; /* Offset in blocks */ | ||
45 | uint32_t first_boot_sec_id; /* First bootable section ID */ | ||
46 | uint16_t nr_keys; /* Number of encryption keys */ | ||
47 | uint16_t key_dict_off; /* Offset to key dictionary (in blocks) */ | ||
48 | uint16_t header_size; /* In blocks */ | ||
49 | uint16_t nr_sections; /* Number of sections */ | ||
50 | uint16_t sec_hdr_size; /* Section header size (in blocks) */ | ||
51 | uint8_t rand_pad0[6]; /* Random padding */ | ||
52 | uint64_t timestamp; /* In microseconds since 2000/1/1 00:00:00 */ | ||
53 | struct sb_version_t product_ver; | ||
54 | struct sb_version_t component_ver; | ||
55 | uint16_t drive_tag; /* Unknown meaning */ | ||
56 | uint8_t rand_pad1[6]; /* Random padding */ | ||
57 | } __attribute__((packed)); | ||
58 | |||
59 | #define SB_INST_NOP 0x0 | ||
60 | #define SB_INST_TAG 0x1 | ||
61 | #define SB_INST_LOAD 0x2 | ||
62 | #define SB_INST_FILL 0x3 | ||
63 | #define SB_INST_JUMP 0x4 | ||
64 | #define SB_INST_CALL 0x5 | ||
65 | #define SB_INST_MODE 0x6 | ||
66 | |||
67 | #define ROM_SECTION_BOOTABLE (1 << 0) | ||
68 | #define ROM_SECTION_CLEARTEXT (1 << 1) | ||
69 | |||
70 | struct sb_instruction_header_t | ||
71 | { | ||
72 | uint8_t checksum; | ||
73 | uint8_t opcode; | ||
74 | uint16_t zero_except_for_tag; | ||
75 | } __attribute__((packed)); | ||
76 | |||
77 | struct sb_instruction_load_t | ||
78 | { | ||
79 | struct sb_instruction_header_t hdr; | ||
80 | uint32_t addr; | ||
81 | uint32_t len; | ||
82 | uint32_t crc; | ||
83 | } __attribute__((packed)); | ||
84 | |||
85 | struct sb_instruction_fill_t | ||
86 | { | ||
87 | struct sb_instruction_header_t hdr; | ||
88 | uint32_t addr; | ||
89 | uint32_t len; | ||
90 | uint32_t pattern; | ||
91 | } __attribute__((packed)); | ||
92 | |||
93 | struct sb_instruction_call_t | ||
94 | { | ||
95 | struct sb_instruction_header_t hdr; | ||
96 | uint32_t addr; | ||
97 | uint32_t zero; | ||
98 | uint32_t arg; | ||
99 | } __attribute__((packed)); | ||