summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/bitmaps/native/SOURCES10
-rw-r--r--apps/bitmaps/native/hibyicon.70x70x16.bmpbin0 -> 14978 bytes
-rw-r--r--apps/bitmaps/native/rockboxicon.70x70x16.bmpbin0 -> 14978 bytes
-rw-r--r--apps/bitmaps/native/toolsicon.70x70x16.bmpbin0 -> 14978 bytes
-rw-r--r--apps/keymaps/keymap-agptekrocker.c254
-rw-r--r--apps/recorder/bmp.c2
-rw-r--r--bootloader/SOURCES2
-rw-r--r--bootloader/rocker_linux.c546
-rw-r--r--firmware/SOURCES51
-rw-r--r--firmware/asm/SOURCES4
-rw-r--r--firmware/asm/mips/thread-mips32.c71
-rw-r--r--firmware/asm/mips/thread.h17
-rw-r--r--firmware/drivers/audio/rocker_codec.c77
-rw-r--r--firmware/drivers/lcd-24bit.c3
-rw-r--r--firmware/export/audiohw.h2
-rw-r--r--firmware/export/config.h5
-rw-r--r--firmware/export/config/agptekrocker.h119
-rw-r--r--firmware/export/rbpaths.h5
-rw-r--r--firmware/export/rocker_codec.h6
-rw-r--r--firmware/include/bitarray.h1
-rw-r--r--firmware/kernel/thread.c3
-rw-r--r--firmware/screendump.c4
-rw-r--r--firmware/target/hosted/agptek/adc-target.h0
-rw-r--r--firmware/target/hosted/agptek/backlight-agptek.c64
-rw-r--r--firmware/target/hosted/agptek/backlight-target.h36
-rw-r--r--firmware/target/hosted/agptek/button-agptek.c149
-rw-r--r--firmware/target/hosted/agptek/button-target.h43
-rw-r--r--firmware/target/hosted/agptek/debug-agptek.c6
-rw-r--r--firmware/target/hosted/agptek/lcd-agptek.c111
-rw-r--r--firmware/target/hosted/agptek/lcd-target.h26
-rw-r--r--firmware/target/hosted/agptek/power-agptek.c59
-rw-r--r--firmware/target/hosted/agptek/power-agptek.h29
-rw-r--r--firmware/target/hosted/agptek/powermgmt-agptek.c63
-rw-r--r--firmware/target/hosted/agptek/rocker.make48
-rw-r--r--firmware/target/hosted/agptek/sysfs.c186
-rw-r--r--firmware/target/hosted/agptek/sysfs.h31
-rw-r--r--firmware/target/hosted/agptek/system-agptek.c184
-rw-r--r--firmware/target/hosted/agptek/system-target.h28
-rw-r--r--firmware/target/hosted/alsa-controls.c2
-rw-r--r--firmware/target/hosted/alsa-controls.h9
-rw-r--r--firmware/target/hosted/filesystem-app.c3
-rw-r--r--firmware/target/hosted/sdl/sim-ui-defines.h6
-rw-r--r--lib/rbcodec/codecs/libmad/libmad.make3
-rwxr-xr-xtools/configure47
-rw-r--r--tools/root.make6
-rw-r--r--uisimulator/bitmaps/UI-agptekrocker.bmpbin0 -> 282858 bytes
-rw-r--r--uisimulator/buttonmap/SOURCES2
-rw-r--r--uisimulator/buttonmap/agptek-rocker.c80
-rw-r--r--wps/WPSLIST12
50 files changed, 2343 insertions, 74 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 666bf69f60..de633880f6 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -315,4 +315,6 @@ keymaps/keymap-ihifi.c
315keymaps/keymap-ypr1.c 315keymaps/keymap-ypr1.c
316#elif CONFIG_KEYPAD == DX50_PAD 316#elif CONFIG_KEYPAD == DX50_PAD
317keymaps/keymap-dx50.c 317keymaps/keymap-dx50.c
318#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
319keymaps/keymap-agptekrocker.c
318#endif 320#endif
diff --git a/apps/bitmaps/native/SOURCES b/apps/bitmaps/native/SOURCES
index dbd0f577ed..ea726d4c07 100644
--- a/apps/bitmaps/native/SOURCES
+++ b/apps/bitmaps/native/SOURCES
@@ -13,7 +13,7 @@ rockboxlogo.112x30x1.bmp
13rockboxlogo.96x30x16.bmp 13rockboxlogo.96x30x16.bmp
14#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2) 14#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2)
15rockboxlogo.128x42x2.bmp 15rockboxlogo.128x42x2.bmp
16#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 16) 16#elif (LCD_WIDTH == 128) && (LCD_DEPTH >= 16)
17rockboxlogo.128x40x16.bmp 17rockboxlogo.128x40x16.bmp
18#elif (LCD_WIDTH == 132) && (LCD_DEPTH >= 16) 18#elif (LCD_WIDTH == 132) && (LCD_DEPTH >= 16)
19rockboxlogo.132x40x16.bmp 19rockboxlogo.132x40x16.bmp
@@ -40,9 +40,15 @@ rockboxlogo.640x198x16.bmp
40#endif 40#endif
41 41
42/* The Sony NWZ linux bootloader needs icons to display a menu */ 42/* The Sony NWZ linux bootloader needs icons to display a menu */
43#if defined(BOOTLOADER) && defined(SONY_NWZ_LINUX) 43#if defined(BOOTLOADER)
44#if defined(SONY_NWZ_LINUX)
44rockboxicon.130x130x16.bmp 45rockboxicon.130x130x16.bmp
45toolsicon.130x130x16.bmp 46toolsicon.130x130x16.bmp
47#elif defined(AGPTEK_ROCKER)
48hibyicon.70x70x16.bmp
49rockboxicon.70x70x16.bmp
50toolsicon.70x70x16.bmp
51#endif
46#endif 52#endif
47 53
48#ifndef BOOTLOADER /* We don't need these for the bootloader */ 54#ifndef BOOTLOADER /* We don't need these for the bootloader */
diff --git a/apps/bitmaps/native/hibyicon.70x70x16.bmp b/apps/bitmaps/native/hibyicon.70x70x16.bmp
new file mode 100644
index 0000000000..640623421f
--- /dev/null
+++ b/apps/bitmaps/native/hibyicon.70x70x16.bmp
Binary files differ
diff --git a/apps/bitmaps/native/rockboxicon.70x70x16.bmp b/apps/bitmaps/native/rockboxicon.70x70x16.bmp
new file mode 100644
index 0000000000..20f6709530
--- /dev/null
+++ b/apps/bitmaps/native/rockboxicon.70x70x16.bmp
Binary files differ
diff --git a/apps/bitmaps/native/toolsicon.70x70x16.bmp b/apps/bitmaps/native/toolsicon.70x70x16.bmp
new file mode 100644
index 0000000000..aa0deb9ad4
--- /dev/null
+++ b/apps/bitmaps/native/toolsicon.70x70x16.bmp
Binary files differ
diff --git a/apps/keymaps/keymap-agptekrocker.c b/apps/keymaps/keymap-agptekrocker.c
new file mode 100644
index 0000000000..1b4c784dd4
--- /dev/null
+++ b/apps/keymaps/keymap-agptekrocker.c
@@ -0,0 +1,254 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#include "config.h"
22#include "action.h"
23#include "button.h"
24#include "settings.h"
25
26/* {Action Code, Button code, Prereq button code } */
27
28/*
29 * The format of the list is as follows
30 * { Action Code, Button code, Prereq button code }
31 * if there's no need to check the previous button's value, use BUTTON_NONE
32 * Insert LAST_ITEM_IN_LIST at the end of each mapping
33 */
34static const struct button_mapping button_context_standard[] = {
35 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
36 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
37
38 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
39 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
40
41
42 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
43 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
44
45 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
46
47 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
48
49 { ACTION_STD_MENU, BUTTON_POWER, BUTTON_NONE },
50
51// ACTION_STD_QUICKSCREEN,
52// ACTION_STD_KEYLOCK
53// ACTION_STD_REC
54// ACTION_STD_HOTKEY
55
56// { ACTION_STD_QUICKSCREEN, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
57
58 LAST_ITEM_IN_LIST
59}; /* button_context_standard */
60
61
62static const struct button_mapping button_context_wps[] = {
63// { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
64 { ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
65 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
66 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
67 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
68 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
69 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
70 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
71 { ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
72 { ACTION_WPS_VOLDOWN, BUTTON_VOLDOWN, BUTTON_NONE },
73 { ACTION_WPS_VOLDOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
74 { ACTION_WPS_VOLUP, BUTTON_VOLUP, BUTTON_NONE },
75 { ACTION_WPS_VOLUP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
76// ACTION_WPS_PITCHSCREEN optional
77// ACTION_WPS_ID3SCREEN optional
78 { ACTION_WPS_CONTEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
79 { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, // optional
80 { ACTION_WPS_MENU, BUTTON_UP|BUTTON_REL, BUTTON_UP }, /*this should be the same as ACTION_STD_MENU */
81// ACTION_WPS_VIEW_PLAYLIST
82// ACTION_WPS_LIST_BOOKMARKS,/* optional */
83// ACTION_WPS_CREATE_BOOKMARK,/* optional */
84
85 { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE },
86
87 LAST_ITEM_IN_LIST
88}; /* button_context_wps */
89
90static const struct button_mapping button_context_settings[] = {
91 { ACTION_SETTINGS_INC, BUTTON_VOLUP, BUTTON_NONE },
92 { ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
93// ACTION_SETTINGS_INCBIGSTEP
94 { ACTION_SETTINGS_DEC, BUTTON_VOLDOWN, BUTTON_NONE },
95 { ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
96// ACTION_SETTINGS_DECBIGSTEP
97 { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
98// ACTION_SETTINGS_SET, /* Used by touchscreen targets */
99 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
100}; /* button_context_settings */
101
102static const struct button_mapping button_context_list[] = {
103// ACTION_LISTTREE_PGUP,/* optional */
104// ACTION_LISTTREE_PGDOWN,/* optional */
105
106#ifdef HAVE_VOLUME_IN_LIST
107 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
108 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
109 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
110 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
111#endif
112 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
113}; /* button_context_list */
114
115static const struct button_mapping button_context_tree[] = {
116// ACTION_TREE_ROOT_INIT,
117// ACTION_TREE_PGLEFT,/* optional */
118// ACTION_TREE_PGRIGHT,/* optional */
119// ACTION_TREE_STOP,
120// ACTION_TREE_WPS,
121// ACTION_TREE_HOTKEY,
122
123 { ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP },
124// { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
125// { ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
126
127 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
128}; /* button_context_tree */
129
130static const struct button_mapping button_context_yesno[] = {
131 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
132
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
134}; /* button_context_settings_yesno */
135
136static const struct button_mapping button_context_quickscreen[] = {
137 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
138 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
139 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
140 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
141 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
142 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
143 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
144 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
145
146 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
147}; /* button_context_quickscreen */
148
149static const struct button_mapping button_context_settings_time[] = {
150 { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
151 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
152 { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
153 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
154
155 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
156}; /* button_context_settings_time */
157
158static const struct button_mapping button_context_pitchscreen[] = {
159 { ACTION_PS_INC_SMALL, BUTTON_VOLUP, BUTTON_NONE },
160 { ACTION_PS_INC_BIG, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
161 { ACTION_PS_DEC_SMALL, BUTTON_VOLDOWN, BUTTON_NONE },
162 { ACTION_PS_DEC_BIG, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
163 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
164 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
165 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
166 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
167// { ACTION_PS_TOGGLE_MODE, BUTTON_REC, BUTTON_NONE },
168 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
169 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
170 { ACTION_PS_EXIT, BUTTON_UP, BUTTON_NONE },
171 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
172 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
173
174 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
175}; /* button_context_pitchscreen */
176
177static const struct button_mapping button_context_keyboard[] = {
178 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
179 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
180 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
181 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
182
183 { ACTION_KBD_CURSOR_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
184 { ACTION_KBD_CURSOR_LEFT, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
185 { ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
186 { ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
187
188 { ACTION_KBD_UP, BUTTON_VOLDOWN, BUTTON_NONE },
189 { ACTION_KBD_UP, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
190 { ACTION_KBD_DOWN, BUTTON_VOLUP, BUTTON_NONE },
191 { ACTION_KBD_DOWN, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
192 { ACTION_KBD_PAGE_FLIP, BUTTON_POWER|BUTTON_SELECT, BUTTON_POWER },
193 { ACTION_KBD_BACKSPACE, BUTTON_DOWN, BUTTON_NONE },
194 { ACTION_KBD_BACKSPACE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
195 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
196 { ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE },
197 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
198 { ACTION_KBD_MORSE_INPUT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
199 { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
200
201 LAST_ITEM_IN_LIST
202}; /* button_context_keyboard */
203
204static const struct button_mapping button_context_bmark[] = {
205 { ACTION_BMS_DELETE, BUTTON_LEFT, BUTTON_NONE },
206
207 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
208}; /* button_context_bmark */
209
210/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
211const struct button_mapping* get_context_mapping(int context)
212{
213 switch (context)
214 {
215 case CONTEXT_STD:
216 return button_context_standard;
217
218 case CONTEXT_WPS:
219 return button_context_wps;
220
221 case CONTEXT_LIST:
222 return button_context_list;
223
224 case CONTEXT_CUSTOM|CONTEXT_TREE:
225 return button_context_tree;
226
227 case CONTEXT_SETTINGS:
228 case CONTEXT_SETTINGS_EQ:
229 return button_context_settings;
230
231 case CONTEXT_SETTINGS_TIME:
232 return button_context_settings_time;
233
234 case CONTEXT_YESNOSCREEN:
235 return button_context_yesno;
236
237 case CONTEXT_BOOKMARKSCREEN:
238 return button_context_bmark;
239
240 case CONTEXT_QUICKSCREEN:
241 return button_context_quickscreen;
242
243 case CONTEXT_PITCHSCREEN:
244 return button_context_pitchscreen;
245
246 case CONTEXT_KEYBOARD:
247 case CONTEXT_MORSE_INPUT:
248 return button_context_keyboard;
249
250 default:
251 return button_context_standard;
252 }
253 return button_context_standard;
254}
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index 8d49fd7582..b11c41b424 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -670,7 +670,7 @@ int read_bmp_fd(int fd,
670 /* Check if this fits the buffer */ 670 /* Check if this fits the buffer */
671 if (totalsize > maxsize) { 671 if (totalsize > maxsize) {
672 DEBUGF("read_bmp_fd: Bitmap too large for buffer: " 672 DEBUGF("read_bmp_fd: Bitmap too large for buffer: "
673 "%d bytes.\n", totalsize); 673 "%d bytes (%d max).\n", totalsize, maxsize);
674 return -6; 674 return -6;
675 } 675 }
676 676
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index 88b8aa03d2..359e2ba700 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -73,6 +73,8 @@ show_logo.c
73mpio_hd200_hd300.c 73mpio_hd200_hd300.c
74#elif defined(SONY_NWZ_LINUX) 74#elif defined(SONY_NWZ_LINUX)
75nwz_linux.c 75nwz_linux.c
76#elif defined(AGPTEK_ROCKER)
77rocker_linux.c
76#elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) \ 78#elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) \
77 || defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) \ 79 || defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) \
78 || defined(IHIFI760) || defined(IHIFI960) 80 || defined(IHIFI760) || defined(IHIFI960)
diff --git a/bootloader/rocker_linux.c b/bootloader/rocker_linux.c
new file mode 100644
index 0000000000..dd912ee378
--- /dev/null
+++ b/bootloader/rocker_linux.c
@@ -0,0 +1,546 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 *
10 * Copyright (C) 2016 by Amaury Pouly
11 * 2018 by Marcin Bukat
12 *
13 * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
14 * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
20 *
21 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 * KIND, either express or implied.
23 *
24 ****************************************************************************/
25
26#include "system.h"
27#include "lcd.h"
28#include "backlight.h"
29#include "button-target.h"
30#include "button.h"
31#include "../kernel/kernel-internal.h"
32#include "core_alloc.h"
33#include "filesystem-app.h"
34#include "lcd.h"
35#include "font.h"
36#include "power.h"
37#include <string.h>
38#include <stdlib.h>
39#include <unistd.h>
40#include <sys/types.h>
41#include <sys/stat.h>
42#include <fcntl.h>
43#include <dirent.h>
44#include <sys/wait.h>
45#include <stdarg.h>
46#include "version.h"
47
48/* all images must have the following size */
49#define ICON_WIDTH 70
50#define ICON_HEIGHT 70
51
52/* images */
53#include "bitmaps/rockboxicon.h"
54#include "bitmaps/hibyicon.h"
55#include "bitmaps/toolsicon.h"
56
57/* don't issue an error when parsing the file for dependencies */
58#if defined(BMPWIDTH_rockboxicon) && (BMPWIDTH_rockboxicon != ICON_WIDTH || \
59 BMPHEIGHT_rockboxicon != ICON_HEIGHT)
60#error rockboxicon has the wrong resolution
61#endif
62#if defined(BMPWIDTH_hibyicon) && (BMPWIDTH_hibyicon != ICON_WIDTH || \
63 BMPHEIGHT_hibyicon != ICON_HEIGHT)
64#error hibyicon has the wrong resolution
65#endif
66#if defined(BMPWIDTH_toolsicon) && (BMPWIDTH_toolsicon != ICON_WIDTH || \
67 BMPHEIGHT_toolsicon != ICON_HEIGHT)
68#error toolsicon has the wrong resolution
69#endif
70
71#ifndef BUTTON_REW
72#define BUTTON_REW BUTTON_LEFT
73#endif
74#ifndef BUTTON_FF
75#define BUTTON_FF BUTTON_RIGHT
76#endif
77#ifndef BUTTON_PLAY
78#define BUTTON_PLAY BUTTON_SELECT
79#endif
80
81/* return icon y position (x is always centered) */
82static int get_icon_y(void)
83{
84 int h;
85 lcd_getstringsize("X", NULL, &h);
86 return ((LCD_HEIGHT - ICON_HEIGHT)/2) - h;
87}
88
89/* Important Note: this bootloader is carefully written so that in case of
90 * error, the OF is run. This seems like the safest option since the OF is
91 * always there and might do magic things. */
92
93enum boot_mode
94{
95 BOOT_ROCKBOX,
96 BOOT_TOOLS,
97 BOOT_OF,
98 BOOT_COUNT,
99 BOOT_USB, /* special */
100 BOOT_STOP, /* power down/suspend */
101};
102
103static void display_text_center(int y, const char *text)
104{
105 int width;
106 lcd_getstringsize(text, &width, NULL);
107 lcd_putsxy(LCD_WIDTH / 2 - width / 2, y, text);
108}
109
110static void display_text_centerf(int y, const char *format, ...)
111{
112 char buf[1024];
113 va_list ap;
114 va_start(ap, format);
115
116 vsnprintf(buf, sizeof(buf), format, ap);
117 display_text_center(y, buf);
118}
119
120/* get timeout before taking action if the user doesn't touch the device */
121static int get_inactivity_tmo(void)
122{
123#if defined(HAS_BUTTON_HOLD)
124 if(button_hold())
125 return 5 * HZ; /* Inactivity timeout when on hold */
126 else
127#endif
128 return 10 * HZ; /* Inactivity timeout when not on hold */
129}
130
131/* return action on idle timeout */
132static enum boot_mode inactivity_action(enum boot_mode cur_selection)
133{
134#if defined(HAS_BUTTON_HOLD)
135 if(button_hold())
136 return BOOT_STOP; /* power down/suspend */
137 else
138#endif
139 return cur_selection; /* return last choice */
140}
141
142/* we store the boot mode in a file in /tmp so we can reload it between 'boots'
143 * (since the mostly suspends instead of powering down) */
144static enum boot_mode load_boot_mode(enum boot_mode mode)
145{
146 int fd = open("/data/rb_bl_mode.txt", O_RDONLY);
147 if(fd >= 0)
148 {
149 read(fd, &mode, sizeof(mode));
150 close(fd);
151 }
152 return mode;
153}
154
155static void save_boot_mode(enum boot_mode mode)
156{
157 int fd = open("/data/rb_bl_mode.txt", O_RDWR | O_CREAT | O_TRUNC);
158 if(fd >= 0)
159 {
160 write(fd, &mode, sizeof(mode));
161 close(fd);
162 }
163}
164
165static enum boot_mode get_boot_mode(void)
166{
167 /* load previous mode, or start with rockbox if none */
168 enum boot_mode init_mode = load_boot_mode(BOOT_ROCKBOX);
169 /* wait for user action */
170 enum boot_mode mode = init_mode;
171 int last_activity = current_tick;
172#if defined(HAS_BUTTON_HOLD)
173 bool hold_status = button_hold();
174#endif
175 while(true)
176 {
177 /* on usb detect, return to usb
178 * FIXME this is a hack, we need proper usb detection */
179 if(power_input_status() & POWER_INPUT_USB_CHARGER)
180 {
181 /* save last choice */
182 save_boot_mode(mode);
183 return BOOT_USB;
184 }
185 /* inactivity detection */
186 int timeout = last_activity + get_inactivity_tmo();
187 if(TIME_AFTER(current_tick, timeout))
188 {
189 /* save last choice */
190 save_boot_mode(mode);
191 return inactivity_action(mode);
192 }
193 /* redraw */
194 lcd_clear_display();
195 /* display top text */
196#if defined(HAS_BUTTON_HOLD)
197 if(button_hold())
198 {
199 lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
200 display_text_center(0, "ON HOLD!");
201 }
202 else
203#endif
204 {
205 lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
206 display_text_center(0, "SELECT PLAYER");
207 }
208 lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
209 /* display icon */
210 const struct bitmap *icon = (mode == BOOT_OF) ? &bm_hibyicon :
211 (mode == BOOT_ROCKBOX) ? &bm_rockboxicon : &bm_toolsicon;
212 lcd_bmp(icon, (LCD_WIDTH - ICON_WIDTH) / 2, get_icon_y());
213 /* display bottom description */
214 const char *desc = (mode == BOOT_OF) ? "HIBY PLAYER" :
215 (mode == BOOT_ROCKBOX) ? "ROCKBOX" : "TOOLS";
216
217 int desc_height;
218 lcd_getstringsize(desc, NULL, &desc_height);
219 display_text_center(LCD_HEIGHT - 3*desc_height, desc);
220
221 /* display arrows */
222 int arrow_width, arrow_height;
223 lcd_getstringsize("<", &arrow_width, &arrow_height);
224 int arrow_y = get_icon_y() + ICON_HEIGHT / 2 - arrow_height / 2;
225 lcd_putsxy(arrow_width / 2, arrow_y, "<");
226 lcd_putsxy(LCD_WIDTH - 3 * arrow_width / 2, arrow_y, ">");
227
228 lcd_set_foreground(LCD_RGBPACK(0, 255, 0));
229 display_text_centerf(LCD_HEIGHT - arrow_height * 3 / 2, "timeout in %d sec",
230 (timeout - current_tick + HZ - 1) / HZ);
231
232 lcd_update();
233
234 /* wait for a key */
235 int btn = button_get_w_tmo(HZ / 10);
236
237#if defined(HAS_BUTTON_HOLD)
238 /* record action, changing HOLD counts as action */
239 if(btn & BUTTON_MAIN || hold_status != button_hold())
240 last_activity = current_tick;
241
242 hold_status = button_hold();
243#else
244 if(btn & BUTTON_MAIN)
245 last_activity = current_tick;
246#endif
247 /* ignore release, allow repeat */
248 if(btn & BUTTON_REL)
249 continue;
250 if(btn & BUTTON_REPEAT)
251 btn &= ~BUTTON_REPEAT;
252 /* play -> stop loop and return mode */
253 if(btn == BUTTON_PLAY)
254 break;
255 /* left/right/up/down: change mode */
256 if(btn == BUTTON_LEFT || btn == BUTTON_DOWN || btn == BUTTON_REW)
257 mode = (mode + BOOT_COUNT - 1) % BOOT_COUNT;
258 if(btn == BUTTON_RIGHT || btn == BUTTON_UP || btn == BUTTON_FF)
259 mode = (mode + 1) % BOOT_COUNT;
260 }
261
262 /* save mode */
263 save_boot_mode(mode);
264 return mode;
265}
266
267void error_screen(const char *msg)
268{
269 lcd_clear_display();
270 lcd_putsf(0, 0, msg);
271 lcd_update();
272}
273
274int choice_screen(const char *title, bool center, int nr_choices, const char *choices[])
275{
276 int choice = 0;
277 int max_len = 0;
278 int h;
279 lcd_getstringsize("x", NULL, &h);
280 for(int i = 0; i < nr_choices; i++)
281 {
282 int len = strlen(choices[i]);
283 if(len > max_len)
284 max_len = len;
285 }
286 char *buf = malloc(max_len + 10);
287 int top_y = 2 * h;
288 int nr_lines = (LCD_HEIGHT - top_y) / h;
289 while(true)
290 {
291 /* make sure choice is visible */
292 int offset = choice - nr_lines / 2;
293 if(offset < 0)
294 offset = 0;
295 lcd_clear_display();
296 /* display top text */
297 lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
298 display_text_center(0, title);
299 int line = 0;
300 for(int i = 0; i < nr_choices && line < nr_lines; i++)
301 {
302 if(i < offset)
303 continue;
304 if(i == choice)
305 lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
306 else
307 lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
308 sprintf(buf, "%s", choices[i]);
309 if(center)
310 display_text_center(top_y + h * line, buf);
311 else
312 lcd_putsxy(0, top_y + h * line, buf);
313 line++;
314 }
315
316 lcd_update();
317
318 /* wait for a key */
319 int btn = button_get_w_tmo(HZ / 10);
320 /* ignore release, allow repeat */
321 if(btn & BUTTON_REL)
322 continue;
323 if(btn & BUTTON_REPEAT)
324 btn &= ~BUTTON_REPEAT;
325 /* play -> stop loop and return mode */
326 if(btn == BUTTON_PLAY || btn == BUTTON_LEFT)
327 {
328 free(buf);
329 return btn == BUTTON_PLAY ? choice : -1;
330 }
331 /* left/right/up/down: change mode */
332 if(btn == BUTTON_UP)
333 choice = (choice + nr_choices - 1) % nr_choices;
334 if(btn == BUTTON_DOWN)
335 choice = (choice + 1) % nr_choices;
336 }
337}
338
339void run_file(const char *name)
340{
341 char *dirname = "/mnt/sd_0/";
342 char *buf = malloc(strlen(dirname) + strlen(name) + 1);
343 sprintf(buf, "%s%s", dirname, name);
344
345 lcd_clear_display();
346 lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
347 lcd_putsf(0, 0, "Running %s", name);
348 lcd_update();
349
350 pid_t pid = fork();
351 if(pid == 0)
352 {
353 execlp("sh", "sh", buf, NULL);
354 _exit(42);
355 }
356 int status;
357 waitpid(pid, &status, 0);
358 if(WIFEXITED(status))
359 {
360 lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
361 lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status));
362 }
363 else
364 {
365 lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
366 lcd_putsf(0, 1, "an error occured: %x", status);
367 }
368 lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
369 lcd_putsf(0, 3, "Press any key or wait");
370 lcd_update();
371 /* wait a small time */
372 sleep(HZ);
373 /* ignore event */
374 while(button_get(false) != 0) {}
375 /* wait for any key or timeout */
376 button_get_w_tmo(4 * HZ);
377}
378
379void run_script_menu(void)
380{
381 const char **entries = NULL;
382 int nr_entries = 0;
383 DIR *dir = opendir("/mnt/sd_0");
384 struct dirent *ent;
385 while((ent = readdir(dir)))
386 {
387 if(ent->d_type != DT_REG)
388 continue;
389 entries = realloc(entries, (nr_entries + 1) * sizeof(const char *));
390 entries[nr_entries++] = strdup(ent->d_name);
391 }
392 closedir(dir);
393 int idx = choice_screen("RUN SCRIPT", false, nr_entries, entries);
394 if(idx >= 0)
395 run_file(entries[idx]);
396 for(int i = 0; i < nr_entries; i++)
397 free((char *)entries[i]);
398 free(entries);
399}
400
401static void adb(int start)
402{
403 pid_t pid = fork();
404 if(pid == 0)
405 {
406 execlp("/etc/init.d/K90adb", "K90adb", start ? "start" : "stop", NULL);
407 _exit(42);
408 }
409 int status;
410 waitpid(pid, &status, 0);
411#if 0
412 if(WIFEXITED(status))
413 {
414 lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
415 lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status));
416 }
417 else
418 {
419 lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
420 lcd_putsf(0, 1, "an error occured: %x", status);
421 }
422#endif
423}
424
425static void tools_screen(void)
426{
427 const char *choices[] = {"ADB start", "ADB stop", "Run script", "Restart", "Shutdown"};
428 int choice = choice_screen("TOOLS MENU", true, 5, choices);
429 if(choice == 0)
430 {
431 /* run service menu */
432 printf("Starting ADB service...\n");
433 fflush(stdout);
434 adb(1);
435 }
436 else if(choice == 1)
437 {
438 printf("Stopping ADB service...\n");
439 fflush(stdout);
440 adb(0);
441 }
442 else if(choice == 2)
443 {
444 run_script_menu();
445 }
446// else if(choice == 2)
447// nwz_power_restart();
448 else if(choice == 4)
449 power_off();
450}
451
452/* open log file */
453static int open_log(void)
454{
455 /* open regular log file */
456 int fd = open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND);
457 /* get its size */
458 struct stat stat;
459 if(fstat(fd, &stat) != 0)
460 return fd; /* on error, don't do anything */
461 /* if file is too large, rename it and start a new log file */
462 if(stat.st_size < 1000000)
463 return fd;
464 close(fd);
465 /* move file */
466 rename("/mnt/sd_0/rockbox.log", "/mnt_sd0/rockbox.log.1");
467 /* re-open the file, truncate in case the move was unsuccessful */
468 return open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND | O_TRUNC);
469}
470
471int main(int argc, char **argv)
472{
473 (void) argc;
474 (void) argv;
475 /* redirect stdout and stderr to have error messages logged somewhere on the
476 * user partition */
477 int fd = open_log();
478 if(fd >= 0)
479 {
480 dup2(fd, fileno(stdout));
481 dup2(fd, fileno(stderr));
482 close(fd);
483 }
484 /* print version */
485 printf("Rockbox boot loader\n");
486 printf("Version: %s\n", rbversion);
487 printf("%s\n", MODEL_NAME);
488
489 system_init();
490 core_allocator_init();
491 kernel_init();
492 paths_init();
493 lcd_init();
494 font_init();
495 button_init();
496 backlight_init();
497 backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
498// /* try to load the extra font we install on the device */
499// int font_id = font_load("/usr/local/share/rockbox/bootloader.fnt");
500// if(font_id >= 0)
501// lcd_setfont(font_id);
502
503 /* run all tools menu */
504 while(true)
505 {
506 enum boot_mode mode = get_boot_mode();
507 if(mode == BOOT_USB || mode == BOOT_OF)
508 {
509 fflush(stdout);
510 fflush(stderr);
511 close(fileno(stdout));
512 close(fileno(stderr));
513 /* for now the only way we have to trigger USB mode it to run the OF */
514 /* boot OF */
515 execvp("/usr/bin/hiby_player", argv);
516 error_screen("Cannot boot OF");
517 sleep(5 * HZ);
518 }
519 else if(mode == BOOT_TOOLS)
520 {
521 tools_screen();
522 }
523 else if(mode == BOOT_ROCKBOX)
524 {
525 /* Rockbox expects /.rockbox to contain themes, rocks, etc, but we
526 * cannot easily create this symlink because the root filesystem is
527 * mounted read-only. Although we could remount it read-write temporarily,
528 * this is neededlessly complicated and we defer this job to the dualboot
529 * install script */
530 fflush(stdout);
531 execl("/mnt/sd_0/.rockbox/rockbox.rocker", "rockbox.rocker", NULL);
532 printf("execvp failed: %s\n", strerror(errno));
533 /* fallback to OF in case of failure */
534 error_screen("Cannot boot Rockbox");
535 sleep(5 * HZ);
536 }
537 else
538 {
539 printf("suspend\n");
540// nwz_power_suspend();
541 }
542 }
543 /* if we reach this point, everything failed, so return an error so that
544 * sysmgrd knows something is wrong */
545 return 1;
546}
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 1310fa0434..96d5d3dcec 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -96,10 +96,6 @@ target/hosted/samsungypr/radio-ypr.c
96#endif 96#endif
97 97
98#if defined(SONY_NWZ_LINUX) && !defined(SIMULATOR) 98#if defined(SONY_NWZ_LINUX) && !defined(SIMULATOR)
99target/hosted/backtrace-glibc.c
100target/hosted/kernel-unix.c
101target/hosted/filesystem-unix.c
102target/hosted/lc-unix.c
103target/hosted/sonynwz/lcd-nwz.c 99target/hosted/sonynwz/lcd-nwz.c
104target/hosted/sonynwz/button-nwz.c 100target/hosted/sonynwz/button-nwz.c
105target/hosted/sonynwz/system-nwz.c 101target/hosted/sonynwz/system-nwz.c
@@ -113,6 +109,23 @@ target/hosted/sonynwz/nvp-nwz.c
113target/hosted/sonynwz/nwz-db.c 109target/hosted/sonynwz/nwz-db.c
114#endif 110#endif
115 111
112#if defined(AGPTEK_ROCKER) && !defined(SIMULATOR)
113target/hosted/backtrace-glibc.c
114target/hosted/kernel-unix.c
115target/hosted/filesystem-unix.c
116target/hosted/lc-unix.c
117target/hosted/alsa-controls.c
118target/hosted/pcm-alsa.c
119target/hosted/agptek/sysfs.c
120target/hosted/agptek/backlight-agptek.c
121target/hosted/agptek/button-agptek.c
122target/hosted/agptek/debug-agptek.c
123target/hosted/agptek/lcd-agptek.c
124target/hosted/agptek/power-agptek.c
125target/hosted/agptek/powermgmt-agptek.c
126target/hosted/agptek/system-agptek.c
127#endif
128
116#if defined(SAMSUNG_YPR0) && !defined(SIMULATOR) 129#if defined(SAMSUNG_YPR0) && !defined(SIMULATOR)
117drivers/adc-as3514.c 130drivers/adc-as3514.c
118#if (CONFIG_RTC == RTC_AS3514) 131#if (CONFIG_RTC == RTC_AS3514)
@@ -250,7 +263,7 @@ drivers/lcd-16bit-vert.c
250#else 263#else
251drivers/lcd-16bit.c 264drivers/lcd-16bit.c
252#endif 265#endif
253#elif LCD_DEPTH == 24 266#elif (LCD_DEPTH == 24) || (LCD_PIXELFORMAT == XRGB8888)
254drivers/lcd-24bit.c 267drivers/lcd-24bit.c
255#endif /* LCD_DEPTH */ 268#endif /* LCD_DEPTH */
256common/diacritic.c 269common/diacritic.c
@@ -470,6 +483,8 @@ target/hosted/pcm-alsa.c
470drivers/audio/nwzlinux-codec.c 483drivers/audio/nwzlinux-codec.c
471target/hosted/alsa-controls.c 484target/hosted/alsa-controls.c
472target/hosted/pcm-alsa.c 485target/hosted/pcm-alsa.c
486#elif defined(HAVE_ROCKER_CODEC)
487drivers/audio/rocker_codec.c
473#elif defined(HAVE_SDL_AUDIO) 488#elif defined(HAVE_SDL_AUDIO)
474drivers/audio/sdl.c 489drivers/audio/sdl.c
475#if CONFIG_CODEC == SWCODEC 490#if CONFIG_CODEC == SWCODEC
@@ -1618,10 +1633,10 @@ target/arm/s5l8700/ipodnano2g/piezo-nano2g.c
1618 1633
1619#ifdef IPOD_6G 1634#ifdef IPOD_6G
1620target/arm/ipod/button-clickwheel.c 1635target/arm/ipod/button-clickwheel.c
1621target/arm/s5l8702/ipod6g/storage_ata-6g.c 1636target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
1622target/arm/s5l8702/ipod6g/backlight-6g.c 1637target/arm/s5l8702/ipod6g/backlight-ipod6g.c
1623target/arm/s5l8702/ipod6g/powermgmt-6g.c 1638target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c
1624target/arm/s5l8702/ipod6g/power-6g.c 1639target/arm/s5l8702/ipod6g/power-ipod6g.c
1625target/arm/s5l8702/kernel-s5l8702.c 1640target/arm/s5l8702/kernel-s5l8702.c
1626target/arm/s5l8702/system-s5l8702.c 1641target/arm/s5l8702/system-s5l8702.c
1627target/arm/s5l8702/timer-s5l8702.c 1642target/arm/s5l8702/timer-s5l8702.c
@@ -1629,28 +1644,28 @@ target/arm/s5l8702/gpio-s5l8702.c
1629target/arm/s5l8702/pl080.c 1644target/arm/s5l8702/pl080.c
1630target/arm/s5l8702/dma-s5l8702.c 1645target/arm/s5l8702/dma-s5l8702.c
1631target/arm/s5l8702/clocking-s5l8702.c 1646target/arm/s5l8702/clocking-s5l8702.c
1632target/arm/s5l8702/ipod6g/lcd-6g.c 1647target/arm/s5l8702/ipod6g/lcd-ipod6g.c
1633target/arm/s5l8702/ipod6g/lcd-asm-6g.S 1648target/arm/s5l8702/ipod6g/lcd-asm-ipod6g.S
1634target/arm/s5l8702/ipod6g/piezo-6g.c 1649target/arm/s5l8702/ipod6g/piezo-ipod6g.c
1635#if 0 //TODO 1650#if 0 //TODO
1636target/arm/s5l8702/postmortemstub.S 1651target/arm/s5l8702/postmortemstub.S
1637#endif 1652#endif
1638target/arm/s5l8702/ipod6g/pmu-6g.c 1653target/arm/s5l8702/ipod6g/pmu-ipod6g.c
1639target/arm/s5l8702/ipod6g/rtc-6g.c 1654target/arm/s5l8702/ipod6g/rtc-ipod6g.c
1640target/arm/s5l8702/ipod6g/adc-6g.c 1655target/arm/s5l8702/ipod6g/adc-ipod6g.c
1641#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE) 1656#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE)
1642target/arm/s5l8702/usb-s5l8702.c 1657target/arm/s5l8702/usb-s5l8702.c
1643#endif 1658#endif
1644#ifdef HAVE_SERIAL 1659#ifdef HAVE_SERIAL
1645target/arm/uc870x.c 1660target/arm/uc870x.c
1646target/arm/s5l8702/uart-s5l8702.c 1661target/arm/s5l8702/uart-s5l8702.c
1647target/arm/s5l8702/ipod6g/serial-6g.c 1662target/arm/s5l8702/ipod6g/serial-ipod6g.c
1648#endif 1663#endif
1649#ifndef BOOTLOADER 1664#ifndef BOOTLOADER
1650target/arm/s5l8702/debug-s5l8702.c 1665target/arm/s5l8702/debug-s5l8702.c
1651target/arm/s5l8702/pcm-s5l8702.c 1666target/arm/s5l8702/pcm-s5l8702.c
1652target/arm/s5l8702/ipod6g/audio-6g.c 1667target/arm/s5l8702/ipod6g/audio-ipod6g.c
1653target/arm/s5l8702/ipod6g/cscodec-6g.c 1668target/arm/s5l8702/ipod6g/cscodec-ipod6g.c
1654#else 1669#else
1655target/arm/s5l8702/spi-s5l8702.c 1670target/arm/s5l8702/spi-s5l8702.c
1656target/arm/s5l8702/crypto-s5l8702.c 1671target/arm/s5l8702/crypto-s5l8702.c
diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES
index 5a1310ed65..eba5bd2cb6 100644
--- a/firmware/asm/SOURCES
+++ b/firmware/asm/SOURCES
@@ -15,9 +15,9 @@ mempcpy.c
15 defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \ 15 defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \
16 defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ 16 defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \
17 defined(SAMSUNG_YPR1) || defined(DX50) || defined(DX90) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \ 17 defined(SAMSUNG_YPR1) || defined(DX50) || defined(DX90) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \
18 defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX)) && \ 18 defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX) || defined(AGPTEK_ROCKER)) && \
19 !defined(SIMULATOR) 19 !defined(SIMULATOR)
20#if LCD_DEPTH == 24 20#if LCD_DEPTH >= 24
21lcd-as-memframe-24bit.c 21lcd-as-memframe-24bit.c
22#else 22#else
23lcd-as-memframe.c 23lcd-as-memframe.c
diff --git a/firmware/asm/mips/thread-mips32.c b/firmware/asm/mips/thread-mips32.c
index e754df7e29..19efb6eea9 100644
--- a/firmware/asm/mips/thread-mips32.c
+++ b/firmware/asm/mips/thread-mips32.c
@@ -26,24 +26,23 @@
26 *--------------------------------------------------------------------------- 26 *---------------------------------------------------------------------------
27 */ 27 */
28 28
29void start_thread(void); /* Provide C access to ASM label */ 29static void USED_ATTR start_thread(void *addr)
30static void USED_ATTR _start_thread(void)
31{ 30{
32 /* t1 = context */
33 asm volatile ( 31 asm volatile (
34 "start_thread: \n"
35 ".set noreorder \n" 32 ".set noreorder \n"
36 ".set noat \n" 33 ".set noat \n"
37 "lw $8, 4($9) \n" /* Fetch thread function pointer ($8 = t0, $9 = t1) */ 34 "lw $t9, 4(%0) \n" /* Fetch thread function pointer ($25 = t9) */
38 "lw $29, 36($9) \n" /* Set initial sp(=$29) */ 35 "lw $sp, 40(%0) \n" /* Set initial sp(=$29) */
39 "jalr $8 \n" /* Start the thread */ 36 "jalr $t9 \n" /* Start the thread */
40 "sw $0, 44($9) \n" /* Clear start address */ 37 "sw $zero, 48(%0) \n" /* Clear start address */
41 ".set at \n" 38 ".set at \n"
42 ".set reorder \n" 39 ".set reorder \n"
40 : : "r" (addr) : "t9"
43 ); 41 );
44 thread_exit(); 42 thread_exit();
45} 43}
46 44
45
47/* Place context pointer in s0 slot, function pointer in s1 slot, and 46/* Place context pointer in s0 slot, function pointer in s1 slot, and
48 * start_thread pointer in context_start */ 47 * start_thread pointer in context_start */
49#define THREAD_STARTUP_INIT(core, thread, function) \ 48#define THREAD_STARTUP_INIT(core, thread, function) \
@@ -60,17 +59,18 @@ static inline void store_context(void* addr)
60 asm volatile ( 59 asm volatile (
61 ".set noreorder \n" 60 ".set noreorder \n"
62 ".set noat \n" 61 ".set noat \n"
63 "sw $16, 0(%0) \n" /* s0 */ 62 "sw $s0, 0(%0) \n" /* s0 */
64 "sw $17, 4(%0) \n" /* s1 */ 63 "sw $s1, 4(%0) \n" /* s1 */
65 "sw $18, 8(%0) \n" /* s2 */ 64 "sw $s2, 8(%0) \n" /* s2 */
66 "sw $19, 12(%0) \n" /* s3 */ 65 "sw $s3, 12(%0) \n" /* s3 */
67 "sw $20, 16(%0) \n" /* s4 */ 66 "sw $s4, 16(%0) \n" /* s4 */
68 "sw $21, 20(%0) \n" /* s5 */ 67 "sw $s5, 20(%0) \n" /* s5 */
69 "sw $22, 24(%0) \n" /* s6 */ 68 "sw $s6, 24(%0) \n" /* s6 */
70 "sw $23, 28(%0) \n" /* s7 */ 69 "sw $s7, 28(%0) \n" /* s7 */
71 "sw $30, 32(%0) \n" /* fp */ 70 "sw $gp, 32(%0) \n" /* gp */
72 "sw $29, 36(%0) \n" /* sp */ 71 "sw $fp, 36(%0) \n" /* fp */
73 "sw $31, 40(%0) \n" /* ra */ 72 "sw $sp, 40(%0) \n" /* sp */
73 "sw $ra, 44(%0) \n" /* ra */
74 ".set at \n" 74 ".set at \n"
75 ".set reorder \n" 75 ".set reorder \n"
76 : : "r" (addr) 76 : : "r" (addr)
@@ -86,26 +86,27 @@ static inline void load_context(const void* addr)
86 asm volatile ( 86 asm volatile (
87 ".set noat \n" 87 ".set noat \n"
88 ".set noreorder \n" 88 ".set noreorder \n"
89 "lw $8, 44(%0) \n" /* Get start address ($8 = t0) */ 89 "lw $t9, 48(%0) \n" /* Get start address ($8 = t0) */
90 "beqz $8, running \n" /* NULL -> already running */ 90 "beqz $t9, running \n" /* NULL -> already running */
91 "nop \n" 91 "nop \n"
92 "jr $8 \n" 92 "jr $t9 \n"
93 "move $9, %0 \n" /* t1 = context */ 93 "move $a0, %0 \n" /* a0 = context branch delay slot anyway */
94 "running: \n" 94 "running: \n"
95 "lw $16, 0(%0) \n" /* s0 */ 95 "lw $s0, 0(%0) \n" /* s0 */
96 "lw $17, 4(%0) \n" /* s1 */ 96 "lw $s1, 4(%0) \n" /* s1 */
97 "lw $18, 8(%0) \n" /* s2 */ 97 "lw $s2, 8(%0) \n" /* s2 */
98 "lw $19, 12(%0) \n" /* s3 */ 98 "lw $s3, 12(%0) \n" /* s3 */
99 "lw $20, 16(%0) \n" /* s4 */ 99 "lw $s4, 16(%0) \n" /* s4 */
100 "lw $21, 20(%0) \n" /* s5 */ 100 "lw $s5, 20(%0) \n" /* s5 */
101 "lw $22, 24(%0) \n" /* s6 */ 101 "lw $s6, 24(%0) \n" /* s6 */
102 "lw $23, 28(%0) \n" /* s7 */ 102 "lw $s7, 28(%0) \n" /* s7 */
103 "lw $30, 32(%0) \n" /* fp */ 103 "lw $gp, 32(%0) \n" /* gp */
104 "lw $29, 36(%0) \n" /* sp */ 104 "lw $fp, 36(%0) \n" /* fp */
105 "lw $31, 40(%0) \n" /* ra */ 105 "lw $sp, 40(%0) \n" /* sp */
106 "lw $ra, 44(%0) \n" /* ra */
106 ".set at \n" 107 ".set at \n"
107 ".set reorder \n" 108 ".set reorder \n"
108 : : "r" (addr) : "t0", "t1" 109 : : "r" (addr) : "t9"
109 ); 110 );
110} 111}
111 112
diff --git a/firmware/asm/mips/thread.h b/firmware/asm/mips/thread.h
index ac37560a68..42b0f7049f 100644
--- a/firmware/asm/mips/thread.h
+++ b/firmware/asm/mips/thread.h
@@ -19,9 +19,24 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22/* index offset register
23 * 0 0 $16 s0
24 * 1 4 $17 s1
25 * 2 8 $18 s2
26 * 3 12 $19 s3
27 * 4 16 $20 s4
28 * 5 20 $21 s5
29 * 6 24 $22 s6
30 * 7 28 $23 s7
31 * 8 32 $28 gp
32 * 9 36 $30 s8 (s8)
33 * 10 40 $29 sp
34 * 11 44 $31 ra
35 * 12 48 start
36 */
22struct regs 37struct regs
23{ 38{
24 uint32_t r[9]; /* 0-32 - Registers s0-s7, fp */ 39 uint32_t r[10]; /* 0-32 - Registers s0-s7, gp, fp */
25 uint32_t sp; /* 36 - Stack pointer */ 40 uint32_t sp; /* 36 - Stack pointer */
26 uint32_t ra; /* 40 - Return address */ 41 uint32_t ra; /* 40 - Return address */
27 uint32_t start; /* 44 - Thread start address, or NULL when started */ 42 uint32_t start; /* 44 - Thread start address, or NULL when started */
diff --git a/firmware/drivers/audio/rocker_codec.c b/firmware/drivers/audio/rocker_codec.c
new file mode 100644
index 0000000000..23541a4ddb
--- /dev/null
+++ b/firmware/drivers/audio/rocker_codec.c
@@ -0,0 +1,77 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 *
11 * Copyright (c) 2018 Marcin Bukat
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22
23#include "config.h"
24#include "audio.h"
25#include "audiohw.h"
26#include "system.h"
27#include "panic.h"
28#include "alsa-controls.h"
29
30static int fd_hw;
31
32static void hw_open(void)
33{
34 fd_hw = open("/dev/snd/controlC0", O_RDWR);
35 if(fd_hw < 0)
36 panicf("Cannot open '/dev/snd/controlC0'");
37}
38
39static void hw_close(void)
40{
41 close(fd_hw);
42}
43
44void audiohw_preinit(void)
45{
46 long int hp = 2;
47
48 alsa_controls_init();
49 hw_open();
50
51 /* Output port switch set to Headphones */
52 alsa_controls_set_ints("Output Port Switch", 1, &hp);
53}
54
55void audiohw_postinit(void)
56{
57}
58
59void audiohw_close(void)
60{
61 hw_close();
62 alsa_controls_close();
63}
64
65void audiohw_set_frequency(int fsel)
66{
67 (void)fsel;
68}
69
70void audiohw_set_volume(int vol_l, int vol_r)
71{
72 long int vol_l_hw = -vol_l/5;
73 long int vol_r_hw = -vol_r/5;
74
75 alsa_controls_set_ints("Left Playback Volume", 1, &vol_l_hw);
76 alsa_controls_set_ints("Right Playback Volume", 1, &vol_r_hw);
77}
diff --git a/firmware/drivers/lcd-24bit.c b/firmware/drivers/lcd-24bit.c
index 092ed9d576..0585cfb7a0 100644
--- a/firmware/drivers/lcd-24bit.c
+++ b/firmware/drivers/lcd-24bit.c
@@ -189,7 +189,8 @@ void lcd_fillrect(int x, int y, int width, int height)
189 enum fill_opt fillopt = OPT_NONE; 189 enum fill_opt fillopt = OPT_NONE;
190 fb_data *dst, *dst_end; 190 fb_data *dst, *dst_end;
191 int len, step; 191 int len, step;
192 fb_data bits = { 0, 0, 0 }; 192 fb_data bits; // = { 0, 0, 0 };
193 memset(&bits, 0, sizeof(fb_data));
193 194
194 /******************** In viewport clipping **********************/ 195 /******************** In viewport clipping **********************/
195 /* nothing to draw? */ 196 /* nothing to draw? */
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index 6026a3b4bd..26a1a69f95 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -216,6 +216,8 @@ struct sound_settings_info
216#include "codec-dx50.h" 216#include "codec-dx50.h"
217#elif defined(DX90) 217#elif defined(DX90)
218#include "codec-dx90.h" 218#include "codec-dx90.h"
219#elif defined(HAVE_ROCKER_CODEC)
220#include "rocker_codec.h"
219#endif 221#endif
220 222
221/* convert caps into defines */ 223/* convert caps into defines */
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 0d15ab6a33..14664257bf 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -166,6 +166,7 @@
166#define SAMSUNG_YH92X_PAD 62 166#define SAMSUNG_YH92X_PAD 62
167#define DX50_PAD 63 167#define DX50_PAD 63
168#define SONY_NWZA860_PAD 64 /* The NWZ-A860 is too different (touchscreen) */ 168#define SONY_NWZA860_PAD 64 /* The NWZ-A860 is too different (touchscreen) */
169#define AGPTEK_ROCKER_PAD 65
169 170
170/* CONFIG_REMOTE_KEYPAD */ 171/* CONFIG_REMOTE_KEYPAD */
171#define H100_REMOTE 1 172#define H100_REMOTE 1
@@ -279,6 +280,7 @@
279#define LCD_CREATIVEZENXFISTYLE 61 /* as used by Creative Zen X-Fi Style */ 280#define LCD_CREATIVEZENXFISTYLE 61 /* as used by Creative Zen X-Fi Style */
280#define LCD_SAMSUNGYPR1 62 /* as used by Samsung YP-R1 */ 281#define LCD_SAMSUNGYPR1 62 /* as used by Samsung YP-R1 */
281#define LCD_NWZ_LINUX 63 /* as used in the Linux-based NWZ series */ 282#define LCD_NWZ_LINUX 63 /* as used in the Linux-based NWZ series */
283#define LCD_INGENIC_LINUX 64
282 284
283/* LCD_PIXELFORMAT */ 285/* LCD_PIXELFORMAT */
284#define HORIZONTAL_PACKING 1 286#define HORIZONTAL_PACKING 1
@@ -288,6 +290,7 @@
288#define RGB565 565 290#define RGB565 565
289#define RGB565SWAPPED 3553 291#define RGB565SWAPPED 3553
290#define RGB888 888 292#define RGB888 888
293#define XRGB8888 8888
291 294
292/* LCD_STRIDEFORMAT */ 295/* LCD_STRIDEFORMAT */
293#define VERTICAL_STRIDE 1 296#define VERTICAL_STRIDE 1
@@ -601,6 +604,8 @@ Lyre prototype 1 */
601#include "config/sonynwzs750.h" 604#include "config/sonynwzs750.h"
602#elif defined(SONY_NWZE350) 605#elif defined(SONY_NWZE350)
603#include "config/sonynwze350.h" 606#include "config/sonynwze350.h"
607#elif defined(AGPTEK_ROCKER)
608#include "config/agptekrocker.h"
604#else 609#else
605/* no known platform */ 610/* no known platform */
606#endif 611#endif
diff --git a/firmware/export/config/agptekrocker.h b/firmware/export/config/agptekrocker.h
new file mode 100644
index 0000000000..517448b86d
--- /dev/null
+++ b/firmware/export/config/agptekrocker.h
@@ -0,0 +1,119 @@
1/*
2 * This config file is for the Agptek Rocket
3 */
4
5/* For Rolo and boot loader */
6#define MODEL_NUMBER 103//???
7
8#define MODEL_NAME "Agptek Rocker"
9
10/* LCD dimensions */
11#define LCD_WIDTH 128
12#define LCD_HEIGHT 160
13/* sqrt(128^2 + 160^2) / 2 = 102. */
14#define LCD_DPI 102
15
16#ifndef SIMULATOR
17#define CONFIG_PLATFORM (PLATFORM_HOSTED)
18#endif
19
20/* define this if you have a bitmap LCD display */
21#define HAVE_LCD_BITMAP
22
23/* define this if you have a colour LCD */
24#define HAVE_LCD_COLOR
25
26/* Define this if the LCD can shut down */
27//#define HAVE_LCD_SHUTDOWN
28
29/* define this if you want album art for this target */
30#define HAVE_ALBUMART
31
32/* define this to enable bitmap scaling */
33#define HAVE_BMP_SCALING
34
35/* define this to enable JPEG decoding */
36#define HAVE_JPEG
37
38/* define this if you have access to the quickscreen */
39#define HAVE_QUICKSCREEN
40
41/* define this if you would like tagcache to build on this target */
42#define HAVE_TAGCACHE
43
44#define LCD_DEPTH 32
45/* Check that but should not matter */
46#define LCD_PIXELFORMAT XRGB8888
47
48#define HAVE_BACKLIGHT
49#define HAVE_BACKLIGHT_BRIGHTNESS
50
51/* Main LCD backlight brightness range and defaults: the backlight driver
52 * has levels from 0 to 2555. But 0 is off so start at 1.
53 */
54#define MIN_BRIGHTNESS_SETTING 1
55#define MAX_BRIGHTNESS_SETTING 255
56#define DEFAULT_BRIGHTNESS_SETTING 70
57
58/* Which backlight fading type? */
59#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
60
61/* define this if you have a real-time clock */
62#define CONFIG_RTC 0
63
64/* The number of bytes reserved for loadable codecs */
65#define CODEC_SIZE 0x80000
66
67/* The number of bytes reserved for loadable plugins */
68#define PLUGIN_BUFFER_SIZE 0x100000
69
70/* Define this if you do software codec */
71#define CONFIG_CODEC SWCODEC
72#define HAVE_ROCKER_CODEC
73
74#define HAVE_HEADPHONE_DETECTION
75
76/* KeyPad configuration for plugins */
77#define CONFIG_KEYPAD AGPTEK_ROCKER_PAD
78
79#ifndef SIMULATOR
80/* We have usb power and can detect usb but it is handled by Linux */
81#define HAVE_USB_POWER
82#define USB_NONE
83#endif
84
85#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
86
87/* Linux controlls charging, we can monitor */
88#define CONFIG_CHARGING CHARGING_MONITOR
89
90/* define this if the hardware can be powered off while charging */
91#define HAVE_POWEROFF_WHILE_CHARGING
92
93/* same dimensions as gigabeats */
94#define CONFIG_LCD LCD_INGENIC_LINUX
95
96/* Define this if you have a software controlled poweroff */
97#define HAVE_SW_POWEROFF
98
99/* Define this to the CPU frequency */
100#define CPU_FREQ 532000000
101
102/* No special storage */
103#define CONFIG_STORAGE (STORAGE_HOSTFS)//|STORAGE_SD)
104//#define MULTIDRIVE_DIR "/mnt/sd_0"
105//#define NUM_DRIVES 1
106//#define HAVE_HOTSWAP
107#define HAVE_STORAGE_FLUSH
108
109/* Battery */
110#define BATTERY_TYPES_COUNT 1
111
112/* Audio codec */
113#define HAVE_ROCKER_CODEC
114
115/* Battery */
116#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */
117#define BATTERY_CAPACITY_MIN 600 /* min. capacity selectable */
118#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */
119#define BATTERY_CAPACITY_INC 0 /* capacity increment */
diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h
index 8dc9b3a7f9..6623461639 100644
--- a/firmware/export/rbpaths.h
+++ b/firmware/export/rbpaths.h
@@ -41,7 +41,8 @@
41#endif /* def __PCTOOL__ */ 41#endif /* def __PCTOOL__ */
42 42
43#if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \ 43#if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \
44 defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) 44 defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || \
45 defined(AGPTEK_ROCKER)
45 46
46#if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) 47#if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1)
47#define HOME_DIR "/mnt/media0" 48#define HOME_DIR "/mnt/media0"
@@ -50,6 +51,8 @@
50#elif defined(DX50) || defined(DX90) 51#elif defined(DX50) || defined(DX90)
51/* Where to put save files like recordings, playlists, screen dumps ...*/ 52/* Where to put save files like recordings, playlists, screen dumps ...*/
52#define HOME_DIR "/mnt/sdcard" 53#define HOME_DIR "/mnt/sdcard"
54#elif defined(AGPTEK_ROCKER)
55#define HOME_DIR "/mnt/sd_0"
53#else 56#else
54#define HOME_DIR "/" 57#define HOME_DIR "/"
55#endif 58#endif
diff --git a/firmware/export/rocker_codec.h b/firmware/export/rocker_codec.h
new file mode 100644
index 0000000000..366900d717
--- /dev/null
+++ b/firmware/export/rocker_codec.h
@@ -0,0 +1,6 @@
1#ifndef __ROCKER_CODEC__
2#define __ROCKER_CODEC__
3
4#define AUDIOHW_CAPS 0
5AUDIOHW_SETTING(VOLUME, "dB", 1, 5, -1020, 0, -300, )
6#endif
diff --git a/firmware/include/bitarray.h b/firmware/include/bitarray.h
index 4777ccb6a4..a1e7a3fd58 100644
--- a/firmware/include/bitarray.h
+++ b/firmware/include/bitarray.h
@@ -44,6 +44,7 @@
44/** Iterators **/ 44/** Iterators **/
45#include "config.h" 45#include "config.h"
46#include <stdint.h> 46#include <stdint.h>
47#include <limits.h>
47 48
48#if (defined(CPU_ARM) && ARM_ARCH >= 5) || UINT32_MAX < UINT_MAX 49#if (defined(CPU_ARM) && ARM_ARCH >= 5) || UINT32_MAX < UINT_MAX
49#define __BITARRAY_CTZ(wval) __builtin_ctz(wval) 50#define __BITARRAY_CTZ(wval) __builtin_ctz(wval)
diff --git a/firmware/kernel/thread.c b/firmware/kernel/thread.c
index 29ab9db873..307be7116a 100644
--- a/firmware/kernel/thread.c
+++ b/firmware/kernel/thread.c
@@ -37,6 +37,9 @@
37#endif 37#endif
38#include "core_alloc.h" 38#include "core_alloc.h"
39 39
40#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
41#include <errno.h>
42#endif
40/* Define THREAD_EXTRA_CHECKS as 1 to enable additional state checks */ 43/* Define THREAD_EXTRA_CHECKS as 1 to enable additional state checks */
41#ifdef DEBUG 44#ifdef DEBUG
42#define THREAD_EXTRA_CHECKS 1 /* Always 1 for DEBUG */ 45#define THREAD_EXTRA_CHECKS 1 /* Always 1 for DEBUG */
diff --git a/firmware/screendump.c b/firmware/screendump.c
index 226d08a390..1acaaafba6 100644
--- a/firmware/screendump.c
+++ b/firmware/screendump.c
@@ -234,8 +234,8 @@ void screen_dump(void)
234#endif 234#endif
235 } 235 }
236 while (dst < dst_end); 236 while (dst < dst_end);
237#elif LCD_DEPTH == 24 237#elif LCD_DEPTH >= 24
238 dst_end = dst + LCD_WIDTH*3; 238 dst_end = dst + LCD_WIDTH*sizeof(fb_data);
239 src = FBADDR(0, y); 239 src = FBADDR(0, y);
240 do 240 do
241 { 241 {
diff --git a/firmware/target/hosted/agptek/adc-target.h b/firmware/target/hosted/agptek/adc-target.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/firmware/target/hosted/agptek/adc-target.h
diff --git a/firmware/target/hosted/agptek/backlight-agptek.c b/firmware/target/hosted/agptek/backlight-agptek.c
new file mode 100644
index 0000000000..2f00787f72
--- /dev/null
+++ b/firmware/target/hosted/agptek/backlight-agptek.c
@@ -0,0 +1,64 @@
1/***************************************************************************
2 * __________ __ ___
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#include <sys/types.h>
21#include <sys/stat.h>
22#include <fcntl.h>
23#include <stdbool.h>
24#include <unistd.h>
25#include <string.h>
26#include <stdio.h>
27#include "config.h"
28#include "backlight-target.h"
29#include "sysfs.h"
30#include "panic.h"
31
32static const char * const sysfs_bl_brightness =
33 "/sys/class/backlight/pwm-backlight.0/brightness";
34
35static const char * const sysfs_bl_power =
36 "/sys/class/backlight/pwm-backlight.0/bl_power";
37
38bool backlight_hw_init(void)
39{
40 backlight_hw_on();
41 backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING);
42 return true;
43}
44
45void backlight_hw_on(void)
46{
47 sysfs_set_int(sysfs_bl_power, 0);
48}
49
50void backlight_hw_off(void)
51{
52 sysfs_set_int(sysfs_bl_power, 1);
53}
54
55void backlight_hw_brightness(int brightness)
56{
57 /* cap range, just in case */
58 if (brightness > MAX_BRIGHTNESS_SETTING)
59 brightness = MAX_BRIGHTNESS_SETTING;
60 if (brightness < MIN_BRIGHTNESS_SETTING)
61 brightness = MIN_BRIGHTNESS_SETTING;
62
63 sysfs_set_int(sysfs_bl_brightness, brightness);
64}
diff --git a/firmware/target/hosted/agptek/backlight-target.h b/firmware/target/hosted/agptek/backlight-target.h
new file mode 100644
index 0000000000..e3b8a7bd78
--- /dev/null
+++ b/firmware/target/hosted/agptek/backlight-target.h
@@ -0,0 +1,36 @@
1/***************************************************************************
2 * __________ __ ___
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#ifndef _BACKLIGHT_TARGET_H_
22#define _BACKLIGHT_TARGET_H_
23
24
25#include <stdbool.h>
26
27
28/* See backlight.c */
29bool backlight_hw_init(void);
30void backlight_hw_on(void);
31void backlight_hw_off(void);
32void backlight_hw_brightness(int brightness);
33
34
35#endif
36
diff --git a/firmware/target/hosted/agptek/button-agptek.c b/firmware/target/hosted/agptek/button-agptek.c
new file mode 100644
index 0000000000..a8b5debee5
--- /dev/null
+++ b/firmware/target/hosted/agptek/button-agptek.c
@@ -0,0 +1,149 @@
1/***************************************************************************
2 * __________ __ ___
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#include <poll.h>
21//#include <dir.h>
22#include <errno.h>
23#include <unistd.h>
24#include <sys/types.h>
25#include <linux/input.h>
26#include <fcntl.h>
27#include <string.h>
28#include <stdlib.h>
29
30#include "sysfs.h"
31#include "button.h"
32#include "button-target.h"
33#include "panic.h"
34
35#define NR_POLL_DESC 2
36static struct pollfd poll_fds[NR_POLL_DESC];
37
38static int button_map(int keycode)
39{
40 switch(keycode)
41 {
42 case KEY_LEFT:
43 return BUTTON_LEFT;
44
45 case KEY_RIGHT:
46 return BUTTON_RIGHT;
47
48 case KEY_UP:
49 return BUTTON_UP;
50
51 case KEY_DOWN:
52 return BUTTON_DOWN;
53
54 case KEY_PLAYPAUSE:
55 return BUTTON_SELECT;
56
57 case KEY_VOLUMEUP:
58 return BUTTON_VOLUP;
59
60 case KEY_VOLUMEDOWN:
61 return BUTTON_VOLDOWN;
62
63 case KEY_POWER:
64 return BUTTON_POWER;
65
66 default:
67 return 0;
68 }
69}
70
71void button_init_device(void)
72{
73 const char * const input_devs[] = {
74 "/dev/input/event0",
75 "/dev/input/event1"
76 };
77
78 for(int i = 0; i < NR_POLL_DESC; i++)
79 {
80 int fd = open(input_devs[i], O_RDWR);
81
82 if(fd < 0)
83 {
84 panicf("Cannot open input device: %s\n", input_devs[i]);
85 }
86
87 poll_fds[i].fd = fd;
88 poll_fds[i].events = POLLIN;
89 poll_fds[i].revents = 0;
90 }
91}
92
93int button_read_device(void)
94{
95 static int button_bitmap = 0;
96 struct input_event event;
97
98 /* check if there are any events pending and process them */
99 while(poll(poll_fds, NR_POLL_DESC, 0))
100 {
101 for(int i = 0; i < NR_POLL_DESC; i++)
102 {
103 /* read only if non-blocking */
104 if(poll_fds[i].revents & POLLIN)
105 {
106 int size = read(poll_fds[i].fd, &event, sizeof(event));
107 if(size == (int)sizeof(event))
108 {
109 int keycode = event.code;
110 /* event.value == 0x10000 means press
111 * event.value == 0 means release
112 */
113 bool press = event.value ? true : false;
114
115 /* map linux event code to rockbox button bitmap */
116 if(press)
117 {
118 button_bitmap |= button_map(keycode);
119 }
120 else
121 {
122 button_bitmap &= ~button_map(keycode);
123 }
124 }
125 }
126 }
127 }
128
129 return button_bitmap;
130}
131
132bool headphones_inserted(void)
133{
134 int status = 0;
135 const char * const sysfs_hp_switch = "/sys/devices/switch/headset/status";
136 sysfs_get_int(sysfs_hp_switch, &status);
137
138 return status ? true : false;
139}
140
141void button_close_device(void)
142{
143 /* close descriptors */
144 for(int i = 0; i < NR_POLL_DESC; i++)
145 {
146 close(poll_fds[i].fd);
147 }
148}
149
diff --git a/firmware/target/hosted/agptek/button-target.h b/firmware/target/hosted/agptek/button-target.h
new file mode 100644
index 0000000000..b08c055895
--- /dev/null
+++ b/firmware/target/hosted/agptek/button-target.h
@@ -0,0 +1,43 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 by Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#ifndef _BUTTON_TARGET_H_
21#define _BUTTON_TARGET_H_
22
23#include <stdbool.h>
24#include "config.h"
25
26/* Main unit's buttons */
27#define BUTTON_LEFT 0x00000001
28#define BUTTON_RIGHT 0x00000002
29#define BUTTON_UP 0x00000004
30#define BUTTON_DOWN 0x00000008
31#define BUTTON_SELECT 0x00000010
32#define BUTTON_VOLDOWN 0x00000020
33#define BUTTON_VOLUP 0x00000040
34#define BUTTON_POWER 0x00000080
35
36#define BUTTON_MAIN 0x000000ff
37
38/* Software power-off */
39#define POWEROFF_BUTTON BUTTON_POWER
40#define POWEROFF_COUNT 10
41
42#endif /* _BUTTON_TARGET_H_ */
43
diff --git a/firmware/target/hosted/agptek/debug-agptek.c b/firmware/target/hosted/agptek/debug-agptek.c
new file mode 100644
index 0000000000..33f3ac4b97
--- /dev/null
+++ b/firmware/target/hosted/agptek/debug-agptek.c
@@ -0,0 +1,6 @@
1#include <stdbool.h>
2
3bool debug_hw_info(void)
4{
5 return false;
6}
diff --git a/firmware/target/hosted/agptek/lcd-agptek.c b/firmware/target/hosted/agptek/lcd-agptek.c
new file mode 100644
index 0000000000..abf89ea9e3
--- /dev/null
+++ b/firmware/target/hosted/agptek/lcd-agptek.c
@@ -0,0 +1,111 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 Marcin Bukat
10 * Copyright (C) 2016 Amaury Pouly
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 <stdlib.h>
23#include <unistd.h>
24#include <stdio.h>
25#include <linux/fb.h>
26#include <sys/mman.h>
27#include <sys/ioctl.h>
28#include <fcntl.h>
29#include "lcd.h"
30#include "lcd-target.h"
31#include "backlight-target.h"
32#include "panic.h"
33
34static int fd = -1;
35static struct fb_var_screeninfo vinfo;
36fb_data *framebuffer = 0; /* global variable, see lcd-target.h */
37
38void lcd_init_device(void)
39{
40 const char * const fb_dev = "/dev/fb0";
41 fd = open(fb_dev, O_RDWR);
42 if(fd < 0)
43 {
44 panicf("Cannot open framebuffer: %s\n", fb_dev);
45 }
46
47 /* get fixed and variable information */
48 struct fb_fix_screeninfo finfo;
49 if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0)
50 {
51 panicf("Cannot read framebuffer fixed information");
52 }
53
54 if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
55 {
56 panicf("Cannot read framebuffer variable information");
57 }
58
59#if 0
60 /* check resolution and framebuffer size */
61 if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH)
62 {
63 panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres,
64 vinfo.yres, vinfo.bits_per_pixel);
65 }
66#endif
67 /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the
68 * values returned by the driver for line_length */
69
70 /* map framebuffer */
71 framebuffer = mmap(0, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
72 if((void *)framebuffer == MAP_FAILED)
73 {
74 panicf("Cannot map framebuffer");
75 }
76}
77
78static void redraw(void)
79{
80 ioctl(fd, FBIOPAN_DISPLAY, &vinfo);
81}
82
83extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src,
84 int width, int height);
85
86void lcd_update(void)
87{
88 /* Copy the Rockbox framebuffer to the second framebuffer */
89 lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), FBADDR(0,0),
90 LCD_WIDTH*LCD_HEIGHT, 1);
91 redraw();
92}
93
94void lcd_update_rect(int x, int y, int width, int height)
95{
96 fb_data *dst = LCD_FRAMEBUF_ADDR(x, y);
97 fb_data * src = FBADDR(x,y);
98
99 /* Copy part of the Rockbox framebuffer to the second framebuffer */
100 if (width < LCD_WIDTH)
101 {
102 /* Not full width - do line-by-line */
103 lcd_copy_buffer_rect(dst, src, width, height);
104 }
105 else
106 {
107 /* Full width - copy as one line */
108 lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1);
109 }
110 redraw();
111}
diff --git a/firmware/target/hosted/agptek/lcd-target.h b/firmware/target/hosted/agptek/lcd-target.h
new file mode 100644
index 0000000000..346644bdfc
--- /dev/null
+++ b/firmware/target/hosted/agptek/lcd-target.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2016 Amaury Pouly
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#ifndef __LCD_TARGET_H__
22#define __LCD_TARGET_H__
23
24extern fb_data *framebuffer; /* see lcd-nwz.c */
25#define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col))
26#endif /* __LCD_TARGET_H__ */
diff --git a/firmware/target/hosted/agptek/power-agptek.c b/firmware/target/hosted/agptek/power-agptek.c
new file mode 100644
index 0000000000..7403801681
--- /dev/null
+++ b/firmware/target/hosted/agptek/power-agptek.c
@@ -0,0 +1,59 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 by Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#include <sys/types.h>
21#include <fcntl.h>
22#include <string.h>
23#include <unistd.h>
24#include <stdio.h>
25
26#include "system.h"
27#include "power-agptek.h"
28#include "power.h"
29#include "panic.h"
30#include "sysfs.h"
31
32const char * const sysfs_bat_voltage =
33 "/sys/class/power_supply/battery/voltage_now";
34
35const char * const sysfs_bat_status =
36 "/sys/class/power_supply/battery/status";
37
38unsigned int agptek_power_get_status(void)
39{
40 char buf[12] = {0};
41 sysfs_get_string(sysfs_bat_status, buf, sizeof(buf));
42
43 if (strncmp(buf, "Charging", 8) == 0)
44 {
45 return POWER_INPUT_USB_CHARGER;
46 }
47 else
48 {
49 return POWER_INPUT_NONE;
50 }
51}
52
53unsigned int agptek_power_get_battery_voltage(void)
54{
55 int battery_voltage;
56 sysfs_get_int(sysfs_bat_voltage, &battery_voltage);
57
58 return battery_voltage/1000;
59}
diff --git a/firmware/target/hosted/agptek/power-agptek.h b/firmware/target/hosted/agptek/power-agptek.h
new file mode 100644
index 0000000000..16f32b76ad
--- /dev/null
+++ b/firmware/target/hosted/agptek/power-agptek.h
@@ -0,0 +1,29 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 by Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#ifndef _POWER_AGPTEK_H_
21#define _POWER_AGPTEK_H_
22
23#include <stdbool.h>
24#include "config.h"
25
26unsigned int agptek_power_get_status(void);
27unsigned int agptek_power_get_battery_voltage(void);
28#endif /* _POWER_AGPTEK_H_ */
29
diff --git a/firmware/target/hosted/agptek/powermgmt-agptek.c b/firmware/target/hosted/agptek/powermgmt-agptek.c
new file mode 100644
index 0000000000..3371d1e793
--- /dev/null
+++ b/firmware/target/hosted/agptek/powermgmt-agptek.c
@@ -0,0 +1,63 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 Marcin Bukat
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#include "powermgmt.h"
21#include "power.h"
22#include "power-agptek.h"
23
24const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
25{
26 3470
27};
28
29/* the OF shuts down at this voltage */
30const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
31{
32 3400
33};
34
35/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled
36 * NOTE: not calibrated simple linear scale for now
37 */
38const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
39{
40 { 3400, 3480, 3560, 3640, 3720, 3800, 3880, 3960, 4040, 4120, 4200 }
41};
42
43/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
44const unsigned short const percent_to_volt_charge[11] =
45{
46 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200
47};
48
49unsigned int power_input_status(void)
50{
51 /* POWER_INPUT_USB_CHARGER, POWER_INPUT_NONE */
52 return agptek_power_get_status();
53}
54
55int _battery_voltage(void)
56{
57 return agptek_power_get_battery_voltage();
58}
59
60bool charging_state(void)
61{
62 return agptek_power_get_status() == POWER_INPUT_USB_CHARGER;
63}
diff --git a/firmware/target/hosted/agptek/rocker.make b/firmware/target/hosted/agptek/rocker.make
new file mode 100644
index 0000000000..1e8faaac0d
--- /dev/null
+++ b/firmware/target/hosted/agptek/rocker.make
@@ -0,0 +1,48 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10INCLUDES += -I$(FIRMDIR)/include -I$(FIRMDIR)/export $(TARGET_INC) -I$(BUILDDIR) -I$(APPSDIR)
11
12SIMFLAGS += $(INCLUDES) $(DEFINES) -DHAVE_CONFIG_H $(GCCOPTS)
13
14# bootloader build is sligtly different
15ifneq (,$(findstring bootloader,$(APPSDIR)))
16
17SRC += $(call preprocess, $(APPSDIR)/SOURCES)
18CLEANOBJS += $(BUILDDIR)/bootloader.*
19
20endif #bootloader
21
22.SECONDEXPANSION: # $$(OBJ) is not populated until after this
23
24ifneq (,$(findstring bootloader,$(APPSDIR)))
25# bootloader build
26
27$(BUILDDIR)/bootloader.elf : $$(OBJ) $(FIRMLIB) $(CORE_LIBS)
28 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \
29 -L$(BUILDDIR)/firmware -lfirmware \
30 -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \
31 $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/bootloader.map
32
33$(BUILDDIR)/$(BINARY): $(BUILDDIR)/bootloader.elf
34
35else
36# rockbox app build
37
38$(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS)
39 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \
40 -L$(BUILDDIR)/firmware -lfirmware \
41 -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
42 -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \
43 $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
44
45$(BUILDDIR)/rockbox.rocker : $(BUILDDIR)/rockbox.elf
46 $(call PRINTS,OC $(@F))$(call objcopy,$^,$@)
47
48endif
diff --git a/firmware/target/hosted/agptek/sysfs.c b/firmware/target/hosted/agptek/sysfs.c
new file mode 100644
index 0000000000..ad4635ac57
--- /dev/null
+++ b/firmware/target/hosted/agptek/sysfs.c
@@ -0,0 +1,186 @@
1/***************************************************************************
2 * __________ __ ___
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50
10 * Copyright (C) 2014 by Mario Basister: iBasso DX90 port
11 * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features
12 * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23
24
25#include <stdio.h>
26#include <string.h>
27
28#include "config.h"
29#include "debug.h"
30#include "sysfs.h"
31
32
33static FILE* open_read(const char *file_name)
34{
35 FILE *f = fopen(file_name, "r");
36 if(f == NULL)
37 {
38 DEBUGF("ERROR %s: Can not open %s for reading.", __func__, file_name);
39 }
40
41 return f;
42}
43
44
45static FILE* open_write(const char* file_name)
46{
47 FILE *f = fopen(file_name, "w");
48 if(f == NULL)
49 {
50 DEBUGF("ERROR %s: Can not open %s for writing.", __func__, file_name);
51 }
52
53 return f;
54}
55
56
57bool sysfs_get_int(const char *path, int *value)
58{
59 *value = -1;
60
61 FILE *f = open_read(path);
62 if(f == NULL)
63 {
64 return false;
65 }
66
67 bool success = true;
68 if(fscanf(f, "%d", value) == EOF)
69 {
70 DEBUGF("ERROR %s: Read failed for %s.", __func__, path);
71 success = false;
72 }
73
74 fclose(f);
75 return success;
76}
77
78
79bool sysfs_set_int(const char *path, int value)
80{
81 FILE *f = open_write(path);
82 if(f == NULL)
83 {
84 return false;
85 }
86
87 bool success = true;
88 if(fprintf(f, "%d", value) < 1)
89 {
90 DEBUGF("ERROR %s: Write failed for %s.", __func__, path);
91 success = false;
92 }
93
94 fclose(f);
95 return success;
96}
97
98
99bool sysfs_get_char(const char *path, char *value)
100{
101 *value = '\0';
102 FILE *f = open_read(path);
103 if(f == NULL)
104 {
105 return false;
106 }
107
108 bool success = true;
109 if(fscanf(f, "%c", value) == EOF)
110 {
111 DEBUGF("ERROR %s: Read failed for %s.", __func__, path);
112 success = false;
113 }
114
115 fclose(f);
116 return success;
117}
118
119
120bool sysfs_set_char(const char *path, char value)
121{
122 FILE *f = open_write(path);
123 if(f == NULL)
124 {
125 return false;
126 }
127
128 bool success = true;
129 if(fprintf(f, "%c", value) < 1)
130 {
131 DEBUGF("ERROR %s: Write failed for %s.", __func__, path);
132 success = false;
133 }
134
135 fclose(f);
136 return success;
137}
138
139
140bool sysfs_get_string(const char *path, char *value, int size)
141{
142 value[0] = '\0';
143 FILE *f = open_read(path);
144 if(f == NULL)
145 {
146 return false;
147 }
148
149 bool success = true;
150 if(fgets(value, size, f) == NULL)
151 {
152 DEBUGF("ERROR %s: Read failed for %s.", __func__, path);
153 success = false;
154 }
155 else
156 {
157 size_t length = strlen(value);
158 if((length > 0) && value[length - 1] == '\n')
159 {
160 value[length - 1] = '\0';
161 }
162 }
163
164 fclose(f);
165 return success;
166}
167
168
169bool sysfs_set_string(const char *path, char *value)
170{
171 FILE *f = open_write(path);
172 if(f == NULL)
173 {
174 return false;
175 }
176
177 bool success = true;
178 if(fprintf(f, "%s", value) < 1)
179 {
180 DEBUGF("ERROR %s: Write failed for %s.", __func__, path);
181 success = false;
182 }
183
184 fclose(f);
185 return success;
186}
diff --git a/firmware/target/hosted/agptek/sysfs.h b/firmware/target/hosted/agptek/sysfs.h
new file mode 100644
index 0000000000..639cc1c409
--- /dev/null
+++ b/firmware/target/hosted/agptek/sysfs.h
@@ -0,0 +1,31 @@
1/***************************************************************************
2 * __________ __ ___
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50
10 * Copyright (C) 2014 by Mario Basister: iBasso DX90 port
11 * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features
12 * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23
24#include <stdbool.h>
25
26bool sysfs_get_int(const char *path, int *value);
27bool sysfs_set_int(const char *path, int value);
28bool sysfs_get_char(const char *path, char *value);
29bool sysfs_set_char(const char *path, char value);
30bool sysfs_get_string(const char *path, char *value, int size);
31bool sysfs_set_string(const char *path, char *value);
diff --git a/firmware/target/hosted/agptek/system-agptek.c b/firmware/target/hosted/agptek/system-agptek.c
new file mode 100644
index 0000000000..7f0949daf2
--- /dev/null
+++ b/firmware/target/hosted/agptek/system-agptek.c
@@ -0,0 +1,184 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 Marcin Bukat
10 * Copyright (C) 2016 Amaury Pouly
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#include <unistd.h>
22#include <signal.h>
23#include <string.h>
24#include <ucontext.h>
25#include <backtrace.h>
26
27#include "system.h"
28#include "mv.h"
29#include "font.h"
30#include "power.h"
31#include "button.h"
32#include "backlight-target.h"
33#include "lcd.h"
34
35/* to make thread-internal.h happy */
36uintptr_t *stackbegin;
37uintptr_t *stackend;
38
39static void sig_handler(int sig, siginfo_t *siginfo, void *context)
40{
41 /* safe guard variable - we call backtrace() only on first
42 * UIE call. This prevent endless loop if backtrace() touches
43 * memory regions which cause abort
44 */
45 static bool triggered = false;
46
47 lcd_set_backdrop(NULL);
48 lcd_set_drawmode(DRMODE_SOLID);
49 lcd_set_foreground(LCD_BLACK);
50 lcd_set_background(LCD_WHITE);
51 unsigned line = 0;
52
53 lcd_setfont(FONT_SYSFIXED);
54 lcd_set_viewport(NULL);
55 lcd_clear_display();
56
57 /* get context info */
58 ucontext_t *uc = (ucontext_t *)context;
59 unsigned long pc = uc->uc_mcontext.pc;
60 unsigned long sp = uc->uc_mcontext.gregs[29];
61
62 lcd_putsf(0, line++, "%s at %08x", strsignal(sig), pc);
63
64 if(sig == SIGILL || sig == SIGFPE || sig == SIGSEGV || sig == SIGBUS || sig == SIGTRAP)
65 lcd_putsf(0, line++, "address 0x%08x", siginfo->si_addr);
66
67 if(!triggered)
68 {
69 triggered = true;
70 rb_backtrace(pc, sp, &line);
71 }
72
73#ifdef ROCKBOX_HAS_LOGF
74 lcd_putsf(0, line++, "logf:");
75 logf_panic_dump(&line);
76#endif
77
78 lcd_update();
79
80 system_exception_wait(); /* If this returns, try to reboot */
81 system_reboot();
82 while (1); /* halt */
83}
84
85void power_off(void)
86{
87 system("/sbin/poweroff");
88}
89
90void system_init(void)
91{
92 int *s;
93 /* fake stack, to make thread-internal.h happy */
94 stackbegin = stackend = (uintptr_t*)&s;
95 /* catch some signals for easier debugging */
96 struct sigaction sa;
97 sigfillset(&sa.sa_mask);
98 sa.sa_flags = SA_SIGINFO;
99 sa.sa_sigaction = &sig_handler;
100 sigaction(SIGILL, &sa, NULL);
101 sigaction(SIGABRT, &sa, NULL);
102 sigaction(SIGFPE, &sa, NULL);
103 sigaction(SIGSEGV, &sa, NULL);
104 sigaction(SIGPIPE, &sa, NULL);
105 sigaction(SIGTERM, &sa, NULL);
106 sigaction(SIGBUS, &sa, NULL);
107 sigaction(SIGTERM, &sa, NULL);
108}
109
110void system_reboot(void)
111{
112 system("/sbin/reboot");
113}
114
115void system_exception_wait(void)
116{
117 backlight_hw_on();
118 backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING);
119 /* wait until button press and release */
120 while(button_read_device() != 0) {}
121 while(button_read_device() == 0) {}
122 while(button_read_device() != 0) {}
123 while(button_read_device() == 0) {}
124}
125
126bool hostfs_removable(IF_MD_NONVOID(int drive))
127{
128#ifdef HAVE_MULTIDRIVE
129 if (drive > 0) /* Active LOW */
130 return true;
131 else
132#endif
133 return false; /* internal: always present */
134}
135
136bool hostfs_present(IF_MD_NONVOID(int drive))
137{
138#ifdef HAVE_MULTIDRIVE
139 if (drive > 0) /* Active LOW */
140 return true; //FIXME
141 else
142#endif
143 return true; /* internal: always present */
144}
145
146#ifdef HAVE_MULTIDRIVE
147int volume_drive(int drive)
148{
149 return drive;
150}
151#endif /* HAVE_MULTIDRIVE */
152
153#ifdef CONFIG_STORAGE_MULTI
154int hostfs_driver_type(int drive)
155{
156 return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM;
157}
158#endif /* CONFIG_STORAGE_MULTI */
159
160int hostfs_init(void)
161{
162 return 0;
163}
164
165int hostfs_flush(void)
166{
167 sync();
168 return 0;
169}
170
171#ifdef HAVE_HOTSWAP
172bool volume_removable(int volume)
173{
174 /* don't support more than one partition yet, so volume == drive */
175 return hostfs_removable(volume);
176}
177
178bool volume_present(int volume)
179{
180 /* don't support more than one partition yet, so volume == drive */
181 return hostfs_present(volume);
182}
183#endif
184
diff --git a/firmware/target/hosted/agptek/system-target.h b/firmware/target/hosted/agptek/system-target.h
new file mode 100644
index 0000000000..830f19fde4
--- /dev/null
+++ b/firmware/target/hosted/agptek/system-target.h
@@ -0,0 +1,28 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2017 Marcin Bukat
10 * Copyright (C) 2016 Amaury Pouly
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#include "kernel-unix.h"
25#include "system-hosted.h"
26
27#define NEED_GENERIC_BYTESWAPS
28#endif /* __SYSTEM_TARGET_H__ */
diff --git a/firmware/target/hosted/alsa-controls.c b/firmware/target/hosted/alsa-controls.c
index 1d6d73e751..19de7aea44 100644
--- a/firmware/target/hosted/alsa-controls.c
+++ b/firmware/target/hosted/alsa-controls.c
@@ -3,7 +3,7 @@
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2016 Amaury Pouly 9 * Copyright (C) 2016 Amaury Pouly
diff --git a/firmware/target/hosted/alsa-controls.h b/firmware/target/hosted/alsa-controls.h
index 870797c5b8..a08fc46e14 100644
--- a/firmware/target/hosted/alsa-controls.h
+++ b/firmware/target/hosted/alsa-controls.h
@@ -1,10 +1,19 @@
1/*************************************************************************** 1/***************************************************************************
2<<<<<<< 9a9c7f2b7c63a9db203084a3485988c07f17b86c
2 * __________ __ ___. 3 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 8 * \/ \/ \/ \/ \/
9=======
10 * __________ __ ___.
11 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
12 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
13 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
14 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
15 * \/ \/ \/ \/ \/
16>>>>>>> Agptek rocker port initial commit
8 * 17 *
9 * Copyright (C) 2016 Amaury Pouly 18 * Copyright (C) 2016 Amaury Pouly
10 * 19 *
diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c
index 64ce9f41bc..4f1019c7a1 100644
--- a/firmware/target/hosted/filesystem-app.c
+++ b/firmware/target/hosted/filesystem-app.c
@@ -48,7 +48,8 @@ static const char rbhome[] = HOME_DIR;
48#endif 48#endif
49 49
50#if !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || defined(DX50) || \ 50#if !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || defined(DX50) || \
51 defined(SONY_NWZ_LINUX) || defined(DX90)) && !defined(__PCTOOL__) 51 defined(SONY_NWZ_LINUX) || defined(DX90) || defined(AGPTEK_ROCKER)) && \
52 !defined(__PCTOOL__)
52/* Special dirs are user-accessible (and user-writable) dirs which take priority 53/* Special dirs are user-accessible (and user-writable) dirs which take priority
53 * over the ones where Rockbox is installed to. Classic example would be 54 * over the ones where Rockbox is installed to. Classic example would be
54 * $HOME/.config/rockbox.org vs /usr/share/rockbox */ 55 * $HOME/.config/rockbox.org vs /usr/share/rockbox */
diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h
index d14f70bf99..1ac124c881 100644
--- a/firmware/target/hosted/sdl/sim-ui-defines.h
+++ b/firmware/target/hosted/sdl/sim-ui-defines.h
@@ -515,6 +515,12 @@
515#define UI_LCD_POSX 78 515#define UI_LCD_POSX 78
516#define UI_LCD_POSY 92 516#define UI_LCD_POSY 92
517 517
518#elif defined(AGPTEK_ROCKER)
519#define UI_TITLE "Agptek Rocker"
520#define UI_WIDTH 186
521#define UI_HEIGHT 380
522#define UI_LCD_POSX 29
523#define UI_LCD_POSY 25
518#elif defined(SIMULATOR) 524#elif defined(SIMULATOR)
519#error no UI defines 525#error no UI defines
520#endif 526#endif
diff --git a/lib/rbcodec/codecs/libmad/libmad.make b/lib/rbcodec/codecs/libmad/libmad.make
index 16b2bd76a9..a8dedc6721 100644
--- a/lib/rbcodec/codecs/libmad/libmad.make
+++ b/lib/rbcodec/codecs/libmad/libmad.make
@@ -19,7 +19,8 @@ MADFLAGS += -UDEBUG -DNDEBUG -DHAVE_LIMITS_H -DHAVE_ASSERT_H
19ifeq ($(ARCH),arch_arm) 19ifeq ($(ARCH),arch_arm)
20 MADFLAGS += -O1 20 MADFLAGS += -O1
21else 21else
22 MADFLAGS += -O2 22# MADFLAGS += -O2
23 MADFLAGS += -O0 -g
23endif 24endif
24 25
25# MPEGplayer 26# MPEGplayer
diff --git a/tools/configure b/tools/configure
index d86c78de3a..27c1e71f23 100755
--- a/tools/configure
+++ b/tools/configure
@@ -867,6 +867,26 @@ androidndkcc()
867 prefixtools $gcctarget 867 prefixtools $gcctarget
868} 868}
869 869
870mipsellinuxcc () {
871 GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib//`
872 GCCOPTS="$GCCOPTS -march=mips32r2 -mno-mips16 -mno-long-calls -Umips -fPIC"
873 GCCOPTIMIZE=''
874 LDOPTS="-lasound -lpthread -lm -ldl -lrt $LDOPTS"
875 GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs"
876 SHARED_LDFLAG="-shared"
877 SHARED_CFLAGS='-fPIC -fvisibility=hidden'
878 endian="little"
879 app_type="rocker"
880 thread_support="HAVE_SIGALTSTACK_THREADS"
881
882 # Include path
883 GCCOPTS="$GCCOPTS -D_GNU_SOURCE=1 -U_FORTIFY_SOURCE -D_REENTRANT"
884
885 # Set up compiler
886 gccchoice="4.9.4"
887 prefixtools "mipsel-rockbox-linux-gnu-"
888}
889
870whichadvanced () { 890whichadvanced () {
871 atype=`echo "$1" | cut -c 2-` 891 atype=`echo "$1" | cut -c 2-`
872 ################################################################## 892 ##################################################################
@@ -1511,8 +1531,8 @@ cat <<EOF
1511 207) Android x86 230) 760 223) NWZ-E460 series 1531 207) Android x86 230) 760 223) NWZ-E460 series
1512 208) Samsung YP-R1 231) 960 224) NWZ-E470 series 1532 208) Samsung YP-R1 231) 960 224) NWZ-E470 series
1513 225) NWZ-E580 series 1533 225) NWZ-E580 series
1514 ==iBasso== 226) NWZ-A10 series 1534 ==iBasso== ==Agptek== 226) NWZ-A10 series
1515 232) DX50 227) NW-A20 series 1535 232) DX50 240) Rocker 227) NW-A20 series
1516 233) DX90 228) NWZ-A860 series 1536 233) DX90 228) NWZ-A860 series
1517 229) NWZ-S750 series 1537 229) NWZ-S750 series
1518EOF 1538EOF
@@ -4173,6 +4193,29 @@ fi
4173 t_model="dx90" 4193 t_model="dx90"
4174 ;; 4194 ;;
4175 4195
4196 240|agptekrocker)
4197 application="yes"
4198 target_id=97
4199 modelname="agptekrocker"
4200 target="AGPTEK_ROCKER"
4201 memory=6
4202 tool="cp "
4203 boottool="cp "
4204 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
4205 bmp2rb_native="$rootdir/tools/bmp2rb -f 10"
4206 output="rockbox.rocker"
4207 bootoutput="bootloader.rocker"
4208 appextra="recorder:gui:hosted"
4209 plugins=""
4210 swcodec="yes"
4211 # architecture, manufacturer and model for the target-tree build
4212 t_cpu="hosted"
4213 t_manufacturer="agptek"
4214 t_model="rocker"
4215 rbdir='/mnt/sd_0/.rockbox'
4216 mipsellinuxcc
4217 ;;
4218
4176 *) 4219 *)
4177 echo "Please select a supported target platform!" 4220 echo "Please select a supported target platform!"
4178 exit 7 4221 exit 7
diff --git a/tools/root.make b/tools/root.make
index b5bd0e8096..60a2b69404 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -103,6 +103,8 @@ endif
103ifneq (,$(findstring bootloader,$(APPSDIR))) 103ifneq (,$(findstring bootloader,$(APPSDIR)))
104 ifneq (,$(findstring sonynwz,$(APP_TYPE))) 104 ifneq (,$(findstring sonynwz,$(APP_TYPE)))
105 include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make 105 include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
106 else ifneq (,$(findstring rocker,$(APP_TYPE)))
107 include $(ROOTDIR)/firmware/target/hosted/agptek/rocker.make
106 else 108 else
107 include $(APPSDIR)/bootloader.make 109 include $(APPSDIR)/bootloader.make
108 endif 110 endif
@@ -143,6 +145,10 @@ else # core
143 include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make 145 include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
144 endif 146 endif
145 147
148 ifneq (,$(findstring rocker,$(APP_TYPE)))
149 include $(ROOTDIR)/firmware/target/hosted/agptek/rocker.make
150 endif
151
146 ifneq (,$(findstring android_ndk, $(APP_TYPE))) 152 ifneq (,$(findstring android_ndk, $(APP_TYPE)))
147 include $(ROOTDIR)/firmware/target/hosted/ibasso/android_ndk.make 153 include $(ROOTDIR)/firmware/target/hosted/ibasso/android_ndk.make
148 else 154 else
diff --git a/uisimulator/bitmaps/UI-agptekrocker.bmp b/uisimulator/bitmaps/UI-agptekrocker.bmp
new file mode 100644
index 0000000000..36a215f234
--- /dev/null
+++ b/uisimulator/bitmaps/UI-agptekrocker.bmp
Binary files differ
diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES
index 6acbd94624..901b4ebd2f 100644
--- a/uisimulator/buttonmap/SOURCES
+++ b/uisimulator/buttonmap/SOURCES
@@ -83,5 +83,7 @@ samsung-ypr0.c
83creative-zen.c 83creative-zen.c
84#elif CONFIG_KEYPAD == SONY_NWZA860_PAD 84#elif CONFIG_KEYPAD == SONY_NWZA860_PAD
85sony-nwza860.c 85sony-nwza860.c
86#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
87agptek-rocker.c
86#endif 88#endif
87#endif /* SIMULATOR */ 89#endif /* SIMULATOR */
diff --git a/uisimulator/buttonmap/agptek-rocker.c b/uisimulator/buttonmap/agptek-rocker.c
new file mode 100644
index 0000000000..ef7abd9879
--- /dev/null
+++ b/uisimulator/buttonmap/agptek-rocker.c
@@ -0,0 +1,80 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2013 by Amaury Pouly
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 <SDL.h>
24#include "button.h"
25#include "buttonmap.h"
26
27int key_to_button(int keyboard_button)
28{
29 int new_btn = BUTTON_NONE;
30 switch (keyboard_button)
31 {
32 case SDLK_KP4:
33 case SDLK_LEFT:
34 new_btn = BUTTON_LEFT;
35 break;
36 case SDLK_KP6:
37 case SDLK_RIGHT:
38 new_btn = BUTTON_RIGHT;
39 break;
40 case SDLK_KP8:
41 case SDLK_UP:
42 new_btn = BUTTON_UP;
43 break;
44 case SDLK_KP2:
45 case SDLK_DOWN:
46 new_btn = BUTTON_DOWN;
47 break;
48 case SDLK_ESCAPE:
49 new_btn = BUTTON_POWER;
50 break;
51 case SDLK_KP_PLUS:
52 case SDLK_EQUALS:
53 new_btn = BUTTON_VOLUP;
54 break;
55 case SDLK_KP_MINUS:
56 case SDLK_MINUS:
57 new_btn = BUTTON_VOLDOWN;
58 break;
59 case SDLK_KP_ENTER:
60 case SDLK_RETURN:
61 case SDLK_SPACE:
62 case SDLK_INSERT:
63 case SDLK_KP5:
64 new_btn = BUTTON_SELECT;
65 break;
66 }
67 return new_btn;
68}
69
70struct button_map bm[] = {
71 { SDLK_LEFT, 38, 296, 20, "Left" },
72 { SDLK_RIGHT, 146, 295, 20, "Right" },
73 { SDLK_UP, 93, 241, 20, "Up" },
74 { SDLK_DOWN, 93, 348, 20, "Down" },
75 { SDLK_ESCAPE, 2, 45, 20, "Power" },
76 { SDLK_RETURN, 93, 295, 40, "Select" },
77 { SDLK_KP_MINUS, 182, 100, 30, "Volume -" },
78 { SDLK_KP_PLUS, 182, 45, 30, "Volume +" },
79 { 0, 0, 0, 0, "None" }
80};
diff --git a/wps/WPSLIST b/wps/WPSLIST
index d26370214f..6708d7264d 100644
--- a/wps/WPSLIST
+++ b/wps/WPSLIST
@@ -95,7 +95,7 @@ wps.160x128x1: cabbiev2.160x128x1.wps
95wps.138x110x2: cabbiev2.138x110x2.wps 95wps.138x110x2: cabbiev2.138x110x2.wps
96wps.128x128x(16|24): cabbiev2.128x128x16.wps 96wps.128x128x(16|24): cabbiev2.128x128x16.wps
97wps.128x128x2: cabbiev2.128x128x2.wps 97wps.128x128x2: cabbiev2.128x128x2.wps
98wps.128x160x(16|24): cabbiev2.128x160x16.wps 98wps.128x160x(16|24|32): cabbiev2.128x160x16.wps
99wps.132x80x(16|24): cabbiev2.132x80x16.wps 99wps.132x80x(16|24): cabbiev2.132x80x16.wps
100wps.128x96x(16|24): cabbiev2.128x96x16.wps 100wps.128x96x(16|24): cabbiev2.128x96x16.wps
101wps.128x96x2: cabbiev2.128x96x2.wps 101wps.128x96x2: cabbiev2.128x96x2.wps
@@ -124,7 +124,7 @@ Font.160x128x1: 12-Adobe-Helvetica.fnt
124Font.138x110x2: 12-Adobe-Helvetica.fnt 124Font.138x110x2: 12-Adobe-Helvetica.fnt
125Font.128x128x(16|24): 12-Adobe-Helvetica.fnt 125Font.128x128x(16|24): 12-Adobe-Helvetica.fnt
126Font.128x128x2: 12-Adobe-Helvetica.fnt 126Font.128x128x2: 12-Adobe-Helvetica.fnt
127Font.128x160x(16|24): 12-Adobe-Helvetica.fnt 127Font.128x160x(16|24|32): 12-Adobe-Helvetica.fnt
128Font.132x80x(16|24): 11-Sazanami-Mincho.fnt 128Font.132x80x(16|24): 11-Sazanami-Mincho.fnt
129Font.128x96x(16|24): 08-Rockfont.fnt 129Font.128x96x(16|24): 08-Rockfont.fnt
130Font.128x96x2: 12-Adobe-Helvetica.fnt 130Font.128x96x2: 12-Adobe-Helvetica.fnt
@@ -148,7 +148,7 @@ backdrop.320x480x(16|24): backdrops/cabbiev2.320x480x16.bmp
148backdrop.320x240x(16|24): backdrops/cabbiev2.320x240x16.bmp 148backdrop.320x240x(16|24): backdrops/cabbiev2.320x240x16.bmp
149backdrop.128x128x(16|24): backdrops/cabbiev2.128x128x16.bmp 149backdrop.128x128x(16|24): backdrops/cabbiev2.128x128x16.bmp
150backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp 150backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp
151backdrop.128x160x(16|24): backdrops/cabbiev2.128x160x16.bmp 151backdrop.128x160x(16|24|32): backdrops/cabbiev2.128x160x16.bmp
152backdrop.132x80x(16|24): backdrops/cabbiev2.132x80x16.bmp 152backdrop.132x80x(16|24): backdrops/cabbiev2.132x80x16.bmp
153backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp 153backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp
154backdrop.160x128x(16|24): backdrops/cabbiev2.160x128x16.bmp 154backdrop.160x128x(16|24): backdrops/cabbiev2.160x128x16.bmp
@@ -173,9 +173,9 @@ iconset.400x240x(16|24): icons/tango_icons.16x16.bmp
173iconset.320x480x(16|24): icons/tango_icons.24x24.bmp 173iconset.320x480x(16|24): icons/tango_icons.24x24.bmp
174iconset.320x240x(16|24): icons/tango_icons.16x16.bmp 174iconset.320x240x(16|24): icons/tango_icons.16x16.bmp
175iconset.128x128x(16|24): icons/tango_icons.12x12.bmp 175iconset.128x128x(16|24): icons/tango_icons.12x12.bmp
176iconset.128x160x(16|24): icons/tango_icons.12x12.bmp 176iconset.128x160x(16|24|32): icons/tango_icons.12x12.bmp
177iconset.132x80x(16|24): icons/tango_icons.12x12.bmp 177iconset.132x80x(16|24): icons/tango_icons.12x12.bmp
178iconset.160x128x(16|24): icons/tango_icons.12x12.bmp 178iconset.160x128x(16|24|32): icons/tango_icons.12x12.bmp
179iconset.176x132x(16|24): icons/tango_icons.12x12.bmp 179iconset.176x132x(16|24): icons/tango_icons.12x12.bmp
180iconset.176x220x(16|24): icons/tango_icons.12x12.bmp 180iconset.176x220x(16|24): icons/tango_icons.12x12.bmp
181iconset.220x176x(16|24): icons/tango_icons.12x12.bmp 181iconset.220x176x(16|24): icons/tango_icons.12x12.bmp
@@ -194,7 +194,7 @@ viewers iconset.320x240x(16|24): icons/tango_icons_viewers.16x16.bmp
194viewers iconset.128x128x(16|24): icons/tango_icons_viewers.12x12.bmp 194viewers iconset.128x128x(16|24): icons/tango_icons_viewers.12x12.bmp
195viewers iconset.128x160x(16|24): icons/tango_icons_viewers.12x12.bmp 195viewers iconset.128x160x(16|24): icons/tango_icons_viewers.12x12.bmp
196viewers iconset.132x80x(16|24): icons/tango_icons_viewers.12x12.bmp 196viewers iconset.132x80x(16|24): icons/tango_icons_viewers.12x12.bmp
197viewers iconset.160x128x(16|24): icons/tango_icons_viewers.12x12.bmp 197viewers iconset.160x128x(16|24|32): icons/tango_icons_viewers.12x12.bmp
198viewers iconset.176x132x(16|24): icons/tango_icons_viewers.12x12.bmp 198viewers iconset.176x132x(16|24): icons/tango_icons_viewers.12x12.bmp
199viewers iconset.176x220x(16|24): icons/tango_icons_viewers.12x12.bmp 199viewers iconset.176x220x(16|24): icons/tango_icons_viewers.12x12.bmp
200viewers iconset.220x176x(16|24): icons/tango_icons_viewers.12x12.bmp 200viewers iconset.220x176x(16|24): icons/tango_icons_viewers.12x12.bmp