epicsAtomic: RTEMS ISR safe impl. for epicsAtomicLock()

This commit is contained in:
Michael Davidsaver
2015-02-27 17:29:11 -05:00
parent 214c9003a9
commit 332fd550ad
2 changed files with 66 additions and 1 deletions

View File

@@ -19,7 +19,7 @@
#include "compilerSpecific.h"
#define EPICS_ATOMIC_INLINE EPICS_FUNC_INLINE
#define EPICS_ATOMIC_INLINE static EPICS_ALWAYS_INLINE
#ifdef __cplusplus
extern "C" {

View File

@@ -0,0 +1,65 @@
/*************************************************************************\
* Copyright (c) 2011 LANS LLC, as Operator of
* Los Alamos National Laboratory.
* Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Author Jeffrey O. Hill
* johill@lanl.gov
*/
#ifndef epicsAtomicOSD_h
#define epicsAtomicOSD_h
#include <shareLib.h>
#include "epicsMMIO.h"
#include "compilerSpecific.h"
#include "epicsInterrupt.h"
#define EPICS_ATOMIC_OS_NAME "RTEMS"
typedef struct EpicsAtomicLockKey {
int key;
} EpicsAtomicLockKey;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
{
epicsAtomicMemoryBarrierFallback();
}
#endif
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
{
rwbarr();
}
#endif
EPICS_ATOMIC_INLINE void epicsAtomicLock ( struct EpicsAtomicLockKey * pkey )
{
pkey->key = epicsInterruptLock();
}
EPICS_ATOMIC_INLINE void epicsAtomicUnlock ( struct EpicsAtomicLockKey * pkey )
{
epicsInterruptUnlock(pkey->key);
}
#ifdef __cplusplus
} /* end of extern "C" */
#endif /* __cplusplus */
#include "epicsAtomicDefault.h"
#endif /* epicsAtomicOSD_h */