Zephyr API Documentation  3.0.0
A Scalable Open Source RTOS
3.0.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
27struct sys_multi_heap;
28
51typedef void *(*sys_multi_heap_fn_t)(struct sys_multi_heap *mheap, void *cfg,
52 size_t align, size_t size);
53
55 int nheaps;
58};
59
82 sys_multi_heap_fn_t choice_fn);
83
96
110void *sys_multi_heap_alloc(struct sys_multi_heap *mheap, void *cfg, size_t bytes);
111
126 void *cfg, size_t align, size_t bytes);
127
142void sys_multi_heap_free(struct sys_multi_heap *mheap, void *block);
143
144#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:51
#define MAX_MULTI_HEAPS
Definition: multi_heap.h:10
void sys_multi_heap_init(struct sys_multi_heap *heap, sys_multi_heap_fn_t choice_fn)
Initialize multi-heap.
void sys_multi_heap_add_heap(struct sys_multi_heap *mheap, struct sys_heap *heap)
Add sys_heap to 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.
Definition: sys_heap.h:55
struct z_heap * heap
Definition: sys_heap.h:56
Definition: multi_heap.h:54
sys_multi_heap_fn_t choice
Definition: multi_heap.h:56
struct sys_heap * heaps[8]
Definition: multi_heap.h:57
int nheaps
Definition: multi_heap.h:55
void * block
Definition: test_threads_cancel_abort.c:108