diff options
Diffstat (limited to 'firmware/target/hosted/android/system-android.c')
-rw-r--r-- | firmware/target/hosted/android/system-android.c | 54 |
1 files changed, 2 insertions, 52 deletions
diff --git a/firmware/target/hosted/android/system-android.c b/firmware/target/hosted/android/system-android.c index 6279504e48..d13b8d6462 100644 --- a/firmware/target/hosted/android/system-android.c +++ b/firmware/target/hosted/android/system-android.c | |||
@@ -23,12 +23,6 @@ | |||
23 | #include <setjmp.h> | 23 | #include <setjmp.h> |
24 | #include <jni.h> | 24 | #include <jni.h> |
25 | #include <pthread.h> | 25 | #include <pthread.h> |
26 | #if defined(DX50) || defined(DX90) | ||
27 | #include <stdlib.h> | ||
28 | #include <sys/reboot.h> | ||
29 | #include <sys/stat.h> | ||
30 | #include <stdio.h> | ||
31 | #endif /* DX50 || DX90 */ | ||
32 | #include <unistd.h> | 26 | #include <unistd.h> |
33 | #include "config.h" | 27 | #include "config.h" |
34 | #include "system.h" | 28 | #include "system.h" |
@@ -37,83 +31,40 @@ | |||
37 | 31 | ||
38 | 32 | ||
39 | 33 | ||
40 | #if !defined(DX50) && !defined(DX90) | ||
41 | /* global fields for use with various JNI calls */ | 34 | /* global fields for use with various JNI calls */ |
42 | static JavaVM *vm_ptr; | 35 | static JavaVM *vm_ptr; |
43 | JNIEnv *env_ptr; | 36 | JNIEnv *env_ptr; |
44 | jobject RockboxService_instance; | 37 | jobject RockboxService_instance; |
45 | jclass RockboxService_class; | 38 | jclass RockboxService_class; |
46 | #endif /* !DX50 && !DX90 */ | ||
47 | 39 | ||
48 | uintptr_t *stackbegin; | 40 | uintptr_t *stackbegin; |
49 | uintptr_t *stackend; | 41 | uintptr_t *stackend; |
50 | 42 | ||
51 | extern int main(void); | 43 | extern int main(void); |
52 | #if !defined(DX50) && !defined(DX90) | ||
53 | extern void telephony_init_device(void); | 44 | extern void telephony_init_device(void); |
54 | #endif | 45 | |
55 | void system_exception_wait(void) | 46 | void system_exception_wait(void) |
56 | { | 47 | { |
57 | #if defined(DX50) || defined(DX90) | ||
58 | while(1); | ||
59 | #else | ||
60 | intptr_t dummy = 0; | 48 | intptr_t dummy = 0; |
61 | while(button_read_device(&dummy) != BUTTON_BACK); | 49 | while(button_read_device(&dummy) != BUTTON_BACK); |
62 | #endif /* DX50 || DX90 */ | ||
63 | } | 50 | } |
64 | 51 | ||
65 | void system_reboot(void) | 52 | void system_reboot(void) |
66 | { | 53 | { |
67 | #if defined(DX50) || defined(DX90) | ||
68 | reboot(RB_AUTOBOOT); | ||
69 | #else | ||
70 | power_off(); | 54 | power_off(); |
71 | #endif /* DX50 || DX90 */ | ||
72 | } | 55 | } |
73 | 56 | ||
74 | #if !defined(DX50) && !defined(DX90) | ||
75 | /* this is used to return from the entry point of the native library. */ | 57 | /* this is used to return from the entry point of the native library. */ |
76 | static jmp_buf poweroff_buf; | 58 | static jmp_buf poweroff_buf; |
77 | #endif | ||
78 | |||
79 | void power_off(void) | 59 | void power_off(void) |
80 | { | 60 | { |
81 | #if defined(DX50) || defined(DX90) | ||
82 | reboot(RB_POWER_OFF); | ||
83 | #else | ||
84 | longjmp(poweroff_buf, 1); | 61 | longjmp(poweroff_buf, 1); |
85 | #endif /* DX50 || DX90 */ | ||
86 | } | 62 | } |
87 | 63 | ||
88 | void system_init(void) | 64 | void system_init(void) |
89 | { | 65 | { |
90 | #if defined(DX50) || defined(DX90) | ||
91 | volatile uintptr_t stack = 0; | ||
92 | stackbegin = stackend = (uintptr_t*) &stack; | ||
93 | |||
94 | struct stat m1, m2; | ||
95 | stat("/mnt/", &m1); | ||
96 | do | ||
97 | { | ||
98 | /* waiting for storage to get mounted */ | ||
99 | stat("/sdcard/", &m2); | ||
100 | usleep(100000); | ||
101 | } | ||
102 | while(m1.st_dev == m2.st_dev); | ||
103 | /* here would be the correct place for 'system("/system/bin/muteopen");' (headphone-out relay) but in pcm-dx50.c, pcm_play_dma_start() | ||
104 | the output capacitors are charged already a bit and the click of the headphone-connection-relay is softer */ | ||
105 | |||
106 | #if defined(DX90) | ||
107 | /* DAC needs to be unmuted on DX90 */ | ||
108 | FILE * f = fopen("/sys/class/codec/wm8740_mute", "w"); | ||
109 | fputc(0, f); | ||
110 | fclose(f); | ||
111 | #endif /* DX90 */ | ||
112 | |||
113 | #else | ||
114 | /* no better place yet */ | 66 | /* no better place yet */ |
115 | telephony_init_device(); | 67 | telephony_init_device(); |
116 | #endif /* DX50 || DX90 */ | ||
117 | } | 68 | } |
118 | 69 | ||
119 | int hostfs_init(void) | 70 | int hostfs_init(void) |
@@ -128,7 +79,6 @@ int hostfs_flush(void) | |||
128 | return 0; | 79 | return 0; |
129 | } | 80 | } |
130 | 81 | ||
131 | #if !defined(DX50) && !defined(DX90) | ||
132 | JNIEXPORT jint JNICALL | 82 | JNIEXPORT jint JNICALL |
133 | JNI_OnLoad(JavaVM *vm, void* reserved) | 83 | JNI_OnLoad(JavaVM *vm, void* reserved) |
134 | { | 84 | { |
@@ -169,7 +119,7 @@ Java_org_rockbox_RockboxService_main(JNIEnv *env, jobject this) | |||
169 | /* simply return here. this will allow the VM to clean up objects and do | 119 | /* simply return here. this will allow the VM to clean up objects and do |
170 | * garbage collection */ | 120 | * garbage collection */ |
171 | } | 121 | } |
172 | #endif /* !DX50 && !DX90 */ | 122 | |
173 | 123 | ||
174 | /* below is the facility for external (from other java threads) to safely call | 124 | /* below is the facility for external (from other java threads) to safely call |
175 | * into our snative code. When extracting rockbox.zip the main function is | 125 | * into our snative code. When extracting rockbox.zip the main function is |