summaryrefslogtreecommitdiff
path: root/firmware/test/memory/memory-block.c
diff options
context:
space:
mode:
authorAlan Korr <alkorr@rockbox.org>2002-04-21 12:21:14 +0000
committerAlan Korr <alkorr@rockbox.org>2002-04-21 12:21:14 +0000
commitb7cf0602fd08f6a367d42f0b6adadb8322b3d35d (patch)
treeabbfb87b615f4c01a5f56eedacd75acbd2e52b87 /firmware/test/memory/memory-block.c
parent257d17da6d64d2e265df3c80192a01f47e1dd2b7 (diff)
downloadrockbox-b7cf0602fd08f6a367d42f0b6adadb8322b3d35d.tar.gz
rockbox-b7cf0602fd08f6a367d42f0b6adadb8322b3d35d.zip
removing all that stuff permanently.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@159 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/memory/memory-block.c')
-rw-r--r--firmware/test/memory/memory-block.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/firmware/test/memory/memory-block.c b/firmware/test/memory/memory-block.c
deleted file mode 100644
index c5cf3ce9f8..0000000000
--- a/firmware/test/memory/memory-block.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Alan Korr
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#if 0
20#include <memory.h>
21#include "memory-page.h"
22#include "memory-slab.h"
23
24static struct memory_cache *__memory_free_block_cache[MEMORY_PAGE_MINIMAL_ORDER - 2];
25
26///////////////////////////////////////////////////////////////////////////////
27// MEMORY BLOCK :
28/////////////////
29//
30// - memory_allocate_block : allocate a power-of-2-sized block (or a page)
31// - memory_release_block : release a power-of-2-sized block (or a page)
32//
33
34static inline void *__memory_allocate_block (int order)
35 {
36 struct memory_cache *cache = __memory_free_block_cache[order - 2];
37 do
38 {
39 if (cache)
40 return memory_cache_allocate (cache);
41 }
42 while ((__memory_free_block_cache[order] = cache = memory_create_cache (size,0,0)));
43 return MEMORY_RETURN_FAILURE;
44 }
45
46void *memory_allocate_block (int order)
47 {
48 if (order < 2)
49 order = 2;
50 if (order < MEMORY_PAGE_MINIMAL_ORDER)
51 return __memory_allocate_block (order);
52 if (order < MEMORY_PAGE_MAXIMAL_ORDER)
53 return memory_allocate_page (order);
54 return MEMORY_RETURN_FAILURE;
55 }
56
57static inline int __memory_release_block (int order,void *address)
58 {
59 struct memory_cache *cache = __memory_free_block_cache[order - 2];
60 if (cache)
61 return memory_cache_release (cache,address);
62 return MEMORY_RETURN_FAILURE;
63 }
64
65int memory_release_block (int order,void *address)
66 {
67 if (order < 2)
68 order = 2;
69 if (order < MEMORY_PAGE_MINIMAL_ORDER)
70 return __memory_release_block (order);
71 if (order < MEMORY_PAGE_MAXIMAL_ORDER)
72 return memory_release_page (address);
73 return MEMORY_RETURN_FAILURE;
74 }
75
76#endif