OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_processor/] [mor1kx-5.0/] [sw/] [mor1kx/] [int.i] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
# 1 "int.c"
2
# 1 "/work/mor1kx-dev-env/sw/drivers/or1200//"
3
# 1 ""
4
# 1 "int.c"
5
 
6
 
7
 
8
 
9
 
10
 
11
# 1 "../../drivers/or1200/include/or1200-utils.h" 1
12
 
13
 
14
 
15
 
16
# 1 "../../drivers/or1200/include/int.h" 1
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
struct ihnd {
25
 void (*handler)(void *);
26
 void *arg;
27
};
28
 
29
 
30
int int_add(unsigned long vect, void (* handler)(void *), void *arg);
31
 
32
 
33
void add_handler(unsigned long vector, void (* handler) (void));
34
 
35
 
36
int int_init();
37
 
38
 
39
void int_main();
40
# 6 "../../drivers/or1200/include/or1200-utils.h" 2
41
# 25 "../../drivers/or1200/include/or1200-utils.h"
42
void mtspr(unsigned long spr, unsigned long value);
43
 
44
 
45
unsigned long mfspr(unsigned long spr);
46
 
47
 
48
void sim_putc(unsigned char c);
49
 
50
 
51
void report(unsigned long value);
52
 
53
 
54
void exit(int i);
55
 
56
 
57
void cpu_enable_user_interrupts(void);
58
 
59
 
60
extern unsigned long timer_ticks;
61
 
62
void cpu_enable_timer(void);
63
 
64
void cpu_disable_timer(void);
65
 
66
void cpu_timer_tick(void);
67
 
68
void cpu_reset_timer_ticks(void);
69
 
70
unsigned long cpu_get_timer_ticks(void);
71
 
72
void cpu_sleep_10ms(void);
73
# 8 "int.c" 2
74
# 1 "../../drivers/or1200/include/spr-defs.h" 1
75
# 9 "int.c" 2
76
# 1 "../../drivers/or1200/include/int.h" 1
77
# 10 "int.c" 2
78
 
79
 
80
struct ihnd int_handlers[32];
81
 
82
 
83
int int_init()
84
{
85
  int i;
86
 
87
  for(i = 0; i < 32; i++) {
88
    int_handlers[i].handler = 0;
89
    int_handlers[i].arg = 0;
90
  }
91
 
92
  return 0;
93
}
94
 
95
 
96
int int_add(unsigned long irq, void (* handler)(void *), void *arg)
97
{
98
  if(irq >= 32)
99
    return -1;
100
 
101
  int_handlers[irq].handler = handler;
102
  int_handlers[irq].arg = arg;
103
 
104
  mtspr(((9<< (11)) + 0), mfspr(((9<< (11)) + 0)) | (0x00000001L << irq));
105
 
106
  return 0;
107
}
108
 
109
 
110
int int_disable(unsigned long irq)
111
{
112
  if(irq >= 32)
113
    return -1;
114
 
115
  mtspr(((9<< (11)) + 0), mfspr(((9<< (11)) + 0)) & ~(0x00000001L << irq));
116
 
117
  return 0;
118
}
119
 
120
 
121
int int_enable(unsigned long irq)
122
{
123
  if(irq >= 32)
124
    return -1;
125
 
126
  mtspr(((9<< (11)) + 0), mfspr(((9<< (11)) + 0)) | (0x00000001L << irq));
127
 
128
  return 0;
129
}
130
 
131
 
132
void int_main()
133
{
134
  unsigned long picsr = mfspr(((9<< (11)) + 2));
135
  unsigned long i = 0;
136
 
137
  mtspr(((9<< (11)) + 2), 0);
138
 
139
  while(i < 32) {
140
    if((picsr & (0x01L << i)) && (int_handlers[i].handler != 0)) {
141
      (*int_handlers[i].handler)(int_handlers[i].arg);
142
 
143
 
144
 
145
 
146
 
147
       mtspr(((9<< (11)) + 2), mfspr(((9<< (11)) + 2)) & ~(0x00000001L << i));
148
    }
149
    i++;
150
  }
151
}

powered by: WebSVN 2.1.0

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