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	alloc.h
9  * @brief	Memory allocation handling primitives for libmetal.
10  */
11 
12 #ifndef __METAL_ALLOC__H__
13 #define __METAL_ALLOC__H__
14 
15 #include <metal/system/@PROJECT_SYSTEM@/alloc.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /** \defgroup Memory Allocation Interfaces
22  *  @{
23  */
24 
25 /**
26  * @brief      allocate requested memory size
27  *             return a pointer to the allocated memory
28  *
29  * @param[in]  size        size in byte of requested memory
30  * @return     memory pointer, or 0 if it failed to allocate
31  */
metal_allocate_memory(unsigned int size)32 static inline void *metal_allocate_memory(unsigned int size)
33 {
34 	return __metal_allocate_memory(size);
35 }
36 
37 /**
38  * @brief      free the memory previously allocated
39  *
40  * @param[in]  ptr       pointer to memory
41  */
metal_free_memory(void * ptr)42 static inline void metal_free_memory(void *ptr)
43 {
44 	__metal_free_memory(ptr);
45 }
46 
47 /** @} */
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 
53 #endif /* __METAL_ALLOC__H__ */
54