1 | /* |
---|
2 | * Lattice Mico32 (lm32) CPU Dependent Source |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1999. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | * |
---|
14 | * Jukka Pietarinen <jukka.pietarinen@mrf.fi>, 2008, |
---|
15 | * Micro-Research Finland Oy |
---|
16 | */ |
---|
17 | |
---|
18 | #include <rtems/system.h> |
---|
19 | #include <rtems/score/isr.h> |
---|
20 | #include <rtems/score/wkspace.h> |
---|
21 | |
---|
22 | /* _CPU_Initialize |
---|
23 | * |
---|
24 | * This routine performs processor dependent initialization. |
---|
25 | * |
---|
26 | * INPUT PARAMETERS: NONE |
---|
27 | * |
---|
28 | * LM32 Specific Information: |
---|
29 | * |
---|
30 | * XXX document implementation including references if appropriate |
---|
31 | */ |
---|
32 | |
---|
33 | void _CPU_Initialize(void) |
---|
34 | { |
---|
35 | /* |
---|
36 | * If there is not an easy way to initialize the FP context |
---|
37 | * during Context_Initialize, then it is usually easier to |
---|
38 | * save an "uninitialized" FP context here and copy it to |
---|
39 | * the task's during Context_Initialize. |
---|
40 | */ |
---|
41 | |
---|
42 | /* FP context initialization support goes here */ |
---|
43 | } |
---|
44 | |
---|
45 | /*PAGE |
---|
46 | * |
---|
47 | * _CPU_ISR_Get_level |
---|
48 | * |
---|
49 | * LM32 Specific Information: |
---|
50 | * |
---|
51 | * XXX document implementation including references if appropriate |
---|
52 | */ |
---|
53 | |
---|
54 | uint32_t _CPU_ISR_Get_level( void ) |
---|
55 | { |
---|
56 | /* |
---|
57 | * This routine returns the current interrupt level. |
---|
58 | */ |
---|
59 | |
---|
60 | return 0; |
---|
61 | } |
---|
62 | |
---|
63 | /*PAGE |
---|
64 | * |
---|
65 | * _CPU_ISR_install_raw_handler |
---|
66 | * |
---|
67 | * LM32 Specific Information: |
---|
68 | * |
---|
69 | * XXX document implementation including references if appropriate |
---|
70 | */ |
---|
71 | |
---|
72 | void _CPU_ISR_install_raw_handler( |
---|
73 | uint32_t vector, |
---|
74 | proc_ptr new_handler, |
---|
75 | proc_ptr *old_handler |
---|
76 | ) |
---|
77 | { |
---|
78 | /* |
---|
79 | * This is where we install the interrupt handler into the "raw" interrupt |
---|
80 | * table used by the CPU to dispatch interrupt handlers. |
---|
81 | */ |
---|
82 | } |
---|
83 | |
---|
84 | /*PAGE |
---|
85 | * |
---|
86 | * _CPU_ISR_install_vector |
---|
87 | * |
---|
88 | * This kernel routine installs the RTEMS handler for the |
---|
89 | * specified vector. |
---|
90 | * |
---|
91 | * Input parameters: |
---|
92 | * vector - interrupt vector number |
---|
93 | * old_handler - former ISR for this vector number |
---|
94 | * new_handler - replacement ISR for this vector number |
---|
95 | * |
---|
96 | * Output parameters: NONE |
---|
97 | * |
---|
98 | * |
---|
99 | * LM32 Specific Information: |
---|
100 | * |
---|
101 | * XXX document implementation including references if appropriate |
---|
102 | */ |
---|
103 | |
---|
104 | void _CPU_ISR_install_vector( |
---|
105 | uint32_t vector, |
---|
106 | proc_ptr new_handler, |
---|
107 | proc_ptr *old_handler |
---|
108 | ) |
---|
109 | { |
---|
110 | *old_handler = _ISR_Vector_table[ vector ]; |
---|
111 | |
---|
112 | /* |
---|
113 | * If the interrupt vector table is a table of pointer to isr entry |
---|
114 | * points, then we need to install the appropriate RTEMS interrupt |
---|
115 | * handler for this vector number. |
---|
116 | */ |
---|
117 | |
---|
118 | _CPU_ISR_install_raw_handler( vector, new_handler, old_handler ); |
---|
119 | |
---|
120 | /* |
---|
121 | * We put the actual user ISR address in '_ISR_vector_table'. This will |
---|
122 | * be used by the _ISR_Handler so the user gets control. |
---|
123 | */ |
---|
124 | |
---|
125 | _ISR_Vector_table[ vector ] = new_handler; |
---|
126 | } |
---|
127 | |
---|
128 | /*PAGE |
---|
129 | * |
---|
130 | * _CPU_Install_interrupt_stack |
---|
131 | * |
---|
132 | * LM32 Specific Information: |
---|
133 | * |
---|
134 | * XXX document implementation including references if appropriate |
---|
135 | */ |
---|
136 | |
---|
137 | void _CPU_Install_interrupt_stack( void ) |
---|
138 | { |
---|
139 | } |
---|
140 | |
---|
141 | /*PAGE |
---|
142 | * |
---|
143 | * _CPU_Thread_Idle_body |
---|
144 | * |
---|
145 | * NOTES: |
---|
146 | * |
---|
147 | * 1. This is the same as the regular CPU independent algorithm. |
---|
148 | * |
---|
149 | * 2. If you implement this using a "halt", "idle", or "shutdown" |
---|
150 | * instruction, then don't forget to put it in an infinite loop. |
---|
151 | * |
---|
152 | * 3. Be warned. Some processors with onboard DMA have been known |
---|
153 | * to stop the DMA if the CPU were put in IDLE mode. This might |
---|
154 | * also be a problem with other on-chip peripherals. So use this |
---|
155 | * hook with caution. |
---|
156 | * |
---|
157 | * LM32 Specific Information: |
---|
158 | * |
---|
159 | * XXX document implementation including references if appropriate |
---|
160 | */ |
---|
161 | |
---|
162 | void *_CPU_Thread_Idle_body( uintptr_t ignored ) |
---|
163 | { |
---|
164 | for( ; ; ) { |
---|
165 | /* The LM32 softcore itself hasn't any HLT instruction. But the |
---|
166 | * LM32 qemu target interprets this nop instruction as HLT. |
---|
167 | */ |
---|
168 | asm volatile("and r0, r0, r0"); |
---|
169 | } |
---|
170 | } |
---|