xref: /aosp_15_r20/external/arm-trusted-firmware/include/lib/spinlock.h (revision 54fd6939e177f8ff529b10183254802c76df6d08)
1 /*
2  * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef SPINLOCK_H
8 #define SPINLOCK_H
9 
10 #ifndef __ASSEMBLER__
11 
12 #include <stdint.h>
13 
14 typedef struct spinlock {
15 	volatile uint32_t lock;
16 } spinlock_t;
17 
18 void spin_lock(spinlock_t *lock);
19 void spin_unlock(spinlock_t *lock);
20 
21 #else
22 
23 /* Spin lock definitions for use in assembly */
24 #define SPINLOCK_ASM_ALIGN	2
25 #define SPINLOCK_ASM_SIZE	4
26 
27 #endif
28 
29 #endif /* SPINLOCK_H */
30