libmetal
lib
system
zephyr
alloc.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017, Linaro Limited. and Contributors. All rights reserved.
3
*
4
* SPDX-License-Identifier: BSD-3-Clause
5
*/
6
7
/*
8
* @file zephyr/alloc.h
9
* @brief zephyr libmetal memory allocattion definitions.
10
*/
11
12
#ifndef __METAL_ALLOC__H__
13
#error "Include metal/alloc.h instead of metal/zephyr/alloc.h"
14
#endif
15
16
#ifndef __METAL_ZEPHYR_ALLOC__H__
17
#define __METAL_ZEPHYR_ALLOC__H__
18
19
#include <kernel.h>
20
#include <stdlib.h>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
#if (CONFIG_HEAP_MEM_POOL_SIZE > 0)
27
static
inline
void
*
metal_allocate_memory
(
unsigned
int
size)
28
{
29
return
k_malloc(size);
30
}
31
32
static
inline
void
metal_free_memory
(
void
*ptr)
33
{
34
k_free(ptr);
35
}
36
#else
37
38
void
*
metal_zephyr_allocate_memory
(
unsigned
int
size);
39
void
metal_zephyr_free_memory
(
void
*ptr);
40
41
static
inline
void
*
metal_allocate_memory
(
unsigned
int
size)
42
{
43
return
metal_zephyr_allocate_memory
(size);
44
}
45
46
static
inline
void
metal_free_memory
(
void
*ptr)
47
{
48
metal_zephyr_free_memory
(ptr);
49
}
50
#endif
/* CONFIG_HEAP_MEM_POOL_SIZE */
51
52
53
#ifdef __cplusplus
54
}
55
#endif
56
57
#endif
/* __METAL_ZEPHYR_ALLOC__H__ */
metal_allocate_memory
static void * metal_allocate_memory(unsigned int size)
Definition:
alloc.h:41
metal_free_memory
static void metal_free_memory(void *ptr)
Definition:
alloc.h:46
metal_zephyr_free_memory
void metal_zephyr_free_memory(void *ptr)
Definition:
alloc.c:23
metal_zephyr_allocate_memory
void * metal_zephyr_allocate_memory(unsigned int size)
Definition:
alloc.c:17
Generated on Sat Aug 1 2020 00:00:00 for libmetal by
1.8.18