Sound Open Firmware
Loading...
Searching...
No Matches
objpool.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2025 Intel Corporation.
4 */
5
6#ifndef __ZEPHYR_OBJPOOL_H__
7#define __ZEPHYR_OBJPOOL_H__
8
9#include <sof/list.h>
10
11#include <stdbool.h>
12#include <stddef.h>
13#include <stdint.h>
14
15struct vregion;
16struct k_heap;
19 struct vregion *vreg;
20 struct k_heap *heap;
21 uint32_t flags;
22};
23
43void *objpool_alloc(struct objpool_head *head, size_t size, uint32_t flags);
44
56int objpool_free(struct objpool_head *head, void *data);
57
63void objpool_prune(struct objpool_head *head);
64
65/* returns true to stop */
66typedef bool (*objpool_iterate_cb)(void *data, void *arg);
67
80int objpool_iterate(struct objpool_head *head, objpool_iterate_cb cb, void *arg);
81
82#endif
uint32_t data[]
Definition debug_stream_slot.h:2
#define list_item(item, type, member)
Definition list.h:80
void * objpool_alloc(struct objpool_head *head, size_t size, uint32_t flags)
Allocate memory tracked as part of an object pool.
bool(* objpool_iterate_cb)(void *data, void *arg)
Definition objpool.h:66
int objpool_free(struct objpool_head *head, void *data)
Return a block to the object pool.
int objpool_iterate(struct objpool_head *head, objpool_iterate_cb cb, void *arg)
Iterate over object pool entries until stopped.
void objpool_prune(struct objpool_head *head)
Free all of the object pool memory.
Definition objpool.h:17
struct list_item list
Definition objpool.h:18
struct vregion * vreg
Definition objpool.h:19
struct k_heap * heap
Definition objpool.h:20
uint32_t flags
Definition objpool.h:21
Definition vregion.h:155