mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-30 02:15:22 +00:00
The intention of hardware spinlock is to allow two processors, that have no alternative mechanism for accomplish synchronization and mutual exclusion operations, to share resources (such as memory and/or any other element). Here, we add the hwspinlock framework, that makes possible to use those hwspinlock devices and stay platform-independent. Each platform wishing to support hardware spinlock must describe a driver using this framework. Signed-off-by: Aziz Idomar <aidomar@sequans.com>
41 lines
1.0 KiB
C
41 lines
1.0 KiB
C
/*
|
|
* Copyright (c) 2023 Sequans Communications
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr/drivers/hwspinlock.h>
|
|
#include <zephyr/syscall_handler.h>
|
|
|
|
static inline int z_vrfy_hwspinlock_trylock(const struct device *dev, uint32_t id)
|
|
{
|
|
Z_OOPS(Z_SYSCALL_DRIVER_HWSPINLOCK(dev, trylock));
|
|
return z_impl_hwspinlock_trylock(dev, id);
|
|
}
|
|
|
|
#include <syscalls/hwspinlock_trylock_mrsh.c>
|
|
|
|
static inline void z_vrfy_hwspinlock_lock(const struct device *dev, uint32_t id)
|
|
{
|
|
Z_OOPS(Z_SYSCALL_DRIVER_HWSPINLOCK(dev, lock));
|
|
z_impl_hwspinlock_lock(dev, id);
|
|
}
|
|
|
|
#include <syscalls/hwspinlock_lock_mrsh.c>
|
|
|
|
static inline void z_vrfy_hwspinlock_unlock(const struct device *dev, uint32_t id)
|
|
{
|
|
Z_OOPS(Z_SYSCALL_DRIVER_HWSPINLOCK(dev, unlock));
|
|
z_impl_hwspinlock_unlock(dev, id);
|
|
}
|
|
|
|
#include <syscalls/hwspinlock_unlock_mrsh.c>
|
|
|
|
static inline uint32_t z_vrfy_hwspinlock_get_max_id(const struct device *dev)
|
|
{
|
|
Z_OOPS(Z_SYSCALL_DRIVER_HWSPINLOCK(dev, get_max_id));
|
|
return z_impl_hwspinlock_get_max_id(dev);
|
|
}
|
|
|
|
#include <syscalls/hwspinlock_get_max_id_mrsh.c>
|