summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-06-28 06:24:26 -0400
committerMichael Giacomelli <giac2000@hotmail.com>2018-07-28 10:56:31 -0400
commit0662793ca0050e823cd1207cc4689a1cba5068bd (patch)
tree08cd2ec59c9044c96b697b5bf8d0640841d044e0 /bootloader
parentb3e2bd619b1b7ea94ef29d32db48e80b347a1990 (diff)
downloadrockbox-0662793ca0050e823cd1207cc4689a1cba5068bd.tar.gz
rockbox-0662793ca0050e823cd1207cc4689a1cba5068bd.tar.bz2
rockbox-0662793ca0050e823cd1207cc4689a1cba5068bd.zip
Add cleaned-up xDuoo X3 support
Cleaned up, rebased, and forward-ported from the xvortex fork. (original credit to vsoftster@gmail.com) Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/SOURCES3
-rw-r--r--bootloader/common.c2
-rw-r--r--bootloader/xduoox3.c184
3 files changed, 188 insertions, 1 deletions
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index 359e2ba700..0b39da153a 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -53,6 +53,9 @@ samsung_yps3.c
#elif defined(ONDA_VX747) || defined(ONDA_VX747P) || defined(ONDA_VX767) || defined(ONDA_VX777)
ondavx747.c
show_logo.c
+#elif defined(XDUOO_X3)
+xduoox3.c
+show_logo.c
#elif defined(CREATIVE_ZVx)
creativezvm.c
#elif CONFIG_CPU==AS3525 || CONFIG_CPU==AS3525v2
diff --git a/bootloader/common.c b/bootloader/common.c
index 4969d92b40..5c5647ac64 100644
--- a/bootloader/common.c
+++ b/bootloader/common.c
@@ -54,7 +54,7 @@
|| defined(SAMSUNG_YH820) || defined(PHILIPS_SA9200) \
|| defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) \
|| defined(ONDA_VX747) || defined(PBELL_VIBE500) \
- || defined(TOSHIBA_GIGABEAT_S)
+ || defined(TOSHIBA_GIGABEAT_S) || defined(XDUOO_X3)
bool verbose = false;
#else
bool verbose = true;
diff --git a/bootloader/xduoox3.c b/bootloader/xduoox3.c
new file mode 100644
index 0000000000..3db87a866d
--- /dev/null
+++ b/bootloader/xduoox3.c
@@ -0,0 +1,184 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2016 by Roman Stolyarov
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "jz4760b.h"
+#include "../kernel-internal.h"
+#include "backlight.h"
+#include "font.h"
+#include "lcd.h"
+#include "file.h"
+#include "usb.h"
+#include "system.h"
+#include "button.h"
+#include "common.h"
+#include "rb-loader.h"
+#include "loader_strerror.h"
+#include "storage.h"
+#include "file_internal.h"
+#include "disk.h"
+#include "string.h"
+#include "adc.h"
+#include "version.h"
+
+#include "xdebug.h"
+
+extern void show_logo(void);
+extern void power_off(void);
+
+static void show_splash(int timeout, const char *msg)
+{
+ reset_screen();
+ lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2,
+ (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg);
+ lcd_update();
+
+ sleep(timeout);
+}
+
+static void usb_mode(void)
+{
+ int button;
+
+ /* Init USB */
+ usb_init();
+ usb_start_monitoring();
+
+ /* Wait for threads to connect */
+ show_splash(HZ/2, "Waiting for USB");
+
+ while (1)
+ {
+ button = button_get_w_tmo(HZ/2);
+
+ if (button == SYS_USB_CONNECTED)
+ break; /* Hit */
+ }
+
+ if (button == SYS_USB_CONNECTED)
+ {
+ /* Got the message - wait for disconnect */
+ show_splash(0, "Bootloader USB mode");
+
+ usb_acknowledge(SYS_USB_CONNECTED_ACK);
+
+ while (1)
+ {
+ button = button_get(true);
+ if (button == SYS_USB_DISCONNECTED)
+ break;
+ }
+ }
+}
+
+static int boot_rockbox(void)
+{
+ int rc;
+ void (*kernel_entry)(void);
+
+ printf("Mounting disk...\n");
+ rc = disk_mount_all();
+ if (rc <= 0)
+ {
+ verbose = true;
+ error(EDISK,rc, true);
+ }
+
+ printf("Loading firmware...\n");
+ rc = load_firmware((unsigned char *)CONFIG_SDRAM_START, BOOTFILE, 0x400000);
+ if(rc <= EFILE_EMPTY)
+ return rc;
+ else
+ {
+ printf("Starting Rockbox...\n");
+ adc_close(); /* Disable SADC, seems to fix the re-init Rockbox does */
+
+ disable_interrupt();
+ kernel_entry = (void*) CONFIG_SDRAM_START;
+ kernel_entry();
+
+ return 0; /* Shouldn't happen */
+ }
+}
+
+static void reset_configuration(void)
+{
+ int rc;
+
+ rc = disk_mount_all();
+ if (rc <= 0)
+ {
+ verbose = true;
+ error(EDISK,rc, true);
+ }
+
+ if(rename(ROCKBOX_DIR "/config.cfg", ROCKBOX_DIR "/config.old") == 0)
+ show_splash(HZ/2, "Configuration reset successfully!");
+ else
+ show_splash(HZ/2, "Couldn't reset configuration!");
+}
+
+int main(void)
+{
+ int rc;
+
+ serial_puts("\n\nSPL Stage 2\n\n");
+
+ kernel_init();
+ lcd_init();
+ font_init();
+ lcd_setfont(FONT_SYSFIXED);
+ button_init();
+ backlight_init();
+
+ show_logo();
+
+ filesystem_init();
+
+ rc = storage_init();
+ if(rc)
+ {
+ verbose = true;
+ error(EATA, rc, true);
+ }
+
+ /* Don't mount the disks yet, there could be file system/partition errors
+ which are fixable in USB mode */
+
+ reset_screen();
+
+ printf(MODEL_NAME" Rockbox Bootloader\n");
+ printf("Version %s\n", rbversion);
+
+ rc = boot_rockbox();
+
+ if(rc <= EFILE_EMPTY)
+ {
+ verbose = true;
+ printf("Error: %s", loader_strerror(rc));
+ }
+
+ /* Halt */
+ while (1)
+ core_idle();
+
+ return 0;
+}