spinlock.h 496 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef SPINLOCK_H
  7. #define SPINLOCK_H
  8. #ifndef __ASSEMBLER__
  9. #include <stdint.h>
  10. typedef struct spinlock {
  11. volatile uint32_t lock;
  12. } spinlock_t;
  13. void spin_lock(spinlock_t *lock);
  14. void spin_unlock(spinlock_t *lock);
  15. #else
  16. /* Spin lock definitions for use in assembly */
  17. #define SPINLOCK_ASM_ALIGN 2
  18. #define SPINLOCK_ASM_SIZE 4
  19. #endif
  20. #endif /* SPINLOCK_H */