From d0b72e25903574acb1cf9184a6052cdd646dbc37 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 30 Aug 2011 14:01:33 +0000 Subject: GSoC/Buflib: Add buflib memory alocator to the core. The buflib memory allocator is handle based and can free and compact, move or resize memory on demand. This allows to effeciently allocate memory dynamically without an MMU, by avoiding fragmentation through memory compaction. This patch adds the buflib library to the core, along with convinience wrappers to omit the context parameter. Compaction is not yet enabled, but will be in a later patch. Therefore, this acts as a replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug menu. See buflib.h for some API documentation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657 --- firmware/rolo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'firmware/rolo.c') diff --git a/firmware/rolo.c b/firmware/rolo.c index 9b6f4fec4a..283779d7ee 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c @@ -31,7 +31,7 @@ #include "i2c.h" #include "adc.h" #include "string.h" -#include "buffer.h" +#include "core_alloc.h" #include "storage.h" #include "rolo.h" @@ -48,6 +48,7 @@ #define IRQ0_EDGE_TRIGGER 0x80 +static int rolo_handle; #ifdef CPU_PP /* Handle the COP properly - it needs to jump to a function outside SDRAM while * the new firmware is being loaded, and then jump to the start of SDRAM @@ -99,7 +100,7 @@ void rolo_restart_cop(void) static void rolo_error(const char *text) { - buffer_release_buffer(0); + rolo_handle = core_free(rolo_handle); lcd_clear_display(); lcd_puts(0, 0, "ROLO error:"); lcd_puts_scroll(0, 1, text); @@ -240,7 +241,8 @@ int rolo_load(const char* filename) /* get the system buffer. release only in case of error, otherwise * we don't return anyway */ - filebuf = buffer_get_buffer(&filebuf_size); + rolo_handle = core_alloc_maximum("rolo", &filebuf_size, NULL); + filebuf = core_get_data(rolo_handle); #if CONFIG_CPU != SH7034 /* Read and save checksum */ -- cgit v1.2.3