Sound Open Firmware
Loading...
Searching...
No Matches
fast-get.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2024 Intel Corporation. All rights reserved.
4 *
5 * Author: Jyri Sarha <jyri.sarha@linux.intel.com>
6 */
7
8#ifndef __SOF_LIB_FAST_GET_H__
9#define __SOF_LIB_FAST_GET_H__
10
11#include <stddef.h>
12
13struct k_mem_domain;
14struct mod_alloc_ctx;
15
16/*
17 * When built for SOF, fast_get() and fast_put() are only needed when DRAM
18 * storage and execution is enabled (CONFIG_COLD_STORE_EXECUTE_DRAM=y), but not
19 * when building LLEXT extensions (!defined(LL_EXTENSION_BUILD)), using Zephyr
20 * SDK (CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=n while
21 * CONFIG_LLEXT_TYPE_ELF_SHAREDLIB=y).
22 * For unit-testing full versions of fast_get() and fast_put() are checked by
23 * test/ztest/unit/fast-get/ and test/cmocka/src/lib/fast-get/
24 */
25#if (CONFIG_COLD_STORE_EXECUTE_DRAM && \
26 (CONFIG_LLEXT_TYPE_ELF_RELOCATABLE || !defined(LL_EXTENSION_BUILD))) || \
27 !CONFIG_SOF_FULL_ZEPHYR_APPLICATION
28const void *fast_get(struct mod_alloc_ctx *alloc, const void * const dram_ptr, size_t size);
29void fast_put(struct mod_alloc_ctx *alloc, struct k_mem_domain *mdom, const void *sram_ptr);
30#else
31static inline const void *fast_get(struct mod_alloc_ctx *alloc, const void * const dram_ptr,
32 size_t size)
33{
34 return dram_ptr;
35}
36static inline void fast_put(struct mod_alloc_ctx *alloc, struct k_mem_domain *mdom,
37 const void *sram_ptr) {}
38#endif
39
40#endif /* __SOF_LIB_FAST_GET_H__ */
const void * fast_get(struct mod_alloc_ctx *alloc, const void *const dram_ptr, size_t size)
void fast_put(struct mod_alloc_ctx *alloc, struct k_mem_domain *mdom, const void *sram_ptr)
Definition alloc.h:167