X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fmware%2Fheap.h;h=2c4594e1e77f3317f53352cae3ed9ddffc5504d4;hb=cfa8814ca45e8bae9b36713bc534ecb581834016;hp=97cef8a3f1dd615b6e46c2a4694f6ef53bc7da5e;hpb=791e167e053bdd9250d34a9a5ccae6ccde4d6679;p=bertos.git diff --git a/bertos/mware/heap.h b/bertos/mware/heap.h index 97cef8a3..2c4594e1 100644 --- a/bertos/mware/heap.h +++ b/bertos/mware/heap.h @@ -1,123 +1,2 @@ -/** - * \file - * - * - * \brief Heap subsystem (public interface). - * - * \version $Id$ - * - * \author Bernardo Innocenti - * - * \todo Heap memory could be defined as an array of MemChunk, and used - * in this form also within the implementation. This would probably remove - * memory alignment problems, and also some aliasing issues. - * - */ - -/*#* - *#* $Log$ - *#* Revision 1.7 2006/07/19 12:56:27 bernie - *#* Convert to new Doxygen style. - *#* - *#* Revision 1.6 2005/11/27 23:36:19 bernie - *#* Use appconfig.h instead of cfg/config.h. - *#* - *#* Revision 1.5 2005/11/04 16:20:02 bernie - *#* Fix reference to README.devlib in header. - *#* - *#* Revision 1.4 2005/04/11 19:10:28 bernie - *#* Include top-level headers from cfg/ subdir. - *#* - *#* Revision 1.3 2004/08/25 14:12:09 rasky - *#* Aggiornato il comment block dei log RCS - *#* - *#* Revision 1.2 2004/08/04 15:54:18 rasky - *#* Merge da SC: prima versione veramente funzionante - *#* - *#* Revision 1.1 2004/07/31 16:33:58 rasky - *#* Spostato lo heap da kern/ a mware/ - *#* - *#* Revision 1.2 2004/06/03 11:27:09 bernie - *#* Add dual-license information. - *#* - *#* Revision 1.1 2004/05/23 17:27:00 bernie - *#* Import kern/ subdirectory. - *#* - *#*/ - -#ifndef MWARE_HEAP_H -#define MWARE_HEAP_H - -#include -#include - -struct _MemChunk; - -/// A heap -struct Heap -{ - struct _MemChunk *FreeList; ///< Head of the free list -}; - - -/// Initialize \a heap within the buffer pointed by \a memory which is of \a size bytes -void heap_init(struct Heap* heap, void* memory, size_t size); - -/// Allocate a chunk of memory of \a size bytes from the heap -void *heap_allocmem(struct Heap* heap, size_t size); - -/// Free a chunk of memory of \a size bytes from the heap -void heap_freemem(struct Heap* heap, void *mem, size_t size); - - -#define HNEW(heap, type) \ - (type*)heap_allocmem(heap, sizeof(type)) - -#define HNEWVEC(heap, type, nelem) \ - (type*)heap_allocmem(heap, sizeof(type) * (nelem)) - -#define HDELETE(heap, type, mem) \ - heap_freemem(heap, mem, sizeof(type)) - -#define HDELETEVEC(heap, type, nelem, mem) \ - heap_freemem(heap, mem, sizeof(type) * (nelem)) - - -#if CONFIG_HEAP_MALLOC - -void *heap_malloc(struct Heap* heap, size_t size); -void *heap_calloc(struct Heap* heap, size_t size); -void heap_free(struct Heap* heap, void * mem); - -#endif - -#endif /* MWARE_HEAP_H */ +#warning This header is OBSOLETE +#include