Lines Matching refs:l
86 bool z_spin_lock_valid(struct k_spinlock *l);
87 bool z_spin_unlock_valid(struct k_spinlock *l);
88 void z_spin_lock_set_owner(struct k_spinlock *l);
92 bool z_spin_lock_mem_coherent(struct k_spinlock *l);
110 static ALWAYS_INLINE void z_spinlock_validate_pre(struct k_spinlock *l) in z_spinlock_validate_pre() argument
112 ARG_UNUSED(l); in z_spinlock_validate_pre()
114 __ASSERT(z_spin_lock_valid(l), "Invalid spinlock %p", l); in z_spinlock_validate_pre()
116 __ASSERT_NO_MSG(z_spin_lock_mem_coherent(l)); in z_spinlock_validate_pre()
121 static ALWAYS_INLINE void z_spinlock_validate_post(struct k_spinlock *l) in z_spinlock_validate_post() argument
123 ARG_UNUSED(l); in z_spinlock_validate_post()
125 z_spin_lock_set_owner(l); in z_spinlock_validate_post()
127 l->lock_time = sys_clock_cycle_get_32(); in z_spinlock_validate_post()
160 static ALWAYS_INLINE k_spinlock_key_t k_spin_lock(struct k_spinlock *l) in k_spin_lock() argument
162 ARG_UNUSED(l); in k_spin_lock()
171 z_spinlock_validate_pre(l); in k_spin_lock()
173 while (!atomic_cas(&l->locked, 0, 1)) { in k_spin_lock()
177 z_spinlock_validate_post(l); in k_spin_lock()
196 static ALWAYS_INLINE int k_spin_trylock(struct k_spinlock *l, k_spinlock_key_t *k) in k_spin_trylock() argument
200 z_spinlock_validate_pre(l); in k_spin_trylock()
202 if (!atomic_cas(&l->locked, 0, 1)) { in k_spin_trylock()
207 z_spinlock_validate_post(l); in k_spin_trylock()
235 static ALWAYS_INLINE void k_spin_unlock(struct k_spinlock *l, in k_spin_unlock() argument
238 ARG_UNUSED(l); in k_spin_unlock()
240 __ASSERT(z_spin_unlock_valid(l), "Not my spinlock %p", l); in k_spin_unlock()
243 uint32_t delta = sys_clock_cycle_get_32() - l->lock_time; in k_spin_unlock()
247 l, delta, CONFIG_SPIN_LOCK_TIME_LIMIT); in k_spin_unlock()
259 atomic_clear(&l->locked); in k_spin_unlock()
276 static ALWAYS_INLINE bool z_spin_is_locked(struct k_spinlock *l) in z_spin_is_locked() argument
278 return l->locked; in z_spin_is_locked()
283 static ALWAYS_INLINE void k_spin_release(struct k_spinlock *l) in k_spin_release() argument
285 ARG_UNUSED(l); in k_spin_release()
287 __ASSERT(z_spin_unlock_valid(l), "Not my spinlock %p", l); in k_spin_release()
290 atomic_clear(&l->locked); in k_spin_release()