coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
atomic.h File Reference

Atomic operations that C can't guarantee us. More...

Go to the source code of this file.

Data Structures

struct  atomic_t
 

Macros

#define ATOMIC_INIT(i)   { (i) }
 
#define atomic_read(v)   ((v)->counter)
 atomic_read - read atomic variable More...
 
#define atomic_set(v, i)   (((v)->counter) = (i))
 atomic_set - set atomic variable More...
 

Functions

static __always_inline void atomic_inc (atomic_t *v)
 atomic_inc - increment atomic variable More...
 
static __always_inline void atomic_dec (atomic_t *v)
 atomic_dec - decrement atomic variable More...
 

Detailed Description

Atomic operations that C can't guarantee us.

Useful for resource counting etc..

Definition in file atomic.h.

Macro Definition Documentation

◆ ATOMIC_INIT

#define ATOMIC_INIT (   i)    { (i) }

Definition at line 13 of file atomic.h.

◆ atomic_read

#define atomic_read (   v)    ((v)->counter)

atomic_read - read atomic variable

Parameters
vpointer of type atomic_t

Atomically reads the value of v. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 28 of file atomic.h.

◆ atomic_set

#define atomic_set (   v,
 
)    (((v)->counter) = (i))

atomic_set - set atomic variable

Parameters
vpointer of type atomic_t
irequired value

Atomically sets the value of v to i. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 38 of file atomic.h.

Function Documentation

◆ atomic_dec()

static __always_inline void atomic_dec ( atomic_t v)
static

atomic_dec - decrement atomic variable

Parameters
vpointer of type atomic_t

Atomically decrements v by 1. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 62 of file atomic.h.

References atomic_t::counter.

◆ atomic_inc()

static __always_inline void atomic_inc ( atomic_t v)
static

atomic_inc - increment atomic variable

Parameters
vpointer of type atomic_t

Atomically increments v by 1. Note that the guaranteed useful range of an atomic_t is only 24 bits.

Definition at line 47 of file atomic.h.

References atomic_t::counter.