2013-10-25 09:08:21 +01:00
|
|
|
/*
|
2018-08-16 16:52:57 +01:00
|
|
|
* Copyright (c) 2013-2018, 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
|
|
|
*/
|
|
|
|
|
2018-10-31 15:55:57 +00:00
|
|
|
#ifndef SPINLOCK_H
|
|
|
|
#define SPINLOCK_H
|
2013-10-25 09:08:21 +01:00
|
|
|
|
2019-07-09 21:49:11 +01:00
|
|
|
#ifndef __ASSEMBLER__
|
2017-01-19 14:23:36 +00:00
|
|
|
|
2018-08-16 16:52:57 +01:00
|
|
|
#include <stdint.h>
|
2017-01-19 14:23:36 +00:00
|
|
|
|
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
|
|
|
|
|
2018-10-31 15:55:57 +00:00
|
|
|
#endif /* SPINLOCK_H */
|