summaryrefslogtreecommitdiff
path: root/utils/rk27utils/rkwtool/rkw.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rk27utils/rkwtool/rkw.h')
-rw-r--r--utils/rk27utils/rkwtool/rkw.h123
1 files changed, 123 insertions, 0 deletions
diff --git a/utils/rk27utils/rkwtool/rkw.h b/utils/rk27utils/rkwtool/rkw.h
new file mode 100644
index 0000000000..eba673c974
--- /dev/null
+++ b/utils/rk27utils/rkwtool/rkw.h
@@ -0,0 +1,123 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2014 by Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#include <stdint.h>
22
23#define RKLD_MAGIC 0x4C44524B
24#define RKRS_MAGIC 0x53524B52
25#define RKST_MAGIC 0X53544B52
26
27enum section_type_t {
28 ST_RKLD,
29 ST_RKRS,
30 ST_RKST
31};
32
33enum rkst_action_t {
34 act_null = 0,
35 act_mkdir = 1,
36 act_fcopy = 2,
37 act_fsoper = 3,
38 act_format = 4,
39 act_loader = 5,
40
41 act_dispbmp = 10,
42 act_dispstr = 11,
43 act_setfont = 12,
44
45 act_delay = 20,
46
47 act_system = 100,
48 act_uilogo = 100,
49 act_readme = 101,
50 act_copyright = 102,
51 act_select = 103,
52 act_restart = 104,
53
54 act_regkey = 120,
55 act_version = 121,
56
57 act_freplace = 130,
58 act_fpreplace = 131,
59 act_fsdel = 132,
60
61 act_space = 200,
62
63 act_addfile = 300,
64
65 act_setmem = 1000,
66 act_getmem = 1001,
67};
68
69struct section_header_t {
70 uint32_t size;
71 uint32_t magic;
72 uint32_t property;
73 uint32_t timestamp;
74 uint32_t allign;
75 uint32_t file_size;
76 uint16_t size_of_name_dir;
77 uint16_t size_of_id_dir;
78 uint16_t number_of_named_entries;
79 uint16_t number_of_id_entries;
80 uint32_t offset_of_named_entries;
81 uint32_t offset_of_id_entries;
82} __attribute__((__packed__));
83
84struct rkrs_named_t {
85 uint32_t size;
86 uint32_t type;
87 uint32_t data_offset;
88 uint32_t data_size;
89 uint32_t param[4];
90} __attribute__((__packed__));
91
92struct rkst_named_t {
93 uint32_t size;
94 uint32_t action;
95 uint32_t data_offset;
96 uint32_t data_size;
97 uint8_t name;
98};
99
100struct section_info_t {
101 char *header;
102 char *items;
103};
104
105struct rkw_info_t {
106 char *rkw;
107 long size;
108 struct section_info_t rkrs_info;
109 struct section_info_t rkst_info;
110};
111
112/* general functions */
113struct rkw_info_t *rkw_slurp(char *filename);
114void rkw_free(struct rkw_info_t *rkw_info);
115
116/* info functions */
117void rkrs_list_named_items(struct rkw_info_t *rkw_info);
118void rkst_list_named_items(struct rkw_info_t *rkw_info);
119
120/* extract functions */
121void unpack_bootloader(struct rkw_info_t *rkw_info, char *prefix);
122void unpack_rkst(struct rkw_info_t *rkw_info, char *prefix);
123void unpack_addfile(struct rkw_info_t *rkw_info, char *prefix);