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

Subversion Repositories or1k

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

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
#include <linux/config.h>
5
 
6
/*
7
 * Atomic operations that C can't guarantee us.  Useful for
8
 * resource counting etc..
9
 */
10
 
11
/*
12
 * We do not have SMP m68k systems, so we don't have to deal with that.
13
 */
14
 
15
typedef int atomic_t;
16
 
17
static __inline__ void atomic_add(atomic_t i, atomic_t *v)
18
{
19
#ifdef CONFIG_COLDFIRE
20
        __asm__ __volatile__(
21
                "movel %1,%/d0\t\n"
22
                "addl %/d0,%0"
23
                :
24
                : "m" (*v), "id" (i)
25
                : "d0");
26
#else
27
        __asm__ __volatile__("addl %1,%0" : : "m" (*v), "id" (i));
28
#endif
29
}
30
 
31
static __inline__ void atomic_sub(atomic_t i, atomic_t *v)
32
{
33
#ifdef CONFIG_COLDFIRE
34
        __asm__ __volatile__(
35
                "movel %1,%/d0\t\n"
36
                "subl %/d0,%0"
37
                :
38
                : "m" (*v), "id" (i)
39
                : "d0");
40
#else
41
        __asm__ __volatile__("subl %1,%0" : : "m" (*v), "id" (i));
42
#endif
43
}
44
 
45
static __inline__ void atomic_inc(atomic_t *v)
46
{
47
        __asm__ __volatile__("addql #1,%0" : : "m" (*v));
48
}
49
 
50
static __inline__ void atomic_dec(atomic_t *v)
51
{
52
        __asm__ __volatile__("subql #1,%0" : : "m" (*v));
53
}
54
 
55
static __inline__ int atomic_dec_and_test(atomic_t *v)
56
{
57
        char c;
58
        __asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c) : "m" (*v));
59
        return c != 0;
60
}
61
 
62
#endif /* __ARCH_M68K_ATOMIC __ */

powered by: WebSVN 2.1.0

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