summaryrefslogtreecommitdiff
path: root/firmware/test/memory/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/test/memory/memory.c')
-rw-r--r--firmware/test/memory/memory.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/firmware/test/memory/memory.c b/firmware/test/memory/memory.c
new file mode 100644
index 0000000000..19944d5fb4
--- /dev/null
+++ b/firmware/test/memory/memory.c
@@ -0,0 +1,50 @@
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#define __LIBRARY_MEMORY_C__
20#include <memory.h>
21#include "memory-page.h"
22#if 0
23# include "memory-slab.h"
24# include "memory-block.h"
25#endif
26
27/* NOT VERY OPTIMIZED AT ALL BUT WE WILL DO IT WHEN PRIORITY COMES */
28void memory_copy (void *target,void const *source,unsigned int count)
29 {
30 while (count--)
31 *((char *)target)++ = *((char const *)source)++;
32 }
33
34/* NOT VERY OPTIMIZED AT ALL BUT WE WILL DO IT WHEN PRIORITY COMES */
35void memory_set (void *target,int byte,unsigned int count)
36 {
37 while (count--)
38 *((char *)target)++ = (char)byte;
39 }
40
41void memory_setup (void)
42 {
43#if 1
44 memory_set (free_page,0,MEMORY_TOTAL_BYTES);
45 memory_set (free_page_bin,0,MEMORY_TOTAL_ORDERS *sizeof (struct memory_free_page *));
46 memory_set (free_page_order + 1,0,MEMORY_TOTAL_PAGES);
47#endif
48 free_page_order[0] = MEMORY_TOTAL_ORDERS - 1;
49 free_page_bin[MEMORY_TOTAL_ORDERS - 1] = free_page;
50 }