A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Rockbox as an application: Commit current Android port progress.

General state is: Rockbox is usable (plays music, saves configuration, touchscreen works too).
Problems:
- Playing music in the background (i.e. when switching to another app) doesn't work reliably, but I'm working on that now.
- no cabbiev2 (only some preliminary files for it), no other default theme.
- screen flickers sometimes if the updates are too frequent
- no multi screen apk/package
- strange behavior when a phone call comes in

The java files (and the eclipse project) resides in android/, which is also supposed to be the build folder.
I've put a small README in there for instructions. There are some steps needed after the make part, which are described there,
and which eclipse mostly handles. But there ought to be some script/makefile rules which do that instead in the future.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27668 a1c6a512-1295-4272-9138-f99709370657

+2103 -68
+7
android/.classpath
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <classpath> 3 + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> 4 + <classpathentry kind="src" path="src"/> 5 + <classpathentry kind="src" path="gen"/> 6 + <classpathentry kind="output" path="bin"/> 7 + </classpath>
+33
android/.project
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <projectDescription> 3 + <name>Rockbox</name> 4 + <comment></comment> 5 + <projects> 6 + </projects> 7 + <buildSpec> 8 + <buildCommand> 9 + <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> 10 + <arguments> 11 + </arguments> 12 + </buildCommand> 13 + <buildCommand> 14 + <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> 15 + <arguments> 16 + </arguments> 17 + </buildCommand> 18 + <buildCommand> 19 + <name>org.eclipse.jdt.core.javabuilder</name> 20 + <arguments> 21 + </arguments> 22 + </buildCommand> 23 + <buildCommand> 24 + <name>com.android.ide.eclipse.adt.ApkBuilder</name> 25 + <arguments> 26 + </arguments> 27 + </buildCommand> 28 + </buildSpec> 29 + <natures> 30 + <nature>com.android.ide.eclipse.adt.AndroidNature</nature> 31 + <nature>org.eclipse.jdt.core.javanature</nature> 32 + </natures> 33 + </projectDescription>
+18
android/AndroidManifest.xml
··· 1 + <?xml version="1.0" encoding="utf-8"?> 2 + <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 + package="org.rockbox" 4 + android:versionCode="1" 5 + android:versionName="1.0"> 6 + <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> 7 + <activity android:name=".RockboxActivity" 8 + android:label="@string/app_name"> 9 + <intent-filter> 10 + <action android:name="android.intent.action.MAIN" /> 11 + <category android:name="android.intent.category.LAUNCHER" /> 12 + </intent-filter> 13 + </activity> 14 + 15 + </application> 16 + <uses-sdk android:minSdkVersion="4" /> 17 + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> 18 + </manifest>
+34
android/README
··· 1 + This folder contains the java parts needed to build an Rockbox as an 2 + application for android. 3 + 4 + * Build instructions 5 + 6 + Until there's a script which does all the work the procedure is documented here. 7 + 8 + First, make sure you have the ANDROID_NDK_PATH environment variable set up, 9 + otherwise configure will fail to find the compiler. 10 + 11 + Use this as your build folder, using '../tools/configure' etc. 12 + $ ../tools/configure 13 + $ make 14 + 15 + After the build finished, you need to copy librockbox.so to libs/armeabi/. 16 + $ cp librockbox.so libs/armeabi 17 + 18 + For the other files (codecs, themes), you execute 'make zip'. Then you copy the 19 + zip to libs/armeabi, using the name libmisc.so. This is needed, since there's no 20 + way to bundle stuff into apk's and have access to them from native code other 21 + than pretending it was a library. 22 + $ make zip 23 + $ cp rockbox.zip lib/armeabi/libmisc.so 24 + 25 + rockbox.zip..err, libmisc.so will be unpacked at runtime. 26 + 27 + To finish, you can follow this guide [1], or use eclipse. Simply install eclipse 28 + and the android plugins, then import this folder as a new Android project and run it. 29 + See [2] for a guide on how to set up eclipse for android development. 30 + 31 + 32 + 33 + [1]: http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/ 34 + [2]: http://developer.android.com/sdk/installing.html
+11
android/default.properties
··· 1 + # This file is automatically generated by Android Tools. 2 + # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 + # 4 + # This file must be checked in Version Control Systems. 5 + # 6 + # To customize properties used by the Ant build system use, 7 + # "build.properties", and override values to adapt the script to your 8 + # project structure. 9 + 10 + # Project target. 11 + target=android-4
+22
android/gen/org/rockbox/R.java
··· 1 + /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 + * 3 + * This class was automatically generated by the 4 + * aapt tool from the resource data it found. It 5 + * should not be modified by hand. 6 + */ 7 + 8 + package org.rockbox; 9 + 10 + public final class R { 11 + public static final class attr { 12 + } 13 + public static final class drawable { 14 + public static final int icon=0x7f020000; 15 + } 16 + public static final class layout { 17 + public static final int main=0x7f030000; 18 + } 19 + public static final class string { 20 + public static final int app_name=0x7f040000; 21 + } 22 + }
android/res/drawable-hdpi/icon.png

This is a binary file and will not be displayed.

android/res/drawable-ldpi/icon.png

This is a binary file and will not be displayed.

android/res/drawable-mdpi/icon.png

This is a binary file and will not be displayed.

