summaryrefslogtreecommitdiff
path: root/firmware/rolo.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-08-30 14:01:33 +0000
committerThomas Martitz <kugel@rockbox.org>2011-08-30 14:01:33 +0000
commitd0b72e25903574acb1cf9184a6052cdd646dbc37 (patch)
tree5be8db5ee00b2a727e4821cf51a5f7bcf3991073 /firmware/rolo.c
parentc940811ade7d99a0e0d414df7c6509672413684a (diff)
downloadrockbox-d0b72e25903574acb1cf9184a6052cdd646dbc37.tar.gz
rockbox-d0b72e25903574acb1cf9184a6052cdd646dbc37.zip
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
Diffstat (limited to 'firmware/rolo.c')
-rw-r--r--firmware/rolo.c8
1 files changed, 5 insertions, 3 deletions
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 @@
31#include "i2c.h" 31#include "i2c.h"
32#include "adc.h" 32#include "adc.h"
33#include "string.h" 33#include "string.h"
34#include "buffer.h" 34#include "core_alloc.h"
35#include "storage.h" 35#include "storage.h"
36#include "rolo.h" 36#include "rolo.h"
37 37
@@ -48,6 +48,7 @@
48 48
49#define IRQ0_EDGE_TRIGGER 0x80 49#define IRQ0_EDGE_TRIGGER 0x80
50 50
51static int rolo_handle;
51#ifdef CPU_PP 52#ifdef CPU_PP
52/* Handle the COP properly - it needs to jump to a function outside SDRAM while 53/* Handle the COP properly - it needs to jump to a function outside SDRAM while
53 * the new firmware is being loaded, and then jump to the start of SDRAM 54 * the new firmware is being loaded, and then jump to the start of SDRAM
@@ -99,7 +100,7 @@ void rolo_restart_cop(void)
99 100
100static void rolo_error(const char *text) 101static void rolo_error(const char *text)
101{ 102{
102 buffer_release_buffer(0); 103 rolo_handle = core_free(rolo_handle);
103 lcd_clear_display(); 104 lcd_clear_display();
104 lcd_puts(0, 0, "ROLO error:"); 105 lcd_puts(0, 0, "ROLO error:");
105 lcd_puts_scroll(0, 1, text); 106 lcd_puts_scroll(0, 1, text);
@@ -240,7 +241,8 @@ int rolo_load(const char* filename)
240 241
241 /* get the system buffer. release only in case of error, otherwise 242 /* get the system buffer. release only in case of error, otherwise
242 * we don't return anyway */ 243 * we don't return anyway */
243 filebuf = buffer_get_buffer(&filebuf_size); 244 rolo_handle = core_alloc_maximum("rolo", &filebuf_size, NULL);
245 filebuf = core_get_data(rolo_handle);
244 246
245#if CONFIG_CPU != SH7034 247#if CONFIG_CPU != SH7034
246 /* Read and save checksum */ 248 /* Read and save checksum */