summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/system-android.c
diff options
context:
space:
mode:
authorSimon Rothen <rothen@gmx.net>2014-08-30 13:15:53 +0200
committerMichael Giacomelli <giac2000@hotmail.com>2014-09-18 18:19:01 +0200
commit0b5ad60c26f30dc5363c21e436b73292c09ac567 (patch)
tree2d7cee2b2133218d59e0f462c9dbdbec8e88b2e2 /firmware/target/hosted/android/system-android.c
parent1f0fa0546647a191c52784a4a225982ffbd1af11 (diff)
downloadrockbox-0b5ad60c26f30dc5363c21e436b73292c09ac567.tar.gz
rockbox-0b5ad60c26f30dc5363c21e436b73292c09ac567.zip
Introducing Targets iBasso DX50 & iBasso DX90
The port to for this two targets has been entirely developped by Ilia Sergachev (alias Il or xzcc). His source can be found at https://bitbucket.org/isergachev/rockbox . The few necesary modifications for the DX90 port was done by headwhacker form head-fi.org. Unfortunately i could not try out the final state of the DX90 port. The port is hosted on android (without java) as standalone app. The official Firmware is required to run this port. Ilia did modify the source files for the "android" target in the rockbox source to make the DX port work. The work I did was to separate the code for DX50 (&DX90) from the android target. On this Target Ilia used source from tinyalsa from AOSP. I did not touch that part of the code because I do not understand it. What else I changed from Ilias sources besides the separation from the target "android": * removed a dirty hack to keep backlight off * changed value battery meter to voltage battery meter * made all plugins compile (named target as "standalone") and added keymaps * i added the graphics for the manual but did not do anything else for the manual yet * minor optimizations known bugs: * timers are slowed donw when playback is active (tinyalsa related?) * some minor bugs Things to do: * The main prolem will be how to install the app correctly. A guy called DOC2008 added a CWM (by androtab.info) to the official firmware and Ilia made a CWM installation script and a dualboot selector (rbutils/ibassoboot, build with ndk-build). We will have to find a way to install rockbox in a proper way without breaking any copyrights. Maybe ADB is an option but it is not enable with OF by default. Patching the OF is probably the way to go. * All the wiki and manual to build: needed: android ndk installed, android sdk installed with additional build-tools 19.1.0 installed ./tools/configure select iBasso DX50 or iBasso DX90 make -j apk the content of rockbox.zip/.rockbox needs to be copied to /system/rockbox/app_rockbox/rockbox/ (rockbox app not needed) the content of libs/armeabi to /system/rockbox/lib/ (rockbox app needed) The boot selector is needed as /system/bin/MangoPlayer and the iBasso app as /system/bin/MangoPlayer_original. There is also the "vold" file. The one from OF does not work with DX50 rockbox (DX90 works!?), the one from Ilia is necessary. Until we have found a proper way to install it, it can only be installed following the instructions of Ilia on his bitbucket page, using the CWM-OF and his installation script package. Change-Id: Ic4faaf84824c162aabcc08e492cee6e0068719d0 Reviewed-on: http://gerrit.rockbox.org/941 Tested: Chiwen Chang <rock1104.tw@yahoo.com.tw> Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
Diffstat (limited to 'firmware/target/hosted/android/system-android.c')
-rw-r--r--firmware/target/hosted/android/system-android.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/firmware/target/hosted/android/system-android.c b/firmware/target/hosted/android/system-android.c
index d13b8d6462..6279504e48 100644
--- a/firmware/target/hosted/android/system-android.c
+++ b/firmware/target/hosted/android/system-android.c
@@ -23,6 +23,12 @@
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 */
26#include <unistd.h> 32#include <unistd.h>
27#include "config.h" 33#include "config.h"
28#include "system.h" 34#include "system.h"
@@ -31,40 +37,83 @@
31 37
32 38
33 39
40#if !defined(DX50) && !defined(DX90)
34/* global fields for use with various JNI calls */ 41/* global fields for use with various JNI calls */
35static JavaVM *vm_ptr; 42static JavaVM *vm_ptr;
36JNIEnv *env_ptr; 43JNIEnv *env_ptr;
37jobject RockboxService_instance; 44jobject RockboxService_instance;
38jclass RockboxService_class; 45jclass RockboxService_class;
46#endif /* !DX50 && !DX90 */
39 47
40uintptr_t *stackbegin; 48uintptr_t *stackbegin;
41uintptr_t *stackend; 49uintptr_t *stackend;
42 50
43extern int main(void); 51extern int main(void);
52#if !defined(DX50) && !defined(DX90)
44extern void telephony_init_device(void); 53extern void telephony_init_device(void);
45 54#endif
46void system_exception_wait(void) 55void system_exception_wait(void)
47{ 56{
57#if defined(DX50) || defined(DX90)
58 while(1);
59#else
48 intptr_t dummy = 0; 60 intptr_t dummy = 0;
49 while(button_read_device(&dummy) != BUTTON_BACK); 61 while(button_read_device(&dummy) != BUTTON_BACK);
62#endif /* DX50 || DX90 */
50} 63}
51 64
52void system_reboot(void) 65void system_reboot(void)
53{ 66{
67#if defined(DX50) || defined(DX90)
68 reboot(RB_AUTOBOOT);
69#else
54 power_off(); 70 power_off();
71#endif /* DX50 || DX90 */
55} 72}
56 73
74#if !defined(DX50) && !defined(DX90)
57/* this is used to return from the entry point of the native library. */ 75/* this is used to return from the entry point of the native library. */
58static jmp_buf poweroff_buf; 76static jmp_buf poweroff_buf;
77#endif
78
59void power_off(void) 79void power_off(void)
60{ 80{
81#if defined(DX50) || defined(DX90)
82 reboot(RB_POWER_OFF);
83#else
61 longjmp(poweroff_buf, 1); 84 longjmp(poweroff_buf, 1);
85#endif /* DX50 || DX90 */
62} 86}
63 87
64void system_init(void) 88void system_init(void)
65{ 89{
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
66 /* no better place yet */ 114 /* no better place yet */
67 telephony_init_device(); 115 telephony_init_device();
116#endif /* DX50 || DX90 */
68} 117}
69 118
70int hostfs_init(void) 119int hostfs_init(void)
@@ -79,6 +128,7 @@ int hostfs_flush(void)
79 return 0; 128 return 0;
80} 129}
81 130
131#if !defined(DX50) && !defined(DX90)
82JNIEXPORT jint JNICALL 132JNIEXPORT jint JNICALL
83JNI_OnLoad(JavaVM *vm, void* reserved) 133JNI_OnLoad(JavaVM *vm, void* reserved)
84{ 134{
@@ -119,7 +169,7 @@ Java_org_rockbox_RockboxService_main(JNIEnv *env, jobject this)
119 /* simply return here. this will allow the VM to clean up objects and do 169 /* simply return here. this will allow the VM to clean up objects and do
120 * garbage collection */ 170 * garbage collection */
121} 171}
122 172#endif /* !DX50 && !DX90 */
123 173
124/* below is the facility for external (from other java threads) to safely call 174/* below is the facility for external (from other java threads) to safely call
125 * into our snative code. When extracting rockbox.zip the main function is 175 * into our snative code. When extracting rockbox.zip the main function is