Skip to content

Commit b38c2f7

Browse files
committed
fast-get: convert to syscalls
Convert fast_get() and fast_put() to syscalls. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent a3c2952 commit b38c2f7

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

src/include/sof/lib/fast-get.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@
1111
#include <stddef.h>
1212

1313
struct k_heap;
14+
15+
#ifdef __ZEPHYR__
16+
#include <zephyr/toolchain.h>
17+
18+
__syscall const void *fast_get(struct k_heap *heap, const void * const dram_ptr, size_t size);
19+
__syscall void fast_put(struct k_heap *heap, const void *sram_ptr);
20+
#include <zephyr/syscalls/fast-get.h>
21+
#else
1422
const void *fast_get(struct k_heap *heap, const void * const dram_ptr, size_t size);
1523
void fast_put(struct k_heap *heap, const void *sram_ptr);
24+
#endif /* __ZEPHYR__ */
1625

1726
#endif /* __SOF_LIB_FAST_GET_H__ */

zephyr/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ zephyr_library_sources_ifdef(CONFIG_SHELL
529529
sof_shell.c
530530
)
531531

532+
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib/fast-get.h)
533+
532534
zephyr_library_link_libraries(SOF)
533535
target_link_libraries(SOF INTERFACE zephyr_interface)
534536

zephyr/lib/fast-get.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static struct sof_fast_get_entry *fast_get_find_entry(struct sof_fast_get_data *
8080
return NULL;
8181
}
8282

83-
const void *fast_get(struct k_heap *heap, const void *dram_ptr, size_t size)
83+
const void *z_impl_fast_get(struct k_heap *heap, const void *dram_ptr, size_t size)
8484
{
8585
struct sof_fast_get_data *data = &fast_get_data;
8686
struct sof_fast_get_entry *entry;
@@ -131,7 +131,7 @@ const void *fast_get(struct k_heap *heap, const void *dram_ptr, size_t size)
131131

132132
return ret;
133133
}
134-
EXPORT_SYMBOL(fast_get);
134+
EXPORT_SYMBOL(z_impl_fast_get);
135135

136136
static struct sof_fast_get_entry *fast_put_find_entry(struct sof_fast_get_data *data,
137137
const void *sram_ptr)
@@ -146,7 +146,7 @@ static struct sof_fast_get_entry *fast_put_find_entry(struct sof_fast_get_data *
146146
return NULL;
147147
}
148148

149-
void fast_put(struct k_heap *heap, const void *sram_ptr)
149+
void z_impl_fast_put(struct k_heap *heap, const void *sram_ptr)
150150
{
151151
struct sof_fast_get_data *data = &fast_get_data;
152152
struct sof_fast_get_entry *entry;
@@ -168,4 +168,16 @@ void fast_put(struct k_heap *heap, const void *sram_ptr)
168168
entry ? entry->size : 0, entry ? entry->refcount : 0);
169169
k_spin_unlock(&data->lock, key);
170170
}
171-
EXPORT_SYMBOL(fast_put);
171+
EXPORT_SYMBOL(z_impl_fast_put);
172+
173+
#ifdef CONFIG_USERSPACE
174+
void z_vrfy_fast_put(struct k_heap *heap, const void *sram_ptr)
175+
{
176+
z_impl_fast_put(heap, sram_ptr);
177+
}
178+
179+
const void *z_vrfy_fast_get(struct k_heap *heap, const void *dram_ptr, size_t size)
180+
{
181+
return z_impl_fast_get(heap, dram_ptr, size);
182+
}
183+
#endif

0 commit comments

Comments
 (0)