1 // © 2021 Qualcomm Innovation Center, Inc. All rights reserved. 2 // 3 // SPDX-License-Identifier: BSD-3-Clause 4 5 #include <hyptypes.h> 6 7 #include <spinlock.h> 8 9 // Dummy spinlock implementation used for uniprocessor builds. 10 11 void spinlock_init(spinlock_t * lock)12spinlock_init(spinlock_t *lock) 13 { 14 trigger_spinlock_init_event(lock); 15 } 16 17 void spinlock_acquire(spinlock_t * lock)18spinlock_acquire(spinlock_t *lock) 19 { 20 trigger_spinlock_acquire_event(lock); 21 trigger_spinlock_acquired_event(lock); 22 } 23 24 bool spinlock_trylock(spinlock_t * lock)25spinlock_trylock(spinlock_t *lock) 26 { 27 // Always succeeds; this must not be used to prevent recursion! 28 spinlock_acquire(lock); 29 return true; 30 } 31 32 void spinlock_release(spinlock_t * lock)33spinlock_release(spinlock_t *lock) 34 { 35 trigger_spinlock_release_event(lock); 36 trigger_spinlock_released_event(lock); 37 } 38