From dbabd0d9c34a33bc0c51243ec37f230d117db955 Mon Sep 17 00:00:00 2001 From: Udo Schläpfer Date: Mon, 2 Feb 2015 21:44:29 +0100 Subject: 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 --- firmware/target/hosted/android/system-android.c | 54 +------------------------ 1 file changed, 2 insertions(+), 52 deletions(-) (limited to 'firmware/target/hosted/android/system-android.c') 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 @@ #include #include #include -#if defined(DX50) || defined(DX90) -#include -#include -#include -#include -#endif /* DX50 || DX90 */ #include #include "config.h" #include "system.h" @@ -37,83 +31,40 @@ -#if !defined(DX50) && !defined(DX90) /* global fields for use with various JNI calls */ static JavaVM *vm_ptr; JNIEnv *env_ptr; jobject RockboxService_instance; jclass RockboxService_class; -#endif /* !DX50 && !DX90 */ uintptr_t *stackbegin; uintptr_t *stackend; extern int main(void); -#if !defined(DX50) && !defined(DX90) extern void telephony_init_device(void); -#endif + void system_exception_wait(void) { -#if defined(DX50) || defined(DX90) - while(1); -#else intptr_t dummy = 0; while(button_read_device(&dummy) != BUTTON_BACK); -#endif /* DX50 || DX90 */ } void system_reboot(void) { -#if defined(DX50) || defined(DX90) - reboot(RB_AUTOBOOT); -#else power_off(); -#endif /* DX50 || DX90 */ } -#if !defined(DX50) && !defined(DX90) /* this is used to return from the entry point of the native library. */ static jmp_buf poweroff_buf; -#endif - void power_off(void) { -#if defined(DX50) || defined(DX90) - reboot(RB_POWER_OFF); -#else longjmp(poweroff_buf, 1); -#endif /* DX50 || DX90 */ } void system_init(void) { -#if defined(DX50) || defined(DX90) - volatile uintptr_t stack = 0; - stackbegin = stackend = (uintptr_t*) &stack; - - struct stat m1, m2; - stat("/mnt/", &m1); - do - { - /* waiting for storage to get mounted */ - stat("/sdcard/", &m2); - usleep(100000); - } - while(m1.st_dev == m2.st_dev); -/* here would be the correct place for 'system("/system/bin/muteopen");' (headphone-out relay) but in pcm-dx50.c, pcm_play_dma_start() - the output capacitors are charged already a bit and the click of the headphone-connection-relay is softer */ - -#if defined(DX90) - /* DAC needs to be unmuted on DX90 */ - FILE * f = fopen("/sys/class/codec/wm8740_mute", "w"); - fputc(0, f); - fclose(f); -#endif /* DX90 */ - -#else /* no better place yet */ telephony_init_device(); -#endif /* DX50 || DX90 */ } int hostfs_init(void) @@ -128,7 +79,6 @@ int hostfs_flush(void) return 0; } -#if !defined(DX50) && !defined(DX90) JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void* reserved) { @@ -169,7 +119,7 @@ Java_org_rockbox_RockboxService_main(JNIEnv *env, jobject this) /* simply return here. this will allow the VM to clean up objects and do * garbage collection */ } -#endif /* !DX50 && !DX90 */ + /* below is the facility for external (from other java threads) to safely call * into our snative code. When extracting rockbox.zip the main function is -- cgit v1.2.3