diff options
author | Udo Schläpfer <rockbox-2014.10@desktopwarrior.net> | 2015-02-02 21:44:29 +0100 |
---|---|---|
committer | Udo Schläpfer <rockbox-2014.10@desktopwarrior.net> | 2015-02-02 21:57:55 +0100 |
commit | dbabd0d9c34a33bc0c51243ec37f230d117db955 (patch) | |
tree | 46de348929ce739702a230a2587fdb5539585753 /firmware/target/hosted/android/system-android.c | |
parent | cef17e3d59ad93f766e8ee23b1610540a33dfe5e (diff) | |
download | rockbox-dbabd0d9c34a33bc0c51243ec37f230d117db955.tar.gz rockbox-dbabd0d9c34a33bc0c51243ec37f230d117db955.zip |
iBasso DX50/DX90: Major code cleanup and reorganization.
Reorganization
- Separated iBasso devices from PLATFORM_ANDROID. These are now standlone
hosted targets. Most device specific code is in the
firmware/target/hosted/ibasso directory.
- No dependency on Android SDK, only the Android NDK is needed.
32 bit Android NDK and Android API Level 16.
- Separate implementation for each device where feasible.
Code cleanup
- Rewrite of existing code, from simple reformat to complete reimplementation.
- New backlight interface, seperating backlight from touchscreen.
- Rewrite of device button handler, removing unneeded code and fixing memory
leaks.
- New Debug messages interface logging to Android adb logcat (DEBUGF, panicf,
logf).
- Rewrite of lcd device handler, removing unneeded code and fixing memory leaks.
- Rewrite of audiohw device handler/pcm interface, removing unneeded code and
fixing memory leaks, enabling 44.1/48kHz pthreaded playback.
- Rewrite of power and powermng, proper shutdown, using batterylog results
(see http://gerrit.rockbox.org/r/#/c/1047/).
- Rewrite of configure (Android NDK) and device specific config.
- Rewrite of the Android NDK specific Makefile.
Misc
- All plugins/games/demos activated.
- Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa.
Includes
- http://gerrit.rockbox.org/r/#/c/993/
- http://gerrit.rockbox.org/r/#/c/1010/
- http://gerrit.rockbox.org/r/#/c/1035/
Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight
interface and new option for hold switch, touchscreen, physical button
interaction.
Rockbox needs the iBasso DX50/DX90 loader for startup, see
http://gerrit.rockbox.org/r/#/c/1099/
The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If
/mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit
gracefully and the loader will restart Rockbox on USB disconnect.
Tested on iBasso DX50.
Compiled (not tested) for iBasso DX90.
Compiled (not tested) for PLATFORM_ANDROID.
Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
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 |