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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * Copyright (C) 1999           Keith Adams     <kma@cse.ogi.edu>
3
 *                              Oregon Graduate Institute
4
 */
5
#ifndef _I960_SYSTEM_H
6
#define _I960_SYSTEM_H
7
 
8
#include <linux/linkage.h>
9
 
10
asmlinkage void resume(void);
11
struct task_struct;
12
extern void switch_to(struct task_struct* prev, struct task_struct* next);
13
 
14
 
15
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
16
#define tas(ptr) (xchg((ptr),1))
17
 
18
#define cli() do { \
19
        int garbage; \
20
        __asm__ __volatile__("modpc     g0, %1, %1"     \
21
                             :"=r" (garbage)    \
22
                             : "0" (0x1f << 16)); \
23
} while (0)
24
 
25
#define sti() do { \
26
        int garbage;    \
27
        __asm__ __volatile__("modpc     g0, %1, %2"     \
28
                             : "=r" (garbage)   \
29
                             : "r" (0x1f << 16), "0" (0));        \
30
} while (0)
31
 
32
#define save_flags(flags) do { \
33
        __asm__ __volatile__ ("modpc    g0, 0, %0" :"=&r" (flags));     \
34
} while (0)
35
 
36
#define restore_flags(flags) do { \
37
        int     flagcpy=flags;  \
38
        __asm__ __volatile__ ("modpc    g0, %1, %2" \
39
                              : "=r"(flagcpy) \
40
                              : "r" (0xffffffff), "0" (flagcpy)); \
41
} while (0)
42
 
43
extern unsigned long atmod(volatile void* ptr, unsigned long mask, unsigned long val);
44
 
45
static inline unsigned long __xchg(unsigned long x,
46
                                   volatile void * ptr, int size)
47
{
48
        unsigned long mask, retval;
49
        int off;
50
 
51
        switch (size) {
52
                case 1:
53
                        mask = 0xff;
54
                        off = (long) ptr % 4;
55
                        mask <<= off * 8;
56
                        x <<= off * 8;
57
                        retval = atmod(ptr, mask, x);
58
                        break;
59
 
60
                case 2:
61
                        mask = 0xffff;
62
                        off = (long)ptr % 2;
63
                        mask <<= off * 16;
64
                        x <<= off * 16;
65
                        retval = atmod(ptr, mask, x);
66
                        break;
67
 
68
                case 4:
69
                        mask = 0xffffffff;
70
                        retval = atmod(ptr, mask, x);
71
                        break;
72
        }
73
        return retval;
74
}
75
 
76
#endif /* _I960_SYSTEM_H */

powered by: WebSVN 2.1.0

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