diff options
Diffstat (limited to 'firmware/core_alloc.c')
-rw-r--r-- | firmware/core_alloc.c | 35 |
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 @@ | |||
1 | 1 | ||
2 | #include "config.h" | ||
2 | #include <string.h> | 3 | #include <string.h> |
4 | #include "system.h" | ||
3 | #include "core_alloc.h" | 5 | #include "core_alloc.h" |
4 | #include "buflib.h" | 6 | #include "buflib.h" |
5 | #include "buffer.h" | ||
6 | 7 | ||
7 | /* not static so it can be discovered by core_get_data() */ | 8 | /* not static so it can be discovered by core_get_data() */ |
8 | struct buflib_context core_ctx; | 9 | struct buflib_context core_ctx; |
9 | 10 | ||
11 | /* defined in linker script */ | ||
12 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | ||
13 | #if defined(IPOD_VIDEO) && !defined(BOOTLOADER) | ||
14 | extern unsigned char *audiobufend_lds[]; | ||
15 | unsigned char *audiobufend; | ||
16 | #else /* !IPOD_VIDEO */ | ||
17 | extern unsigned char audiobufend[]; | ||
18 | #endif | ||
19 | /* defined in linker script */ | ||
20 | extern unsigned char audiobuffer[]; | ||
21 | #else /* PLATFORM_HOSTED */ | ||
22 | unsigned char audiobuffer[(MEMORYSIZE*1024-256)*1024]; | ||
23 | unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer); | ||
24 | extern unsigned char *audiobufend; | ||
25 | #endif | ||
26 | |||
10 | /* debug test alloc */ | 27 | /* debug test alloc */ |
11 | static int test_alloc; | 28 | static int test_alloc; |
12 | void core_allocator_init(void) | 29 | void core_allocator_init(void) |
13 | { | 30 | { |
14 | buffer_init(); | 31 | unsigned char *start = ALIGN_UP(audiobuffer, sizeof(intptr_t)); |
15 | size_t size; | 32 | |
16 | void *start = buffer_get_buffer(&size); | 33 | #if defined(IPOD_VIDEO) && !defined(BOOTLOADER) && !defined(SIMULATOR) |
17 | buflib_init(&core_ctx, start, size); | 34 | audiobufend=(unsigned char *)audiobufend_lds; |
18 | buffer_release_buffer(size); | 35 | if(MEMORYSIZE==64 && probed_ramsize!=64) |
36 | { | ||
37 | audiobufend -= (32<<20); | ||
38 | } | ||
39 | #endif | ||
40 | |||
41 | buflib_init(&core_ctx, start, audiobufend - start); | ||
19 | 42 | ||
20 | test_alloc = core_alloc("test", 112); | 43 | test_alloc = core_alloc("test", 112); |
21 | } | 44 | } |