summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/ibasso/system-ibasso.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/ibasso/system-ibasso.c')
-rw-r--r--firmware/target/hosted/ibasso/system-ibasso.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/firmware/target/hosted/ibasso/system-ibasso.c b/firmware/target/hosted/ibasso/system-ibasso.c
new file mode 100644
index 0000000000..00f8669ae0
--- /dev/null
+++ b/firmware/target/hosted/ibasso/system-ibasso.c
@@ -0,0 +1,101 @@
1/***************************************************************************
2 * __________ __ ___
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50
10 * Copyright (C) 2014 by Mario Basister: iBasso DX90 port
11 * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features
12 * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23
24
25#include <stdint.h>
26#include <stdlib.h>
27#include <sys/reboot.h>
28
29#include "config.h"
30#include "cpufreq-linux.h"
31#include "debug.h"
32
33#include "button-ibasso.h"
34#include "debug-ibasso.h"
35#include "sysfs-ibasso.h"
36#include "usb-ibasso.h"
37#include "vold-ibasso.h"
38
39
40/* Fake stack. */
41uintptr_t* stackbegin;
42uintptr_t* stackend;
43
44
45void system_init(void)
46{
47 TRACE;
48
49 /* Fake stack. */
50 volatile uintptr_t stack = 0;
51 stackbegin = stackend = (uintptr_t*) &stack;
52
53 cpufreq_set_governor("powersave", CPUFREQ_ALL_CPUS);
54 vold_monitor_start();
55 ibasso_set_usb_mode(USB_MODE_MASS_STORAGE);
56
57 /*
58 Prevent device from deep sleeping, which will interrupt playback.
59 /sys/power/wake_lock
60 */
61 if(! sysfs_set_string(SYSFS_POWER_WAKE_LOCK, "rockbox"))
62 {
63 DEBUGF("ERROR %s: Can not set suspend blocker.", __func__);
64 }
65
66 /*
67 Prevent device to mute, which will cause tinyalsa pcm_writes to fail.
68 /sys/class/codec/wm8740_mute
69 */
70 if(! sysfs_set_char(SYSFS_WM8740_MUTE, '0'))
71 {
72 DEBUGF("ERROR %s: Can not set WM8740 lock.", __func__);
73 }
74}
75
76
77void system_reboot(void)
78{
79 TRACE;
80
81 button_close_device();
82
83 if(vold_monitor_forced_close_imminent())
84 {
85 /*
86 We are here, because Android Vold is going to kill Rockbox. Instead of powering off,
87 we exit into the loader.
88 */
89 exit(42);
90 }
91
92 reboot(RB_AUTOBOOT);
93}
94
95
96void system_exception_wait(void)
97{
98 TRACE;
99
100 while(1) {};
101}