From 08dada2df506405d7fa7dc57a19d4a283f51162d Mon Sep 17 00:00:00 2001 From: Alan Korr Date: Wed, 17 Apr 2002 12:13:43 +0000 Subject: cosmetic changes and additions : * now we have seperate private headers files containing private and static or public functions in memory-* files. * there is only one .c file of the same name the library. Zagor: because now there is only one .c file, you could only have a .o file and use it instead of the .a libfile. * most structures and codes are now private. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@112 a1c6a512-1295-4272-9138-f99709370657 --- firmware/test/memory/functions.h | 64 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) (limited to 'firmware/test/memory/functions.h') diff --git a/firmware/test/memory/functions.h b/firmware/test/memory/functions.h index e0f6aea..c856a93 100644 --- a/firmware/test/memory/functions.h +++ b/firmware/test/memory/functions.h @@ -21,11 +21,71 @@ #endif # ifndef __LIBRARY_MEMORY_FUNCTIONS_H__ # define __LIBRARY_MEMORY_FUNCTIONS_H__ + +///////////////////////////////////////////////////////////////////// +// MEMORY : +/////////// + extern void memory_copy (void *target,void const *source,unsigned int count); extern void memory_set (void *target,int byte,unsigned int count); -extern int memory_release_page (void *); -extern void *memory_allocate_page (int); + +///////////////////////////////////////////////////////////////////// +// MEMORY PAGE : +//////////////// +// +// - memory_allocate_page : allocate a page +// - memory_release_page : release a page +// + +extern int memory_release_page (void *address); +extern void *memory_allocate_page (int order); extern void memory_setup (void); + +// +///////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////// +// MEMORY SLAB : +//////////////// +// +// - memory_grow_cache : allocate a new slab for a cache +// - memory_shrink_cache : release free slabs from a cache +// - memory_create_cache : create a new cache of size-fixed blocks +// - memory_destroy_cache : destroy the cache and release all the slabs +// - memory_cache_allocate : allocate a block from the cache +// - memory_cache_release : release a block in the cache +// + +extern struct memory_slab *memory_grow_cache (struct memory_cache *cache); +extern int memory_shrink_cache (struct memory_cache *cache,int all); +extern struct memory_cache *memory_create_cache (unsigned int size,int align,int flags); +extern int memory_destroy_cache (struct memory_cache *cache); +extern void *memory_cache_allocate (struct memory_cache *cache); +extern int memory_cache_release (struct memory_cache *cache,void *address); + +// +///////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// MEMORY BLOCK : +///////////////// +// +// - memory_allocate_small_block : allocate a small block (no page) +// - memory_release_small_block : release a small block (no page) +// - memory_allocate_block : allocate a block (or a page) +// - memory_release_block : release a block (or a page) +// + +extern void *memory_allocate_small_block (int order); +extern int memory_release_small_block (int order,void *address); +extern void *memory_allocate_block (unsigned int size); +extern int memory_release_block (void *address); + +// +///////////////////////////////////////////////////////////////////// + + + # ifdef TEST void memory_spy_page (void *address); void memory_dump (int order); -- cgit v1.1