summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/arm
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-02-13 15:43:03 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-02-17 08:46:38 +0100
commit0344ce0385fb2ff4f55d4154ae38b438c2168340 (patch)
treec183563bb9be2aea7c350af62321e928b58b44bd /cpukit/score/cpu/arm
parentsmptests/smplock01: Use atomic operations (diff)
downloadrtems-0344ce0385fb2ff4f55d4154ae38b438c2168340.tar.bz2
score: Use atomic API for SMP lock
Use a ticket lock implementation based on atomic operations. Delete CPU port specific SMP lock implementations.
Diffstat (limited to 'cpukit/score/cpu/arm')
-rw-r--r--cpukit/score/cpu/arm/Makefile.am1
-rw-r--r--cpukit/score/cpu/arm/preinstall.am4
-rw-r--r--cpukit/score/cpu/arm/rtems/score/cpusmplock.h101
3 files changed, 0 insertions, 106 deletions
diff --git a/cpukit/score/cpu/arm/Makefile.am b/cpukit/score/cpu/arm/Makefile.am
index fe97e03e29..c051a4894f 100644
--- a/cpukit/score/cpu/arm/Makefile.am
+++ b/cpukit/score/cpu/arm/Makefile.am
@@ -10,7 +10,6 @@ include_rtems_score_HEADERS += rtems/score/armv4.h
include_rtems_score_HEADERS += rtems/score/armv7m.h
include_rtems_score_HEADERS += rtems/score/types.h
include_rtems_score_HEADERS += rtems/score/cpuatomic.h
-include_rtems_score_HEADERS += rtems/score/cpusmplock.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/cpukit/score/cpu/arm/preinstall.am b/cpukit/score/cpu/arm/preinstall.am
index 5c9c821ed1..4213c552ab 100644
--- a/cpukit/score/cpu/arm/preinstall.am
+++ b/cpukit/score/cpu/arm/preinstall.am
@@ -55,7 +55,3 @@ $(PROJECT_INCLUDE)/rtems/score/cpuatomic.h: rtems/score/cpuatomic.h $(PROJECT_IN
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpuatomic.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpuatomic.h
-$(PROJECT_INCLUDE)/rtems/score/cpusmplock.h: rtems/score/cpusmplock.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/cpusmplock.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/cpusmplock.h
-
diff --git a/cpukit/score/cpu/arm/rtems/score/cpusmplock.h b/cpukit/score/cpu/arm/rtems/score/cpusmplock.h
deleted file mode 100644
index 46592f432b..0000000000
--- a/cpukit/score/cpu/arm/rtems/score/cpusmplock.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * @file
- *
- * @ingroup ScoreSMPLockARM
- *
- * @brief ARM SMP Lock Implementation
- */
-
-/*
- * Copyright (c) 2013 embedded brains GmbH
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- */
-
-#ifndef _RTEMS_SCORE_ARM_SMPLOCK_H
-#define _RTEMS_SCORE_ARM_SMPLOCK_H
-
-#include <rtems/score/cpu.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @defgroup ScoreSMPLockARM ARM SMP Locks
- *
- * @ingroup ScoreSMPLock
- *
- * A ticket lock implementation is used.
- *
- * @{
- */
-
-typedef struct {
- uint32_t next_ticket;
- uint32_t now_serving;
-} CPU_SMP_lock_Control;
-
-#define CPU_SMP_LOCK_INITIALIZER { 0, 0 }
-
-static inline void _CPU_SMP_lock_Initialize( CPU_SMP_lock_Control *lock )
-{
- lock->next_ticket = 0;
- lock->now_serving = 0;
-}
-
-static inline void _CPU_SMP_lock_Acquire( CPU_SMP_lock_Control *lock )
-{
- uint32_t my_ticket;
- uint32_t next_ticket;
- uint32_t status;
-
- __asm__ volatile (
- "1: ldrex %[my_ticket], [%[next_ticket_addr]]\n"
- "add %[next_ticket], %[my_ticket], #1\n"
- "strex %[status], %[next_ticket], [%[next_ticket_addr]]\n"
- "teq %[status], #0\n"
- "bne 1b"
- : [my_ticket] "=&r" (my_ticket),
- [next_ticket] "=&r" (next_ticket),
- [status] "=&r" (status)
- : [next_ticket_addr] "r" (&lock->next_ticket)
- : "cc", "memory"
- );
-
- while ( my_ticket != lock->now_serving ) {
- _ARM_Wait_for_event();
- }
-
- _ARM_Data_memory_barrier();
-}
-
-static inline void _CPU_SMP_lock_Release( CPU_SMP_lock_Control *lock )
-{
- _ARM_Data_memory_barrier();
- ++lock->now_serving;
- _ARM_Data_synchronization_barrier();
- _ARM_Send_event();
-}
-
-#define _CPU_SMP_lock_ISR_disable_and_acquire( lock, isr_cookie ) \
- do { \
- _CPU_ISR_Disable( isr_cookie ); \
- _CPU_SMP_lock_Acquire( lock ); \
- } while (0)
-
-#define _CPU_SMP_lock_Release_and_ISR_enable( lock, isr_cookie ) \
- do { \
- _CPU_SMP_lock_Release( lock ); \
- _CPU_ISR_Enable( isr_cookie ); \
- } while (0)
-
-/**@}*/
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _RTEMS_SCORE_ARM_SMPLOCK_H */