blob: 9fd3fc65fe3ce1848190dd9ea4b3a359d72ddef2 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Govindraj Rajaeee28e72023-08-01 15:52:40 -05002 * Copyright (c) 2013-2018, Arm Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Achin Gupta4f6ad662013-10-25 09:08:21 +01005 */
6
Antonio Nino Diaz519248b2018-10-31 15:55:57 +00007#ifndef SPINLOCK_H
8#define SPINLOCK_H
Achin Gupta4f6ad662013-10-25 09:08:21 +01009
Julius Werner53456fc2019-07-09 13:49:11 -070010#ifndef __ASSEMBLER__
Jeenu Viswambharan54ec86a2017-01-19 14:23:36 +000011
Antonio Nino Diaz4b32e622018-08-16 16:52:57 +010012#include <stdint.h>
Jeenu Viswambharan54ec86a2017-01-19 14:23:36 +000013
Dan Handleye2712bc2014-04-10 15:37:22 +010014typedef struct spinlock {
Jeenu Viswambharan54ec86a2017-01-19 14:23:36 +000015 volatile uint32_t lock;
Achin Gupta4f6ad662013-10-25 09:08:21 +010016} spinlock_t;
17
18void spin_lock(spinlock_t *lock);
19void spin_unlock(spinlock_t *lock);
20
Jeenu Viswambharan54ec86a2017-01-19 14:23:36 +000021#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
Antonio Nino Diaz519248b2018-10-31 15:55:57 +000029#endif /* SPINLOCK_H */