1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2011-08-30 14:01:33 +00:00
parent c940811ade
commit d0b72e2590
26 changed files with 1453 additions and 125 deletions

View file

@ -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 */