atomic.c File Reference
#include "config.h"
#include <atomic.h>
Include dependency graph for atomic.c:

Go to the source code of this file.

Functions

void atomic_inc (atomic_t *counter)
 increment atomic counter without interruption. More...
 
 __asm__ ("\.text\.globl _atomic_inc\ _atomic_inc:\ stc ccr, r1h ; save flags\ orc #0x80, ccr ; disable all but NMI\ mov.b @r0, r1l\ inc r1l\ mov.b r1l, @r0\ ldc r1h, ccr ; restore flags\ rts\")
 
void atomic_dec (atomic_t *counter)
 decrement atomic counter without interruption. More...
 
 __asm__ ("\.text\.globl _atomic_dec\ _atomic_dec:\ stc ccr, r1h\ orc #0x80, ccr\ mov.b @r0, r1l\ dec r1l\ mov.b r1l, @r0\ ldc r1h, ccr\ rts\")
 

Function Documentation

◆ __asm__() [1/2]

__asm__ ( "\ext\lobl _atomic_inc\atomic_inc:\tc  ccr,
r1h ;save flags\ orc #  0x80,
ccr ;disable all but NMI\ mov.b @  r0,
r1l\ inc r1l\ mov.b  r1l,
@r0\ ldc  r1h,
ccr ;restore flags\ rts\"   
)

◆ __asm__() [2/2]

__asm__ ( "\ext\lobl _atomic_dec\atomic_dec:\tc  ccr,
r1h\ orc #  0x80,
ccr\ mov.b @  r0,
r1l\ dec r1l\ mov.b  r1l,
@r0\ ldc  r1h,
ccr\ rts\"   
)

◆ atomic_dec()

void atomic_dec ( atomic_t counter)

decrement atomic counter without interruption.

locks interrupts except NMI, decrements count then restores interrupts.

Parameters
counterthe counter resource to be decremented
See also
atomic_inc

◆ atomic_inc()

void atomic_inc ( atomic_t counter)

increment atomic counter without interruption.

locks interrupts except NMI, increments count then restores interrupts.

Parameters
counterthe counter resource to be incremented
See also
atomic_dec

Referenced by sem_post().


brickOS is released under the Mozilla Public License.
Original code copyright 1998-2005 by the authors.

Generated for brickOS Kernel Developer by doxygen 1.8.13