summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/system-android.c
diff options
context:
space:
mode:
authorUdo Schläpfer <rockbox-2014.10@desktopwarrior.net>2015-02-02 21:44:29 +0100
committerUdo Schläpfer <rockbox-2014.10@desktopwarrior.net>2015-02-02 21:57:55 +0100
commitdbabd0d9c34a33bc0c51243ec37f230d117db955 (patch)
tree46de348929ce739702a230a2587fdb5539585753 /firmware/target/hosted/android/system-android.c
parentcef17e3d59ad93f766e8ee23b1610540a33dfe5e (diff)
downloadrockbox-dbabd0d9c34a33bc0c51243ec37f230d117db955.zip
rockbox-dbabd0d9c34a33bc0c51243ec37f230d117db955.tar.gz
rockbox-dbabd0d9c34a33bc0c51243ec37f230d117db955.tar.bz2
rockbox-dbabd0d9c34a33bc0c51243ec37f230d117db955.tar.xz
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.c54
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 6279504..d13b8d6 100644
--- a/firmware/target/hosted/android/system-android.c
+++ b/firmware/target/hosted/android/system-android.c
@@ -23,12 +23,6 @@
#include <setjmp.h>
#include <jni.h>
#include <pthread.h>
-#if defined(DX50) || defined(DX90)
-#include <stdlib.h>
-#include <sys/reboot.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#endif /* DX50 || DX90 */
#include <unistd.h>
#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