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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-armnommu/] [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
/*
2
 * linux/include/asm-arm/atomic.h
3
 *
4
 * Copyright (c) 1996 Russell King.
5
 *
6
 * Changelog:
7
 *  27-06-1996  RMK     Created
8
 *  13-04-1997  RMK     Made functions atomic
9
 */
10
#ifndef __ASM_ARM_ATOMIC_H
11
#define __ASM_ARM_ATOMIC_H
12
 
13
#include <asm/system.h>
14
 
15
typedef int atomic_t;
16
 
17
extern __inline__ void atomic_add(atomic_t i, atomic_t *v)
18
{
19
        unsigned long flags;
20
 
21
        save_flags_cli (flags);
22
        *v += i;
23
        restore_flags (flags);
24
}
25
 
26
extern __inline__ void atomic_sub(atomic_t i, atomic_t *v)
27
{
28
        unsigned long flags;
29
 
30
        save_flags_cli (flags);
31
        *v -= i;
32
        restore_flags (flags);
33
}
34
 
35
extern __inline__ void atomic_inc(atomic_t *v)
36
{
37
        unsigned long flags;
38
 
39
        save_flags_cli (flags);
40
        *v += 1;
41
        restore_flags (flags);
42
}
43
 
44
extern __inline__ void atomic_dec(atomic_t *v)
45
{
46
        unsigned long flags;
47
 
48
        save_flags_cli (flags);
49
        *v -= 1;
50
        restore_flags (flags);
51
}
52
 
53
extern __inline__ int atomic_dec_and_test(atomic_t *v)
54
{
55
        unsigned long flags;
56
        int result;
57
 
58
        save_flags_cli (flags);
59
        *v -= 1;
60
        result = (*v == 0);
61
        restore_flags (flags);
62
 
63
        return result;
64
}
65
 
66
#endif
67
 

powered by: WebSVN 2.1.0

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