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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [include/] [asm-or32/] [system.h] - Blame information for rev 1778

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

Line No. Rev Author Line
1 666 simons
#ifndef _OR32_SYSTEM_H
2
#define _OR32_SYSTEM_H
3
 
4
#include <linux/config.h> /* get configuration macros */
5
#include <linux/linkage.h>
6
#include <asm/segment.h>
7
 
8
#include <asm/processor.h>
9
#include <asm/board.h>
10
 
11
extern int abs(int);
12
 
13
extern void __save_flags(unsigned long *flags);
14
extern void __restore_flags(unsigned long flags);
15
extern void sti(void);
16
extern void cli(void);
17
extern void mtspr(unsigned long add, unsigned long val);
18
extern unsigned long mfspr(unsigned long add);
19
extern void ic_enable(void);
20
extern void ic_disable(void);
21
extern void ic_invalidate(void);
22
extern void dc_enable(void);
23
extern void dc_disable(void);
24
extern void dc_line_invalidate(unsigned long);
25
extern void _print(const char *fmt, ...);
26
extern void _switch(struct thread_struct *, struct thread_struct *);
27
 
28
#define SYS_TICK_PER  0x10000
29 718 simons
#define BIGALLOCS     1
30 666 simons
 
31
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
32
#define tas(ptr) (xchg((ptr),1))
33
 
34
struct __xchg_dummy { unsigned long a[100]; };
35
#define __xg(x) ((volatile struct __xchg_dummy *)(x))
36
 
37
#define nop() __asm__ __volatile__ ("l.nop"::)
38
#define mb()  __asm__ __volatile__ (""   : : :"memory")
39
 
40
#define save_flags(x) __save_flags((unsigned long *)&(x))
41
#define restore_flags(x) __restore_flags((x))
42
 
43
static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
44
{
45
  unsigned long tmp, flags;
46
 
47
  save_flags(flags);
48
  cli();
49
 
50
  switch (size) {
51
  case 1:
52
    __asm__ __volatile__
53
    ("l.lbz %0,%2\n\t"
54
     "l.sb %2,%1"
55
    : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
56
    break;
57
  case 2:
58
    __asm__ __volatile__
59
    ("l.lhz %0,%2\n\t"
60
     "l.sh %2,%1"
61
    : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
62
    break;
63
  case 4:
64
    __asm__ __volatile__
65
    ("l.lwz %0,%2\n\t"
66
     "l.sw %2,%1"
67
    : "=&r" (tmp) : "r" (x), "m" (*__xg(ptr)) : "memory");
68
    break;
69
  }
70
 
71
  restore_flags(flags);
72
  return tmp;
73
}
74
 
75
#define HARD_RESET_NOW() ({             \
76
        cli();                          \
77
})
78
 
79
#endif /* _OR32_SYSTEM_H */

powered by: WebSVN 2.1.0

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