1 | /* |
---|
2 | * XXX CPU Dependent Source |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * All rights assigned to U.S. Government, 1994. |
---|
8 | * |
---|
9 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
10 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
11 | * notice must appear in all copies of this file and its derivatives. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #include <rtems/system.h> |
---|
17 | #include <rtems/score/isr.h> |
---|
18 | #include <rtems/score/wkspace.h> |
---|
19 | |
---|
20 | /* _CPU_Initialize |
---|
21 | * |
---|
22 | * This routine performs processor dependent initialization. |
---|
23 | * |
---|
24 | * INPUT PARAMETERS: |
---|
25 | * cpu_table - CPU table to initialize |
---|
26 | * thread_dispatch - address of disptaching routine |
---|
27 | */ |
---|
28 | |
---|
29 | |
---|
30 | void _CPU_Initialize( |
---|
31 | rtems_cpu_table *cpu_table, |
---|
32 | void (*thread_dispatch) /* ignored on this CPU */ |
---|
33 | ) |
---|
34 | { |
---|
35 | /* |
---|
36 | * The thread_dispatch argument is the address of the entry point |
---|
37 | * for the routine called at the end of an ISR once it has been |
---|
38 | * decided a context switch is necessary. On some compilation |
---|
39 | * systems it is difficult to call a high-level language routine |
---|
40 | * from assembly. This allows us to trick these systems. |
---|
41 | * |
---|
42 | * If you encounter this problem save the entry point in a CPU |
---|
43 | * dependent variable. |
---|
44 | */ |
---|
45 | |
---|
46 | _CPU_Thread_dispatch_pointer = thread_dispatch; |
---|
47 | |
---|
48 | /* |
---|
49 | * If there is not an easy way to initialize the FP context |
---|
50 | * during Context_Initialize, then it is usually easier to |
---|
51 | * save an "uninitialized" FP context here and copy it to |
---|
52 | * the task's during Context_Initialize. |
---|
53 | */ |
---|
54 | |
---|
55 | /* FP context initialization support goes here */ |
---|
56 | |
---|
57 | _CPU_Table = *cpu_table; |
---|
58 | } |
---|
59 | |
---|
60 | /*PAGE |
---|
61 | * |
---|
62 | * _CPU_ISR_Get_level |
---|
63 | */ |
---|
64 | |
---|
65 | unsigned32 _CPU_ISR_Get_level( void ) |
---|
66 | { |
---|
67 | /* |
---|
68 | * This routine returns the current interrupt level. |
---|
69 | */ |
---|
70 | } |
---|
71 | |
---|
72 | /*PAGE |
---|
73 | * |
---|
74 | * _CPU_ISR_install_raw_handler |
---|
75 | */ |
---|
76 | |
---|
77 | void _CPU_ISR_install_raw_handler( |
---|
78 | unsigned32 vector, |
---|
79 | proc_ptr new_handler, |
---|
80 | proc_ptr *old_handler |
---|
81 | ) |
---|
82 | { |
---|
83 | /* |
---|
84 | * This is where we install the interrupt handler into the "raw" interrupt |
---|
85 | * table used by the CPU to dispatch interrupt handlers. |
---|
86 | */ |
---|
87 | } |
---|
88 | |
---|
89 | /*PAGE |
---|
90 | * |
---|
91 | * _CPU_ISR_install_vector |
---|
92 | * |
---|
93 | * This kernel routine installs the RTEMS handler for the |
---|
94 | * specified vector. |
---|
95 | * |
---|
96 | * Input parameters: |
---|
97 | * vector - interrupt vector number |
---|
98 | * old_handler - former ISR for this vector number |
---|
99 | * new_handler - replacement ISR for this vector number |
---|
100 | * |
---|
101 | * Output parameters: NONE |
---|
102 | * |
---|
103 | */ |
---|
104 | |
---|
105 | void _CPU_ISR_install_vector( |
---|
106 | unsigned32 vector, |
---|
107 | proc_ptr new_handler, |
---|
108 | proc_ptr *old_handler |
---|
109 | ) |
---|
110 | { |
---|
111 | *old_handler = _ISR_Vector_table[ vector ]; |
---|
112 | |
---|
113 | /* |
---|
114 | * If the interrupt vector table is a table of pointer to isr entry |
---|
115 | * points, then we need to install the appropriate RTEMS interrupt |
---|
116 | * handler for this vector number. |
---|
117 | */ |
---|
118 | |
---|
119 | _CPU_ISR_install_raw_handler( vector, new_handler, old_handler ); |
---|
120 | |
---|
121 | /* |
---|
122 | * We put the actual user ISR address in '_ISR_vector_table'. This will |
---|
123 | * be used by the _ISR_Handler so the user gets control. |
---|
124 | */ |
---|
125 | |
---|
126 | _ISR_Vector_table[ vector ] = new_handler; |
---|
127 | } |
---|
128 | |
---|
129 | /*PAGE |
---|
130 | * |
---|
131 | * _CPU_Install_interrupt_stack |
---|
132 | */ |
---|
133 | |
---|
134 | void _CPU_Install_interrupt_stack( void ) |
---|
135 | { |
---|
136 | } |
---|
137 | |
---|
138 | /*PAGE |
---|
139 | * |
---|
140 | * _CPU_Thread_Idle_body |
---|
141 | * |
---|
142 | * NOTES: |
---|
143 | * |
---|
144 | * 1. This is the same as the regular CPU independent algorithm. |
---|
145 | * |
---|
146 | * 2. If you implement this using a "halt", "idle", or "shutdown" |
---|
147 | * instruction, then don't forget to put it in an infinite loop. |
---|
148 | * |
---|
149 | * 3. Be warned. Some processors with onboard DMA have been known |
---|
150 | * to stop the DMA if the CPU were put in IDLE mode. This might |
---|
151 | * also be a problem with other on-chip peripherals. So use this |
---|
152 | * hook with caution. |
---|
153 | */ |
---|
154 | |
---|
155 | void _CPU_Thread_Idle_body( void ) |
---|
156 | { |
---|
157 | |
---|
158 | for( ; ; ) |
---|
159 | /* insert your "halt" instruction here */ ; |
---|
160 | } |
---|