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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-sparc64/] [atomic.h] - Blame information for rev 1774

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

Line No. Rev Author Line
1 1276 phoenix
/* $Id: atomic.h,v 1.1.1.1 2004-04-15 03:00:53 phoenix Exp $
2
 * atomic.h: Thankfully the V9 is at least reasonable for this
3
 *           stuff.
4
 *
5
 * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)
6
 */
7
 
8
#ifndef __ARCH_SPARC64_ATOMIC__
9
#define __ARCH_SPARC64_ATOMIC__
10
 
11
typedef struct { volatile int counter; } atomic_t;
12
#define ATOMIC_INIT(i)  { (i) }
13
 
14
#define atomic_read(v)          ((v)->counter)
15
#define atomic_set(v, i)        (((v)->counter) = i)
16
 
17
extern int __atomic_add(int, atomic_t *);
18
extern int __atomic_sub(int, atomic_t *);
19
 
20
#define atomic_add(i, v) ((void)__atomic_add(i, v))
21
#define atomic_sub(i, v) ((void)__atomic_sub(i, v))
22
 
23
#define atomic_dec_return(v) __atomic_sub(1, v)
24
#define atomic_inc_return(v) __atomic_add(1, v)
25
 
26
#define atomic_sub_and_test(i, v) (__atomic_sub(i, v) == 0)
27
#define atomic_dec_and_test(v) (__atomic_sub(1, v) == 0)
28
 
29
#define atomic_inc(v) ((void)__atomic_add(1, v))
30
#define atomic_dec(v) ((void)__atomic_sub(1, v))
31
 
32
/* Atomic operations are already serializing */
33
#define smp_mb__before_atomic_dec()     barrier()
34
#define smp_mb__after_atomic_dec()      barrier()
35
#define smp_mb__before_atomic_inc()     barrier()
36
#define smp_mb__after_atomic_inc()      barrier()
37
 
38
#endif /* !(__ARCH_SPARC64_ATOMIC__) */

powered by: WebSVN 2.1.0

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