Orocos Real-Time Toolkit  2.9.0
Typedefs | Functions
oro_arch_interface.h File Reference

Please use this template to create new oro_arch.h files for different target architectures or compilers. More...

Go to the source code of this file.

Typedefs

typedef struct oro_atomic_t_interface oro_atomic_t
 

Functions

void ORO_ATOMIC_SETUP (oro_atomic_t *a, int n)
 Initializes the uninitialized atomic structure a with a counter value of 'n'. More...
 
void ORO_ATOMIC_CLEANUP (oro_atomic_t *a)
 Cleans up all resources allocated durint the setup of atomic structure a. More...
 
int oro_atomic_read (oro_atomic_t *a)
 Returns the current counter value of the atomic structure a. More...
 
void oro_atomic_set (oro_atomic_t *a, int n)
 Sets the current counter value of the atomic structure a to n. More...
 
void oro_atomic_add (oro_atomic_t *a, int n)
 Add n to a. More...
 
int oro_atomic_add_return (oro_atomic_t *a, int n)
 Add n to a and return the new value. More...
 
void oro_atomic_sub (int n, oro_atomic_t *a, int n)
 Subtract n from a. More...
 
int oro_atomic_sub_return (int n, oro_atomic_t *a, int n)
 Subtract n from a and return the new value. More...
 
int oro_atomic_sub_and_test (oro_atomic_t *a, int n)
 Subtract n from a and test for zero. More...
 
void oro_atomic_inc (oro_atomic_t *a)
 Increment a atomically. More...
 
int oro_atomic_inc_return (oro_atomic_t *a)
 Increment a atomically and return the new value. More...
 
void oro_atomic_dec (oro_atomic_t *a)
 Decrement a atomically. More...
 
int oro_atomic_dec_return (oro_atomic_t *a)
 Decrement a atomically and return the new value. More...
 
int oro_atomic_dec_and_test (oro_atomic_t *a)
 Decrement a atomically and test for zero. More...
 
int oro_atomic_inc_and_test (oro_atomic_t *a)
 Increment a atomically and test for zero. More...
 
int oro_cmpxchg (void volatile *ptr, unsigned long o, unsigned long n)
 Compare o with *ptr and swap with n if equal. More...
 

Detailed Description

Please use this template to create new oro_arch.h files for different target architectures or compilers.

You are free to make any of these functions macros or to declare them inlined.

Do not include this header, it serves only as an example and the expected architecture-specific API of the RTT. Include oro_arch.h instead.

This interface has been inspired on the common intrinsics API's of various compilers, operating systems and processor architectures. Examples are: GCC, Visual Studio and the Intel instruction set.

Definition in file oro_arch_interface.h.

Typedef Documentation

typedef struct oro_atomic_t_interface oro_atomic_t

Definition at line 26 of file oro_arch_interface.h.

Function Documentation

void oro_atomic_add ( oro_atomic_t a,
int  n 
)

Add n to a.

Referenced by RTT::os::AtomicInt::add().

int oro_atomic_add_return ( oro_atomic_t a,
int  n 
)

Add n to a and return the new value.

void ORO_ATOMIC_CLEANUP ( oro_atomic_t a)

Cleans up all resources allocated durint the setup of atomic structure a.

Referenced by RTT::os::AtomicInt::~AtomicInt(), RTT::base::ChannelElementBase::~ChannelElementBase(), and RTT::os::SharedMutex::~SharedMutex().

void oro_atomic_dec ( oro_atomic_t a)
int oro_atomic_dec_and_test ( oro_atomic_t a)
int oro_atomic_dec_return ( oro_atomic_t a)

Decrement a atomically and return the new value.

void oro_atomic_inc ( oro_atomic_t a)
int oro_atomic_inc_and_test ( oro_atomic_t a)
int oro_atomic_inc_return ( oro_atomic_t a)

Increment a atomically and return the new value.

int oro_atomic_read ( oro_atomic_t a)
void oro_atomic_set ( oro_atomic_t a,
int  n 
)

Sets the current counter value of the atomic structure a to n.

Referenced by RTT::internal::IntrusiveStorage::IntrusiveStorage(), RTT::os::AtomicInt::operator=(), and RTT::os::AtomicInt::set().

void ORO_ATOMIC_SETUP ( oro_atomic_t a,
int  n 
)

Initializes the uninitialized atomic structure a with a counter value of 'n'.

Referenced by RTT::os::AtomicInt::AtomicInt(), RTT::base::ChannelElementBase::ChannelElementBase(), and RTT::os::SharedMutex::SharedMutex().

void oro_atomic_sub ( int  n,
oro_atomic_t a,
int  n 
)

Subtract n from a.

Referenced by RTT::os::AtomicInt::sub().

int oro_atomic_sub_and_test ( oro_atomic_t a,
int  n 
)

Subtract n from a and test for zero.

Referenced by RTT::os::AtomicInt::sub_and_test().

int oro_atomic_sub_return ( int  n,
oro_atomic_t a,
int  n 
)

Subtract n from a and return the new value.

int oro_cmpxchg ( void volatile *  ptr,
unsigned long  o,
unsigned long  n 
)

Compare o with *ptr and swap with n if equal.

Note: you need to implement this function for different sizes of pointers and payloads. You will probably need to implement this function as a macro to resolve this in a way compatible with C.