summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/pdbox.h
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-07-23 21:37:35 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-07-23 21:37:35 +0000
commit840cd1069292e3f29d18e57f2274ec1e979f858b (patch)
tree0ee1d43fa3863de53c99432dc32001e625703d1c /apps/plugins/pdbox/pdbox.h
parent0d9b7ec73e71188632a4fd584dfd745aeb7571b3 (diff)
downloadrockbox-840cd1069292e3f29d18e57f2274ec1e979f858b.zip
rockbox-840cd1069292e3f29d18e57f2274ec1e979f858b.tar.gz
rockbox-840cd1069292e3f29d18e57f2274ec1e979f858b.tar.bz2
rockbox-840cd1069292e3f29d18e57f2274ec1e979f858b.tar.xz
Another pdbox patch by Wincent Balin (FS #10416): switch to using TLSF as memory allocator. Probably the last patch I commit for him, next changes are for him :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22017 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/pdbox.h')
-rw-r--r--apps/plugins/pdbox/pdbox.h45
1 files changed, 38 insertions, 7 deletions
diff --git a/apps/plugins/pdbox/pdbox.h b/apps/plugins/pdbox/pdbox.h
index 2ca5bc8..47aa2ec 100644
--- a/apps/plugins/pdbox/pdbox.h
+++ b/apps/plugins/pdbox/pdbox.h
@@ -22,19 +22,50 @@
#ifndef PDBOX_H
#define PDBOX_H
-/* Use dbestfit. */
-#include "bmalloc.h"
-#include "dmalloc.h"
+
+#if 1
+/* Use TLSF. */
+#include "tlsf.h"
+#endif
/* Pure Data */
#include "m_pd.h"
-
-/* dbestfit declarations. */
-
/* Minimal memory size. */
#define MIN_MEM_SIZE (4 * 1024 * 1024)
+/* Memory prototypes. */
+
+#if 1
+/* Direct memory allocator functions to TLSF. */
+#define malloc(size) tlsf_malloc(size)
+#define free(ptr) tlsf_free(ptr)
+#define realloc(ptr, size) tlsf_realloc(ptr, size)
+#define calloc(elements, elem_size) tlsf_calloc(elements, elem_size)
+#endif
+
+#if 0
+extern void set_memory_pool(void* memory_pool, size_t memory_size);
+extern void clear_memory_pool(void);
+extern void* mcalloc(size_t nmemb, size_t size);
+extern void* mmalloc(size_t size);
+extern void mfree(void* ptr);
+extern void* mrealloc(void* ptr, size_t size);
+extern void print_memory_pool(void);
+
+#define malloc mmalloc
+#define free mfree
+#define realloc mrealloc
+#define calloc mcalloc
+#endif
+
+#if 0
+#include <stdlib.h>
+#define malloc malloc
+#define free free
+#define realloc realloc
+#define calloc calloc
+#endif
/* Audio declarations. */
#define PD_SAMPLERATE 22050
@@ -44,7 +75,7 @@
/* Audio buffer part. Contains data for one HZ period. */
#ifdef SIMULATOR
-#define AUDIOBUFSIZE (PD_SAMPLES_PER_HZ * PD_OUT_CHANNELS * 4)
+#define AUDIOBUFSIZE (PD_SAMPLES_PER_HZ * PD_OUT_CHANNELS * 32)
#else
#define AUDIOBUFSIZE (PD_SAMPLES_PER_HZ * PD_OUT_CHANNELS)
#endif