summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-11 09:30:41 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-11 14:18:42 +0000
commit6533d983ca48b48563cd6177c2a9d4ad1a84b749 (patch)
tree40b59ef742c2daea168ba408d1827511c192134d /firmware
parentfcdfeb2a45bf0045e5d23104259de68b1da7b16e (diff)
downloadrockbox-6533d983ca48b48563cd6177c2a9d4ad1a84b749.tar.gz
rockbox-6533d983ca48b48563cd6177c2a9d4ad1a84b749.zip
hosted: Add ROLO support for hosted targets
Change-Id: I2d46a63ee8225a9d9d77dd80a06c418af78c260c
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES4
-rw-r--r--firmware/export/config/agptekrocker.h5
-rw-r--r--firmware/export/config/xduoox20.h6
-rw-r--r--firmware/export/config/xduoox3ii.h7
-rw-r--r--firmware/export/rolo.h4
-rw-r--r--firmware/rolo.c6
-rw-r--r--firmware/target/hosted/rolo.c102
7 files changed, 131 insertions, 3 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 42677725fc..cbbebbc66f 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -47,6 +47,10 @@ debug.c
47#endif /* PLATFORM_NATIVE */ 47#endif /* PLATFORM_NATIVE */
48panic.c 48panic.c
49 49
50#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(BOOTFILE)
51target/hosted/rolo.c
52#endif
53
50#ifdef HAVE_SDL 54#ifdef HAVE_SDL
51target/hosted/sdl/button-sdl.c 55target/hosted/sdl/button-sdl.c
52target/hosted/sdl/kernel-sdl.c 56target/hosted/sdl/kernel-sdl.c
diff --git a/firmware/export/config/agptekrocker.h b/firmware/export/config/agptekrocker.h
index 749786dff1..a97522d976 100644
--- a/firmware/export/config/agptekrocker.h
+++ b/firmware/export/config/agptekrocker.h
@@ -124,3 +124,8 @@
124#define BATTERY_CAPACITY_MIN 600 /* min. capacity selectable */ 124#define BATTERY_CAPACITY_MIN 600 /* min. capacity selectable */
125#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ 125#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */
126#define BATTERY_CAPACITY_INC 0 /* capacity increment */ 126#define BATTERY_CAPACITY_INC 0 /* capacity increment */
127
128/* ROLO */
129#define BOOTFILE_EXT "rocker"
130#define BOOTFILE "rockbox." BOOTFILE_EXT
131#define BOOTDIR "/.rockbox"
diff --git a/firmware/export/config/xduoox20.h b/firmware/export/config/xduoox20.h
index 1852027cf0..a8d2175719 100644
--- a/firmware/export/config/xduoox20.h
+++ b/firmware/export/config/xduoox20.h
@@ -122,3 +122,9 @@
122#define BATTERY_CAPACITY_MIN 2400 /* min. capacity selectable */ 122#define BATTERY_CAPACITY_MIN 2400 /* min. capacity selectable */
123#define BATTERY_CAPACITY_MAX 2400 /* max. capacity selectable */ 123#define BATTERY_CAPACITY_MAX 2400 /* max. capacity selectable */
124#define BATTERY_CAPACITY_INC 0 /* capacity increment */ 124#define BATTERY_CAPACITY_INC 0 /* capacity increment */
125
126/* ROLO */
127#define BOOTFILE_EXT "x20"
128#define BOOTFILE "rockbox." BOOTFILE_EXT
129#define BOOTDIR "/.rockbox"
130
diff --git a/firmware/export/config/xduoox3ii.h b/firmware/export/config/xduoox3ii.h
index dab7c0f257..143d4442fd 100644
--- a/firmware/export/config/xduoox3ii.h
+++ b/firmware/export/config/xduoox3ii.h
@@ -122,3 +122,10 @@
122#define BATTERY_CAPACITY_MIN 2000 /* min. capacity selectable */ 122#define BATTERY_CAPACITY_MIN 2000 /* min. capacity selectable */
123#define BATTERY_CAPACITY_MAX 2000 /* max. capacity selectable */ 123#define BATTERY_CAPACITY_MAX 2000 /* max. capacity selectable */
124#define BATTERY_CAPACITY_INC 0 /* capacity increment */ 124#define BATTERY_CAPACITY_INC 0 /* capacity increment */
125
126/* ROLO */
127#define BOOTFILE_EXT "x3ii"
128#define BOOTFILE "rockbox." BOOTFILE_EXT
129#define BOOTDIR "/.rockbox"
130
131
diff --git a/firmware/export/rolo.h b/firmware/export/rolo.h
index 1a06d61892..4b6c8abf64 100644
--- a/firmware/export/rolo.h
+++ b/firmware/export/rolo.h
@@ -21,6 +21,10 @@
21#ifndef __ROLO_H__ 21#ifndef __ROLO_H__
22#define __ROLO_H__ 22#define __ROLO_H__
23 23
24#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(BOOTFILE)
25#define HAVE_ROLO
26#endif
27
24int rolo_load(const char* file); 28int rolo_load(const char* file);
25 29
26#ifdef CPU_PP 30#ifdef CPU_PP
diff --git a/firmware/rolo.c b/firmware/rolo.c
index 7cded0906f..50f3d68183 100644
--- a/firmware/rolo.c
+++ b/firmware/rolo.c
@@ -45,7 +45,7 @@
45#if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) 45#if defined(HAVE_BOOTDATA) && !defined(SIMULATOR)
46#include "bootdata.h" 46#include "bootdata.h"
47#include "crc32.h" 47#include "crc32.h"
48extern int write_bootdata(unsigned char* buf, int len, unsigned int boot_volume); /*mi4-loader.c*/ 48extern int write_bootdata(unsigned char* buf, int len, unsigned int boot_volume); /*mi4-loader.c*/
49#endif 49#endif
50#define LOAD_FIRMWARE(a,b,c) load_mi4(a,b,c) 50#define LOAD_FIRMWARE(a,b,c) load_mi4(a,b,c)
51#elif defined(RKW_FORMAT) 51#elif defined(RKW_FORMAT)
@@ -56,7 +56,7 @@ extern int write_bootdata(unsigned char* buf, int len, unsigned int boot_volume
56#if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) 56#if defined(HAVE_BOOTDATA) && !defined(SIMULATOR)
57#include "bootdata.h" 57#include "bootdata.h"
58#include "crc32.h" 58#include "crc32.h"
59extern int write_bootdata(unsigned char* buf, int len, unsigned int boot_volume); /*rb-loader.c*/ 59extern int write_bootdata(unsigned char* buf, int len, unsigned int boot_volume); /*rb-loader.c*/
60#endif 60#endif
61#define LOAD_FIRMWARE(a,b,c) load_firmware(a,b,c) 61#define LOAD_FIRMWARE(a,b,c) load_firmware(a,b,c)
62#endif 62#endif
@@ -98,7 +98,7 @@ void rolo_restart_cop(void)
98 98
99 /* Invalidate cache */ 99 /* Invalidate cache */
100 commit_discard_idcache(); 100 commit_discard_idcache();
101 101
102 /* Disable cache */ 102 /* Disable cache */
103 CACHE_CTL = CACHE_CTL_DISABLE; 103 CACHE_CTL = CACHE_CTL_DISABLE;
104 104
diff --git a/firmware/target/hosted/rolo.c b/firmware/target/hosted/rolo.c
new file mode 100644
index 0000000000..432d69c86e
--- /dev/null
+++ b/firmware/target/hosted/rolo.c
@@ -0,0 +1,102 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2020 Solomon Peachy
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 "lcd.h"
23#ifdef HAVE_REMOTE_LCD
24#include "lcd-remote.h"
25#endif
26#include "audio.h"
27#include "button.h"
28#include "scroll_engine.h"
29#include "storage.h"
30#include "rolo.h"
31#include "rbpaths.h"
32
33#include <unistd.h>
34#include <stdio.h>
35
36#if defined(HAVE_BOOTDATA) && !defined(SIMULATOR)
37#include "bootdata.h"
38#include "crc32.h"
39extern int write_bootdata(unsigned char* buf, int len, unsigned int boot_volume); /*rb-loader.c*/
40#endif
41
42static void rolo_error(const char *text, const char *text2)
43{
44 lcd_clear_display();
45 lcd_puts(0, 0, "ROLO error:");
46 lcd_puts_scroll(0, 1, text);
47 if (text2)
48 lcd_puts_scroll(0, 2, text2);
49 lcd_update();
50 button_get(true);
51 button_get(true);
52 button_get(true);
53 lcd_scroll_stop();
54}
55
56int rolo_load(const char* filename)
57{
58 lcd_clear_display();
59 lcd_puts(0, 0, "ROLO...");
60 lcd_puts(0, 1, "Loading");
61 lcd_update();
62#ifdef HAVE_REMOTE_LCD
63 lcd_remote_clear_display();
64 lcd_remote_puts(0, 0, "ROLO...");
65 lcd_remote_puts(0, 1, "Loading");
66 lcd_remote_update();
67#endif
68
69 audio_stop();
70
71#if defined(HAVE_BOOTDATA) && !defined(SIMULATOR)
72 /* write the bootdata as if rolo were the bootloader */
73 unsigned int crc = 0;
74 if (strcmp(filename, BOOTDIR "/" BOOTFILE) == 0)
75 crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff);
76
77 if(crc > 0 && crc == boot_data.crc)
78 write_bootdata(filebuf, filebuf_size, boot_data.boot_volume); /* rb-loader.c */
79#endif
80
81#ifdef HAVE_STORAGE_FLUSH
82 lcd_puts(0, 1, "Flushing storage buffers");
83 lcd_update();
84 storage_flush();
85#endif
86
87 lcd_puts(0, 1, "Executing");
88 lcd_update();
89#ifdef HAVE_REMOTE_LCD
90 lcd_remote_puts(0, 1, "Executing");
91 lcd_remote_update();
92#endif
93
94 char buf[256];
95 snprintf(buf, sizeof(buf), "%s/%s", HOME_DIR, filename);
96 execl(buf, BOOTFILE, NULL);
97
98 rolo_error("Failed to launch!", strerror(errno));
99
100 /* never reached */
101 return 0;
102}