summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-10-02 02:19:10 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2021-10-04 10:56:33 -0400
commit7c67a48332d0519c43618efd943f19d2e4bf5788 (patch)
tree98b20f656f3d79f426bde2a6f625dc605655c77b
parent75524a7eeca2a5771486762b65c7e0e5ad3e4a65 (diff)
downloadrockbox-7c67a48332.tar.gz
rockbox-7c67a48332.zip
Sansa E200v1 Bootloader attempt at enabling USB in boot loader
there is a 1MB free region that is used to load the firmware but we shouldn't need that till after a USB connection so here is my 2nd try Change-Id: I2552db3a7fba019d7e7188984432f758ddafe548
-rw-r--r--bootloader/main-pp.c7
-rw-r--r--firmware/core_alloc.c19
2 files changed, 21 insertions, 5 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index 08b5ea3ef5..8357b2fff6 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -51,6 +51,9 @@
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
#include "usb_drv.h"
#endif
+#if defined(SANSA_E200) && defined(HAVE_BOOTLOADER_USB_MODE)
+#include "core_alloc.h"
+#endif
#if defined(SAMSUNG_YH925)
/* this function (in lcd-yh925.c) resets the screen orientation for the OF
* for use with dualbooting */
@@ -232,7 +235,6 @@ static int handle_usb(int connect_timeout)
usb = USB_HANDLED;
usb_acknowledge(SYS_USB_CONNECTED_ACK);
usb_wait_for_disconnect(&q);
- break;
}
if (connect_timeout != TIMEOUT_BLOCK &&
@@ -299,6 +301,9 @@ void* main(void)
int usb = USB_EXTRACTED;
system_init();
+#if defined(SANSA_E200) && defined(HAVE_BOOTLOADER_USB_MODE)
+ core_allocator_init();
+#endif
kernel_init();
#ifdef HAVE_BOOTLOADER_USB_MODE
diff --git a/firmware/core_alloc.c b/firmware/core_alloc.c
index df1b4d3213..bf2f8e8298 100644
--- a/firmware/core_alloc.c
+++ b/firmware/core_alloc.c
@@ -8,16 +8,27 @@
/* not static so it can be discovered by core_get_data() */
struct buflib_context core_ctx;
-/* defined in linker script */
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(__PCTOOL__)
+
#if defined(IPOD_VIDEO) && !defined(BOOTLOADER)
+/* defined in linker script */
+extern unsigned char audiobuffer[];
extern unsigned char *audiobufend_lds[];
+/* pointer to end of audio buffer filled at runtime allocator_init */
unsigned char *audiobufend;
-#else /* !IPOD_VIDEO */
-extern unsigned char audiobufend[];
-#endif
+#elif defined(SANSA_E200) && defined(HAVE_BOOTLOADER_USB_MODE)
+/* defined in linker script */
+extern unsigned char freebuffer[];
+extern unsigned char freebufferend[];
+/* map linker symbol to the audiobuffer in order to use core_alloc */
+unsigned char *audiobuffer = (unsigned char *)freebuffer;
+unsigned char *audiobufend = (unsigned char *)freebufferend;
+#else /* !IPOD_VIDEO, !SANSA_E200&&BOOTLOADERUSB */
/* defined in linker script */
extern unsigned char audiobuffer[];
+extern unsigned char audiobufend[];
+#endif
+
#else /* PLATFORM_HOSTED */
static unsigned char audiobuffer[((MEMORYSIZE)*1024-768)*1024];
unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer);