blob: 8aec7078958b6a8b1ea8a208463a8b4aeb349753 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Antonio Nino Diaz4b32e622018-08-16 16:52:57 +01002 * 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
7#ifndef __SPINLOCK_H__
8#define __SPINLOCK_H__
9
Jeenu Viswambharan54ec86a2017-01-19 14:23:36 +000010#ifndef __ASSEMBLY__
11
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
Achin Gupta4f6ad662013-10-25 09:08:21 +010029#endif /* __SPINLOCK_H__ */