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