6#ifndef ZEPHYR_INCLUDE_SPINLOCK_H_
7#define ZEPHYR_INCLUDE_SPINLOCK_H_
18struct z_spinlock_key {
34#ifdef CONFIG_SPIN_VALIDATE
41#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_SMP) && \
42 !defined(CONFIG_SPIN_VALIDATE)
64#ifdef CONFIG_SPIN_VALIDATE
67void z_spin_lock_set_owner(
struct k_spinlock *l);
70# ifdef CONFIG_KERNEL_COHERENCE
71bool z_spin_lock_mem_coherent(
struct k_spinlock *l);
128#ifdef CONFIG_SPIN_VALIDATE
129 __ASSERT(z_spin_lock_valid(l),
"Recursive spinlock %p", l);
130# ifdef CONFIG_KERNEL_COHERENCE
131 __ASSERT_NO_MSG(z_spin_lock_mem_coherent(l));
140#ifdef CONFIG_SPIN_VALIDATE
141 z_spin_lock_set_owner(l);
171#ifdef CONFIG_SPIN_VALIDATE
172 __ASSERT(z_spin_unlock_valid(l),
"Not my spinlock %p", l);
194#ifdef CONFIG_SPIN_VALIDATE
195 __ASSERT(z_spin_unlock_valid(l),
"Not my spinlock %p", l);
static ALWAYS_INLINE unsigned int arch_irq_lock(void)
Disable all interrupts on the local CPU.
Definition: irq.h:168
static ALWAYS_INLINE void arch_irq_unlock(unsigned int key)
Definition: irq.h:176
int atomic_t
Definition: atomic.h:21
atomic_val_t atomic_clear(atomic_t *target)
static ALWAYS_INLINE bool atomic_cas(atomic_t *target, atomic_val_t oldval, atomic_val_t newval)
Definition: atomic_xtensa.h:42
#define ALWAYS_INLINE
Definition: common.h:116
static ALWAYS_INLINE void k_spin_release(struct k_spinlock *l)
Definition: spinlock.h:191
static ALWAYS_INLINE void k_spin_unlock(struct k_spinlock *l, k_spinlock_key_t key)
Unlock a spin lock.
Definition: spinlock.h:167
static ALWAYS_INLINE k_spinlock_key_t k_spin_lock(struct k_spinlock *l)
Lock a spinlock.
Definition: spinlock.h:117
struct z_spinlock_key k_spinlock_key_t
Spinlock key type.
Definition: spinlock.h:87
static k_spinlock_key_t key
Definition: spinlock_error_case.c:14
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:75
Kernel Spin Lock.
Definition: spinlock.h:29
atomic_t locked
Definition: spinlock.h:31
#define CONFIG_MP_NUM_CPUS
Definition: ztest.h:38