From b38bc68b9edf385f2576a6cbf304187721f562c1 Mon Sep 17 00:00:00 2001 From: Jeenu Viswambharan Date: Thu, 19 Jan 2017 14:23:36 +0000 Subject: Allow spin locks to be defined from assembly At present, spin locks can only defined from C files. Add some macros such that they can be defined from assembly files too. Change-Id: I64f0c214062f5c15b3c8b412c7f25c908e87d970 Signed-off-by: Jeenu Viswambharan --- include/lib/spinlock.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'include/lib') diff --git a/include/lib/spinlock.h b/include/lib/spinlock.h index cb0bc3e5..8273c784 100644 --- a/include/lib/spinlock.h +++ b/include/lib/spinlock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -31,11 +31,23 @@ #ifndef __SPINLOCK_H__ #define __SPINLOCK_H__ +#ifndef __ASSEMBLY__ + +#include + typedef struct spinlock { - volatile unsigned int lock; + volatile uint32_t lock; } spinlock_t; void spin_lock(spinlock_t *lock); void spin_unlock(spinlock_t *lock); +#else + +/* Spin lock definitions for use in assembly */ +#define SPINLOCK_ASM_ALIGN 2 +#define SPINLOCK_ASM_SIZE 4 + +#endif + #endif /* __SPINLOCK_H__ */ -- cgit v1.2.3