1 /* 2 * Copyright (c) 2013-2024, 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 typedef struct bitlock { 19 volatile uint8_t lock; 20 } bitlock_t; 21 22 void spin_lock(spinlock_t *lock); 23 void spin_unlock(spinlock_t *lock); 24 25 void bit_lock(bitlock_t *lock, uint8_t mask); 26 void bit_unlock(bitlock_t *lock, uint8_t mask); 27 28 #else 29 30 /* Spin lock definitions for use in assembly */ 31 #define SPINLOCK_ASM_ALIGN 2 32 #define SPINLOCK_ASM_SIZE 4 33 34 #endif /* __ASSEMBLER__ */ 35 #endif /* SPINLOCK_H */ 36