diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/config.h | 3 | ||||
-rw-r--r-- | firmware/export/config/erosqnative.h | 16 | ||||
-rw-r--r-- | firmware/export/devicedata.h | 94 |
3 files changed, 112 insertions, 1 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h index 37ea9a1dd7..ede1825f88 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -893,7 +893,8 @@ Lyre prototype 1 */ | |||
893 | #endif | 893 | #endif |
894 | 894 | ||
895 | /* Bootloaders don't need multivolume awareness */ | 895 | /* Bootloaders don't need multivolume awareness */ |
896 | #if defined(BOOTLOADER) && defined(HAVE_MULTIVOLUME) && !(CONFIG_PLATFORM & PLATFORM_HOSTED) | 896 | #if defined(BOOTLOADER) && defined(HAVE_MULTIVOLUME) \ |
897 | && !(CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(BOOT_REDIR) | ||
897 | #undef HAVE_MULTIVOLUME | 898 | #undef HAVE_MULTIVOLUME |
898 | #endif | 899 | #endif |
899 | 900 | ||
diff --git a/firmware/export/config/erosqnative.h b/firmware/export/config/erosqnative.h index 26073a5f34..adb1b29e01 100644 --- a/firmware/export/config/erosqnative.h +++ b/firmware/export/config/erosqnative.h | |||
@@ -9,6 +9,19 @@ | |||
9 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 9 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
10 | #define BOOTDIR "/.rockbox" | 10 | #define BOOTDIR "/.rockbox" |
11 | 11 | ||
12 | /* Define EROSQN_VER as an "extradefine" in the configure script - | ||
13 | * v1, v2 players: "1" | ||
14 | * v3 players: "3" | ||
15 | * Only bootloader will be affected. | ||
16 | * | ||
17 | * This allows us to fix the LCD init issues with v3 players. | ||
18 | */ | ||
19 | #ifdef BOOTLOADER | ||
20 | #ifndef EROSQN_VER | ||
21 | #error "Must define EROSQN_VER" | ||
22 | #endif | ||
23 | #endif | ||
24 | |||
12 | /* CPU defines */ | 25 | /* CPU defines */ |
13 | #define CONFIG_CPU X1000 | 26 | #define CONFIG_CPU X1000 |
14 | #define X1000_EXCLK_FREQ 24000000 | 27 | #define X1000_EXCLK_FREQ 24000000 |
@@ -106,6 +119,9 @@ | |||
106 | #define HAVE_BOOTDATA | 119 | #define HAVE_BOOTDATA |
107 | #define BOOT_REDIR "rockbox_main.aigo_erosqn" | 120 | #define BOOT_REDIR "rockbox_main.aigo_erosqn" |
108 | 121 | ||
122 | /* DeviceData */ | ||
123 | #define HAVE_DEVICEDATA | ||
124 | |||
109 | /* USB support */ | 125 | /* USB support */ |
110 | #ifndef SIMULATOR | 126 | #ifndef SIMULATOR |
111 | #define CONFIG_USBOTG USBOTG_DESIGNWARE | 127 | #define CONFIG_USBOTG USBOTG_DESIGNWARE |
diff --git a/firmware/export/devicedata.h b/firmware/export/devicedata.h new file mode 100644 index 0000000000..c19b0ca25d --- /dev/null +++ b/firmware/export/devicedata.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2017 by Amaury Pouly | ||
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 | #ifndef __RB_DEVICEDATA__ | ||
21 | #define __RB_DEVICEDATA__ | ||
22 | |||
23 | #ifndef __ASSEMBLER__ | ||
24 | #include <stdint.h> | ||
25 | #include "system.h" | ||
26 | #endif | ||
27 | |||
28 | /* /!\ This file can be included in assembly files /!\ */ | ||
29 | |||
30 | /** The device data will be filled by the bootloader with information that might | ||
31 | * be relevant for Rockbox. The bootloader will search for the structure using | ||
32 | * the magic header within the first DEVICE_DATA_SEARCH_SIZE bytes of the binary. | ||
33 | * Typically, this structure should be as close as possible to the entry point */ | ||
34 | |||
35 | /* Search size for the data structure after entry point */ | ||
36 | #define DEVICE_DATA_SEARCH_SIZE 1024 | ||
37 | |||
38 | #define DEVICE_DATA_MAGIC0 ('r' | 'b' << 8 | 'd' << 16 | 'e' << 24) | ||
39 | #define DEVICE_DATA_MAGIC1 ('v' | 'i' << 8 | 'c' << 16 | 'e' << 24) | ||
40 | |||
41 | /* maximum size of payload */ | ||
42 | #define DEVICE_DATA_PAYLOAD_SIZE 4 | ||
43 | |||
44 | #ifndef __ASSEMBLER__ | ||
45 | /* This is the C structure */ | ||
46 | struct device_data_t | ||
47 | { | ||
48 | union | ||
49 | { | ||
50 | uint32_t crc; /* crc of payload data (CRC32 with 0xffffffff for initial value) */ | ||
51 | uint32_t magic[2]; /* DEVICE_DATA_MAGIC0/1 */ | ||
52 | }; | ||
53 | |||
54 | uint32_t length; /* length of the payload */ | ||
55 | |||
56 | /* add fields here */ | ||
57 | union | ||
58 | { | ||
59 | struct | ||
60 | { | ||
61 | #if defined(EROS_QN) | ||
62 | uint8_t lcd_version; | ||
63 | #endif | ||
64 | }; | ||
65 | uint8_t payload[DEVICE_DATA_PAYLOAD_SIZE]; | ||
66 | }; | ||
67 | } __attribute__((packed)); | ||
68 | |||
69 | |||
70 | void fill_devicedata(struct device_data_t *data); | ||
71 | bool write_devicedata(unsigned char* buf, int len); | ||
72 | #ifndef BOOTLOADER | ||
73 | extern struct device_data_t device_data; | ||
74 | |||
75 | void verify_device_data(void) INIT_ATTR; | ||
76 | |||
77 | #endif | ||
78 | |||
79 | #else /* __ASSEMBLER__ */ | ||
80 | |||
81 | /* This assembler macro implements an empty device data structure with just the magic | ||
82 | * string and payload size */ | ||
83 | .macro put_device_data_here | ||
84 | .global device_data | ||
85 | device_data: | ||
86 | .word DEVICE_DATA_MAGIC0 | ||
87 | .word DEVICE_DATA_MAGIC1 | ||
88 | .word DEVICE_DATA_PAYLOAD_SIZE | ||
89 | .space BOOT_DATA_PAYLOAD_SIZE, 0xff /* payload, initialised with value 0xff */ | ||
90 | .endm | ||
91 | |||
92 | #endif | ||
93 | |||
94 | #endif /* __RB_DEVICEDATA__ */ | ||