brickOS Kernel Developer v0.9.0
atomic.c
Go to the documentation of this file.
1#include "config.h"
2#include <atomic.h>
3
4#ifdef CONF_ATOMIC
12void atomic_inc(atomic_t* counter);
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
33void atomic_dec(atomic_t* counter);
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
void atomic_dec(atomic_t *counter)
decrement atomic counter without interruption.
void atomic_inc(atomic_t *counter)
increment atomic counter without interruption.
__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\ ")
Interface: critical section management.
volatile unsigned char atomic_t
The data type that allows for atomic count operations.
Definition atomic.h:43
kernel configuration file