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