[ac7d5ef0] | 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 | * XXX; 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 | /* XXX: FP context initialization support */ |
---|
| 60 | |
---|
| 61 | _CPU_Table = *cpu_table; |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | /* _CPU_ISR_install_vector |
---|
| 65 | * |
---|
| 66 | * This kernel routine installs the RTEMS handler for the |
---|
| 67 | * specified vector. |
---|
| 68 | * |
---|
| 69 | * Input parameters: |
---|
| 70 | * vector - interrupt vector number |
---|
| 71 | * old_handler - former ISR for this vector number |
---|
| 72 | * new_handler - replacement ISR for this vector number |
---|
| 73 | * |
---|
| 74 | * Output parameters: NONE |
---|
| 75 | * |
---|
| 76 | */ |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | void _CPU_ISR_install_vector( |
---|
| 80 | unsigned32 vector, |
---|
| 81 | proc_ptr new_handler, |
---|
| 82 | proc_ptr *old_handler |
---|
| 83 | ) |
---|
| 84 | { |
---|
| 85 | *old_handler = _ISR_Vector_table[ vector ]; |
---|
| 86 | |
---|
| 87 | /* |
---|
| 88 | * If the interrupt vector table is a table of pointer to isr entry |
---|
| 89 | * points, then we need to install the appropriate RTEMS interrupt |
---|
| 90 | * handler for this vector number. |
---|
| 91 | */ |
---|
| 92 | |
---|
| 93 | /* |
---|
| 94 | * We put the actual user ISR address in '_ISR_vector_table'. This will |
---|
| 95 | * be used by the _ISR_Handler so the user gets control. |
---|
| 96 | */ |
---|
| 97 | |
---|
| 98 | _ISR_Vector_table[ vector ] = new_handler; |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | /*PAGE |
---|
| 102 | * |
---|
| 103 | * _CPU_Install_interrupt_stack |
---|
| 104 | */ |
---|
| 105 | |
---|
| 106 | void _CPU_Install_interrupt_stack( void ) |
---|
| 107 | { |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | /*PAGE |
---|
| 111 | * |
---|
| 112 | * _CPU_Internal_threads_Idle_thread_body |
---|
| 113 | * |
---|
| 114 | * NOTES: |
---|
| 115 | * |
---|
| 116 | * 1. This is the same as the regular CPU independent algorithm. |
---|
| 117 | * |
---|
| 118 | * 2. If you implement this using a "halt", "idle", or "shutdown" |
---|
| 119 | * instruction, then don't forget to put it in an infinite loop. |
---|
| 120 | * |
---|
| 121 | * 3. Be warned. Some processors with onboard DMA have been known |
---|
| 122 | * to stop the DMA if the CPU were put in IDLE mode. This might |
---|
| 123 | * also be a problem with other on-chip peripherals. So use this |
---|
| 124 | * hook with caution. |
---|
| 125 | */ |
---|
| 126 | |
---|
| 127 | void _CPU_Internal_threads_Idle_thread_body( void ) |
---|
| 128 | { |
---|
| 129 | |
---|
| 130 | for( ; ; ) |
---|
| 131 | /* insert your "halt" instruction here */ ; |
---|
| 132 | } |
---|