summaryrefslogtreecommitdiff
path: root/rbutil/jztool/include/jztool.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-07-17 19:35:09 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-07-20 14:56:58 +0000
commit740a50687f67f3684e4b5698f8f30e3adebb8f6e (patch)
treecc2afcc989f0ca89e849338ad136e4042acd6bc1 /rbutil/jztool/include/jztool.h
parent6f042e91dd8730bf72b423248aa2c520708f03c5 (diff)
downloadrockbox-740a50687f67f3684e4b5698f8f30e3adebb8f6e.tar.gz
rockbox-740a50687f67f3684e4b5698f8f30e3adebb8f6e.zip
jztool: add support for Shanling Q1 and Eros Qbootloader_shanlingq1_v1
Change-Id: I8e93162d1a9d82e9d132219f2803b1856d24ae6c
Diffstat (limited to 'rbutil/jztool/include/jztool.h')
-rw-r--r--rbutil/jztool/include/jztool.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/rbutil/jztool/include/jztool.h b/rbutil/jztool/include/jztool.h
index df51fe9f44..9d3c08c5bc 100644
--- a/rbutil/jztool/include/jztool.h
+++ b/rbutil/jztool/include/jztool.h
@@ -33,9 +33,12 @@ extern "C" {
33 * Types, enumerations, etc 33 * Types, enumerations, etc
34 */ 34 */
35 35
36#define JZ_CPUINFO_BUFLEN 9
37
36typedef struct jz_context jz_context; 38typedef struct jz_context jz_context;
37typedef struct jz_usbdev jz_usbdev; 39typedef struct jz_usbdev jz_usbdev;
38typedef struct jz_device_info jz_device_info; 40typedef struct jz_device_info jz_device_info;
41typedef struct jz_cpu_info jz_cpu_info;
39typedef struct jz_buffer jz_buffer; 42typedef struct jz_buffer jz_buffer;
40 43
41typedef enum jz_error jz_error; 44typedef enum jz_error jz_error;
@@ -77,19 +80,46 @@ enum jz_log_level {
77 80
78enum jz_device_type { 81enum jz_device_type {
79 JZ_DEVICE_FIIOM3K, 82 JZ_DEVICE_FIIOM3K,
83 JZ_DEVICE_SHANLINGQ1,
84 JZ_DEVICE_EROSQ,
85 JZ_NUM_DEVICES,
80}; 86};
81 87
82enum jz_cpu_type { 88enum jz_cpu_type {
83 JZ_CPU_X1000, 89 JZ_CPU_X1000,
90 JZ_NUM_CPUS,
84}; 91};
85 92
86struct jz_device_info { 93struct jz_device_info {
94 /* internal device name and file extension */
87 const char* name; 95 const char* name;
96 const char* file_ext;
97
98 /* human-readable name */
88 const char* description; 99 const char* description;
100
101 /* device and CPU type */
89 jz_device_type device_type; 102 jz_device_type device_type;
90 jz_cpu_type cpu_type; 103 jz_cpu_type cpu_type;
104
105 /* USB IDs of the device in mass storage mode */
106 uint16_t vendor_id;
107 uint16_t product_id;
108};
109
110struct jz_cpu_info {
111 /* CPU info string, as reported by the boot ROM */
112 const char* info_str;
113
114 /* USB IDs of the boot ROM */
91 uint16_t vendor_id; 115 uint16_t vendor_id;
92 uint16_t product_id; 116 uint16_t product_id;
117
118 /* default addresses for running binaries */
119 uint32_t stage1_load_addr;
120 uint32_t stage1_exec_addr;
121 uint32_t stage2_load_addr;
122 uint32_t stage2_exec_addr;
93}; 123};
94 124
95struct jz_buffer { 125struct jz_buffer {
@@ -119,11 +149,13 @@ void jz_sleepms(int ms);
119 * Device and file info 149 * Device and file info
120 */ 150 */
121 151
122int jz_get_num_device_info(void);
123const jz_device_info* jz_get_device_info(jz_device_type type); 152const jz_device_info* jz_get_device_info(jz_device_type type);
124const jz_device_info* jz_get_device_info_named(const char* name); 153const jz_device_info* jz_get_device_info_named(const char* name);
125const jz_device_info* jz_get_device_info_indexed(int index); 154const jz_device_info* jz_get_device_info_indexed(int index);
126 155
156const jz_cpu_info* jz_get_cpu_info(jz_cpu_type type);
157const jz_cpu_info* jz_get_cpu_info_named(const char* info_str);
158
127int jz_identify_x1000_spl(const void* data, size_t len); 159int jz_identify_x1000_spl(const void* data, size_t len);
128int jz_identify_scramble_image(const void* data, size_t len); 160int jz_identify_scramble_image(const void* data, size_t len);
129 161
@@ -139,15 +171,16 @@ int jz_usb_recv(jz_usbdev* dev, uint32_t addr, size_t len, void* data);
139int jz_usb_start1(jz_usbdev* dev, uint32_t addr); 171int jz_usb_start1(jz_usbdev* dev, uint32_t addr);
140int jz_usb_start2(jz_usbdev* dev, uint32_t addr); 172int jz_usb_start2(jz_usbdev* dev, uint32_t addr);
141int jz_usb_flush_caches(jz_usbdev* dev); 173int jz_usb_flush_caches(jz_usbdev* dev);
174int jz_usb_get_cpu_info(jz_usbdev* dev, char* buffer, size_t buflen);
142 175
143/****************************************************************************** 176/******************************************************************************
144 * Rockbox loader (all functions are model-specific, see docs) 177 * Rockbox loader (all functions are model-specific, see docs)
145 */ 178 */
146 179
147int jz_fiiom3k_boot(jz_usbdev* dev, const char* filename); 180int jz_x1000_boot(jz_usbdev* dev, jz_device_type type, const char* filename);
148 181
149/****************************************************************************** 182/******************************************************************************
150 * Simple buffer API 183 * Buffer API and other functions
151 */ 184 */
152 185
153jz_buffer* jz_buffer_alloc(size_t size, const void* data); 186jz_buffer* jz_buffer_alloc(size_t size, const void* data);
@@ -156,6 +189,8 @@ void jz_buffer_free(jz_buffer* buf);
156int jz_buffer_load(jz_buffer** buf, const char* filename); 189int jz_buffer_load(jz_buffer** buf, const char* filename);
157int jz_buffer_save(jz_buffer* buf, const char* filename); 190int jz_buffer_save(jz_buffer* buf, const char* filename);
158 191
192jz_buffer* jz_ucl_unpack(const uint8_t* src, uint32_t src_len, uint32_t* dst_len);
193
159/****************************************************************************** 194/******************************************************************************
160 * END 195 * END
161 */ 196 */