Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / arm-raspi / boot / support.c
blobbbd07d497017947f1adb58ad942ff21368b27247
1 /*
2 Copyright © 2013, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "boot.h"
8 #include <sys/types.h>
10 static unsigned char __tmpspace[BOOT_TMP_SIZE];
11 static unsigned char *first_free;
12 static unsigned long free_memory;
14 void arm_flush_cache(uint32_t addr, uint32_t length)
16 while (length)
18 __asm__ __volatile__("mcr p15, 0, %0, c7, c14, 1"::"r"(addr));
19 addr += 32;
20 length -= 32;
22 __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4"::"r"(addr));
25 void arm_icache_invalidate(uint32_t addr, uint32_t length)
27 while (length)
29 __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 1"::"r"(addr));
30 addr += 32;
31 length -= 32;
33 __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4"::"r"(addr));
36 void arm_dcache_invalidate(uint32_t addr, uint32_t length)
38 while (length)
40 __asm__ __volatile__("mcr p15, 0, %0, c7, c6, 1"::"r"(addr));
41 addr += 32;
42 length -= 32;
44 __asm__ __volatile__("mcr p15, 0, %0, c7, c10, 4"::"r"(addr));
47 void *malloc(size_t size)
49 void *ret = NULL;
51 size = (size + 15) & ~15;
53 if (size <= free_memory)
55 ret = first_free;
57 first_free += size;
58 free_memory -= size;
61 return ret;
64 void mem_init(void)
66 first_free = &__tmpspace[0];
67 free_memory = BOOT_TMP_SIZE;
70 size_t mem_avail()
72 return free_memory;
75 size_t mem_used()
77 return BOOT_TMP_SIZE - free_memory;
80 int32_t strlen(const char *c)
82 int32_t result = 0;
83 while (*c++)
84 result++;
86 return result;
89 const char *remove_path(const char *in)
91 const char *p = &in[strlen(in)-1];
92 while (p > in && p[-1] != '/' && p[-1] != ':') p--;
93 return p;