diff options
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r-- | firmware/target/hosted/sonynwz/system-nwz.c | 74 |
1 files changed, 66 insertions, 8 deletions
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 */ | ||