+7
android/res/layout/main.xml
··· 1 + <?xml version="1.0" encoding="utf-8"?> 2 + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 + android:orientation="vertical" 4 + android:layout_width="fill_parent" 5 + android:layout_height="fill_parent" 6 + > 7 + </LinearLayout>
+5
android/res/values/strings.xml
··· 1 + <?xml version="1.0" encoding="utf-8"?> 2 + <resources> 3 + 4 + <string name="app_name">Rockbox</string> 5 + </resources>
+148
android/src/org/rockbox/RockboxActivity.java
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + package org.rockbox; 23 + 24 + import java.io.BufferedInputStream; 25 + import java.io.BufferedOutputStream; 26 + import java.io.File; 27 + import java.io.FileOutputStream; 28 + import java.util.Enumeration; 29 + import java.util.zip.ZipEntry; 30 + import java.util.zip.ZipFile; 31 + 32 + import android.app.Activity; 33 + import android.graphics.Rect; 34 + import android.os.Bundle; 35 + import android.util.Log; 36 + import android.view.Window; 37 + import android.view.WindowManager; 38 + 39 + public class RockboxActivity extends Activity { 40 + /** Called when the activity is first created. */ 41 + public RockboxFramebuffer fb; 42 + private Thread rb; 43 + static final int BUFFER = 2048; 44 + /** Called when the activity is first created. */ 45 + @Override 46 + public void onCreate(Bundle savedInstanceState) { 47 + super.onCreate(savedInstanceState); 48 + LOG("start rb"); 49 + requestWindowFeature(Window.FEATURE_NO_TITLE); 50 + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN 51 + ,WindowManager.LayoutParams.FLAG_FULLSCREEN); 52 + fb = new RockboxFramebuffer(this); 53 + if (true) { 54 + try 55 + { 56 + BufferedOutputStream dest = null; 57 + BufferedInputStream is = null; 58 + ZipEntry entry; 59 + File file = new File("/data/data/org.rockbox/lib/libmisc.so"); 60 + /* use arbitary file to determine whether extracting is needed */ 61 + File file2 = new File("/data/data/org.rockbox/app_rockbox/rockbox/codecs/mpa.codec"); 62 + if (!file2.exists() || (file.lastModified() > file2.lastModified())) 63 + { 64 + ZipFile zipfile = new ZipFile(file); 65 + Enumeration<? extends ZipEntry> e = zipfile.entries(); 66 + File folder; 67 + while(e.hasMoreElements()) { 68 + entry = (ZipEntry) e.nextElement(); 69 + LOG("Extracting: " +entry); 70 + if (entry.isDirectory()) 71 + { 72 + folder = new File(entry.getName()); 73 + LOG("mkdir "+ entry); 74 + try { 75 + folder.mkdirs(); 76 + } catch (SecurityException ex){ 77 + LOG(ex.getMessage()); 78 + } 79 + continue; 80 + } 81 + is = new BufferedInputStream(zipfile.getInputStream(entry)); 82 + int count; 83 + byte data[] = new byte[BUFFER]; 84 + folder = new File(new File(entry.getName()).getParent()); 85 + LOG("" + folder.getAbsolutePath()); 86 + if (!folder.exists()) 87 + folder.mkdirs(); 88 + FileOutputStream fos = new FileOutputStream(entry.getName()); 89 + dest = new BufferedOutputStream(fos, BUFFER); 90 + while ((count = is.read(data, 0, BUFFER)) != -1) { 91 + dest.write(data, 0, count); 92 + } 93 + dest.flush(); 94 + dest.close(); 95 + is.close(); 96 + } 97 + } 98 + } catch(Exception e) { 99 + e.printStackTrace(); 100 + }} 101 + Rect r = new Rect(); 102 + fb.getDrawingRect(r); 103 + LOG(r.left + " " + r.top + " " + r.right + " " + r.bottom); 104 + rb = new Thread(new Runnable() 105 + { 106 + public void run() 107 + { 108 + main(); 109 + } 110 + },"Rockbox thread"); 111 + System.loadLibrary("rockbox"); 112 + rb.setDaemon(false); 113 + setContentView(fb); 114 + } 115 + 116 + private void LOG(CharSequence text) 117 + { 118 + Log.d("RockboxBootloader", (String) text); 119 + } 120 + 121 + public synchronized void onStart() 122 + { 123 + super.onStart(); 124 + if (!rb.isAlive()) 125 + rb.start(); 126 + } 127 + 128 + public void onPause() 129 + { 130 + super.onPause(); 131 + } 132 + 133 + public void onResume() 134 + { 135 + super.onResume(); 136 + switch (rb.getState()) { 137 + case BLOCKED: LOG("BLOCKED"); break; 138 + case RUNNABLE: LOG("RUNNABLE"); break; 139 + case NEW: LOG("NEW"); break; 140 + case TERMINATED: LOG("TERMINATED"); break; 141 + case TIMED_WAITING: LOG("TIMED_WAITING"); break; 142 + case WAITING: LOG("WAITING"); break; 143 + } 144 + } 145 + 146 + 147 + private native void main(); 148 + }
+98
android/src/org/rockbox/RockboxFramebuffer.java
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + package org.rockbox; 23 + 24 + import java.nio.ByteBuffer; 25 + import android.content.Context; 26 + import android.graphics.Bitmap; 27 + import android.graphics.Canvas; 28 + import android.os.Handler; 29 + import android.util.Log; 30 + import android.view.MotionEvent; 31 + import android.view.View; 32 + 33 + public class RockboxFramebuffer extends View 34 + { 35 + private Bitmap btm; 36 + private ByteBuffer native_buf; 37 + private Handler update_handler; 38 + private Runnable cb; 39 + 40 + 41 + public RockboxFramebuffer(Context c) 42 + { 43 + super(c); 44 + update_handler = new Handler(); 45 + cb = new Runnable() { 46 + public void run() 47 + { 48 + btm.copyPixelsFromBuffer(native_buf); 49 + invalidate(); 50 + } 51 + }; 52 + btm = null; 53 + } 54 + 55 + public void onDraw(Canvas c) 56 + { 57 + if (btm != null) 58 + c.drawBitmap(btm, 0.0f, 0.0f, null); 59 + } 60 + 61 + public void java_lcd_init(int lcd_width, int lcd_height, ByteBuffer native_fb) 62 + { 63 + btm = Bitmap.createBitmap(lcd_width, lcd_height, Bitmap.Config.RGB_565); 64 + native_buf = native_fb; 65 + } 66 + 67 + public void java_lcd_update() 68 + { 69 + update_handler.post(cb); 70 + } 71 + 72 + private void LOG(CharSequence text) 73 + { 74 + Log.d("RockboxBootloader", (String) text); 75 + } 76 + 77 + public boolean onTouchEvent(MotionEvent me) 78 + { 79 + LOG("onTouchEvent"); 80 + switch (me.getAction()) 81 + { 82 + case MotionEvent.ACTION_CANCEL: 83 + case MotionEvent.ACTION_UP: 84 + touchHandler(0); 85 + break; 86 + case MotionEvent.ACTION_MOVE: 87 + case MotionEvent.ACTION_DOWN: 88 + touchHandler(1); 89 + break; 90 + 91 + } 92 + pixelHandler((int)me.getX(), (int)me.getY()); 93 + return true; 94 + } 95 + 96 + public native void pixelHandler(int x, int y); 97 + public native void touchHandler(int down); 98 + }
+155
android/src/org/rockbox/RockboxPCM.java
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + package org.rockbox; 23 + 24 + import android.media.AudioFormat; 25 + import android.media.AudioManager; 26 + import android.media.AudioTrack; 27 + import android.util.Log; 28 + 29 + public class RockboxPCM extends AudioTrack 30 + { 31 + byte[] raw_data; 32 + 33 + private void LOG(CharSequence text) 34 + { 35 + Log.d("RockboxBootloader", (String) text); 36 + } 37 + 38 + public RockboxPCM() 39 + { 40 + super(AudioManager.STREAM_MUSIC, 41 + 44100, 42 + /* should be CHANNEL_OUT_STEREO in 2.0 and above */ 43 + AudioFormat.CHANNEL_CONFIGURATION_STEREO, 44 + AudioFormat.ENCODING_PCM_16BIT, 45 + 24<<10, 46 + AudioTrack.MODE_STREAM); 47 + int buf_len = 24<<10; 48 + 49 + raw_data = new byte[buf_len*2]; 50 + for(int i = 0; i < raw_data.length; i++) raw_data[i] = (byte) 0x00; 51 + /* fill with silence */ 52 + write(raw_data, 0, raw_data.length); 53 + if (getState() == AudioTrack.STATE_INITIALIZED) 54 + { 55 + if (setNotificationMarkerPosition(bytes2frames(buf_len*2)/4) != AudioTrack.SUCCESS) 56 + LOG("setNotificationMarkerPosition Error"); 57 + setPlaybackPositionUpdateListener(new PCMListener(buf_len*2)); 58 + } 59 + } 60 + 61 + 62 + 63 + int bytes2frames(int bytes) { 64 + /* 1 sample is 2 bytes, 2 samples are 1 frame */ 65 + return (bytes/4); 66 + } 67 + 68 + int frames2bytes(int frames) { 69 + /* 1 frame is 2 samples, 1 sample is 2 bytes */ 70 + return (frames*4); 71 + } 72 + 73 + @SuppressWarnings("unused") 74 + private void play_pause(boolean pause) { 75 + LOG("play_pause()"); 76 + if (pause) 77 + pause(); 78 + else 79 + { 80 + if (getPlayState() == AudioTrack.PLAYSTATE_STOPPED) 81 + { 82 + for(int i = 0; i < raw_data.length; i++) raw_data[i] = (byte) 0x00; 83 + LOG("Writing silence"); 84 + /* fill with silence */ 85 + write(raw_data, 0, raw_data.length); 86 + } 87 + play(); 88 + } 89 + LOG("play_pause() return"); 90 + } 91 + 92 + @SuppressWarnings("unused") 93 + private void set_volume(int volume) 94 + { 95 + /* volume comes from 0..-990 from Rockbox */ 96 + /* TODO volume is in dB, but this code acts as if it were in %, convert? */ 97 + float fvolume; 98 + /* special case min and max volume to not suffer from floating point accuracy */ 99 + if (volume == 0) 100 + fvolume = 1.0f; 101 + else if (volume == -990) 102 + fvolume = 0.0f; 103 + else 104 + fvolume = (volume + 990)/990.0f; 105 + setStereoVolume(fvolume, fvolume); 106 + } 107 + 108 + public native void pcmSamplesToByteArray(byte[] dest); 109 + 110 + private class PCMListener implements OnPlaybackPositionUpdateListener { 111 + int max_len; 112 + byte[] buf; 113 + public PCMListener(int len) { 114 + max_len = len; 115 + buf = new byte[len/2]; 116 + } 117 + @Override 118 + public void onMarkerReached(AudioTrack track) { 119 + // push new data to the hardware 120 + int result = 1; 121 + pcmSamplesToByteArray(buf); 122 + //LOG("Trying to write " + buf.length + " bytes"); 123 + result = track.write(buf, 0, buf.length); 124 + if (result > 0) 125 + { 126 + //LOG(result + " bytes written"); 127 + track.setPlaybackPositionUpdateListener(this); 128 + track.setNotificationMarkerPosition(bytes2frames(max_len)/4); 129 + switch(track.getPlayState()) 130 + { 131 + case AudioTrack.PLAYSTATE_PLAYING: 132 + //LOG("State PLAYING"); 133 + break; 134 + case AudioTrack.PLAYSTATE_PAUSED: 135 + LOG("State PAUSED"); 136 + break; 137 + case AudioTrack.PLAYSTATE_STOPPED: 138 + LOG("State STOPPED"); 139 + break; 140 + } 141 + } 142 + else 143 + { 144 + LOG("Error in onMarkerReached"); 145 + track.stop(); 146 + } 147 + } 148 + 149 + @Override 150 + public void onPeriodicNotification(AudioTrack track) { 151 + // TODO Auto-generated method stub 152 + 153 + } 154 + } 155 + }
+93
android/src/org/rockbox/RockboxTimer.java
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + package org.rockbox; 23 + 24 + import java.util.Timer; 25 + import java.util.TimerTask; 26 + 27 + import android.util.Log; 28 + 29 + public class RockboxTimer extends Timer 30 + { 31 + RockboxTimerTask task; 32 + long interval; 33 + 34 + private class RockboxTimerTask extends TimerTask { 35 + private RockboxTimer t; 36 + public RockboxTimerTask(RockboxTimer parent) { 37 + super(); 38 + t = parent; 39 + } 40 + 41 + @Override 42 + public void run() { 43 + timerTask(); 44 + synchronized(t) { 45 + t.notify(); 46 + } 47 + } 48 + } 49 + 50 + public void pause() 51 + { 52 + cancel(); 53 + } 54 + public void resume() 55 + { 56 + try { 57 + schedule(task, 0, interval); 58 + } catch (IllegalStateException e) { 59 + /* not an error */ 60 + } catch (Exception e) { 61 + LOG(e.toString()); 62 + } 63 + } 64 + 65 + public RockboxTimer(long period_inverval_in_ms) 66 + { 67 + super("tick timer", false); 68 + task = new RockboxTimerTask(this); 69 + schedule(task, 0, period_inverval_in_ms); 70 + interval = period_inverval_in_ms; 71 + } 72 + 73 + private void LOG(CharSequence text) 74 + { 75 + Log.d("RockboxBootloader", (String) text); 76 + } 77 + 78 + 79 + /* methods called from native, keep them simple */ 80 + public void java_wait_for_interrupt() 81 + { 82 + synchronized(this) { 83 + try { 84 + this.wait(); 85 + } catch (InterruptedException e) { 86 + /* wakeup and return */ 87 + } catch (Exception e) { 88 + LOG(e.toString()); 89 + } 90 + } 91 + } 92 + public native void timerTask(); 93 + }
+4
apps/codecs/codec_crt0.c
··· 34 34 35 35 extern enum codec_status codec_main(void); 36 36 37 + /* stub, the entry point is called via its reference in __header to 38 + * avoid warning with certain compilers */ 39 + int _start(void) {return 0;} 40 + 37 41 enum codec_status codec_start(void) 38 42 { 39 43 #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
+2
apps/codecs/libwavpack/wavpack.h
··· 16 16 17 17 typedef unsigned char uchar; 18 18 typedef unsigned short ushort; 19 + #if 0 // unused and causing compiler errrors 19 20 typedef unsigned int uint; 21 + #endif 20 22 21 23 #include <stdio.h> 22 24
backdrops/cabbiev2.320x480x16.bmp

This is a binary file and will not be displayed.

+2 -1
bootloader/common.c
··· 68 68 #endif 69 69 } 70 70 71 - void printf(const char *format, ...) 71 + int printf(const char *format, ...) 72 72 { 73 73 int len; 74 74 unsigned char *ptr; ··· 91 91 if(remote_line >= LCD_REMOTE_HEIGHT/SYSFONT_HEIGHT) 92 92 remote_line = 0; 93 93 #endif 94 + return len; 94 95 } 95 96 96 97 char *strerror(int error)
+1 -1
bootloader/common.h
··· 41 41 42 42 /* Functions common to all bootloaders */ 43 43 void reset_screen(void); 44 - void printf(const char *format, ...); 44 + int printf(const char *format, ...); 45 45 char *strerror(int error); 46 46 void error(int errortype, int error, bool shutdown); 47 47 int load_firmware(unsigned char* buf, char* firmware, int buffer_size);
+11
firmware/SOURCES
··· 1698 1698 #endif /* BOOTLOADER */ 1699 1699 #endif /* SIMULATOR */ 1700 1700 #endif 1701 + 1702 + 1703 + #if (CONFIG_PLATFORM & PLATFORM_ANDROID) 1704 + target/hosted/android/lcd-android.c 1705 + target/hosted/android/button-android.c 1706 + target/hosted/android/kernel-android.c 1707 + target/hosted/android/pcm-android.c 1708 + target/hosted/android/system-android.c 1709 + drivers/audio/android.c 1710 + thread.c 1711 + #endif
+8
firmware/common/rbpaths.c
··· 33 33 void paths_init(void) 34 34 { 35 35 /* make sure $HOME/.config/rockbox.org exists, it's needed for config.cfg */ 36 + #if (CONFIG_PLATFORM & PLATFORM_ANDROID) 37 + mkdir("/sdcard/rockbox"); 38 + #else 36 39 char home_path[MAX_PATH]; 37 40 snprintf(home_path, sizeof(home_path), "%s/.config/rockbox.org", getenv("HOME")); 38 41 mkdir(home_path); 42 + #endif 39 43 } 40 44 41 45 const char* get_user_file_path(const char *path, ··· 50 54 pos += ROCKBOX_DIR_LEN; 51 55 if (*pos == '/') pos += 1; 52 56 57 + #if (CONFIG_PLATFORM & PLATFORM_ANDROID) 58 + if (snprintf(buf, bufsize, "/sdcard/rockbox/%s", pos) 59 + #else 53 60 if (snprintf(buf, bufsize, "%s/.config/rockbox.org/%s", getenv("HOME"), pos) 61 + #endif 54 62 >= (int)bufsize) 55 63 return NULL; 56 64
+61
firmware/drivers/audio/android.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright © 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + 23 + #include "config.h" 24 + #include "audiohw.h" 25 + 26 + const struct sound_settings_info audiohw_settings[] = { 27 + [SOUND_VOLUME] = {"dB", 0, 1, VOLUME_MIN / 10, VOLUME_MAX / 10, -25}, 28 + /* Bass and treble tone controls */ 29 + #ifdef AUDIOHW_HAVE_BASS 30 + [SOUND_BASS] = {"dB", 0, 1, -24, 24, 0}, 31 + #endif 32 + #ifdef AUDIOHW_HAVE_TREBLE 33 + [SOUND_TREBLE] = {"dB", 0, 1, -24, 24, 0}, 34 + #endif 35 + [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 36 + [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 37 + [SOUND_STEREO_WIDTH] = {"%", 0, 5, 0, 250, 100}, 38 + #if defined(HAVE_RECORDING) 39 + [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0}, 40 + [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0}, 41 + [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16}, 42 + #endif 43 + #if defined(AUDIOHW_HAVE_BASS_CUTOFF) 44 + [SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1}, 45 + #endif 46 + #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF) 47 + [SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1}, 48 + #endif 49 + }; 50 + 51 + 52 + void audiohw_set_volume(int volume) 53 + { 54 + extern void pcm_set_mixer_volume(int); 55 + pcm_set_mixer_volume(volume); 56 + } 57 + 58 + void audiohw_set_balance(int balance) 59 + { 60 + (void)balance; 61 + }
+1 -1
firmware/export/audiohw.h
··· 66 66 #elif defined(HAVE_AK4537) 67 67 #include "ak4537.h" 68 68 #endif 69 - #if defined(HAVE_SDL_AUDIO) 69 + #if (CONFIG_PLATFORM & PLATFORM_HOSTED) 70 70 /* #include <SDL_audio.h> gives errors in other code areas, 71 71 * we don't really need it here, so don't. but it should maybe be fixed */ 72 72 #ifndef SIMULATOR /* simulator gets values from the target .h files */
+12 -2
firmware/export/config.h
··· 78 78 * bit fields to allow PLATFORM_HOSTED to be OR'ed e.g. with a 79 79 * possible future PLATFORM_ANDROID (some OSes might need totally different 80 80 * handling to run on them than a stand-alone application) */ 81 - #define PLATFORM_NATIVE (1<<0) 82 - #define PLATFORM_HOSTED (1<<1) 81 + #define PLATFORM_NATIVE (1<<0) 82 + #define PLATFORM_HOSTED (1<<1) 83 + #define PLATFORM_ANDROID (1<<2) 84 + #define PLATFORM_SDL (1<<3) 83 85 84 86 /* CONFIG_KEYPAD */ 85 87 #define PLAYER_PAD 1 ··· 427 429 428 430 #elif defined(APPLICATION) 429 431 #include "config/application.h" 432 + #define CONFIG_CPU 0 433 + #define CONFIG_STORAGE 0 430 434 #else 431 435 /* no known platform */ 432 436 #endif ··· 689 693 #define HAVE_EXTENDED_MESSAGING_AND_NAME 690 694 #define HAVE_WAKEUP_EXT_CB 691 695 696 + 697 + #if (CONFIG_PLATFORM & PLATFORM_ANDROID) 698 + #define HAVE_PRIORITY_SCHEDULING 699 + #endif 700 + 692 701 #if (CONFIG_PLATFORM & PLATFORM_NATIVE) 693 702 #define HAVE_PRIORITY_SCHEDULING 694 703 #define HAVE_SCHEDULER_BOOSTCTRL 695 704 #endif /* PLATFORM_NATIVE */ 705 + 696 706 697 707 #define HAVE_SEMAPHORE_OBJECTS 698 708
+20 -8
firmware/export/config/application.h
··· 4 4 #define TARGET_TREE /* this target is using the target tree system */ 5 5 6 6 /* We don't run on hardware directly */ 7 - #define CONFIG_PLATFORM PLATFORM_HOSTED 7 + #ifdef ANDROID 8 + #define CONFIG_PLATFORM (PLATFORM_HOSTED|PLATFORM_ANDROID) 9 + #else 10 + #define CONFIG_PLATFORM (PLATFORM_HOSTED|PLATFORM_SDL) 11 + #endif 8 12 /* For Rolo and boot loader */ 9 - /* 10 - #define MODEL_NUMBER 24 11 - */ 13 + #define MODEL_NUMBER 100 12 14 13 15 #define MODEL_NAME "Rockbox" 14 16 ··· 37 39 /* define this if you would like tagcache to build on this target */ 38 40 #define HAVE_TAGCACHE 39 41 40 - /* LCD dimensions */ 42 + /* LCD dimensions 43 + * 44 + * overriden by configure for application builds */ 45 + #ifndef LCD_WIDTH 41 46 #define LCD_WIDTH 320 42 - #define LCD_HEIGHT 240 47 + #endif 48 + 49 + #ifndef LCD_HEIGHT 50 + #define LCD_HEIGHT 480 51 + #endif 52 + 43 53 #define LCD_DEPTH 16 44 54 #define LCD_PIXELFORMAT 565 45 55 ··· 62 72 #define CONFIG_CODEC SWCODEC 63 73 64 74 #define CONFIG_KEYPAD COWON_D2_PAD 75 + 76 + #if (CONFIG_PLATFORM & PLATFORM_SDL) 65 77 /* Use SDL audio/pcm in a SDL app build */ 66 78 #define HAVE_SDL 67 - 68 - #ifdef HAVE_SDL 69 79 #define HAVE_SDL_AUDIO 70 80 #endif 71 81 ··· 92 102 93 103 /* Define this if a programmable hotkey is mapped */ 94 104 //#define HAVE_HOTKEY 105 + 106 + #define BOOTDIR "/.rockbox"
+2 -1
firmware/export/config/sim.h
··· 99 99 #define DEFAULT_BRIGHTNESS_SETTING MAX_BRIGHTNESS_SETTING 100 100 #endif 101 101 102 + #define CONFIG_PLATFORM (PLATFORM_HOSTED|PLATFORM_SDL) 102 103 #define HAVE_SDL 103 104 #define HAVE_SDL_AUDIO 104 - #define CONFIG_PLATFORM PLATFORM_HOSTED 105 + 105 106 #define _ISOC99_SOURCE 1
+6 -1
firmware/export/debug.h
··· 21 21 #ifndef DEBUG_H 22 22 #define DEBUG_H 23 23 24 + #include "config.h" 24 25 #include "gcc_extensions.h" 25 26 26 27 extern void debug_init(void); ··· 34 35 /* */ 35 36 #if defined(SIMULATOR) && !defined(__PCTOOL__) 36 37 #define DEBUGF debugf 37 - #define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__) 38 + #define LDEBUGF(...) ldebugf(__FILE__, __LINE__, __VA_ARGS__) && defined(DEBUG) 39 + #elif (CONFIG_PLATFORM & PLATFORM_ANDROID) 40 + #include "system-target.h" 41 + #define DEBUGF LOG 42 + #define LDEBUGF(...) 38 43 #else 39 44 #if defined(DEBUG) 40 45
+12 -2
firmware/export/thread.h
··· 79 79 80 80 #define MAXTHREADS (BASETHREADS+TARGET_EXTRA_THREADS) 81 81 82 + /* 83 + * We need more stack when we run under a host 84 + * maybe more expensive C lib functions? 85 + * 86 + * simulator doesn't simulate stack usage anyway but well ... */ 87 + #if ((CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SIMULATOR)) 82 88 #define DEFAULT_STACK_SIZE 0x400 /* Bytes */ 89 + #else 90 + #define DEFAULT_STACK_SIZE 0x1000 /* Bytes */ 91 + #endif 83 92 84 - #if (CONFIG_PLATFORM & PLATFORM_NATIVE) 93 + 94 + #if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_ANDROID)) 85 95 /* Need to keep structures inside the header file because debug_menu 86 96 * needs them. */ 87 97 #ifdef CPU_COLDFIRE ··· 101 111 uint32_t pr; /* 32 - Procedure register */ 102 112 uint32_t start; /* 36 - Thread start address, or NULL when started */ 103 113 }; 104 - #elif defined(CPU_ARM) 114 + #elif defined(CPU_ARM) || (CONFIG_PLATFORM & PLATFORM_ANDROID) 105 115 struct regs 106 116 { 107 117 uint32_t r[8]; /* 0-28 - Registers r4-r11 */
+1 -1
firmware/sound.c
··· 273 273 274 274 #elif defined(HAVE_TLV320) || defined(HAVE_WM8978) || defined(HAVE_WM8985) 275 275 audiohw_set_headphone_vol(tenthdb2master(l), tenthdb2master(r)); 276 - #elif defined(HAVE_JZ4740_CODEC) || defined(HAVE_SDL_AUDIO) 276 + #elif defined(HAVE_JZ4740_CODEC) || defined(HAVE_SDL_AUDIO) || defined(ANDROID) 277 277 audiohw_set_volume(current_volume); 278 278 #endif 279 279 #else /* HAVE_SDL_AUDIO */
+25
firmware/target/hosted/android/app/adc-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 by Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + #ifndef __ADC_TARGET_H__ 23 + #define __ADC_TARGET_H__ 24 + 25 + #endif /* __ADC_TARGET_H__ */
+25
firmware/target/hosted/android/app/backlight-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 by Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + #ifndef __BACKLIGHT_TARGET_H__ 23 + #define __BACKLIGHT_TARGET_H__ 24 + 25 + #endif /* __BACKLIGHT_TARGET_H__ */
+29
firmware/target/hosted/android/app/button-application.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ***************************************************9*************************/ 21 + 22 + 23 + #include "button.h" 24 + 25 + int key_to_button(int keyboard_key) 26 + { 27 + (void)keyboard_key; 28 + return BUTTON_NONE; 29 + }
+64
firmware/target/hosted/android/app/button-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2007 by Rob Purchase 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + #ifndef _BUTTON_TARGET_H_ 23 + #define _BUTTON_TARGET_H_ 24 + 25 + #include <stdbool.h> 26 + #include "config.h" 27 + 28 + #undef button_init_device 29 + void button_init_device(void); 30 + int button_read_device(int *data); 31 + 32 + /* Main unit's buttons */ 33 + #define BUTTON_POWER 0x00000001 34 + #define BUTTON_PLUS 0x00000002 35 + #define BUTTON_MINUS 0x00000004 36 + #define BUTTON_MENU 0x00000008 37 + 38 + /* Compatibility hacks for flipping. Needs a somewhat better fix. */ 39 + #define BUTTON_LEFT BUTTON_MIDLEFT 40 + #define BUTTON_RIGHT BUTTON_MIDRIGHT 41 + #define BUTTON_UP BUTTON_TOPMIDDLE 42 + #define BUTTON_DOWN BUTTON_BOTTOMMIDDLE 43 + 44 + /* Touch Screen Area Buttons */ 45 + #define BUTTON_TOPLEFT 0x00000010 46 + #define BUTTON_TOPMIDDLE 0x00000020 47 + #define BUTTON_TOPRIGHT 0x00000040 48 + #define BUTTON_MIDLEFT 0x00000080 49 + #define BUTTON_CENTER 0x00000100 50 + #define BUTTON_MIDRIGHT 0x00000200 51 + #define BUTTON_BOTTOMLEFT 0x00000400 52 + #define BUTTON_BOTTOMMIDDLE 0x00000800 53 + #define BUTTON_BOTTOMRIGHT 0x00001000 54 + 55 + #define BUTTON_MAIN 0x1FFF 56 + 57 + /* No remote */ 58 + #define BUTTON_REMOTE 0 59 + 60 + /* Software power-off */ 61 + #define POWEROFF_BUTTON BUTTON_POWER 62 + #define POWEROFF_COUNT 10 63 + 64 + #endif /* _BUTTON_TARGET_H_ */
+25
firmware/target/hosted/android/app/i2c-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 by Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + #ifndef __I2C_TARGET_H__ 23 + #define __I2C_TARGET_H__ 24 + 25 + #endif /* __I2C_TARGET_H__ */
+25
firmware/target/hosted/android/app/usb-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 by Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + #ifndef __USB_TARGET_H__ 23 + #define __USB_TARGET_H__ 24 + 25 + #endif /* __USB_TARGET_H__ */
+87
firmware/target/hosted/android/button-android.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (c) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + 23 + #include <jni.h> 24 + #include <stdbool.h> 25 + #include "config.h" 26 + #include "kernel.h" 27 + #include "system.h" 28 + #include "touchscreen.h" 29 + 30 + static long last_touch; 31 + static int last_y, last_x; 32 + 33 + static enum { 34 + STATE_UNKNOWN, 35 + STATE_UP, 36 + STATE_DOWN, 37 + } last_state = STATE_UNKNOWN; 38 + 39 + 40 + /* 41 + * this writes in an interrupt-like fashion the last pixel coordinates 42 + * that the user pressed on the screen */ 43 + JNIEXPORT void JNICALL 44 + Java_org_rockbox_RockboxFramebuffer_pixelHandler(JNIEnv*env, jobject this, 45 + int x, int y) 46 + { 47 + (void)env; 48 + (void)this; 49 + last_x = x; 50 + last_y = y; 51 + last_touch = current_tick; 52 + } 53 + 54 + /* 55 + * this notifies us in an interrupt-like fashion whether the user just 56 + * began or stopped the touch action */ 57 + JNIEXPORT void JNICALL 58 + Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv*env, jobject this, 59 + int down) 60 + { 61 + (void)env; 62 + (void)this; 63 + if (down) 64 + last_state = STATE_DOWN; 65 + else 66 + last_state = STATE_UP; 67 + } 68 + 69 + void button_init_device(void) 70 + { 71 + last_touch = current_tick; 72 + } 73 + 74 + int button_read_device(int *data) 75 + { 76 + /* get grid button/coordinates based on the current touchscreen mode */ 77 + int btn = touchscreen_to_pixels(last_x, last_y, data); 78 + if (last_state == STATE_DOWN) 79 + { 80 + return btn; 81 + } 82 + else 83 + { 84 + *data = last_x = last_y = 0; 85 + return 0; 86 + } 87 + }
+43
firmware/target/hosted/android/buttonmap.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 by Fred Bauer 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + #ifndef __BUTTONMAP_H__ 23 + #define __BUTTONMAP_H__ 24 + /* Button maps: simulated key, x, y, radius, name */ 25 + /* Run sim with --mapping to get coordinates */ 26 + /* or --debugbuttons to check */ 27 + /* The First matching button is returned */ 28 + struct button_map { 29 + int button, x, y, radius; 30 + char *description; 31 + }; 32 + 33 + extern struct button_map bm[]; 34 + 35 + int xy2button( int x, int y); 36 + 37 + /* for the sim, these function is implemented in uisimulator/buttonmap/ *.c */ 38 + int key_to_button(int keyboard_button); 39 + #ifdef HAVE_TOUCHSCREEN 40 + int key_to_touch(int keyboard_button, unsigned int mouse_coords); 41 + #endif 42 + 43 + #endif /* __BUTTONMAP_H__ */
+106
firmware/target/hosted/android/kernel-android.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (c) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + 23 + #include <jni.h> 24 + #include "config.h" 25 + #include "system.h" 26 + 27 + extern JNIEnv *env_ptr; 28 + extern jclass RockboxActivity_class; 29 + extern jobject RockboxActivity_instance; 30 + 31 + static jclass RockboxTimer_class; 32 + static jobject RockboxTimer_instance; 33 + static jmethodID java_wait_for_interrupt; 34 + static bool initialized = false; 35 + 36 + /* 37 + * This is called from the separate Timer java thread. I have not added any 38 + * interrupt simulation to it (like the sdl counterpart does), 39 + * I think this is probably not needed, unless code calls disable_interrupt() 40 + * in order to be protected from tick tasks, but I can't remember a place right 41 + * now. 42 + * 43 + * No synchronisation mechanism either. This could possibly be problematic, 44 + * but we'll see :) 45 + */ 46 + JNIEXPORT void JNICALL 47 + Java_org_rockbox_RockboxTimer_timerTask(JNIEnv *env, jobject this) 48 + { 49 + (void)env; 50 + (void)this; 51 + call_tick_tasks(); 52 + } 53 + 54 + void tick_start(unsigned int interval_in_ms) 55 + { 56 + JNIEnv e = *env_ptr; 57 + /* first, create a new Timer instance */ 58 + RockboxTimer_class = e->FindClass(env_ptr, "org/rockbox/RockboxTimer"); 59 + jmethodID constructor = e->GetMethodID(env_ptr, 60 + RockboxTimer_class, 61 + "<init>", 62 + "(J)V"); 63 + /* the constructor will do the tick_start */ 64 + RockboxTimer_instance = e->NewObject(env_ptr, 65 + RockboxTimer_class, 66 + constructor, 67 + (jlong)interval_in_ms); 68 + 69 + /* get our wfi func also */ 70 + java_wait_for_interrupt = e->GetMethodID(env_ptr, 71 + RockboxTimer_class, 72 + "java_wait_for_interrupt", 73 + "()V"); 74 + /* it's now safe to call java_wait_for_interrupt */ 75 + initialized = true; 76 + } 77 + 78 + void wait_for_interrupt(void) 79 + { 80 + if (LIKELY(initialized)) 81 + { 82 + (*env_ptr)->CallVoidMethod(env_ptr, 83 + RockboxTimer_instance, 84 + java_wait_for_interrupt); 85 + } 86 + } 87 + 88 + bool timer_register(int reg_prio, void (*unregister_callback)(void), 89 + long cycles, void (*timer_callback)(void)) 90 + { 91 + (void)reg_prio; 92 + (void)unregister_callback; 93 + (void)cycles; 94 + (void)timer_callback; 95 + return false; 96 + } 97 + 98 + bool timer_set_period(long cycles) 99 + { 100 + (void)cycles; 101 + return false; 102 + } 103 + 104 + void timer_unregister(void) 105 + { 106 + }
+291
firmware/target/hosted/android/lcd-android.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (c) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + 23 + #include <jni.h> 24 + #include "config.h" 25 + #include "system.h" 26 + #include "lcd.h" 27 + 28 + extern JNIEnv *env_ptr; 29 + extern jclass RockboxActivity_class; 30 + extern jobject RockboxActivity_instance; 31 + 32 + static jobject Framebuffer_instance; 33 + static jmethodID java_lcd_update; 34 + 35 + void lcd_init_device(void) 36 + { 37 + /* get the RockboxFramebuffer instance allocated by the activity */ 38 + jfieldID id = (*env_ptr)->GetFieldID(env_ptr, 39 + RockboxActivity_class, 40 + "fb", 41 + "Lorg/rockbox/RockboxFramebuffer;"); 42 + 43 + Framebuffer_instance = (*env_ptr)->GetObjectField(env_ptr, 44 + RockboxActivity_instance, 45 + id); 46 + 47 + jclass Framebuffer_class = (*env_ptr)->GetObjectClass(env_ptr, 48 + Framebuffer_instance); 49 + 50 + /* get the java init function and call it. it'll set up a bitmap 51 + * based on LCD_WIDTH, LCD_HEIGHT and the ByteBuffer which directly maps 52 + * our framebuffer */ 53 + 54 + jmethodID java_init_lcd = (*env_ptr)->GetMethodID(env_ptr, 55 + Framebuffer_class, 56 + "java_lcd_init", 57 + "(IILjava/nio/ByteBuffer;)V"); 58 + java_lcd_update = (*env_ptr)->GetMethodID(env_ptr, 59 + Framebuffer_class, 60 + "java_lcd_update", 61 + "()V"); 62 + 63 + /* map the framebuffer to a ByteBuffer, this way lcd updates will 64 + * be directly feched from the framebuffer */ 65 + jobject buf = (*env_ptr)->NewDirectByteBuffer(env_ptr, 66 + lcd_framebuffer, 67 + sizeof(lcd_framebuffer)); 68 + 69 + (*env_ptr)->CallVoidMethod(env_ptr, 70 + Framebuffer_instance, 71 + java_init_lcd, 72 + LCD_WIDTH, LCD_HEIGHT, buf); 73 + } 74 + 75 + void lcd_update() 76 + { 77 + /* tell the system we're ready for drawing */ 78 + (*env_ptr)->CallVoidMethod(env_ptr, Framebuffer_instance, java_lcd_update); 79 + } 80 + 81 + void lcd_update_rect(int x, int y, int height, int width) 82 + { 83 + /* can't do partial updates yet */ 84 + (void)x; (void)y; (void)height; (void)width; 85 + lcd_update(); 86 + } 87 + 88 + /* below is a plain copy from lcd-sdl.c */ 89 + 90 + /** 91 + * |R| |1.000000 -0.000001 1.402000| |Y'| 92 + * |G| = |1.000000 -0.334136 -0.714136| |Pb| 93 + * |B| |1.000000 1.772000 0.000000| |Pr| 94 + * Scaled, normalized, rounded and tweaked to yield RGB 565: 95 + * |R| |74 0 101| |Y' - 16| >> 9 96 + * |G| = |74 -24 -51| |Cb - 128| >> 8 97 + * |B| |74 128 0| |Cr - 128| >> 9 98 + */ 99 + #define YFAC (74) 100 + #define RVFAC (101) 101 + #define GUFAC (-24) 102 + #define GVFAC (-51) 103 + #define BUFAC (128) 104 + 105 + static inline int clamp(int val, int min, int max) 106 + { 107 + if (val < min) 108 + val = min; 109 + else if (val > max) 110 + val = max; 111 + return val; 112 + } 113 + 114 + void lcd_yuv_set_options(unsigned options) 115 + { 116 + (void)options; 117 + } 118 + 119 + /* Draw a partial YUV colour bitmap - similiar behavior to lcd_blit_yuv 120 + in the core */ 121 + void lcd_blit_yuv(unsigned char * const src[3], 122 + int src_x, int src_y, int stride, 123 + int x, int y, int width, int height) 124 + { 125 + const unsigned char *ysrc, *usrc, *vsrc; 126 + int linecounter; 127 + fb_data *dst, *row_end; 128 + long z; 129 + 130 + /* width and height must be >= 2 and an even number */ 131 + width &= ~1; 132 + linecounter = height >> 1; 133 + 134 + #if LCD_WIDTH >= LCD_HEIGHT 135 + dst = &lcd_framebuffer[y][x]; 136 + row_end = dst + width; 137 + #else 138 + dst = &lcd_framebuffer[x][LCD_WIDTH - y - 1]; 139 + row_end = dst + LCD_WIDTH * width; 140 + #endif 141 + 142 + z = stride * src_y; 143 + ysrc = src[0] + z + src_x; 144 + usrc = src[1] + (z >> 2) + (src_x >> 1); 145 + vsrc = src[2] + (usrc - src[1]); 146 + 147 + /* stride => amount to jump from end of last row to start of next */ 148 + stride -= width; 149 + 150 + /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */ 151 + 152 + do 153 + { 154 + do 155 + { 156 + int y, cb, cr, rv, guv, bu, r, g, b; 157 + 158 + y = YFAC*(*ysrc++ - 16); 159 + cb = *usrc++ - 128; 160 + cr = *vsrc++ - 128; 161 + 162 + rv = RVFAC*cr; 163 + guv = GUFAC*cb + GVFAC*cr; 164 + bu = BUFAC*cb; 165 + 166 + r = y + rv; 167 + g = y + guv; 168 + b = y + bu; 169 + 170 + if ((unsigned)(r | g | b) > 64*256-1) 171 + { 172 + r = clamp(r, 0, 64*256-1); 173 + g = clamp(g, 0, 64*256-1); 174 + b = clamp(b, 0, 64*256-1); 175 + } 176 + 177 + *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 178 + 179 + #if LCD_WIDTH >= LCD_HEIGHT 180 + dst++; 181 + #else 182 + dst += LCD_WIDTH; 183 + #endif 184 + 185 + y = YFAC*(*ysrc++ - 16); 186 + r = y + rv; 187 + g = y + guv; 188 + b = y + bu; 189 + 190 + if ((unsigned)(r | g | b) > 64*256-1) 191 + { 192 + r = clamp(r, 0, 64*256-1); 193 + g = clamp(g, 0, 64*256-1); 194 + b = clamp(b, 0, 64*256-1); 195 + } 196 + 197 + *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 198 + 199 + #if LCD_WIDTH >= LCD_HEIGHT 200 + dst++; 201 + #else 202 + dst += LCD_WIDTH; 203 + #endif 204 + } 205 + while (dst < row_end); 206 + 207 + ysrc += stride; 208 + usrc -= width >> 1; 209 + vsrc -= width >> 1; 210 + 211 + #if LCD_WIDTH >= LCD_HEIGHT 212 + row_end += LCD_WIDTH; 213 + dst += LCD_WIDTH - width; 214 + #else 215 + row_end -= 1; 216 + dst -= LCD_WIDTH*width + 1; 217 + #endif 218 + 219 + do 220 + { 221 + int y, cb, cr, rv, guv, bu, r, g, b; 222 + 223 + y = YFAC*(*ysrc++ - 16); 224 + cb = *usrc++ - 128; 225 + cr = *vsrc++ - 128; 226 + 227 + rv = RVFAC*cr; 228 + guv = GUFAC*cb + GVFAC*cr; 229 + bu = BUFAC*cb; 230 + 231 + r = y + rv; 232 + g = y + guv; 233 + b = y + bu; 234 + 235 + if ((unsigned)(r | g | b) > 64*256-1) 236 + { 237 + r = clamp(r, 0, 64*256-1); 238 + g = clamp(g, 0, 64*256-1); 239 + b = clamp(b, 0, 64*256-1); 240 + } 241 + 242 + *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 243 + 244 + #if LCD_WIDTH >= LCD_HEIGHT 245 + dst++; 246 + #else 247 + dst += LCD_WIDTH; 248 + #endif 249 + 250 + y = YFAC*(*ysrc++ - 16); 251 + r = y + rv; 252 + g = y + guv; 253 + b = y + bu; 254 + 255 + if ((unsigned)(r | g | b) > 64*256-1) 256 + { 257 + r = clamp(r, 0, 64*256-1); 258 + g = clamp(g, 0, 64*256-1); 259 + b = clamp(b, 0, 64*256-1); 260 + } 261 + 262 + *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 263 + 264 + #if LCD_WIDTH >= LCD_HEIGHT 265 + dst++; 266 + #else 267 + dst += LCD_WIDTH; 268 + #endif 269 + } 270 + while (dst < row_end); 271 + 272 + ysrc += stride; 273 + usrc += stride >> 1; 274 + vsrc += stride >> 1; 275 + 276 + #if LCD_WIDTH >= LCD_HEIGHT 277 + row_end += LCD_WIDTH; 278 + dst += LCD_WIDTH - width; 279 + #else 280 + row_end -= 1; 281 + dst -= LCD_WIDTH*width + 1; 282 + #endif 283 + } 284 + while (--linecounter > 0); 285 + 286 + #if LCD_WIDTH >= LCD_HEIGHT 287 + lcd_update_rect(x, y, width, height); 288 + #else 289 + lcd_update_rect(LCD_WIDTH - y - height, x, height, width); 290 + #endif 291 + }
+174
firmware/target/hosted/android/pcm-android.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (c) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + #include <jni.h> 23 + #include <stdbool.h> 24 + #include <system.h> 25 + #include "pcm.h" 26 + 27 + extern JNIEnv *env_ptr; 28 + extern jclass RockboxActivity_class; 29 + extern jobject RockboxActivity_instance; 30 + 31 + /* infos about our pcm chunks */ 32 + static size_t pcm_data_size; 33 + static char *pcm_data_start; 34 + 35 + /* cache frequently called methods */ 36 + static jmethodID play_pause_method; 37 + static jmethodID stop_method; 38 + static jmethodID set_volume_method; 39 + static jclass RockboxPCM_class; 40 + static jobject RockboxPCM_instance; 41 + 42 + 43 + /* 44 + * transfer our raw data into a java array 45 + * 46 + * a bit of a monster functions, but it should cover all cases to overcome 47 + * the issue that the chunk size of the java layer and our pcm chunks are 48 + * differently sized 49 + * 50 + * afterall, it only copies the raw pcm data from pcm_data_start to 51 + * the passed byte[]-array 52 + * 53 + * it is called from the PositionMarker callback of AudioTrack 54 + **/ 55 + JNIEXPORT void JNICALL 56 + Java_org_rockbox_RockboxPCM_pcmSamplesToByteArray(JNIEnv *env, 57 + jobject this, 58 + jbyteArray arr) 59 + { 60 + (void)this; 61 + size_t len; 62 + size_t array_size = (*env)->GetArrayLength(env, arr); 63 + if (array_size > pcm_data_size) 64 + len = pcm_data_size; 65 + else 66 + len = array_size; 67 + 68 + (*env)->SetByteArrayRegion(env, arr, 0, len, pcm_data_start); 69 + 70 + if (array_size > pcm_data_size) 71 + { /* didn't have enough data for the array ? */ 72 + size_t remaining = array_size - pcm_data_size; 73 + size_t offset = len; 74 + retry: 75 + pcm_play_get_more_callback((void**)&pcm_data_start, &pcm_data_size); 76 + if (pcm_data_size == 0) 77 + return; 78 + if (remaining > pcm_data_size) 79 + { /* got too little data, get more ... */ 80 + (*env)->SetByteArrayRegion(env, arr, offset, pcm_data_size, pcm_data_start); 81 + /* advance in the java array by the amount we copied */ 82 + offset += pcm_data_size; 83 + /* we copied at least a bit */ 84 + remaining -= pcm_data_size; 85 + /* let's get another buch of data and try again */ 86 + goto retry; 87 + } 88 + else 89 + (*env)->SetByteArrayRegion(env, arr, offset, remaining, pcm_data_start); 90 + len = remaining; 91 + } 92 + pcm_data_start += len; 93 + pcm_data_size -= len; 94 + } 95 + 96 + void pcm_play_lock(void) 97 + { 98 + } 99 + 100 + void pcm_play_unlock(void) 101 + { 102 + } 103 + 104 + void pcm_dma_apply_settings(void) 105 + { 106 + } 107 + 108 + void pcm_play_dma_start(const void *addr, size_t size) 109 + { 110 + pcm_data_start = (char*)addr; 111 + pcm_data_size = size; 112 + 113 + pcm_play_dma_pause(false); 114 + } 115 + 116 + void pcm_play_dma_stop(void) 117 + { 118 + (*env_ptr)->CallVoidMethod(env_ptr, 119 + RockboxPCM_instance, 120 + stop_method); 121 + } 122 + 123 + void pcm_play_dma_pause(bool pause) 124 + { 125 + (*env_ptr)->CallVoidMethod(env_ptr, 126 + RockboxPCM_instance, 127 + play_pause_method, 128 + (int)pause); 129 + } 130 + 131 + size_t pcm_get_bytes_waiting(void) 132 + { 133 + return pcm_data_size; 134 + } 135 + 136 + const void * pcm_play_dma_get_peak_buffer(int *count) 137 + { 138 + uintptr_t addr = (uintptr_t)pcm_data_start; 139 + *count = pcm_data_size / 4; 140 + return (void *)((addr + 3) & ~3); 141 + } 142 + 143 + void pcm_play_dma_init(void) 144 + { 145 + /* in order to have background music playing after leaving the activity, 146 + * we need to allocate the PCM object from the Rockbox thread (the Activity 147 + * runs in a separate thread because it would otherwise kill us when 148 + * stopping it) 149 + * 150 + * Luckily we only reference the PCM object from here, so it's safe (and 151 + * clean) to allocate it here 152 + **/ 153 + JNIEnv e = *env_ptr; 154 + /* get the class and its constructor */ 155 + RockboxPCM_class = e->FindClass(env_ptr, "org/rockbox/RockboxPCM"); 156 + jmethodID constructor = e->GetMethodID(env_ptr, RockboxPCM_class, "<init>", "()V"); 157 + /* instance = new RockboxPCM() */ 158 + RockboxPCM_instance = e->NewObject(env_ptr, RockboxPCM_class, constructor); 159 + /* cache needed methods */ 160 + play_pause_method = e->GetMethodID(env_ptr, RockboxPCM_class, "play_pause", "(Z)V"); 161 + set_volume_method = e->GetMethodID(env_ptr, RockboxPCM_class, "set_volume", "(I)V"); 162 + stop_method = e->GetMethodID(env_ptr, RockboxPCM_class, "stop", "()V"); 163 + /* get initial pcm data, if any */ 164 + pcm_play_get_more_callback((void*)&pcm_data_start, &pcm_data_size); 165 + } 166 + 167 + void pcm_postinit(void) 168 + { 169 + } 170 + 171 + void pcm_set_mixer_volume(int volume) 172 + { 173 + (*env_ptr)->CallVoidMethod(env_ptr, RockboxPCM_instance, set_volume_method, volume); 174 + }
+59
firmware/target/hosted/android/system-android.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (c) 2010 Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + 23 + #include <jni.h> 24 + #include "config.h" 25 + #include "system.h" 26 + 27 + void system_exception_wait(void) { } 28 + void system_reboot(void) { } 29 + void power_off(void) { } 30 + void system_init(void) { } 31 + 32 + 33 + /* global fields for use with various JNI calls */ 34 + JNIEnv *env_ptr; 35 + jobject RockboxActivity_instance; 36 + jclass RockboxActivity_class; 37 + 38 + uintptr_t *stackbegin; 39 + uintptr_t *stackend; 40 + 41 + extern int main(void); 42 + /* this is the entry point of the android app initially called by jni */ 43 + JNIEXPORT void JNICALL 44 + Java_org_rockbox_RockboxActivity_main(JNIEnv *env, jobject this) 45 + { 46 + /* hack!!! we can't have a valid stack pointer otherwise. 47 + * but we don't really need it anyway, thread.c only needs it 48 + * for overflow detection which doesn't apply for the main thread 49 + * (it's managed by the OS) */ 50 + 51 + (void)env; 52 + (void)this; 53 + volatile uintptr_t stack = 0; 54 + stackbegin = stackend = &stack; 55 + env_ptr = env; 56 + RockboxActivity_instance = this; 57 + RockboxActivity_class = (*env)->GetObjectClass(env, this); 58 + main(); 59 + }
+39
firmware/target/hosted/android/system-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2010 by Thomas Martitz 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + #ifndef __SYSTEM_TARGET_H__ 22 + #define __SYSTEM_TARGET_H__ 23 + 24 + #define disable_irq() 25 + #define enable_irq() 26 + #define disable_irq_save() 0 27 + #define restore_irq(level) (void)level 28 + 29 + void power_off(void); 30 + 31 + #include <android/log.h> 32 + #define LOG_TAG "Rockbox" 33 + #define LOG(args...) \ 34 + __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, ##args); 35 + 36 + #endif /* __SYSTEM_TARGET_H__ */ 37 + 38 + #define NEED_GENERIC_BYTESWAPS 39 +
+98
firmware/target/hosted/android/thread-android-arm.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2005 by Thom Johansen 11 + * Copyright (C) 2010 by Thomas Martitz (Android-suitable core_sleep()) 12 + * 13 + * Generic ARM threading support 14 + * 15 + * This program is free software; you can redistribute it and/or 16 + * modify it under the terms of the GNU General Public License 17 + * as published by the Free Software Foundation; either version 2 18 + * of the License, or (at your option) any later version. 19 + * 20 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 + * KIND, either express or implied. 22 + * 23 + ****************************************************************************/ 24 + 25 + #include <jni.h> 26 + /*--------------------------------------------------------------------------- 27 + * Start the thread running and terminate it if it returns 28 + *--------------------------------------------------------------------------- 29 + */ 30 + static void __attribute__((naked,used)) start_thread(void) 31 + { 32 + /* r0 = context */ 33 + asm volatile ( 34 + "ldr sp, [r0, #32] \n" /* Load initial sp */ 35 + "ldr r4, [r0, #40] \n" /* start in r4 since it's non-volatile */ 36 + "mov r1, #0 \n" /* Mark thread as running */ 37 + "str r1, [r0, #40] \n" 38 + "mov lr, pc \n" /* Call thread function */ 39 + "bx r4 \n" 40 + ); /* No clobber list - new thread doesn't care */ 41 + thread_exit(); 42 + } 43 + 44 + /* For startup, place context pointer in r4 slot, start_thread pointer in r5 45 + * slot, and thread function pointer in context.start. See load_context for 46 + * what happens when thread is initially going to run. */ 47 + #define THREAD_STARTUP_INIT(core, thread, function) \ 48 + ({ (thread)->context.r[0] = (uint32_t)&(thread)->context, \ 49 + (thread)->context.r[1] = (uint32_t)start_thread, \ 50 + (thread)->context.start = (uint32_t)function; }) 51 + 52 + 53 + /*--------------------------------------------------------------------------- 54 + * Store non-volatile context. 55 + *--------------------------------------------------------------------------- 56 + */ 57 + static inline void store_context(void* addr) 58 + { 59 + asm volatile( 60 + "stmia %0, { r4-r11, sp, lr } \n" 61 + : : "r" (addr) 62 + ); 63 + } 64 + 65 + /*--------------------------------------------------------------------------- 66 + * Load non-volatile context. 67 + *--------------------------------------------------------------------------- 68 + */ 69 + static inline void load_context(const void* addr) 70 + { 71 + asm volatile( 72 + "ldr r0, [%0, #40] \n" /* Load start pointer */ 73 + "cmp r0, #0 \n" /* Check for NULL */ 74 + 75 + /* If not already running, jump to start */ 76 + "ldmneia %0, { r0, pc } \n" 77 + "ldmia %0, { r4-r11, sp, lr } \n" /* Load regs r4 to r14 from context */ 78 + : : "r" (addr) : "r0" /* only! */ 79 + ); 80 + } 81 + 82 + /* 83 + * this core sleep suspends the OS thread rockbox runs under, which greatly 84 + * reduces cpu usage (~100% to <10%) 85 + * 86 + * it returns when the RockboxTimer notified us, i.e. at each tick 87 + * (after it called the tick tasks) 88 + * 89 + * wait_for_interrupt is implemented in kernel-android.c 90 + **/ 91 + 92 + extern void wait_for_interrupt(void); 93 + static inline void core_sleep(void) 94 + { 95 + wait_for_interrupt(); 96 + } 97 + 98 +
+12 -3
firmware/thread.c
··· 123 123 struct thread_entry threads[MAXTHREADS] IBSS_ATTR; 124 124 125 125 static const char main_thread_name[] = "main"; 126 + #if (CONFIG_PLATFORM & PLATFORM_NATIVE) 126 127 extern uintptr_t stackbegin[]; 127 128 extern uintptr_t stackend[]; 129 + #else 130 + extern uintptr_t *stackbegin; 131 + extern uintptr_t *stackend; 132 + #endif 128 133 129 134 static inline void core_sleep(IF_COP_VOID(unsigned int core)) 130 135 __attribute__((always_inline)); ··· 170 175 /**************************************************************************** 171 176 * Processor-specific section - include necessary core support 172 177 */ 173 - #if defined(CPU_ARM) 178 + #if defined(ANDROID) 179 + #include "thread-android-arm.c" 180 + #elif defined(CPU_ARM) 174 181 #include "thread-arm.c" 175 182 #if defined (CPU_PP) 176 183 #include "thread-pp.c" ··· 1150 1157 store_context(&thread->context); 1151 1158 1152 1159 /* Check if the current thread stack is overflown */ 1153 - if (UNLIKELY(thread->stack[0] != DEADBEEF)) 1160 + if (UNLIKELY(thread->stack[0] != DEADBEEF) && thread->stack_size > 0) 1154 1161 thread_stkov(thread); 1155 1162 1156 1163 #if NUM_CORES > 1 ··· 2319 2326 */ 2320 2327 int thread_stack_usage(const struct thread_entry *thread) 2321 2328 { 2322 - return stack_usage(thread->stack, thread->stack_size); 2329 + if (LIKELY(thread->stack_size > 0)) 2330 + return stack_usage(thread->stack, thread->stack_size); 2331 + return 0; 2323 2332 } 2324 2333 2325 2334 #if NUM_CORES > 1
+2
tools/buildzip.pl
··· 631 631 } 632 632 else { 633 633 unless (".rockbox" eq $rbdir) { 634 + mkpath($rbdir); 635 + rmtree($rbdir); 634 636 move(".rockbox", $rbdir); 635 637 print "mv .rockbox $rbdir\n" if $verbose; 636 638 }
+109 -35
tools/configure
··· 14 14 # global LD options for all platforms 15 15 GLOBAL_LDOPTS="" 16 16 17 + extradefines="" 17 18 use_logf="#undef ROCKBOX_HAS_LOGF" 18 19 use_bootchart="#undef DO_BOOTCHART" 19 20 ··· 25 26 libdir= 26 27 bindir_full= 27 28 libdir_full= 28 - 29 + 30 + app_platform= 31 + app_lcd_width= 32 + app_lcd_height= 29 33 # 30 34 # Begin Function Definitions 31 35 # ··· 47 51 OC=${prefix}objcopy 48 52 } 49 53 54 + app_get_platform() { 55 + echo "Select your platform: (S)DL, (A)ndroid (default: Android)" 56 + choice=`input` 57 + case $choice in 58 + s|S*) app_platform="sdl" ;; 59 + *|a|A*) app_platform="android" ;; 60 + esac 61 + 62 + echo "Selected $app_platform platform" 63 + echo "Select the LCD resolution seperated with enter: XxY (default: 320x480)" 64 + app_lcd_width=`input` 65 + if [ -z "$app_lcd_width" ]; then app_lcd_width="320"; fi 66 + app_lcd_height=`input` 67 + if [ -z "$app_lcd_height" ]; then app_lcd_height="480"; fi 68 + echo "Selected $app_lcd_width x $app_lcd_height resolution" 69 + 70 + app_lcd_width="#define LCD_WIDTH $app_lcd_width" 71 + app_lcd_height="#define LCD_HEIGHT $app_lcd_height" 72 + # setup files and paths depending on the platform 73 + if [ "$app_platform" = "sdl" ]; then 74 + if [ -z "$PREFIX" ]; then 75 + rbdir="/usr/local/share/rockbox" 76 + bindir="/usr/local/bin" 77 + bindir_full=$bindir 78 + libdir="/usr/local/lib" 79 + libdir_full=$libdir 80 + else 81 + rbdir=`realpath $PREFIX/share/rockbox` 82 + bindir="$PREFIX/bin" 83 + libdir="$PREFIX/lib" 84 + if [ -d bindir ]; then 85 + bindir_full=`realpath $bindir` 86 + fi 87 + if [ -d libdir ]; then 88 + libdir_full=`realpath $libdir` 89 + fi 90 + fi 91 + output="rockbox" 92 + bootoutput="rockbox" 93 + elif [ "$app_platform" = "android" ]; then 94 + if [ -n "$PREFIX" ]; then 95 + echo "WARNING: PREFIX not supported on Android. You can however use --rbdir" 96 + fi 97 + rbdir="/data/data/org.rockbox/app_rockbox/rockbox" 98 + bindir="/data/data/org.rockbox/lib" 99 + bindir_full=$bindir 100 + libdir="/data/data/org.rockbox/app_rockbox" 101 + libdir_full=$libdir 102 + output="librockbox.so" 103 + bootoutput="librockbox.so" 104 + fi 105 + } 106 + 50 107 findarmgcc() { 51 108 if [ "$ARG_ARM_EABI" != "0" ]; then 52 109 prefixtools arm-elf-eabi- ··· 102 159 done 103 160 } 104 161 162 + appcc () { 163 + if [ "$1" = "sdl" ]; then 164 + simcc "sdl-app" 165 + elif [ "$1" = "android" ]; then 166 + app_type=$1 167 + androidcc 168 + fi 169 + } 170 + 105 171 simcc () { 106 172 107 173 # default tool setup for native building ··· 114 180 GCCOPTIMIZE='' 115 181 LDOPTS='-lm' # button-sdl.c uses sqrt() 116 182 117 - # default output binary name 118 - output="rockboxui" 183 + # default output binary name, don't override app_get_platform() 184 + if [ "$app_type" != "sdl-app" ]; then 185 + output="rockboxui" 186 + fi 119 187 120 188 # default share option, override below if needed 121 189 SHARED_FLAG="-shared" 122 190 123 191 if [ "$win32crosscompile" = "yes" ]; then 124 192 LDOPTS="$LDOPTS -mconsole" 125 - output="rockboxui.exe" 193 + output="$output.exe" 126 194 winbuild="yes" 127 195 else 128 196 case $uname in ··· 130 198 echo "Cygwin host detected" 131 199 132 200 LDOPTS="$LDOPTS -mconsole" 133 - output="rockboxui.exe" 201 + output="$output.exe" 134 202 winbuild="yes" 135 203 ;; 136 204 ··· 138 206 echo "MinGW host detected" 139 207 140 208 LDOPTS="$LDOPTS -mconsole" 141 - output="rockboxui.exe" 209 + output="$output.exe" 142 210 winbuild="yes" 143 211 ;; 144 212 ··· 188 256 LDOPTS="$LDOPTS `$sdl --libs`" 189 257 fi 190 258 fi 259 + 191 260 192 261 GCCOPTS="$GCCOPTS -I\$(SIMDIR)" 193 262 ··· 377 446 GCCOPTIMIZE="-fomit-frame-pointer" 378 447 endian="little" 379 448 gccchoice="4.1.2" 449 + } 450 + 451 + androidcc () { 452 + gccchoice="4.4.0" 453 + prefixtools $ANDROID_NDK_PATH/build/prebuilt/linux-x86/arm-eabi-$gccchoice/bin/arm-eabi- 454 + GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef//` 455 + GCCOPTS="$GCCOPTS -std=gnu99 -ffunction-sections -fno-short-enums -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer" 456 + GLOBAL_LDOPTS="$GLOBAL_LDOPTS -nostdlib -lc -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -L$ANDROID_NDK_PATH/build/platforms/android-4/arch-arm/usr/lib/ -Wl,-rpath-link=$ANDROID_NKD_PATH/build/platforms/android-4/arch-arm/usr/lib" 457 + LDOPTS="$LDOPTS -shared -nostdlib -lm -ldl -llog" 458 + extradefines="$extradefines -DANDROID" 459 + endian="little" 460 + SHARED_FLAG="-shared" 380 461 } 381 462 382 463 whichadvanced () { ··· 975 1056 143) YP-S3 160) Vibe 500 131) Mini2440 976 1057 977 1058 ==MPIO== == Application == 978 - 170) HD200 200) SDL 320x240 1059 + 170) HD200 200) Application 979 1060 980 1061 EOF 981 1062 ··· 2609 2690 modelname="application" 2610 2691 target="-DAPPLICATION" 2611 2692 2612 - if [ -z "$PREFIX" ]; then 2613 - rbdir="/usr/local/share/rockbox" 2614 - bindir="/usr/local/bin" 2615 - bindir_full=$bindir 2616 - libdir="/usr/local/lib" 2617 - libdir_full=$libdir 2618 - else 2619 - rbdir=`realpath $PREFIX/share/rockbox` 2620 - bindir="$PREFIX/bin" 2621 - libdir="$PREFIX/lib" 2622 - if [ -d bindir ]; then 2623 - bindir_full=`realpath $bindir` 2624 - fi 2625 - if [ -d libdir ]; then 2626 - libdir_full=`realpath $libdir` 2627 - fi 2628 - fi 2629 2693 need_full_path="yes" 2694 + app_get_platform 2630 2695 2631 2696 memory=8 2632 2697 uname=`uname` 2633 - simcc "sdl-app" 2698 + 2699 + appcc "$app_platform" 2634 2700 tool="cp " 2635 2701 boottool="cp " 2636 2702 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 2637 2703 bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 2638 - output="rockbox" 2639 - bootoutput="bootloader-cowond2.bin" 2640 2704 appextra="recorder:gui:radio" 2641 2705 plugins="" 2642 2706 swcodec="yes" 2643 2707 # architecture, manufacturer and model for the target-tree build 2644 2708 t_cpu="hosted" 2645 - t_manufacturer="sdl" 2709 + t_manufacturer="$app_platform" 2646 2710 t_model="app" 2647 2711 ;; 2648 2712 ··· 2732 2796 [Ii]) 2733 2797 appsdir='\$(ROOTDIR)/bootloader' 2734 2798 apps="bootloader" 2735 - extradefines="-DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections" 2799 + extradefines="$extradefines -DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections" 2736 2800 bootloader="1" 2737 2801 echo "e200R-installer build selected" 2738 2802 ;; ··· 2743 2807 variant=`input` 2744 2808 case $variant in 2745 2809 4) 2746 - extradefines="-DBOOTLOADER -DC200_ERASE -DC240_ERASE -ffunction-sections -fdata-sections" 2810 + extradefines="$extradefines -DBOOTLOADER -DC200_ERASE -DC240_ERASE -ffunction-sections -fdata-sections" 2747 2811 echo "c240 eraser build selected" 2748 2812 ;; 2749 2813 5) 2750 - extradefines="-DBOOTLOADER -DC200_ERASE -DC250_ERASE -ffunction-sections -fdata-sections" 2814 + extradefines="$extradefines -DBOOTLOADER -DC200_ERASE -DC250_ERASE -ffunction-sections -fdata-sections" 2751 2815 echo "c240 eraser build selected" 2752 2816 ;; 2753 2817 esac ··· 2771 2835 output=$bootoutput 2772 2836 fi 2773 2837 fi 2774 - extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections" 2838 + extradefines="$extradefines -DBOOTLOADER -ffunction-sections -fdata-sections" 2775 2839 bootloader="1" 2776 2840 echo "Bootloader build selected" 2777 2841 ;; ··· 2782 2846 fi 2783 2847 debug="-DDEBUG" 2784 2848 simulator="yes" 2785 - extradefines="-DSIMULATOR" 2849 + extradefines="$extradefines -DSIMULATOR" 2786 2850 archosrom="" 2787 2851 flash="" 2788 2852 echo "Simulator build selected" ··· 2792 2856 whichadvanced $btype 2793 2857 ;; 2794 2858 [Gg]) 2795 - extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES 2859 + extradefines="$extradefines -DSTUB" # for target makefile symbol EXTRA_DEFINES 2796 2860 appsdir='\$(ROOTDIR)/gdb' 2797 2861 apps="stub" 2798 2862 case $modelname in ··· 2815 2879 toolset=''; 2816 2880 t_cpu=''; 2817 2881 GCCOPTS=''; 2818 - extradefines="-DDEBUG" 2882 + extradefines="$extradefines -DDEBUG" 2819 2883 appsdir='\$(ROOTDIR)/tools/checkwps'; 2820 2884 output='checkwps.'${modelname}; 2821 2885 archosrom=''; ··· 3048 3112 -e "s<@have_backlight@<$have_backlight<g" \ 3049 3113 -e "s<@have_fmradio_in@<$have_fmradio_in<g" \ 3050 3114 -e "s<@have_ata_poweroff@<$have_ata_poweroff<g" \ 3115 + -e "s<@lcd_width@<$app_lcd_width<g" \ 3116 + -e "s<@lcd_height@<$app_lcd_height<g" \ 3051 3117 <<EOF 3052 3118 /* This header was made by configure */ 3053 3119 #ifndef __BUILD_AUTOCONF_H ··· 3075 3141 @config_rtc@ 3076 3142 @have_rtc_alarm@ 3077 3143 3144 + /* lcd dimensions for application builds from configure */ 3145 + @lcd_width@ 3146 + @lcd_height@ 3147 + 3078 3148 /* root of Rockbox */ 3079 3149 #define ROCKBOX_DIR "@RBDIR@" 3080 3150 #define ROCKBOX_BINARY_PATH "@binpath@" ··· 3088 3158 if [ "$simulator" = "yes" ]; then # a few more includes for the sim target tree 3089 3159 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/" 3090 3160 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/" 3161 + fi 3162 + if [ -n "$app_platform" -a "$app_platform" = "android" ]; then 3163 + # android's gcc doesn't add this :/ 3164 + TARGET_INC="$TARGET_INC -I$ANDROID_NDK_PATH/build/platforms/android-4/arch-arm/usr/include" 3091 3165 fi 3092 3166 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer" 3093 3167 TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
+29 -8
uisimulator/common/io.c
··· 25 25 #include <stdarg.h> 26 26 #include <sys/stat.h> 27 27 #include <time.h> 28 - #ifndef WIN32 28 + #include "config.h" 29 + 30 + #define HAVE_STATVFS (0 == (CONFIG_PLATFORM & PLATFORM_ANDROID) && !defined(WIN32)) 31 + 32 + #if HAVE_STATVFS 29 33 #include <sys/statvfs.h> 30 34 #endif 31 35 ··· 41 45 #endif 42 46 43 47 #include <fcntl.h> 48 + #if (CONFIG_PLATFORM & PLATFORM_SDL) 44 49 #include <SDL.h> 45 50 #include <SDL_thread.h> 51 + #include "thread-sdl.h" 52 + #else 53 + #define sim_thread_unlock() NULL 54 + #define sim_thread_lock(a) 55 + #endif 46 56 #include "thread.h" 47 57 #include "kernel.h" 48 58 #include "debug.h" 49 - #include "config.h" 50 59 #include "ata.h" /* for IF_MV2 et al. */ 51 - #include "thread-sdl.h" 52 60 #include "rbpaths.h" 53 61 54 62 /* keep this in sync with file.h! */ ··· 193 201 /** Simulator I/O engine routines **/ 194 202 #define IO_YIELD_THRESHOLD 512 195 203 196 - enum 204 + enum io_dir 197 205 { 198 206 IO_READ, 199 207 IO_WRITE, ··· 225 233 return HZ; 226 234 } 227 235 228 - static ssize_t io_trigger_and_wait(int cmd) 236 + static ssize_t io_trigger_and_wait(enum io_dir cmd) 229 237 { 230 238 void *mythread = NULL; 231 239 ssize_t result; ··· 246 254 case IO_WRITE: 247 255 result = write(io.fd, io.buf, io.count); 248 256 break; 257 + /* shut up gcc */ 258 + default: 259 + result = -1; 249 260 } 250 261 251 262 /* Regain our status as current */ ··· 480 491 if (free) 481 492 *free = free_clusters * secperclus / 2 * (bytespersec / 512); 482 493 } 483 - #else 494 + #elif HAVE_STATVFS 484 495 struct statvfs vfs; 485 496 486 497 if (!statvfs(".", &vfs)) { ··· 490 501 *size = vfs.f_blocks / 2 * (vfs.f_frsize / 512); 491 502 if (free) 492 503 *free = vfs.f_bfree / 2 * (vfs.f_frsize / 512); 493 - } 504 + } else 494 505 #endif 495 - else { 506 + { 496 507 if (size) 497 508 *size = 0; 498 509 if (free) ··· 537 548 to find an unused filename */ 538 549 for (codec_count = 0; codec_count < 10; codec_count++) 539 550 { 551 + #if (CONFIG_PLATFORM & PLATFORM_ANDROID) 552 + /* we need that path fixed, since get_user_file_path() 553 + * gives us the folder on the sdcard where we cannot load libraries 554 + * from (no exec permissions) 555 + */ 556 + snprintf(path, sizeof(path), 557 + "/data/data/org.rockbox/app_rockbox/libtemp_codec_%d.so", 558 + codec_count); 559 + #else 540 560 char name[MAX_PATH]; 541 561 const char *_name = get_user_file_path(ROCKBOX_DIR, 0, name, sizeof(name)); 542 562 snprintf(path, sizeof(path), "%s/_temp_codec%d.dll", get_sim_pathname(_name), codec_count); 563 + #endif 543 564 fd = OPEN(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); 544 565 if (fd >= 0) 545 566 break; /* Created a file ok */
+3 -3
uisimulator/common/stubs.c
··· 21 21 #include <stdio.h> 22 22 #include <time.h> 23 23 #include <stdbool.h> 24 - #include "thread-sdl.h" 25 - 26 24 #include "debug.h" 27 25 28 26 #include "screens.h" ··· 35 33 36 34 #include "ata.h" /* for volume definitions */ 37 35 38 - extern char having_new_lcd; 39 36 static bool storage_spinning = false; 40 37 41 38 #if CONFIG_CODEC != SWCODEC ··· 211 208 } 212 209 #endif 213 210 211 + #ifdef ARCHOS_PLAYER 214 212 bool is_new_player(void) 215 213 { 214 + extern char having_new_lcd; 216 215 return having_new_lcd; 217 216 } 217 + #endif 218 218 219 219 #ifdef HAVE_USB_POWER 220 220 bool usb_powered(void)
-1
uisimulator/uisimulator.make
··· 30 30 $(SILENT)$(shell rm -f $@) 31 31 $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null 32 32 33 - # SIMLIB needs to be linked twice for some reason 34 33 $(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) 35 34 $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) 36 35
+5
wps/WPSLIST
··· 292 292 Author: Johannes Voggenthaler, Apoo Maha, Marc Guay, Alex Vanderpol, Jerry Lange, Keith Perri, Mark Fawcus, and Marianne Arnold with support from Rockbox developers and forums. Based on Cabbie by Yohann Misquitta. 293 293 294 294 # Preferred font (including .fnt extension - leave blank for player): 295 + Font.320x480x16: 16-Adobe-Helvetica.fnt 295 296 Font.320x240x16: 15-Adobe-Helvetica.fnt 296 297 Font.240x400x16: 16-Adobe-Helvetica.fnt 297 298 Font.240x320x16: 15-Adobe-Helvetica.fnt ··· 320 321 filetype colours: 321 322 322 323 #backdrop - remember this is the source file name in your SVN folder, not dest name! 324 + backdrop.320x480x16: backdrops/cabbiev2.320x480x16.bmp 323 325 backdrop.320x240x16: backdrops/cabbiev2.320x240x16.bmp 324 326 backdrop.128x128x16: backdrops/cabbiev2.128x128x16.bmp 325 327 backdrop.132x80x16: backdrops/cabbiev2.132x80x16.bmp ··· 333 335 backdrop.240x400x16: backdrops/cabbiev2.240x400x16.bmp 334 336 335 337 #selection bar settings for color targets 338 + selector type.320x480x16: bar (gradient) 336 339 selector type.320x240x16: bar (gradient) 337 340 selector type.128x128x16: bar (gradient) 338 341 selector type.132x80x16: bar (gradient) ··· 346 349 selector type.138x110x2: bar (inverse) 347 350 348 351 #icons 352 + iconset.320x480x16: icons/tango_small.bmp 349 353 iconset.320x240x16: icons/tango_small.bmp 350 354 iconset.128x128x16: icons/tango_small.bmp 351 355 iconset.132x80x16: icons/tango_small.bmp ··· 359 363 iconset.240x400x16: icons/tango_small.bmp 360 364 361 365 #viewer icons 366 + viewers iconset.320x480x16: icons/tango_small_viewers.bmp 362 367 viewers iconset.320x240x16: icons/tango_small_viewers.bmp 363 368 viewers iconset.128x128x16: icons/tango_small_viewers.bmp 364 369 viewers iconset.132x80x16: icons/tango_small_viewers.bmp
+79
wps/cabbiev2.320x480x16.wps
··· 1 + # cabbie 2.0 2 + # (C) 2007, Johannes Voggenthaler (Zinc Alloy) 3 + # (C) 2009, Maurus Cuelenaere (mcuelenaere) ported to Onda VX747 4 + # derived from "cabbie" (C) Yohann Misquitta 5 + 6 + %wd 7 + %X(wpsbackdrop-240x400x16.bmp) 8 + %Cl(55,50,130,130,c,c) 9 + %pb(22,284,199,13,pb-240x320x16.bmp) 10 + %T(22,284,199,13,progressbar) 11 + %T(90,238,60,20,playlist) 12 + %?Tl(2.5)<%Vd(t)|%Vd(u)> 13 + %V(0,0,240,330,1) 14 + 15 + 16 + %?C<|> 17 + %?C<|> 18 + %?C<|%s%ac%?it<%it|%fn>> 19 + %?C<|%s%ac%?ia<%ia|%?d(2)<%d(2)|%(root%)>>> 20 + %?C<|%s%ac%?id<%id|%?d(1)<%d(1)|%(root%)>>> 21 + %?C<|%ac%?iy<%iy|>> 22 + %?C<|> 23 + %?C<|%ac%?ig<%ig|>> 24 + %?C<|%ac%?fv<%(vbr%) |>%fb kbit/s %fc> 25 + %?C<|> 26 + %?C<%s%ac%?it<%it|%fn>|> 27 + %?C<%s%ac%?ia<%ia|%?d(2)<%d(2)|%(root%)>>|%ac%Sx(Next Track:)> 28 + %?C<%s%ac%?id<%id|%?d(1)<%d(1)|%(root%)>>|%ac%s%?It<%It|%Fn>> 29 + %?C<|%s%ac%?Ia<%Ia|%?D(2)<%D(2)|%(root%)>>> 30 + %?C<%s%ac%Sx(Next:) %?Ia<%Ia|%?D(2)<%D(2)|%(root%)>> - %?It<%It|%Fn>|%s%ac%?Id<%Id|%?D(1)<%D(1)|%(root%)>>> 31 + 32 + 33 + %pc%ac%?Sr<%pe %Sx(of) %pp|%pp %Sx(of) %pe>%ar%pr 34 + 35 + %?C<%Cd> 36 + 37 + %xl(A,lock-240x320x16.bmp,11,0,2) 38 + %xl(B,battery-240x320x16.bmp,46,0,10) 39 + %xl(C,volume-240x320x16.bmp,98,0,10) 40 + %xl(D,shuffle-240x320x16.bmp,139,0) 41 + %xl(E,repeat-240x320x16.bmp,182,0,4) 42 + %xl(F,playmode-240x320x16.bmp,206,0,5) 43 + 44 + %V(0,372,240,-,1) 45 + %?mh<%xd(Aa)|%xd(Ab)> 46 + %?bp<%?bc<%xd(Ba)|%xd(Bb)>|%?bl<|%xd(Bc)|%xd(Bd)|%xd(Be)|%xd(Bf)|%xd(Bg)|%xd(Bh)|%xd(Bi)|%xd(Bj)>> 47 + %?pv<%xd(Ca)|%xd(Cb)|%xd(Cc)|%xd(Cd)|%xd(Ce)|%xd(Cf)|%xd(Cg)|%xd(Ch)|%xd(Ci)|%xd(Cj)> 48 + %?ps<%xd(D)> 49 + %?mm<|%xd(Ea)|%xd(Eb)|%xd(Ec)|%xd(Ed)> 50 + %?mp<%xd(Fa)|%xd(Fb)|%xd(Fc)|%xd(Fd)|%xd(Fe)> 51 + 52 + %T(206,0,24,24,play) 53 + %T(206,0,24,24,&stop) 54 + %T(182,0,18,92,repmode) 55 + %T(139,0,37,23,shuffle) 56 + %T(98,0,33,23,volume) 57 + 58 + #viewport for the touch icons 59 + %xl(G,browser-320x240x16.bmp,0,0) 60 + %xl(I,pitch-320x240x16.bmp,39,0) 61 + %xl(H,context-320x240x16.bmp,58,0) 62 + %xl(J,quick-320x240x16.bmp,86,0) 63 + %xl(K,rew-320x240x16.bmp,115,0) 64 + %xl(L,ff-320x240x16.bmp,144,0) 65 + 66 + %Vl(t,70,335,-,30,1) 67 + %xd(G) %xd(H) %xd(I) %xd(J) %xd(K) %xd(L) 68 + %T(0,0,37,24,browse) 69 + %T(39,5,24,24,pitch) 70 + %T(58,0,24,24,contextmenu) 71 + %T(86,0,24,24,quickscreen) 72 + %T(115,0,24,23,&rwd) 73 + %T(144,0,24,23,&ffwd) 74 + %T(115,0,24,23,prev) 75 + %T(144,0,24,23,next) 76 + 77 + %Vl(u,70,335,-,30,1) 78 + #purposely left blank 79 +
wps/cabbiev2/wpsbackdrop-320x480x16.bmp

This is a binary file and will not be displayed.