diff options
53 files changed, 2103 insertions, 68 deletions
diff --git a/android/.classpath b/android/.classpath new file mode 100644 index 0000000000..6efcbb739a --- /dev/null +++ b/android/.classpath | |||
@@ -0,0 +1,7 @@ | |||
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> | ||
diff --git a/android/.project b/android/.project new file mode 100644 index 0000000000..7e8d136317 --- /dev/null +++ b/android/.project | |||
@@ -0,0 +1,33 @@ | |||
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> | ||
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000000..a22c393379 --- /dev/null +++ b/android/AndroidManifest.xml | |||
@@ -0,0 +1,18 @@ | |||
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> \ No newline at end of file | ||
diff --git a/android/README b/android/README new file mode 100644 index 0000000000..e41bfa6c0c --- /dev/null +++ b/android/README | |||
@@ -0,0 +1,34 @@ | |||
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 | ||
diff --git a/android/default.properties b/android/default.properties new file mode 100644 index 0000000000..9d79b12c71 --- /dev/null +++ b/android/default.properties | |||
@@ -0,0 +1,11 @@ | |||
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 | ||
diff --git a/android/gen/org/rockbox/R.java b/android/gen/org/rockbox/R.java new file mode 100644 index 0000000000..38c177ef36 --- /dev/null +++ b/android/gen/org/rockbox/R.java | |||
@@ -0,0 +1,22 @@ | |||
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 | } | ||
diff --git a/android/res/drawable-hdpi/icon.png b/android/res/drawable-hdpi/icon.png new file mode 100644 index 0000000000..8074c4c571 --- /dev/null +++ b/android/res/drawable-hdpi/icon.png | |||
Binary files differ | |||
diff --git a/android/res/drawable-ldpi/icon.png b/android/res/drawable-ldpi/icon.png new file mode 100644 index 0000000000..1095584ec2 --- /dev/null +++ b/android/res/drawable-ldpi/icon.png | |||
Binary files differ | |||
diff --git a/android/res/drawable-mdpi/icon.png b/android/res/drawable-mdpi/icon.png new file mode 100644 index 0000000000..a07c69fa5a --- /dev/null +++ b/android/res/drawable-mdpi/icon.png | |||
Binary files differ | |||
diff --git a/android/res/layout/main.xml b/android/res/layout/main.xml new file mode 100644 index 0000000000..4361cfe8aa --- /dev/null +++ b/android/res/layout/main.xml | |||
@@ -0,0 +1,7 @@ | |||
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> | ||
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100644 index 0000000000..6c3c8464fd --- /dev/null +++ b/android/res/values/strings.xml | |||
@@ -0,0 +1,5 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <resources> | ||
3 | |||
4 | <string name="app_name">Rockbox</string> | ||
5 | </resources> | ||
diff --git a/android/src/org/rockbox/RockboxActivity.java b/android/src/org/rockbox/RockboxActivity.java new file mode 100644 index 0000000000..791cad90ff --- /dev/null +++ b/android/src/org/rockbox/RockboxActivity.java | |||
@@ -0,0 +1,148 @@ | |||
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 | } \ No newline at end of file | ||
diff --git a/android/src/org/rockbox/RockboxFramebuffer.java b/android/src/org/rockbox/RockboxFramebuffer.java new file mode 100644 index 0000000000..f947806bb4 --- /dev/null +++ b/android/src/org/rockbox/RockboxFramebuffer.java | |||
@@ -0,0 +1,98 @@ | |||
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 | } | ||
diff --git a/android/src/org/rockbox/RockboxPCM.java b/android/src/org/rockbox/RockboxPCM.java new file mode 100644 index 0000000000..f098df6991 --- /dev/null +++ b/android/src/org/rockbox/RockboxPCM.java | |||
@@ -0,0 +1,155 @@ | |||
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 | } | ||
diff --git a/android/src/org/rockbox/RockboxTimer.java b/android/src/org/rockbox/RockboxTimer.java new file mode 100644 index 0000000000..c7239b4ee6 --- /dev/null +++ b/android/src/org/rockbox/RockboxTimer.java | |||
@@ -0,0 +1,93 @@ | |||
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 | } | ||
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c index dd0f99ffd8..c680030fee 100644 --- a/apps/codecs/codec_crt0.c +++ b/apps/codecs/codec_crt0.c | |||
@@ -34,6 +34,10 @@ extern unsigned char plugin_end_addr[]; | |||
34 | 34 | ||
35 | extern enum codec_status codec_main(void); | 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 | enum codec_status codec_start(void) | 41 | enum codec_status codec_start(void) |
38 | { | 42 | { |
39 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 43 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
diff --git a/apps/codecs/libwavpack/wavpack.h b/apps/codecs/libwavpack/wavpack.h index 5b5385a521..ee7c969b4c 100644 --- a/apps/codecs/libwavpack/wavpack.h +++ b/apps/codecs/libwavpack/wavpack.h | |||
@@ -16,7 +16,9 @@ | |||
16 | 16 | ||
17 | typedef unsigned char uchar; | 17 | typedef unsigned char uchar; |
18 | typedef unsigned short ushort; | 18 | typedef unsigned short ushort; |
19 | #if 0 // unused and causing compiler errrors | ||
19 | typedef unsigned int uint; | 20 | typedef unsigned int uint; |
21 | #endif | ||
20 | 22 | ||
21 | #include <stdio.h> | 23 | #include <stdio.h> |
22 | 24 | ||
diff --git a/backdrops/cabbiev2.320x480x16.bmp b/backdrops/cabbiev2.320x480x16.bmp new file mode 100644 index 0000000000..6933fd0675 --- /dev/null +++ b/backdrops/cabbiev2.320x480x16.bmp | |||
Binary files differ | |||
diff --git a/bootloader/common.c b/bootloader/common.c index 362c3b4d11..1099b9f453 100644 --- a/bootloader/common.c +++ b/bootloader/common.c | |||
@@ -68,7 +68,7 @@ void reset_screen(void) | |||
68 | #endif | 68 | #endif |
69 | } | 69 | } |
70 | 70 | ||
71 | void printf(const char *format, ...) | 71 | int printf(const char *format, ...) |
72 | { | 72 | { |
73 | int len; | 73 | int len; |
74 | unsigned char *ptr; | 74 | unsigned char *ptr; |
@@ -91,6 +91,7 @@ void printf(const char *format, ...) | |||
91 | if(remote_line >= LCD_REMOTE_HEIGHT/SYSFONT_HEIGHT) | 91 | if(remote_line >= LCD_REMOTE_HEIGHT/SYSFONT_HEIGHT) |
92 | remote_line = 0; | 92 | remote_line = 0; |
93 | #endif | 93 | #endif |
94 | return len; | ||
94 | } | 95 | } |
95 | 96 | ||
96 | char *strerror(int error) | 97 | char *strerror(int error) |
diff --git a/bootloader/common.h b/bootloader/common.h index 6713585ad8..7d5425c9c8 100644 --- a/bootloader/common.h +++ b/bootloader/common.h | |||
@@ -41,7 +41,7 @@ extern bool verbose; | |||
41 | 41 | ||
42 | /* Functions common to all bootloaders */ | 42 | /* Functions common to all bootloaders */ |
43 | void reset_screen(void); | 43 | void reset_screen(void); |
44 | void printf(const char *format, ...); | 44 | int printf(const char *format, ...); |
45 | char *strerror(int error); | 45 | char *strerror(int error); |
46 | void error(int errortype, int error, bool shutdown); | 46 | void error(int errortype, int error, bool shutdown); |
47 | int load_firmware(unsigned char* buf, char* firmware, int buffer_size); | 47 | int load_firmware(unsigned char* buf, char* firmware, int buffer_size); |
diff --git a/firmware/SOURCES b/firmware/SOURCES index d8cfadef11..4092f71e04 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1698,3 +1698,14 @@ target/coldfire/mpio/fmradio_i2c-mpio.c | |||
1698 | #endif /* BOOTLOADER */ | 1698 | #endif /* BOOTLOADER */ |
1699 | #endif /* SIMULATOR */ | 1699 | #endif /* SIMULATOR */ |
1700 | #endif | 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 | ||
diff --git a/firmware/common/rbpaths.c b/firmware/common/rbpaths.c index 69bc1387ef..b63586c9f4 100644 --- a/firmware/common/rbpaths.c +++ b/firmware/common/rbpaths.c | |||
@@ -33,9 +33,13 @@ | |||
33 | void paths_init(void) | 33 | void paths_init(void) |
34 | { | 34 | { |
35 | /* make sure $HOME/.config/rockbox.org exists, it's needed for config.cfg */ | 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 | char home_path[MAX_PATH]; | 39 | char home_path[MAX_PATH]; |
37 | snprintf(home_path, sizeof(home_path), "%s/.config/rockbox.org", getenv("HOME")); | 40 | snprintf(home_path, sizeof(home_path), "%s/.config/rockbox.org", getenv("HOME")); |
38 | mkdir(home_path); | 41 | mkdir(home_path); |
42 | #endif | ||
39 | } | 43 | } |
40 | 44 | ||
41 | const char* get_user_file_path(const char *path, | 45 | const char* get_user_file_path(const char *path, |
@@ -50,7 +54,11 @@ const char* get_user_file_path(const char *path, | |||
50 | pos += ROCKBOX_DIR_LEN; | 54 | pos += ROCKBOX_DIR_LEN; |
51 | if (*pos == '/') pos += 1; | 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 | if (snprintf(buf, bufsize, "%s/.config/rockbox.org/%s", getenv("HOME"), pos) | 60 | if (snprintf(buf, bufsize, "%s/.config/rockbox.org/%s", getenv("HOME"), pos) |
61 | #endif | ||
54 | >= (int)bufsize) | 62 | >= (int)bufsize) |
55 | return NULL; | 63 | return NULL; |
56 | 64 | ||
diff --git a/firmware/drivers/audio/android.c b/firmware/drivers/audio/android.c new file mode 100644 index 0000000000..300bb08482 --- /dev/null +++ b/firmware/drivers/audio/android.c | |||
@@ -0,0 +1,61 @@ | |||
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 | } | ||
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index d4861aac5a..658dd1301c 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h | |||
@@ -66,7 +66,7 @@ | |||
66 | #elif defined(HAVE_AK4537) | 66 | #elif defined(HAVE_AK4537) |
67 | #include "ak4537.h" | 67 | #include "ak4537.h" |
68 | #endif | 68 | #endif |
69 | #if defined(HAVE_SDL_AUDIO) | 69 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |
70 | /* #include <SDL_audio.h> gives errors in other code areas, | 70 | /* #include <SDL_audio.h> gives errors in other code areas, |
71 | * we don't really need it here, so don't. but it should maybe be fixed */ | 71 | * we don't really need it here, so don't. but it should maybe be fixed */ |
72 | #ifndef SIMULATOR /* simulator gets values from the target .h files */ | 72 | #ifndef SIMULATOR /* simulator gets values from the target .h files */ |
diff --git a/firmware/export/config.h b/firmware/export/config.h index 1b8a782f39..3b59004549 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -78,8 +78,10 @@ | |||
78 | * bit fields to allow PLATFORM_HOSTED to be OR'ed e.g. with a | 78 | * bit fields to allow PLATFORM_HOSTED to be OR'ed e.g. with a |
79 | * possible future PLATFORM_ANDROID (some OSes might need totally different | 79 | * possible future PLATFORM_ANDROID (some OSes might need totally different |
80 | * handling to run on them than a stand-alone application) */ | 80 | * handling to run on them than a stand-alone application) */ |
81 | #define PLATFORM_NATIVE (1<<0) | 81 | #define PLATFORM_NATIVE (1<<0) |
82 | #define PLATFORM_HOSTED (1<<1) | 82 | #define PLATFORM_HOSTED (1<<1) |
83 | #define PLATFORM_ANDROID (1<<2) | ||
84 | #define PLATFORM_SDL (1<<3) | ||
83 | 85 | ||
84 | /* CONFIG_KEYPAD */ | 86 | /* CONFIG_KEYPAD */ |
85 | #define PLAYER_PAD 1 | 87 | #define PLAYER_PAD 1 |
@@ -427,6 +429,8 @@ Lyre prototype 1 */ | |||
427 | 429 | ||
428 | #elif defined(APPLICATION) | 430 | #elif defined(APPLICATION) |
429 | #include "config/application.h" | 431 | #include "config/application.h" |
432 | #define CONFIG_CPU 0 | ||
433 | #define CONFIG_STORAGE 0 | ||
430 | #else | 434 | #else |
431 | /* no known platform */ | 435 | /* no known platform */ |
432 | #endif | 436 | #endif |
@@ -689,11 +693,17 @@ Lyre prototype 1 */ | |||
689 | #define HAVE_EXTENDED_MESSAGING_AND_NAME | 693 | #define HAVE_EXTENDED_MESSAGING_AND_NAME |
690 | #define HAVE_WAKEUP_EXT_CB | 694 | #define HAVE_WAKEUP_EXT_CB |
691 | 695 | ||
696 | |||
697 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) | ||
698 | #define HAVE_PRIORITY_SCHEDULING | ||
699 | #endif | ||
700 | |||
692 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 701 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
693 | #define HAVE_PRIORITY_SCHEDULING | 702 | #define HAVE_PRIORITY_SCHEDULING |
694 | #define HAVE_SCHEDULER_BOOSTCTRL | 703 | #define HAVE_SCHEDULER_BOOSTCTRL |
695 | #endif /* PLATFORM_NATIVE */ | 704 | #endif /* PLATFORM_NATIVE */ |
696 | 705 | ||
706 | |||
697 | #define HAVE_SEMAPHORE_OBJECTS | 707 | #define HAVE_SEMAPHORE_OBJECTS |
698 | 708 | ||
699 | #if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC | 709 | #if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC |
diff --git a/firmware/export/config/application.h b/firmware/export/config/application.h index a5583ded75..988f0d51ac 100644 --- a/firmware/export/config/application.h +++ b/firmware/export/config/application.h | |||
@@ -4,11 +4,13 @@ | |||
4 | #define TARGET_TREE /* this target is using the target tree system */ | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* We don't run on hardware directly */ | 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 | /* For Rolo and boot loader */ | 12 | /* For Rolo and boot loader */ |
9 | /* | 13 | #define MODEL_NUMBER 100 |
10 | #define MODEL_NUMBER 24 | ||
11 | */ | ||
12 | 14 | ||
13 | #define MODEL_NAME "Rockbox" | 15 | #define MODEL_NAME "Rockbox" |
14 | 16 | ||
@@ -37,9 +39,17 @@ | |||
37 | /* define this if you would like tagcache to build on this target */ | 39 | /* define this if you would like tagcache to build on this target */ |
38 | #define HAVE_TAGCACHE | 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 | #define LCD_WIDTH 320 | 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 | #define LCD_DEPTH 16 | 53 | #define LCD_DEPTH 16 |
44 | #define LCD_PIXELFORMAT 565 | 54 | #define LCD_PIXELFORMAT 565 |
45 | 55 | ||
@@ -62,10 +72,10 @@ | |||
62 | #define CONFIG_CODEC SWCODEC | 72 | #define CONFIG_CODEC SWCODEC |
63 | 73 | ||
64 | #define CONFIG_KEYPAD COWON_D2_PAD | 74 | #define CONFIG_KEYPAD COWON_D2_PAD |
75 | |||
76 | #if (CONFIG_PLATFORM & PLATFORM_SDL) | ||
65 | /* Use SDL audio/pcm in a SDL app build */ | 77 | /* Use SDL audio/pcm in a SDL app build */ |
66 | #define HAVE_SDL | 78 | #define HAVE_SDL |
67 | |||
68 | #ifdef HAVE_SDL | ||
69 | #define HAVE_SDL_AUDIO | 79 | #define HAVE_SDL_AUDIO |
70 | #endif | 80 | #endif |
71 | 81 | ||
@@ -92,3 +102,5 @@ | |||
92 | 102 | ||
93 | /* Define this if a programmable hotkey is mapped */ | 103 | /* Define this if a programmable hotkey is mapped */ |
94 | //#define HAVE_HOTKEY | 104 | //#define HAVE_HOTKEY |
105 | |||
106 | #define BOOTDIR "/.rockbox" | ||
diff --git a/firmware/export/config/sim.h b/firmware/export/config/sim.h index 5dcb4f6f2d..066201ad08 100644 --- a/firmware/export/config/sim.h +++ b/firmware/export/config/sim.h | |||
@@ -99,7 +99,8 @@ | |||
99 | #define DEFAULT_BRIGHTNESS_SETTING MAX_BRIGHTNESS_SETTING | 99 | #define DEFAULT_BRIGHTNESS_SETTING MAX_BRIGHTNESS_SETTING |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | #define CONFIG_PLATFORM (PLATFORM_HOSTED|PLATFORM_SDL) | ||
102 | #define HAVE_SDL | 103 | #define HAVE_SDL |
103 | #define HAVE_SDL_AUDIO | 104 | #define HAVE_SDL_AUDIO |
104 | #define CONFIG_PLATFORM PLATFORM_HOSTED | 105 | |
105 | #define _ISOC99_SOURCE 1 | 106 | #define _ISOC99_SOURCE 1 |
diff --git a/firmware/export/debug.h b/firmware/export/debug.h index f7f0f32426..f19a96c526 100644 --- a/firmware/export/debug.h +++ b/firmware/export/debug.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #ifndef DEBUG_H | 21 | #ifndef DEBUG_H |
22 | #define DEBUG_H | 22 | #define DEBUG_H |
23 | 23 | ||
24 | #include "config.h" | ||
24 | #include "gcc_extensions.h" | 25 | #include "gcc_extensions.h" |
25 | 26 | ||
26 | extern void debug_init(void); | 27 | extern void debug_init(void); |
@@ -34,7 +35,11 @@ extern void ldebugf(const char* file, int line, const char *fmt, ...) | |||
34 | /* */ | 35 | /* */ |
35 | #if defined(SIMULATOR) && !defined(__PCTOOL__) | 36 | #if defined(SIMULATOR) && !defined(__PCTOOL__) |
36 | #define DEBUGF debugf | 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 | #else | 43 | #else |
39 | #if defined(DEBUG) | 44 | #if defined(DEBUG) |
40 | 45 | ||
diff --git a/firmware/export/thread.h b/firmware/export/thread.h index c4b7d1fa22..2853c0b121 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h | |||
@@ -79,9 +79,19 @@ | |||
79 | 79 | ||
80 | #define MAXTHREADS (BASETHREADS+TARGET_EXTRA_THREADS) | 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 | #define DEFAULT_STACK_SIZE 0x400 /* Bytes */ | 88 | #define DEFAULT_STACK_SIZE 0x400 /* Bytes */ |
89 | #else | ||
90 | #define DEFAULT_STACK_SIZE 0x1000 /* Bytes */ | ||
91 | #endif | ||
92 | |||
83 | 93 | ||
84 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 94 | #if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_ANDROID)) |
85 | /* Need to keep structures inside the header file because debug_menu | 95 | /* Need to keep structures inside the header file because debug_menu |
86 | * needs them. */ | 96 | * needs them. */ |
87 | #ifdef CPU_COLDFIRE | 97 | #ifdef CPU_COLDFIRE |
@@ -101,7 +111,7 @@ struct regs | |||
101 | uint32_t pr; /* 32 - Procedure register */ | 111 | uint32_t pr; /* 32 - Procedure register */ |
102 | uint32_t start; /* 36 - Thread start address, or NULL when started */ | 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 | struct regs | 115 | struct regs |
106 | { | 116 | { |
107 | uint32_t r[8]; /* 0-28 - Registers r4-r11 */ | 117 | uint32_t r[8]; /* 0-28 - Registers r4-r11 */ |
diff --git a/firmware/sound.c b/firmware/sound.c index 76f1dd0df6..4cc63f4583 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -273,7 +273,7 @@ static void set_prescaled_volume(void) | |||
273 | 273 | ||
274 | #elif defined(HAVE_TLV320) || defined(HAVE_WM8978) || defined(HAVE_WM8985) | 274 | #elif defined(HAVE_TLV320) || defined(HAVE_WM8978) || defined(HAVE_WM8985) |
275 | audiohw_set_headphone_vol(tenthdb2master(l), tenthdb2master(r)); | 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 | audiohw_set_volume(current_volume); | 277 | audiohw_set_volume(current_volume); |
278 | #endif | 278 | #endif |
279 | #else /* HAVE_SDL_AUDIO */ | 279 | #else /* HAVE_SDL_AUDIO */ |
diff --git a/firmware/target/hosted/android/app/adc-target.h b/firmware/target/hosted/android/app/adc-target.h new file mode 100644 index 0000000000..f8069be6f5 --- /dev/null +++ b/firmware/target/hosted/android/app/adc-target.h | |||
@@ -0,0 +1,25 @@ | |||
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__ */ | ||
diff --git a/firmware/target/hosted/android/app/backlight-target.h b/firmware/target/hosted/android/app/backlight-target.h new file mode 100644 index 0000000000..f753e7c1dd --- /dev/null +++ b/firmware/target/hosted/android/app/backlight-target.h | |||
@@ -0,0 +1,25 @@ | |||
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__ */ | ||
diff --git a/firmware/target/hosted/android/app/button-application.c b/firmware/target/hosted/android/app/button-application.c new file mode 100644 index 0000000000..a27f769718 --- /dev/null +++ b/firmware/target/hosted/android/app/button-application.c | |||
@@ -0,0 +1,29 @@ | |||
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 | } | ||
diff --git a/firmware/target/hosted/android/app/button-target.h b/firmware/target/hosted/android/app/button-target.h new file mode 100644 index 0000000000..329ed651af --- /dev/null +++ b/firmware/target/hosted/android/app/button-target.h | |||
@@ -0,0 +1,64 @@ | |||
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_ */ | ||
diff --git a/firmware/target/hosted/android/app/i2c-target.h b/firmware/target/hosted/android/app/i2c-target.h new file mode 100644 index 0000000000..89f0436b9e --- /dev/null +++ b/firmware/target/hosted/android/app/i2c-target.h | |||
@@ -0,0 +1,25 @@ | |||
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__ */ | ||
diff --git a/firmware/target/hosted/android/app/usb-target.h b/firmware/target/hosted/android/app/usb-target.h new file mode 100644 index 0000000000..10e04677f9 --- /dev/null +++ b/firmware/target/hosted/android/app/usb-target.h | |||
@@ -0,0 +1,25 @@ | |||
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__ */ | ||
diff --git a/firmware/target/hosted/android/button-android.c b/firmware/target/hosted/android/button-android.c new file mode 100644 index 0000000000..67e8ca1f89 --- /dev/null +++ b/firmware/target/hosted/android/button-android.c | |||
@@ -0,0 +1,87 @@ | |||
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 | } | ||
diff --git a/firmware/target/hosted/android/buttonmap.h b/firmware/target/hosted/android/buttonmap.h new file mode 100644 index 0000000000..e90b8a40d4 --- /dev/null +++ b/firmware/target/hosted/android/buttonmap.h | |||
@@ -0,0 +1,43 @@ | |||
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__ */ | ||
diff --git a/firmware/target/hosted/android/kernel-android.c b/firmware/target/hosted/android/kernel-android.c new file mode 100644 index 0000000000..9594516460 --- /dev/null +++ b/firmware/target/hosted/android/kernel-android.c | |||
@@ -0,0 +1,106 @@ | |||
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 | } | ||
diff --git a/firmware/target/hosted/android/lcd-android.c b/firmware/target/hosted/android/lcd-android.c new file mode 100644 index 0000000000..ef4004ef2a --- /dev/null +++ b/firmware/target/hosted/android/lcd-android.c | |||
@@ -0,0 +1,291 @@ | |||
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 | } | ||
diff --git a/firmware/target/hosted/android/pcm-android.c b/firmware/target/hosted/android/pcm-android.c new file mode 100644 index 0000000000..91978f422b --- /dev/null +++ b/firmware/target/hosted/android/pcm-android.c | |||
@@ -0,0 +1,174 @@ | |||
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 | } | ||
diff --git a/firmware/target/hosted/android/system-android.c b/firmware/target/hosted/android/system-android.c new file mode 100644 index 0000000000..07dff2ed56 --- /dev/null +++ b/firmware/target/hosted/android/system-android.c | |||
@@ -0,0 +1,59 @@ | |||
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 | } | ||
diff --git a/firmware/target/hosted/android/system-target.h b/firmware/target/hosted/android/system-target.h new file mode 100644 index 0000000000..210d191d6c --- /dev/null +++ b/firmware/target/hosted/android/system-target.h | |||
@@ -0,0 +1,39 @@ | |||
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 | |||
diff --git a/firmware/target/hosted/android/thread-android-arm.c b/firmware/target/hosted/android/thread-android-arm.c new file mode 100644 index 0000000000..baf8b84b65 --- /dev/null +++ b/firmware/target/hosted/android/thread-android-arm.c | |||
@@ -0,0 +1,98 @@ | |||
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 | |||
diff --git a/firmware/thread.c b/firmware/thread.c index c00fc36e3f..b3d8ec3970 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -123,8 +123,13 @@ static struct core_entry cores[NUM_CORES] IBSS_ATTR; | |||
123 | struct thread_entry threads[MAXTHREADS] IBSS_ATTR; | 123 | struct thread_entry threads[MAXTHREADS] IBSS_ATTR; |
124 | 124 | ||
125 | static const char main_thread_name[] = "main"; | 125 | static const char main_thread_name[] = "main"; |
126 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | ||
126 | extern uintptr_t stackbegin[]; | 127 | extern uintptr_t stackbegin[]; |
127 | extern uintptr_t stackend[]; | 128 | extern uintptr_t stackend[]; |
129 | #else | ||
130 | extern uintptr_t *stackbegin; | ||
131 | extern uintptr_t *stackend; | ||
132 | #endif | ||
128 | 133 | ||
129 | static inline void core_sleep(IF_COP_VOID(unsigned int core)) | 134 | static inline void core_sleep(IF_COP_VOID(unsigned int core)) |
130 | __attribute__((always_inline)); | 135 | __attribute__((always_inline)); |
@@ -170,7 +175,9 @@ void switch_thread(void) | |||
170 | /**************************************************************************** | 175 | /**************************************************************************** |
171 | * Processor-specific section - include necessary core support | 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 | #include "thread-arm.c" | 181 | #include "thread-arm.c" |
175 | #if defined (CPU_PP) | 182 | #if defined (CPU_PP) |
176 | #include "thread-pp.c" | 183 | #include "thread-pp.c" |
@@ -1150,7 +1157,7 @@ void switch_thread(void) | |||
1150 | store_context(&thread->context); | 1157 | store_context(&thread->context); |
1151 | 1158 | ||
1152 | /* Check if the current thread stack is overflown */ | 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 | thread_stkov(thread); | 1161 | thread_stkov(thread); |
1155 | 1162 | ||
1156 | #if NUM_CORES > 1 | 1163 | #if NUM_CORES > 1 |
@@ -2319,7 +2326,9 @@ static int stack_usage(uintptr_t *stackptr, size_t stack_size) | |||
2319 | */ | 2326 | */ |
2320 | int thread_stack_usage(const struct thread_entry *thread) | 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 | #if NUM_CORES > 1 | 2334 | #if NUM_CORES > 1 |
diff --git a/tools/buildzip.pl b/tools/buildzip.pl index 7a127dea20..094214de72 100755 --- a/tools/buildzip.pl +++ b/tools/buildzip.pl | |||
@@ -631,6 +631,8 @@ sub runone { | |||
631 | } | 631 | } |
632 | else { | 632 | else { |
633 | unless (".rockbox" eq $rbdir) { | 633 | unless (".rockbox" eq $rbdir) { |
634 | mkpath($rbdir); | ||
635 | rmtree($rbdir); | ||
634 | move(".rockbox", $rbdir); | 636 | move(".rockbox", $rbdir); |
635 | print "mv .rockbox $rbdir\n" if $verbose; | 637 | print "mv .rockbox $rbdir\n" if $verbose; |
636 | } | 638 | } |
diff --git a/tools/configure b/tools/configure index ce23c2a965..7504d562c9 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -14,6 +14,7 @@ CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes -pipe" | |||
14 | # global LD options for all platforms | 14 | # global LD options for all platforms |
15 | GLOBAL_LDOPTS="" | 15 | GLOBAL_LDOPTS="" |
16 | 16 | ||
17 | extradefines="" | ||
17 | use_logf="#undef ROCKBOX_HAS_LOGF" | 18 | use_logf="#undef ROCKBOX_HAS_LOGF" |
18 | use_bootchart="#undef DO_BOOTCHART" | 19 | use_bootchart="#undef DO_BOOTCHART" |
19 | 20 | ||
@@ -25,7 +26,10 @@ bindir= | |||
25 | libdir= | 26 | libdir= |
26 | bindir_full= | 27 | bindir_full= |
27 | libdir_full= | 28 | libdir_full= |
28 | 29 | ||
30 | app_platform= | ||
31 | app_lcd_width= | ||
32 | app_lcd_height= | ||
29 | # | 33 | # |
30 | # Begin Function Definitions | 34 | # Begin Function Definitions |
31 | # | 35 | # |
@@ -47,6 +51,59 @@ prefixtools () { | |||
47 | OC=${prefix}objcopy | 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 | findarmgcc() { | 107 | findarmgcc() { |
51 | if [ "$ARG_ARM_EABI" != "0" ]; then | 108 | if [ "$ARG_ARM_EABI" != "0" ]; then |
52 | prefixtools arm-elf-eabi- | 109 | prefixtools arm-elf-eabi- |
@@ -102,6 +159,15 @@ findsdl(){ | |||
102 | done | 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 | simcc () { | 171 | simcc () { |
106 | 172 | ||
107 | # default tool setup for native building | 173 | # default tool setup for native building |
@@ -114,15 +180,17 @@ simcc () { | |||
114 | GCCOPTIMIZE='' | 180 | GCCOPTIMIZE='' |
115 | LDOPTS='-lm' # button-sdl.c uses sqrt() | 181 | LDOPTS='-lm' # button-sdl.c uses sqrt() |
116 | 182 | ||
117 | # default output binary name | 183 | # default output binary name, don't override app_get_platform() |
118 | output="rockboxui" | 184 | if [ "$app_type" != "sdl-app" ]; then |
185 | output="rockboxui" | ||
186 | fi | ||
119 | 187 | ||
120 | # default share option, override below if needed | 188 | # default share option, override below if needed |
121 | SHARED_FLAG="-shared" | 189 | SHARED_FLAG="-shared" |
122 | 190 | ||
123 | if [ "$win32crosscompile" = "yes" ]; then | 191 | if [ "$win32crosscompile" = "yes" ]; then |
124 | LDOPTS="$LDOPTS -mconsole" | 192 | LDOPTS="$LDOPTS -mconsole" |
125 | output="rockboxui.exe" | 193 | output="$output.exe" |
126 | winbuild="yes" | 194 | winbuild="yes" |
127 | else | 195 | else |
128 | case $uname in | 196 | case $uname in |
@@ -130,7 +198,7 @@ simcc () { | |||
130 | echo "Cygwin host detected" | 198 | echo "Cygwin host detected" |
131 | 199 | ||
132 | LDOPTS="$LDOPTS -mconsole" | 200 | LDOPTS="$LDOPTS -mconsole" |
133 | output="rockboxui.exe" | 201 | output="$output.exe" |
134 | winbuild="yes" | 202 | winbuild="yes" |
135 | ;; | 203 | ;; |
136 | 204 | ||
@@ -138,7 +206,7 @@ simcc () { | |||
138 | echo "MinGW host detected" | 206 | echo "MinGW host detected" |
139 | 207 | ||
140 | LDOPTS="$LDOPTS -mconsole" | 208 | LDOPTS="$LDOPTS -mconsole" |
141 | output="rockboxui.exe" | 209 | output="$output.exe" |
142 | winbuild="yes" | 210 | winbuild="yes" |
143 | ;; | 211 | ;; |
144 | 212 | ||
@@ -188,6 +256,7 @@ simcc () { | |||
188 | LDOPTS="$LDOPTS `$sdl --libs`" | 256 | LDOPTS="$LDOPTS `$sdl --libs`" |
189 | fi | 257 | fi |
190 | fi | 258 | fi |
259 | |||
191 | 260 | ||
192 | GCCOPTS="$GCCOPTS -I\$(SIMDIR)" | 261 | GCCOPTS="$GCCOPTS -I\$(SIMDIR)" |
193 | 262 | ||
@@ -379,6 +448,18 @@ mipselcc () { | |||
379 | gccchoice="4.1.2" | 448 | gccchoice="4.1.2" |
380 | } | 449 | } |
381 | 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" | ||
461 | } | ||
462 | |||
382 | whichadvanced () { | 463 | whichadvanced () { |
383 | atype=`echo "$1" | cut -c 2-` | 464 | atype=`echo "$1" | cut -c 2-` |
384 | ################################################################## | 465 | ################################################################## |
@@ -975,7 +1056,7 @@ cat <<EOF | |||
975 | 143) YP-S3 160) Vibe 500 131) Mini2440 | 1056 | 143) YP-S3 160) Vibe 500 131) Mini2440 |
976 | 1057 | ||
977 | ==MPIO== == Application == | 1058 | ==MPIO== == Application == |
978 | 170) HD200 200) SDL 320x240 | 1059 | 170) HD200 200) Application |
979 | 1060 | ||
980 | EOF | 1061 | EOF |
981 | 1062 | ||
@@ -2609,40 +2690,23 @@ fi | |||
2609 | modelname="application" | 2690 | modelname="application" |
2610 | target="-DAPPLICATION" | 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 | need_full_path="yes" | 2693 | need_full_path="yes" |
2694 | app_get_platform | ||
2630 | 2695 | ||
2631 | memory=8 | 2696 | memory=8 |
2632 | uname=`uname` | 2697 | uname=`uname` |
2633 | simcc "sdl-app" | 2698 | |
2699 | appcc "$app_platform" | ||
2634 | tool="cp " | 2700 | tool="cp " |
2635 | boottool="cp " | 2701 | boottool="cp " |
2636 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" | 2702 | bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" |
2637 | bmp2rb_native="$rootdir/tools/bmp2rb -f 4" | 2703 | bmp2rb_native="$rootdir/tools/bmp2rb -f 4" |
2638 | output="rockbox" | ||
2639 | bootoutput="bootloader-cowond2.bin" | ||
2640 | appextra="recorder:gui:radio" | 2704 | appextra="recorder:gui:radio" |
2641 | plugins="" | 2705 | plugins="" |
2642 | swcodec="yes" | 2706 | swcodec="yes" |
2643 | # architecture, manufacturer and model for the target-tree build | 2707 | # architecture, manufacturer and model for the target-tree build |
2644 | t_cpu="hosted" | 2708 | t_cpu="hosted" |
2645 | t_manufacturer="sdl" | 2709 | t_manufacturer="$app_platform" |
2646 | t_model="app" | 2710 | t_model="app" |
2647 | ;; | 2711 | ;; |
2648 | 2712 | ||
@@ -2732,7 +2796,7 @@ fi | |||
2732 | [Ii]) | 2796 | [Ii]) |
2733 | appsdir='\$(ROOTDIR)/bootloader' | 2797 | appsdir='\$(ROOTDIR)/bootloader' |
2734 | apps="bootloader" | 2798 | apps="bootloader" |
2735 | extradefines="-DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections" | 2799 | extradefines="$extradefines -DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections" |
2736 | bootloader="1" | 2800 | bootloader="1" |
2737 | echo "e200R-installer build selected" | 2801 | echo "e200R-installer build selected" |
2738 | ;; | 2802 | ;; |
@@ -2743,11 +2807,11 @@ fi | |||
2743 | variant=`input` | 2807 | variant=`input` |
2744 | case $variant in | 2808 | case $variant in |
2745 | 4) | 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 | echo "c240 eraser build selected" | 2811 | echo "c240 eraser build selected" |
2748 | ;; | 2812 | ;; |
2749 | 5) | 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 | echo "c240 eraser build selected" | 2815 | echo "c240 eraser build selected" |
2752 | ;; | 2816 | ;; |
2753 | esac | 2817 | esac |
@@ -2771,7 +2835,7 @@ fi | |||
2771 | output=$bootoutput | 2835 | output=$bootoutput |
2772 | fi | 2836 | fi |
2773 | fi | 2837 | fi |
2774 | extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections" | 2838 | extradefines="$extradefines -DBOOTLOADER -ffunction-sections -fdata-sections" |
2775 | bootloader="1" | 2839 | bootloader="1" |
2776 | echo "Bootloader build selected" | 2840 | echo "Bootloader build selected" |
2777 | ;; | 2841 | ;; |
@@ -2782,7 +2846,7 @@ fi | |||
2782 | fi | 2846 | fi |
2783 | debug="-DDEBUG" | 2847 | debug="-DDEBUG" |
2784 | simulator="yes" | 2848 | simulator="yes" |
2785 | extradefines="-DSIMULATOR" | 2849 | extradefines="$extradefines -DSIMULATOR" |
2786 | archosrom="" | 2850 | archosrom="" |
2787 | flash="" | 2851 | flash="" |
2788 | echo "Simulator build selected" | 2852 | echo "Simulator build selected" |
@@ -2792,7 +2856,7 @@ fi | |||
2792 | whichadvanced $btype | 2856 | whichadvanced $btype |
2793 | ;; | 2857 | ;; |
2794 | [Gg]) | 2858 | [Gg]) |
2795 | extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES | 2859 | extradefines="$extradefines -DSTUB" # for target makefile symbol EXTRA_DEFINES |
2796 | appsdir='\$(ROOTDIR)/gdb' | 2860 | appsdir='\$(ROOTDIR)/gdb' |
2797 | apps="stub" | 2861 | apps="stub" |
2798 | case $modelname in | 2862 | case $modelname in |
@@ -2815,7 +2879,7 @@ fi | |||
2815 | toolset=''; | 2879 | toolset=''; |
2816 | t_cpu=''; | 2880 | t_cpu=''; |
2817 | GCCOPTS=''; | 2881 | GCCOPTS=''; |
2818 | extradefines="-DDEBUG" | 2882 | extradefines="$extradefines -DDEBUG" |
2819 | appsdir='\$(ROOTDIR)/tools/checkwps'; | 2883 | appsdir='\$(ROOTDIR)/tools/checkwps'; |
2820 | output='checkwps.'${modelname}; | 2884 | output='checkwps.'${modelname}; |
2821 | archosrom=''; | 2885 | archosrom=''; |
@@ -3048,6 +3112,8 @@ sed > autoconf.h \ | |||
3048 | -e "s<@have_backlight@<$have_backlight<g" \ | 3112 | -e "s<@have_backlight@<$have_backlight<g" \ |
3049 | -e "s<@have_fmradio_in@<$have_fmradio_in<g" \ | 3113 | -e "s<@have_fmradio_in@<$have_fmradio_in<g" \ |
3050 | -e "s<@have_ata_poweroff@<$have_ata_poweroff<g" \ | 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 | <<EOF | 3117 | <<EOF |
3052 | /* This header was made by configure */ | 3118 | /* This header was made by configure */ |
3053 | #ifndef __BUILD_AUTOCONF_H | 3119 | #ifndef __BUILD_AUTOCONF_H |
@@ -3075,6 +3141,10 @@ sed > autoconf.h \ | |||
3075 | @config_rtc@ | 3141 | @config_rtc@ |
3076 | @have_rtc_alarm@ | 3142 | @have_rtc_alarm@ |
3077 | 3143 | ||
3144 | /* lcd dimensions for application builds from configure */ | ||
3145 | @lcd_width@ | ||
3146 | @lcd_height@ | ||
3147 | |||
3078 | /* root of Rockbox */ | 3148 | /* root of Rockbox */ |
3079 | #define ROCKBOX_DIR "@RBDIR@" | 3149 | #define ROCKBOX_DIR "@RBDIR@" |
3080 | #define ROCKBOX_BINARY_PATH "@binpath@" | 3150 | #define ROCKBOX_BINARY_PATH "@binpath@" |
@@ -3089,6 +3159,10 @@ if test -n "$t_cpu"; then | |||
3089 | TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/" | 3159 | TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/" |
3090 | TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/" | 3160 | TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/" |
3091 | fi | 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" | ||
3165 | fi | ||
3092 | TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer" | 3166 | TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer" |
3093 | TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu" | 3167 | TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu" |
3094 | GCCOPTS="$GCCOPTS" | 3168 | GCCOPTS="$GCCOPTS" |
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 260e880b62..4c0fa33be5 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -25,7 +25,11 @@ | |||
25 | #include <stdarg.h> | 25 | #include <stdarg.h> |
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <time.h> | 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 | #include <sys/statvfs.h> | 33 | #include <sys/statvfs.h> |
30 | #endif | 34 | #endif |
31 | 35 | ||
@@ -41,14 +45,18 @@ | |||
41 | #endif | 45 | #endif |
42 | 46 | ||
43 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | #if (CONFIG_PLATFORM & PLATFORM_SDL) | ||
44 | #include <SDL.h> | 49 | #include <SDL.h> |
45 | #include <SDL_thread.h> | 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 | #include "thread.h" | 56 | #include "thread.h" |
47 | #include "kernel.h" | 57 | #include "kernel.h" |
48 | #include "debug.h" | 58 | #include "debug.h" |
49 | #include "config.h" | ||
50 | #include "ata.h" /* for IF_MV2 et al. */ | 59 | #include "ata.h" /* for IF_MV2 et al. */ |
51 | #include "thread-sdl.h" | ||
52 | #include "rbpaths.h" | 60 | #include "rbpaths.h" |
53 | 61 | ||
54 | /* keep this in sync with file.h! */ | 62 | /* keep this in sync with file.h! */ |
@@ -193,7 +201,7 @@ static unsigned int rockbox2sim(int opt) | |||
193 | /** Simulator I/O engine routines **/ | 201 | /** Simulator I/O engine routines **/ |
194 | #define IO_YIELD_THRESHOLD 512 | 202 | #define IO_YIELD_THRESHOLD 512 |
195 | 203 | ||
196 | enum | 204 | enum io_dir |
197 | { | 205 | { |
198 | IO_READ, | 206 | IO_READ, |
199 | IO_WRITE, | 207 | IO_WRITE, |
@@ -225,7 +233,7 @@ int ata_spinup_time(void) | |||
225 | return HZ; | 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 | void *mythread = NULL; | 238 | void *mythread = NULL; |
231 | ssize_t result; | 239 | ssize_t result; |
@@ -246,6 +254,9 @@ static ssize_t io_trigger_and_wait(int cmd) | |||
246 | case IO_WRITE: | 254 | case IO_WRITE: |
247 | result = write(io.fd, io.buf, io.count); | 255 | result = write(io.fd, io.buf, io.count); |
248 | break; | 256 | break; |
257 | /* shut up gcc */ | ||
258 | default: | ||
259 | result = -1; | ||
249 | } | 260 | } |
250 | 261 | ||
251 | /* Regain our status as current */ | 262 | /* Regain our status as current */ |
@@ -480,7 +491,7 @@ void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) | |||
480 | if (free) | 491 | if (free) |
481 | *free = free_clusters * secperclus / 2 * (bytespersec / 512); | 492 | *free = free_clusters * secperclus / 2 * (bytespersec / 512); |
482 | } | 493 | } |
483 | #else | 494 | #elif HAVE_STATVFS |
484 | struct statvfs vfs; | 495 | struct statvfs vfs; |
485 | 496 | ||
486 | if (!statvfs(".", &vfs)) { | 497 | if (!statvfs(".", &vfs)) { |
@@ -490,9 +501,9 @@ void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) | |||
490 | *size = vfs.f_blocks / 2 * (vfs.f_frsize / 512); | 501 | *size = vfs.f_blocks / 2 * (vfs.f_frsize / 512); |
491 | if (free) | 502 | if (free) |
492 | *free = vfs.f_bfree / 2 * (vfs.f_frsize / 512); | 503 | *free = vfs.f_bfree / 2 * (vfs.f_frsize / 512); |
493 | } | 504 | } else |
494 | #endif | 505 | #endif |
495 | else { | 506 | { |
496 | if (size) | 507 | if (size) |
497 | *size = 0; | 508 | *size = 0; |
498 | if (free) | 509 | if (free) |
@@ -537,9 +548,19 @@ void *sim_codec_load_ram(char* codecptr, int size, void **pd) | |||
537 | to find an unused filename */ | 548 | to find an unused filename */ |
538 | for (codec_count = 0; codec_count < 10; codec_count++) | 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 | char name[MAX_PATH]; | 560 | char name[MAX_PATH]; |
541 | const char *_name = get_user_file_path(ROCKBOX_DIR, 0, name, sizeof(name)); | 561 | const char *_name = get_user_file_path(ROCKBOX_DIR, 0, name, sizeof(name)); |
542 | snprintf(path, sizeof(path), "%s/_temp_codec%d.dll", get_sim_pathname(_name), codec_count); | 562 | snprintf(path, sizeof(path), "%s/_temp_codec%d.dll", get_sim_pathname(_name), codec_count); |
563 | #endif | ||
543 | fd = OPEN(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); | 564 | fd = OPEN(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); |
544 | if (fd >= 0) | 565 | if (fd >= 0) |
545 | break; /* Created a file ok */ | 566 | break; /* Created a file ok */ |
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index 6d7d7de06b..a9011b9aa5 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c | |||
@@ -21,8 +21,6 @@ | |||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <time.h> | 22 | #include <time.h> |
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | #include "thread-sdl.h" | ||
25 | |||
26 | #include "debug.h" | 24 | #include "debug.h" |
27 | 25 | ||
28 | #include "screens.h" | 26 | #include "screens.h" |
@@ -35,7 +33,6 @@ | |||
35 | 33 | ||
36 | #include "ata.h" /* for volume definitions */ | 34 | #include "ata.h" /* for volume definitions */ |
37 | 35 | ||
38 | extern char having_new_lcd; | ||
39 | static bool storage_spinning = false; | 36 | static bool storage_spinning = false; |
40 | 37 | ||
41 | #if CONFIG_CODEC != SWCODEC | 38 | #if CONFIG_CODEC != SWCODEC |
@@ -211,10 +208,13 @@ bool spdif_powered(void) | |||
211 | } | 208 | } |
212 | #endif | 209 | #endif |
213 | 210 | ||
211 | #ifdef ARCHOS_PLAYER | ||
214 | bool is_new_player(void) | 212 | bool is_new_player(void) |
215 | { | 213 | { |
214 | extern char having_new_lcd; | ||
216 | return having_new_lcd; | 215 | return having_new_lcd; |
217 | } | 216 | } |
217 | #endif | ||
218 | 218 | ||
219 | #ifdef HAVE_USB_POWER | 219 | #ifdef HAVE_USB_POWER |
220 | bool usb_powered(void) | 220 | bool usb_powered(void) |
diff --git a/uisimulator/uisimulator.make b/uisimulator/uisimulator.make index b06b48c0d2..dcbd79988f 100644 --- a/uisimulator/uisimulator.make +++ b/uisimulator/uisimulator.make | |||
@@ -30,7 +30,6 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP) | |||
30 | $(SILENT)$(shell rm -f $@) | 30 | $(SILENT)$(shell rm -f $@) |
31 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null | 31 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null |
32 | 32 | ||
33 | # SIMLIB needs to be linked twice for some reason | ||
34 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) | 33 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) |
35 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) | 34 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) |
36 | 35 | ||
diff --git a/wps/WPSLIST b/wps/WPSLIST index 3068f48513..938caa13fa 100644 --- a/wps/WPSLIST +++ b/wps/WPSLIST | |||
@@ -292,6 +292,7 @@ RSBS: | |||
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. | 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 | # Preferred font (including .fnt extension - leave blank for player): | 294 | # Preferred font (including .fnt extension - leave blank for player): |
295 | Font.320x480x16: 16-Adobe-Helvetica.fnt | ||
295 | Font.320x240x16: 15-Adobe-Helvetica.fnt | 296 | Font.320x240x16: 15-Adobe-Helvetica.fnt |
296 | Font.240x400x16: 16-Adobe-Helvetica.fnt | 297 | Font.240x400x16: 16-Adobe-Helvetica.fnt |
297 | Font.240x320x16: 15-Adobe-Helvetica.fnt | 298 | Font.240x320x16: 15-Adobe-Helvetica.fnt |
@@ -320,6 +321,7 @@ line selector text color: 000000 | |||
320 | filetype colours: | 321 | filetype colours: |
321 | 322 | ||
322 | #backdrop - remember this is the source file name in your SVN folder, not dest name! | 323 | #backdrop - remember this is the source file name in your SVN folder, not dest name! |
324 | backdrop.320x480x16: backdrops/cabbiev2.320x480x16.bmp | ||
323 | backdrop.320x240x16: backdrops/cabbiev2.320x240x16.bmp | 325 | backdrop.320x240x16: backdrops/cabbiev2.320x240x16.bmp |
324 | backdrop.128x128x16: backdrops/cabbiev2.128x128x16.bmp | 326 | backdrop.128x128x16: backdrops/cabbiev2.128x128x16.bmp |
325 | backdrop.132x80x16: backdrops/cabbiev2.132x80x16.bmp | 327 | backdrop.132x80x16: backdrops/cabbiev2.132x80x16.bmp |
@@ -333,6 +335,7 @@ backdrop.240x320x16: backdrops/cabbiev2.240x320x16.bmp | |||
333 | backdrop.240x400x16: backdrops/cabbiev2.240x400x16.bmp | 335 | backdrop.240x400x16: backdrops/cabbiev2.240x400x16.bmp |
334 | 336 | ||
335 | #selection bar settings for color targets | 337 | #selection bar settings for color targets |
338 | selector type.320x480x16: bar (gradient) | ||
336 | selector type.320x240x16: bar (gradient) | 339 | selector type.320x240x16: bar (gradient) |
337 | selector type.128x128x16: bar (gradient) | 340 | selector type.128x128x16: bar (gradient) |
338 | selector type.132x80x16: bar (gradient) | 341 | selector type.132x80x16: bar (gradient) |
@@ -346,6 +349,7 @@ selector type.160x128x2: bar (inverse) | |||
346 | selector type.138x110x2: bar (inverse) | 349 | selector type.138x110x2: bar (inverse) |
347 | 350 | ||
348 | #icons | 351 | #icons |
352 | iconset.320x480x16: icons/tango_small.bmp | ||
349 | iconset.320x240x16: icons/tango_small.bmp | 353 | iconset.320x240x16: icons/tango_small.bmp |
350 | iconset.128x128x16: icons/tango_small.bmp | 354 | iconset.128x128x16: icons/tango_small.bmp |
351 | iconset.132x80x16: icons/tango_small.bmp | 355 | iconset.132x80x16: icons/tango_small.bmp |
@@ -359,6 +363,7 @@ iconset.240x320x16: icons/tango_small.bmp | |||
359 | iconset.240x400x16: icons/tango_small.bmp | 363 | iconset.240x400x16: icons/tango_small.bmp |
360 | 364 | ||
361 | #viewer icons | 365 | #viewer icons |
366 | viewers iconset.320x480x16: icons/tango_small_viewers.bmp | ||
362 | viewers iconset.320x240x16: icons/tango_small_viewers.bmp | 367 | viewers iconset.320x240x16: icons/tango_small_viewers.bmp |
363 | viewers iconset.128x128x16: icons/tango_small_viewers.bmp | 368 | viewers iconset.128x128x16: icons/tango_small_viewers.bmp |
364 | viewers iconset.132x80x16: icons/tango_small_viewers.bmp | 369 | viewers iconset.132x80x16: icons/tango_small_viewers.bmp |
diff --git a/wps/cabbiev2.320x480x16.wps b/wps/cabbiev2.320x480x16.wps new file mode 100644 index 0000000000..a64fa6fcf7 --- /dev/null +++ b/wps/cabbiev2.320x480x16.wps | |||
@@ -0,0 +1,79 @@ | |||
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 | |||
diff --git a/wps/cabbiev2/wpsbackdrop-320x480x16.bmp b/wps/cabbiev2/wpsbackdrop-320x480x16.bmp new file mode 100644 index 0000000000..3278c0d965 --- /dev/null +++ b/wps/cabbiev2/wpsbackdrop-320x480x16.bmp | |||
Binary files differ | |||