2013-10-25 09:08:21 +01:00
|
|
|
/*
|
2017-01-19 14:23:36 +00:00
|
|
|
* Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
|
2013-10-25 09:08:21 +01:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2013-10-25 09:08:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SPINLOCK_H__
|
|
|
|
#define __SPINLOCK_H__
|
|
|
|
|
2017-01-19 14:23:36 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
|
|
#include <types.h>
|
|
|
|
|
2014-04-10 15:37:22 +01:00
|
|
|
typedef struct spinlock {
|
2017-01-19 14:23:36 +00:00
|
|
|
volatile uint32_t lock;
|
2013-10-25 09:08:21 +01:00
|
|
|
} spinlock_t;
|
|
|
|
|
|
|
|
void spin_lock(spinlock_t *lock);
|
|
|
|
void spin_unlock(spinlock_t *lock);
|
|
|
|
|
2017-01-19 14:23:36 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
/* Spin lock definitions for use in assembly */
|
|
|
|
#define SPINLOCK_ASM_ALIGN 2
|
|
|
|
#define SPINLOCK_ASM_SIZE 4
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-10-25 09:08:21 +01:00
|
|
|
#endif /* __SPINLOCK_H__ */
|