atomic.c
Go to the documentation of this file.
1
#include "
config.h
"
2
#include <
atomic.h
>
3
4
#ifdef CONF_ATOMIC
5
12
void
atomic_inc
(
atomic_t
* counter);
13
__asm__
(
"\n\
14
.text\n\
15
.globl _atomic_inc\n\
16
_atomic_inc:\n\
17
stc ccr, r1h ; save flags\n\
18
orc #0x80, ccr ; disable all but NMI\n\
19
mov.b @r0, r1l\n\
20
inc r1l\n\
21
mov.b r1l, @r0\n\
22
ldc r1h, ccr ; restore flags\n\
23
rts\n\
24
"
);
25
33
void
atomic_dec
(
atomic_t
* counter);
34
__asm__
(
"\n\
35
.text\n\
36
.globl _atomic_dec\n\
37
_atomic_dec:\n\
38
stc ccr, r1h\n\
39
orc #0x80, ccr\n\
40
mov.b @r0, r1l\n\
41
dec r1l\n\
42
mov.b r1l, @r0\n\
43
ldc r1h, ccr\n\
44
rts\n\
45
"
);
46
#endif
__asm__
__asm__("\n\ .text\n\ .globl _atomic_inc\n\ _atomic_inc:\n\ stc ccr, r1h ; save flags\n\ orc #0x80, ccr ; disable all but NMI\n\ mov.b @r0, r1l\n\ inc r1l\n\ mov.b r1l, @r0\n\ ldc r1h, ccr ; restore flags\n\ rts\n\ ")
atomic_t
volatile unsigned char atomic_t
The data type that allows for atomic count operations.
Definition:
atomic.h:43
atomic.h
Interface: critical section management.
config.h
kernel configuration file
atomic_dec
void atomic_dec(atomic_t *counter)
decrement atomic counter without interruption.
atomic_inc
void atomic_inc(atomic_t *counter)
increment atomic counter without interruption.
brickOS
is released under the
Mozilla Public License
.
Original code copyright 1998-2005 by the authors.
Generated for brickOS Kernel Developer by
1.8.16