summaryrefslogtreecommitdiffstats
path: root/firmware/core_alloc.c
diff options
context:
space:
mode:
authorBoris Gjenero <dreamlayers@rockbox.org>2011-11-29 00:42:27 +0000
committerBoris Gjenero <dreamlayers@rockbox.org>2011-11-29 00:42:27 +0000
commitd51e5983357593981e604b05ad3826f2496f4a6b (patch)
tree036fa986dcf4f6ec4c529dd74c5f996533f62d4f /firmware/core_alloc.c
parent297c29cba60e34ed01fb72974dcb562e58df322b (diff)
downloadrockbox-d51e5983357593981e604b05ad3826f2496f4a6b.tar.gz
rockbox-d51e5983357593981e604b05ad3826f2496f4a6b.tar.bz2
rockbox-d51e5983357593981e604b05ad3826f2496f4a6b.zip
FS#12412 : Delete old buffer allocation code which has been replaced by core_alloc, and move buffer setup code to core_alloc.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31088 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/core_alloc.c')
-rw-r--r--firmware/core_alloc.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/firmware/core_alloc.c b/firmware/core_alloc.c
index 21dd1319dd..34ed48b39f 100644
--- a/firmware/core_alloc.c
+++ b/firmware/core_alloc.c
@@ -1,21 +1,44 @@
+#include "config.h"
#include <string.h>
+#include "system.h"
#include "core_alloc.h"
#include "buflib.h"
-#include "buffer.h"
/* 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)
+#if defined(IPOD_VIDEO) && !defined(BOOTLOADER)
+extern unsigned char *audiobufend_lds[];
+unsigned char *audiobufend;
+#else /* !IPOD_VIDEO */
+extern unsigned char audiobufend[];
+#endif
+/* defined in linker script */
+extern unsigned char audiobuffer[];
+#else /* PLATFORM_HOSTED */
+unsigned char audiobuffer[(MEMORYSIZE*1024-256)*1024];
+unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer);
+extern unsigned char *audiobufend;
+#endif
+
/* debug test alloc */
static int test_alloc;
void core_allocator_init(void)
{
- buffer_init();
- size_t size;
- void *start = buffer_get_buffer(&size);
- buflib_init(&core_ctx, start, size);
- buffer_release_buffer(size);
+ unsigned char *start = ALIGN_UP(audiobuffer, sizeof(intptr_t));
+
+#if defined(IPOD_VIDEO) && !defined(BOOTLOADER) && !defined(SIMULATOR)
+ audiobufend=(unsigned char *)audiobufend_lds;
+ if(MEMORYSIZE==64 && probed_ramsize!=64)
+ {
+ audiobufend -= (32<<20);
+ }
+#endif
+
+ buflib_init(&core_ctx, start, audiobufend - start);
test_alloc = core_alloc("test", 112);
}