Don't know why svn decided to delete tlsf/src... Maybe due to some aborted tests I did to see where it would be best to place TLSF.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22529 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2009-08-29 12:42:47 +00:00
parent 3fad1523c7
commit 0dad8d5ae9
3 changed files with 1059 additions and 0 deletions

View file

@ -0,0 +1,12 @@
#ifndef _TARGET_H_
#define _TARGET_H_
#include <pthread.h>
#define TLSF_MLOCK_T pthread_mutex_t
#define TLSF_CREATE_LOCK(l) pthread_mutex_init (l, NULL)
#define TLSF_DESTROY_LOCK(l) pthread_mutex_destroy(l)
#define TLSF_ACQUIRE_LOCK(l) pthread_mutex_lock(l)
#define TLSF_RELEASE_LOCK(l) pthread_mutex_unlock(l)
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,39 @@
/*
* Two Levels Segregate Fit memory allocator (TLSF)
* Version 2.4.4
*
* Written by Miguel Masmano Tello <mimastel@doctor.upv.es>
*
* Thanks to Ismael Ripoll for his suggestions and reviews
*
* Copyright (C) 2008, 2007, 2006, 2005, 2004
*
* This code is released using a dual license strategy: GPL/LGPL
* You can choose the licence that better fits your requirements.
*
* Released under the terms of the GNU General Public License Version 2.0
* Released under the terms of the GNU Lesser General Public License Version 2.1
*
*/
#ifndef _TLSF_H_
#define _TLSF_H_
#include <sys/types.h>
extern size_t init_memory_pool(size_t, void *);
extern size_t get_used_size(void *);
extern size_t get_max_size(void *);
extern void destroy_memory_pool(void *);
extern size_t add_new_area(void *, size_t, void *);
extern void *malloc_ex(size_t, void *);
extern void free_ex(void *, void *);
extern void *realloc_ex(void *, size_t, void *);
extern void *calloc_ex(size_t, size_t, void *);
extern void *tlsf_malloc(size_t size);
extern void tlsf_free(void *ptr);
extern void *tlsf_realloc(void *ptr, size_t size);
extern void *tlsf_calloc(size_t nelem, size_t elem_size);
#endif