summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-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
34 files changed, 1389 insertions, 62 deletions
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