atomics.h File Reference

Go to the source code of this file.

Enumerations

enum  atomic_compare_t { ATOMIC_COMPARE_NONE = 0, ATOMIC_COMPARE_ZERO, ATOMIC_COMPARE_NEGATIVE }

Functions

u32 atomics_read (u32 *v)
 Atomically read an integer.
void atomics_set (u32 *v, u32 i)
 Atomically set the value of an integer.
int atomics_add (u32 *v, u32 i, atomic_compare_t cmp)
 Atomically add an integer.
int atomics_sub (u32 *v, u32 i, atomic_compare_t cmp)
 Atomically subtract an integer.
int atomics_inc (u32 *v, atomic_compare_t cmp)
 Atomically increase an integer by 1.
int atomics_dec (u32 *v, atomic_compare_t cmp)
 Atomically decrease an integer by 1.
int atomics_bitset (u32 *v, u32 bit)
 Atomically set a bit in an integer.
int atomics_bitclear (u32 *v, u32 bit)
 Atomically clear a bit in an integer.
int atomics_bitchange (u32 *v, u32 bit)
 Atomically switch a bit in an integer.
int atomics_bitcheck (u32 *v, u32 bit)
 Atomically check a bit in an integer.

Detailed Description

Atomic instruction wrappers


Enumeration Type Documentation

An enumeration of the types of atomic comparisons available

Enumerator:
ATOMIC_COMPARE_NONE 

Don't compare

ATOMIC_COMPARE_ZERO 

If the result is 0, return 1. Otherwise return 0.

ATOMIC_COMPARE_NEGATIVE 

If the result is negative, return 1. Otherwise return 0.


Function Documentation

int atomics_add ( u32 *  v,
u32  i,
atomic_compare_t  cmp 
)

Atomically add an integer.

Parameters:
v a pointer to an integer to add to atomically.
i the value to add to the integer.
cmp the type of comparison to do with the result.
Returns:
The result of the comparison.
int atomics_bitchange ( u32 *  v,
u32  bit 
)

Atomically switch a bit in an integer.

Parameters:
v a pointer to an integer to switch a bit in atomically.
bit the bit index to switch. 0 is least significant bit.
Returns:
The old value of the bit. If set, result is 1.
int atomics_bitcheck ( u32 *  v,
u32  bit 
)

Atomically check a bit in an integer.

Parameters:
v a pointer to an integer to check a bit in atomically.
bit the bit index to check. 0 is least significant bit.
Returns:
The old value of the bit. If set, result is 1.
int atomics_bitclear ( u32 *  v,
u32  bit 
)

Atomically clear a bit in an integer.

Parameters:
v a pointer to an integer to clear a bit in atomically.
bit the bit index to clear. 0 is least significant bit.
Returns:
The old value of the bit. If set, result is 1.
int atomics_bitset ( u32 *  v,
u32  bit 
)

Atomically set a bit in an integer.

Parameters:
v a pointer to an integer to set a bit in atomically.
bit the bit index to set. 0 is least significant bit.
Returns:
The old value of the bit. If set, result is 1.
int atomics_dec ( u32 *  v,
atomic_compare_t  cmp 
)

Atomically decrease an integer by 1.

Parameters:
v a pointer to an integer to decrease atomically.
cmp the type of comparison to do with the result.
Returns:
The result of the comparison.
int atomics_inc ( u32 *  v,
atomic_compare_t  cmp 
)

Atomically increase an integer by 1.

Parameters:
v a pointer to an integer to increase atomically.
cmp the type of comparison to do with the result.
Returns:
The result of the comparison.
u32 atomics_read ( u32 *  v  ) 

Atomically read an integer.

Parameters:
v a pointer to an integer to read atomically.
Returns:
The value of the integer.
void atomics_set ( u32 *  v,
u32  i 
)

Atomically set the value of an integer.

Parameters:
v a pointer to an integer to set atomically.
i the value to set the integer to.
int atomics_sub ( u32 *  v,
u32  i,
atomic_compare_t  cmp 
)

Atomically subtract an integer.

Parameters:
v a pointer to an integer to subtract from atomically.
i the value to subtract the integer.
cmp the type of comparison to do with the result.
Returns:
The result of the comparison.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated by  doxygen 1.6.3