diff options
author | Alan Korr <alkorr@rockbox.org> | 2002-04-25 14:42:42 +0000 |
---|---|---|
committer | Alan Korr <alkorr@rockbox.org> | 2002-04-25 14:42:42 +0000 |
commit | 4fbea7cf8bc0326fa939568c866ba33c49ec5b80 (patch) | |
tree | 3f0fe5e159d068db98ff20c6f0f68d86f1712430 /firmware/test/alkorr/memory.h | |
parent | a6f4d21486acbcaac07317892de17916af123899 (diff) | |
download | rockbox-4fbea7cf8bc0326fa939568c866ba33c49ec5b80.tar.gz rockbox-4fbea7cf8bc0326fa939568c866ba33c49ec5b80.zip |
memory stuff
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@235 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/alkorr/memory.h')
-rw-r--r-- | firmware/test/alkorr/memory.h | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/firmware/test/alkorr/memory.h b/firmware/test/alkorr/memory.h new file mode 100644 index 0000000000..37ec4c8c14 --- /dev/null +++ b/firmware/test/alkorr/memory.h | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | ////////////////////////////////////////////////////////////////////////////////// | ||
3 | // __________ __ ___. // | ||
4 | // Open \______ \ ____ ____ | | _\_ |__ _______ ___ // | ||
5 | // Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / // | ||
6 | // Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < // | ||
7 | // Software |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ // | ||
8 | // \/ \/ \/ \/ \/ // | ||
9 | ////////////////////////////////////////////////////////////////////////////////// | ||
10 | // | ||
11 | // $Id$ | ||
12 | // | ||
13 | ///////////////////////////////////// | ||
14 | // Copyright (C) 2002 by Alan Korr // | ||
15 | ///////////////////////////////////// | ||
16 | // | ||
17 | // All files in this archive are subject to the GNU General Public License. | ||
18 | // See the file COPYING in the source tree root for full license agreement. | ||
19 | // | ||
20 | // This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, | ||
21 | // either express or implied. | ||
22 | // | ||
23 | ////////////////////////////////////////////////////////////////////////////////// | ||
24 | */ | ||
25 | |||
26 | #ifndef __MEMORY_H__ | ||
27 | #define __MEMORY_H__ | ||
28 | |||
29 | enum | ||
30 | { | ||
31 | MEMORY_RETURN_SUCCESS = 1, | ||
32 | MEMORY_RETURN_FAILURE = 0 | ||
33 | }; | ||
34 | |||
35 | /* | ||
36 | ///////////////////////////////////////////////////////////////////// | ||
37 | // MEMORY PAGE // | ||
38 | ///////////////// | ||
39 | // | ||
40 | // | ||
41 | */ | ||
42 | |||
43 | #define MEMORY_PAGE_MINIMAL_ORDER ( 9) /* 512 bytes by default */ | ||
44 | #define MEMORY_PAGE_MAXIMAL_ORDER (21) /* 2 Mbytes by default */ | ||
45 | #define MEMORY_PAGE_MINIMAL_SIZE (1 << MEMORY_PAGE_MINIMAL_ORDER) | ||
46 | #define MEMORY_PAGE_MAXIMAL_SIZE (1 << MEMORY_PAGE_MAXIMAL_ORDER) | ||
47 | |||
48 | #define MEMORY_TOTAL_PAGES (MEMORY_PAGE_MAXIMAL_SIZE / MEMORY_PAGE_MINIMAL_SIZE) | ||
49 | #define MEMORY_TOTAL_ORDERS (1 + MEMORY_PAGE_MAXIMAL_ORDER - MEMORY_PAGE_MINIMAL_ORDER) | ||
50 | |||
51 | extern void *memory_page_allocate (int order); | ||
52 | extern int memory_page_release (void *address); | ||
53 | extern void memory_page_release_range (unsigned int start,unsigned int end); | ||
54 | |||
55 | /* | ||
56 | // | ||
57 | ///////////////////////////////////////////////////////////////////// | ||
58 | |||
59 | ///////////////////////////////////////////////////////////////////// | ||
60 | // MEMORY CACHE // | ||
61 | ////////////////// | ||
62 | // | ||
63 | // | ||
64 | */ | ||
65 | |||
66 | struct memory_cache; | ||
67 | |||
68 | extern struct memory_cache *memory_cache_create (unsigned int size,int align); | ||
69 | extern int memory_cache_destroy (struct memory_cache *cache); | ||
70 | extern void *memory_cache_allocate (struct memory_cache *cache); | ||
71 | extern int memory_cache_release (struct memory_cache *cache,void *address); | ||
72 | |||
73 | /* | ||
74 | // | ||
75 | // | ||
76 | ///////////////////////////////////////////////////////////////////// | ||
77 | |||
78 | ///////////////////////////////////////////////////////////////////// | ||
79 | // MEMORY BLOCK // | ||
80 | ////////////////// | ||
81 | // | ||
82 | // | ||
83 | */ | ||
84 | |||
85 | extern void *memory_block_allocate (int order); | ||
86 | extern int memory_block_release (int order,void *address); | ||
87 | |||
88 | /* | ||
89 | // | ||
90 | // | ||
91 | ///////////////////////////////////////////////////////////////////// | ||
92 | |||
93 | ///////////////////////////////////////////////////////////////////// | ||
94 | // MEMORY // | ||
95 | //////////// | ||
96 | // | ||
97 | // | ||
98 | */ | ||
99 | |||
100 | #define MEMORY_TOTAL_BYTES (MEMORY_PAGE_MAXIMAL_SIZE) | ||
101 | |||
102 | extern void memory_copy (void *target,void const *source,unsigned int count); | ||
103 | extern void memory_set (void *target,int byte,unsigned int count); | ||
104 | |||
105 | extern void memory_setup (void); | ||
106 | |||
107 | /* | ||
108 | // | ||
109 | // | ||
110 | ///////////////////////////////////////////////////////////////////// | ||
111 | */ | ||
112 | |||
113 | #endif | ||