Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
multi_heap.h
Go to the documentation of this file.
1/* Copyright (c) 2021 Intel Corporation
2 * SPDX-License-Identifier: Apache-2.0
3 */
4
5#ifndef ZEPHYR_INCLUDE_SYS_MULTI_HEAP_H_
6#define ZEPHYR_INCLUDE_SYS_MULTI_HEAP_H_
7
8#include <zephyr/types.h>
9
10#define MAX_MULTI_HEAPS 8
11
33struct sys_multi_heap;
34
57typedef void *(*sys_multi_heap_fn_t)(struct sys_multi_heap *mheap, void *cfg,
58 size_t align, size_t size);
59
60
62 struct sys_heap *heap;
63 void *user_data;
64};
65
71
94 sys_multi_heap_fn_t choice_fn);
95
109
123void *sys_multi_heap_alloc(struct sys_multi_heap *mheap, void *cfg, size_t bytes);
124
139 void *cfg, size_t align, size_t bytes);
140
153 void *addr);
154
169void sys_multi_heap_free(struct sys_multi_heap *mheap, void *block);
170
175#endif /* ZEPHYR_INCLUDE_SYS_MULTI_HEAP_H_ */
void * sys_multi_heap_alloc(struct sys_multi_heap *mheap, void *cfg, size_t bytes)
Allocate memory from multi heap.
void *(* sys_multi_heap_fn_t)(struct sys_multi_heap *mheap, void *cfg, size_t align, size_t size)
Multi-heap choice function.
Definition multi_heap.h:57
void sys_multi_heap_init(struct sys_multi_heap *heap, sys_multi_heap_fn_t choice_fn)
Initialize multi-heap.
void * sys_multi_heap_aligned_alloc(struct sys_multi_heap *mheap, void *cfg, size_t align, size_t bytes)
Allocate aligned memory from multi heap.
void sys_multi_heap_free(struct sys_multi_heap *mheap, void *block)
Free memory allocated from multi heap.
void sys_multi_heap_add_heap(struct sys_multi_heap *mheap, struct sys_heap *heap, void *user_data)
Add sys_heap to multi heap.
const struct sys_multi_heap_rec * sys_multi_heap_get_heap(const struct sys_multi_heap *mheap, void *addr)
Get a specific heap for provided address.
#define MAX_MULTI_HEAPS
Definition multi_heap.h:10
Definition sys_heap.h:56
Definition multi_heap.h:61
struct sys_heap * heap
Definition multi_heap.h:62
void * user_data
Definition multi_heap.h:63
Definition multi_heap.h:66
sys_multi_heap_fn_t choice
Definition multi_heap.h:68
struct sys_multi_heap_rec heaps[8]
Definition multi_heap.h:69
unsigned int nheaps
Definition multi_heap.h:67
void * block
Definition test_threads_cancel_abort.c:109
static const intptr_t user_data[5]
Definition main.c:588