1 #ifndef SUNXI_HAL_MEM_H
2 #define SUNXI_HAL_MEM_H
3 
4 #ifdef __cplusplus
5 extern "C"
6 {
7 #endif
8 #include <stdlib.h>
9 #include <stddef.h>
10 #include <stdint.h>
11 
12 
13 void *hal_malloc(uint32_t size);
14 void hal_free(void *p);
15 
16 void *hal_malloc_align(uint32_t size, int align);
17 void hal_free_align(void *p);
18 
19 #ifdef CONFIG_KERNEL_FREERTOS
20 #ifdef CONFIG_CORE_DSP0
21 extern unsigned long __va_to_pa(unsigned long vaddr);
22 extern unsigned long __pa_to_va(unsigned long paddr);
23 #else
24 #define __va_to_pa(vaddr) ((u32)vaddr)
25 #define __pa_to_va(vaddr) ((u32)vaddr)
26 #endif /* CONFIG_CORE_DSP0 */
27 #else
28 #include <rtthread.h>
29 
30 unsigned long awos_arch_virt_to_phys(unsigned long virtaddr);
31 unsigned long awos_arch_phys_to_virt(unsigned long phyaddr);
32 
33 #define __va_to_pa(vaddr) awos_arch_virt_to_phys((vaddr))
34 #define __pa_to_va(paddr) awos_arch_phys_to_virt((paddr))
35 #endif /* CONFIG_KERNEL_FREERTOS */
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 #endif
41