diff options
-rw-r--r-- | firmware/export/config/samsungypr0.h | 1 | ||||
-rw-r--r-- | firmware/export/config/sonynwa20.h | 2 | ||||
-rw-r--r-- | firmware/export/config/sonynwza10.h | 2 | ||||
-rw-r--r-- | firmware/export/config/sonynwzlinux.h | 13 | ||||
-rw-r--r-- | firmware/target/hosted/sonynwz/system-nwz.c | 74 |
5 files changed, 81 insertions, 11 deletions
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h index 286299bf81..29c565c525 100644 --- a/firmware/export/config/samsungypr0.h +++ b/firmware/export/config/samsungypr0.h | |||
@@ -169,3 +169,4 @@ | |||
169 | #define HAVE_HOTSWAP | 169 | #define HAVE_HOTSWAP |
170 | #define HAVE_STORAGE_FLUSH | 170 | #define HAVE_STORAGE_FLUSH |
171 | #define MULTIDRIVE_DIR "/mnt/mmc" | 171 | #define MULTIDRIVE_DIR "/mnt/mmc" |
172 | #define MULTIDRIVE_DEV "/sys/block/mmcblk0" | ||
diff --git a/firmware/export/config/sonynwa20.h b/firmware/export/config/sonynwa20.h index d9f6292459..e5380114b7 100644 --- a/firmware/export/config/sonynwa20.h +++ b/firmware/export/config/sonynwa20.h | |||
@@ -13,4 +13,6 @@ | |||
13 | /* sqrt(240^2 + 320^2) / 2 = 200 */ | 13 | /* sqrt(240^2 + 320^2) / 2 = 200 */ |
14 | #define LCD_DPI 200 | 14 | #define LCD_DPI 200 |
15 | 15 | ||
16 | #define NWZ_HAS_SD | ||
17 | |||
16 | #include "sonynwzlinux.h" | 18 | #include "sonynwzlinux.h" |
diff --git a/firmware/export/config/sonynwza10.h b/firmware/export/config/sonynwza10.h index a0650cf22d..750a4d59d7 100644 --- a/firmware/export/config/sonynwza10.h +++ b/firmware/export/config/sonynwza10.h | |||
@@ -13,4 +13,6 @@ | |||
13 | /* sqrt(240^2 + 320^2) / 2 = 200 */ | 13 | /* sqrt(240^2 + 320^2) / 2 = 200 */ |
14 | #define LCD_DPI 200 | 14 | #define LCD_DPI 200 |
15 | 15 | ||
16 | #define NWZ_HAS_SD | ||
17 | |||
16 | #include "sonynwzlinux.h" | 18 | #include "sonynwzlinux.h" |
diff --git a/firmware/export/config/sonynwzlinux.h b/firmware/export/config/sonynwzlinux.h index 074ad1c417..71affd1584 100644 --- a/firmware/export/config/sonynwzlinux.h +++ b/firmware/export/config/sonynwzlinux.h | |||
@@ -57,9 +57,6 @@ | |||
57 | /* The number of bytes reserved for loadable plugins */ | 57 | /* The number of bytes reserved for loadable plugins */ |
58 | #define PLUGIN_BUFFER_SIZE 0x100000 | 58 | #define PLUGIN_BUFFER_SIZE 0x100000 |
59 | 59 | ||
60 | |||
61 | |||
62 | |||
63 | #define CONFIG_TUNER SI4700 | 60 | #define CONFIG_TUNER SI4700 |
64 | 61 | ||
65 | /* There is no hardware tone control */ | 62 | /* There is no hardware tone control */ |
@@ -105,8 +102,18 @@ | |||
105 | /* Define this to the CPU frequency */ | 102 | /* Define this to the CPU frequency */ |
106 | #define CPU_FREQ 532000000 | 103 | #define CPU_FREQ 532000000 |
107 | 104 | ||
105 | #ifdef NWZ_HAS_SD | ||
106 | /* External SD card can be mounted */ | ||
107 | #define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD) | ||
108 | #define HAVE_MULTIDRIVE /* But _not_ CONFIG_STORAGE_MULTI */ | ||
109 | #define NUM_DRIVES 2 | ||
110 | #define HAVE_HOTSWAP | ||
111 | #define MULTIDRIVE_DIR "/mnt/media" | ||
112 | #define MULTIDRIVE_DEV "/sys/block/mmcblk1" | ||
113 | #else | ||
108 | /* No special storage */ | 114 | /* No special storage */ |
109 | #define CONFIG_STORAGE STORAGE_HOSTFS | 115 | #define CONFIG_STORAGE STORAGE_HOSTFS |
116 | #endif | ||
110 | #define HAVE_STORAGE_FLUSH | 117 | #define HAVE_STORAGE_FLUSH |
111 | 118 | ||
112 | /* Battery */ | 119 | /* Battery */ |
diff --git a/firmware/target/hosted/sonynwz/system-nwz.c b/firmware/target/hosted/sonynwz/system-nwz.c index c10c26250b..00a3b77252 100644 --- a/firmware/target/hosted/sonynwz/system-nwz.c +++ b/firmware/target/hosted/sonynwz/system-nwz.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * __________ __ ___. | 2 | * __________ __ ___. |
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * | 8 | * |
9 | * Copyright (C) 2016 Amaury Pouly | 9 | * Copyright (C) 2016 Amaury Pouly |
10 | * | 10 | * |
@@ -23,20 +23,24 @@ | |||
23 | #include <signal.h> | 23 | #include <signal.h> |
24 | #include <ucontext.h> | 24 | #include <ucontext.h> |
25 | #include <string.h> | 25 | #include <string.h> |
26 | #include <stdio.h> | ||
27 | |||
26 | #include "system.h" | 28 | #include "system.h" |
27 | #include "lcd.h" | 29 | #include "lcd.h" |
28 | #include "font.h" | 30 | #include "font.h" |
29 | #include "logf.h" | ||
30 | #include "system.h" | 31 | #include "system.h" |
31 | #include "backlight-target.h" | 32 | #include "backlight-target.h" |
32 | #include "button.h" | 33 | #include "button.h" |
33 | #include "adc.h" | 34 | #include "adc.h" |
34 | #include "power.h" | 35 | #include "power.h" |
36 | #include "mv.h" | ||
35 | #include "power-nwz.h" | 37 | #include "power-nwz.h" |
36 | #include <backtrace.h> | 38 | #include <backtrace.h> |
37 | #include <stdio.h> | 39 | |
40 | #include "logf.h" | ||
38 | 41 | ||
39 | static const char **kern_mod_list; | 42 | static const char **kern_mod_list; |
43 | bool os_file_exists(const char *ospath); | ||
40 | 44 | ||
41 | void power_off(void) | 45 | void power_off(void) |
42 | { | 46 | { |
@@ -238,3 +242,57 @@ bool nwz_is_kernel_module_loaded(const char *name) | |||
238 | return true; | 242 | return true; |
239 | return false; | 243 | return false; |
240 | } | 244 | } |
245 | |||
246 | #ifdef CONFIG_STORAGE_MULTI | ||
247 | int hostfs_driver_type(int drive) | ||
248 | { | ||
249 | return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM; | ||
250 | } | ||
251 | #endif /* CONFIG_STORAGE_MULTI */ | ||
252 | |||
253 | #ifdef HAVE_HOTSWAP | ||
254 | bool hostfs_removable(IF_MD_NONVOID(int volume)) | ||
255 | { | ||
256 | #ifdef HAVE_MULTIDRIVE | ||
257 | if (volume > 0) | ||
258 | return true; | ||
259 | else | ||
260 | #endif | ||
261 | return false; /* internal: always present */ | ||
262 | } | ||
263 | |||
264 | bool hostfs_present(int volume) | ||
265 | { | ||
266 | #ifdef HAVE_MULTIDRIVE | ||
267 | if (volume > 0) | ||
268 | #if defined(MULTIDRIVE_DEV) | ||
269 | return os_file_exists(MULTIDRIVE_DEV); | ||
270 | #else | ||
271 | return true; // FIXME? | ||
272 | #endif | ||
273 | else | ||
274 | #endif | ||
275 | return true; /* internal: always present */ | ||
276 | } | ||
277 | #endif /* HAVE_HOTSWAP */ | ||
278 | |||
279 | #ifdef HAVE_MULTIDRIVE | ||
280 | int volume_drive(int drive) | ||
281 | { | ||
282 | return drive; | ||
283 | } | ||
284 | #endif /* HAVE_MULTIDRIVE */ | ||
285 | |||
286 | #ifdef HAVE_HOTSWAP | ||
287 | bool volume_removable(IF_MV_NONVOID(int volume)) | ||
288 | { | ||
289 | /* don't support more than one partition yet, so volume == drive */ | ||
290 | return hostfs_removable(volume); | ||
291 | } | ||
292 | |||
293 | bool volume_present(int volume) | ||
294 | { | ||
295 | /* don't support more than one partition yet, so volume == drive */ | ||
296 | return hostfs_present(volume); | ||
297 | } | ||
298 | #endif /* HAVE_HOTSWAP */ | ||