1 /*
2  * Copyright (c) 2016, Xilinx Inc. and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /*
8  * @file	generic/alloc.c
9  * @brief	generic libmetal memory allocattion definitions.
10  */
11 
12 #ifndef __METAL_ALLOC__H__
13 #error "Include metal/alloc.h instead of metal/generic/alloc.h"
14 #endif
15 
16 #ifndef __METAL_GENERIC_ALLOC__H__
17 #define __METAL_GENERIC_ALLOC__H__
18 
19 #include <stdlib.h>
20 
21 extern void *rt_malloc(unsigned long nbytes);
22 extern void rt_free(void *ptr);
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
metal_allocate_memory(unsigned int size)28 static inline void *metal_allocate_memory(unsigned int size)
29 {
30 	return (rt_malloc(size));
31 }
32 
metal_free_memory(void * ptr)33 static inline void metal_free_memory(void *ptr)
34 {
35 	rt_free(ptr);
36 }
37 
38 #ifdef __cplusplus
39 }
40 #endif
41 
42 #endif /* __METAL_GENERIC_ALLOC__H__ */
43