OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-m68k/] [atomic.h] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef __ARCH_M68K_ATOMIC__
2
#define __ARCH_M68K_ATOMIC__
3
 
4
/*
5
 * Atomic operations that C can't guarantee us.  Useful for
6
 * resource counting etc..
7
 */
8
 
9
/*
10
 * We do not have SMP m68k systems, so we don't have to deal with that.
11
 */
12
 
13
typedef int atomic_t;
14
 
15
static __inline__ void atomic_add(atomic_t i, atomic_t *v)
16
{
17
        __asm__ __volatile__("addl %1,%0" : : "m" (*v), "id" (i));
18
}
19
 
20
static __inline__ void atomic_sub(atomic_t i, atomic_t *v)
21
{
22
        __asm__ __volatile__("subl %1,%0" : : "m" (*v), "id" (i));
23
}
24
 
25
static __inline__ void atomic_inc(atomic_t *v)
26
{
27
        __asm__ __volatile__("addql #1,%0" : : "m" (*v));
28
}
29
 
30
static __inline__ void atomic_dec(atomic_t *v)
31
{
32
        __asm__ __volatile__("subql #1,%0" : : "m" (*v));
33
}
34
 
35
static __inline__ int atomic_dec_and_test(atomic_t *v)
36
{
37
        char c;
38
        __asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c) : "m" (*v));
39
        return c != 0;
40
}
41
 
42
#endif /* __ARCH_M68K_ATOMIC __ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.