diff options
author | Alan Korr <alkorr@rockbox.org> | 2002-04-17 12:13:43 +0000 |
---|---|---|
committer | Alan Korr <alkorr@rockbox.org> | 2002-04-17 12:13:43 +0000 |
commit | 08dada2df506405d7fa7dc57a19d4a283f51162d (patch) | |
tree | 1f8ebdf5611bd3a86f774c163621a5c786dbab53 /firmware | |
parent | 87789d71547a7da37512690456f603d6e4d5be24 (diff) |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/test/memory/config.h | 2 | ||||
-rw-r--r-- | firmware/test/memory/functions.h | 64 | ||||
-rw-r--r-- | firmware/test/memory/makefile | 2 | ||||
-rw-r--r-- | firmware/test/memory/types.h | 48 |
4 files changed, 68 insertions, 48 deletions
diff --git a/firmware/test/memory/config.h b/firmware/test/memory/config.h index cb3b75f09b..a373ed6b63 100644 --- a/firmware/test/memory/config.h +++ b/firmware/test/memory/config.h @@ -22,6 +22,6 @@ #ifndef __LIBRARY_MEMORY_CONFIG_H__ # define __LIBRARY_MEMORY_CONFIG_H__ # define PACKAGE_NAME "memory" -# define PACKAGE_VERSION "0.1.0" +# define PACKAGE_VERSION "0.1.1" # define MEMORY_PAGE_USE_SPLAY_TREE 1 #endif
\ No newline at end of file diff --git a/firmware/test/memory/functions.h b/firmware/test/memory/functions.h index e0f6aeac97..c856a934cf 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); diff --git a/firmware/test/memory/makefile b/firmware/test/memory/makefile index 2c14b7d0bd..2878500e45 100644 --- a/firmware/test/memory/makefile +++ b/firmware/test/memory/makefile @@ -17,7 +17,7 @@ ############################################################################# ARCH = test PACKAGE = memory -VERSION = 0.1.0 +VERSION = 0.1.1 -include ../makefile-vars -include ../makefile-rules diff --git a/firmware/test/memory/types.h b/firmware/test/memory/types.h index 09e38682f7..d7a7c3c63e 100644 --- a/firmware/test/memory/types.h +++ b/firmware/test/memory/types.h @@ -22,51 +22,11 @@ #ifndef __LIBRARY_MEMORY_TYPES_H__ # define __LIBRARY_MEMORY_TYPES_H__ -struct memory_free_page - { - struct memory_free_page - *less,*more; - char - reserved[MEMORY_PAGE_MINIMAL_SIZE - 2*sizeof (struct memory_free_page *)]; - }; -struct memory_free_block - { - struct memory_free_block - *link; - }; +struct memory_free_page; +struct memory_free_block; +struct memory_slab; +struct memory_cache; -struct memory_cache - { - struct memory_cache - *less,*more,*same; - unsigned int - left; // number of free slabs - struct memory_slab - *used; - struct memory_slab - *free; - struct memory_slab - *reap; - unsigned int - size,original_size; - unsigned int - page_size; - unsigned int - blocks_per_slab; - int - page_order; - unsigned int - flags; - }; -struct memory_slab - { - struct memory_slab - *less,*more; - unsigned int // left == number of free blocks left - left; - struct memory_free_block - *free; - }; #endif
\ No newline at end of file |