blob: a7b0d3940f658904abdec1daafc8e88c145304f2 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Jeenu Viswambharan54ec86a2017-01-19 14:23:36 +00002 * Copyright (c) 2013-2017, 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
7#ifndef __SPINLOCK_H__
8#define __SPINLOCK_H__
9
Jeenu Viswambharan54ec86a2017-01-19 14:23:36 +000010#ifndef __ASSEMBLY__
11
12#include <types.h>
13
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
Achin Gupta4f6ad662013-10-25 09:08:21 +010029#endif /* __SPINLOCK_H__ */