[ac7d5ef0] | 1 | /* |
---|
[38ffa0c] | 2 | * Motorola MC68xxx Dependent Source |
---|
[ac7d5ef0] | 3 | * |
---|
| 4 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 5 | * On-Line Applications Research Corporation (OAR). |
---|
| 6 | * All rights assigned to U.S. Government, 1994. |
---|
| 7 | * |
---|
| 8 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 9 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 10 | * notice must appear in all copies of this file and its derivatives. |
---|
| 11 | * |
---|
| 12 | * $Id$ |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include <rtems/system.h> |
---|
[5e9b32b] | 16 | #include <rtems/score/isr.h> |
---|
[ac7d5ef0] | 17 | |
---|
| 18 | /* _CPU_Initialize |
---|
| 19 | * |
---|
| 20 | * This routine performs processor dependent initialization. |
---|
| 21 | * |
---|
| 22 | * INPUT PARAMETERS: |
---|
| 23 | * cpu_table - CPU table to initialize |
---|
| 24 | * thread_dispatch - entry pointer to thread dispatcher |
---|
| 25 | * |
---|
| 26 | * OUTPUT PARAMETERS: NONE |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | void _CPU_Initialize( |
---|
| 30 | rtems_cpu_table *cpu_table, |
---|
| 31 | void (*thread_dispatch) /* ignored on this CPU */ |
---|
| 32 | ) |
---|
| 33 | { |
---|
| 34 | _CPU_Table = *cpu_table; |
---|
| 35 | } |
---|
| 36 | |
---|
[3a4ae6c] | 37 | /*PAGE |
---|
| 38 | * |
---|
| 39 | * _CPU_ISR_Get_level |
---|
| 40 | */ |
---|
| 41 | |
---|
| 42 | unsigned32 _CPU_ISR_Get_level( void ) |
---|
| 43 | { |
---|
| 44 | unsigned32 level; |
---|
| 45 | |
---|
| 46 | m68k_get_interrupt_level( level ); |
---|
| 47 | |
---|
| 48 | return level; |
---|
| 49 | } |
---|
| 50 | |
---|
[637df35] | 51 | /*PAGE |
---|
| 52 | * |
---|
| 53 | * _CPU_ISR_install_raw_handler |
---|
| 54 | */ |
---|
| 55 | |
---|
| 56 | void _CPU_ISR_install_raw_handler( |
---|
| 57 | unsigned32 vector, |
---|
| 58 | proc_ptr new_handler, |
---|
| 59 | proc_ptr *old_handler |
---|
| 60 | ) |
---|
| 61 | { |
---|
| 62 | proc_ptr *interrupt_table = NULL; |
---|
| 63 | |
---|
| 64 | m68k_get_vbr( interrupt_table ); |
---|
| 65 | |
---|
[38ffa0c] | 66 | #if ( M68K_HAS_VBR == 1) |
---|
[637df35] | 67 | *old_handler = interrupt_table[ vector ]; |
---|
| 68 | interrupt_table[ vector ] = new_handler; |
---|
[38ffa0c] | 69 | #else |
---|
| 70 | *old_handler = *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10); |
---|
| 71 | *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10) = new_handler; |
---|
| 72 | #endif /* M68K_HAS_VBR */ |
---|
[637df35] | 73 | } |
---|
| 74 | |
---|
| 75 | /*PAGE |
---|
| 76 | * |
---|
| 77 | * _CPU_ISR_install_vector |
---|
[ac7d5ef0] | 78 | * |
---|
| 79 | * This kernel routine installs the RTEMS handler for the |
---|
| 80 | * specified vector. |
---|
| 81 | * |
---|
| 82 | * Input parameters: |
---|
| 83 | * vector - interrupt vector number |
---|
| 84 | * new_handler - replacement ISR for this vector number |
---|
| 85 | * old_handler - former ISR for this vector number |
---|
| 86 | * |
---|
| 87 | * Output parameters: NONE |
---|
| 88 | */ |
---|
| 89 | |
---|
| 90 | void _CPU_ISR_install_vector( |
---|
| 91 | unsigned32 vector, |
---|
| 92 | proc_ptr new_handler, |
---|
| 93 | proc_ptr *old_handler |
---|
| 94 | ) |
---|
| 95 | { |
---|
[637df35] | 96 | proc_ptr ignored; |
---|
[ac7d5ef0] | 97 | |
---|
| 98 | *old_handler = _ISR_Vector_table[ vector ]; |
---|
| 99 | |
---|
[637df35] | 100 | _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored ); |
---|
| 101 | |
---|
[ac7d5ef0] | 102 | _ISR_Vector_table[ vector ] = new_handler; |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | /*PAGE |
---|
| 107 | * |
---|
| 108 | * _CPU_Install_interrupt_stack |
---|
| 109 | */ |
---|
| 110 | |
---|
| 111 | void _CPU_Install_interrupt_stack( void ) |
---|
| 112 | { |
---|
| 113 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
| 114 | void *isp = _CPU_Interrupt_stack_high; |
---|
| 115 | |
---|
| 116 | asm volatile ( "movec %0,%%isp" : "=r" (isp) : "0" (isp) ); |
---|
| 117 | #else |
---|
| 118 | #warning "FIX ME... HOW DO I INSTALL THE INTERRUPT STACK!!!" |
---|
| 119 | #endif |
---|
| 120 | } |
---|
| 121 | |
---|
[9e86dd7d] | 122 | #if ( M68K_HAS_BFFFO != 1 ) |
---|
| 123 | /* |
---|
[38ffa0c] | 124 | * Returns table for duplication of the BFFFO instruction (16 bits only) |
---|
[9e86dd7d] | 125 | */ |
---|
[38ffa0c] | 126 | const unsigned char __BFFFOtable[256] = { |
---|
| 127 | 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
| 128 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
---|
| 129 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 130 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
| 131 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
| 132 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
| 133 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
| 134 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
| 135 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
| 136 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
| 137 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
| 138 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
| 139 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
| 140 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
| 141 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
| 142 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
[9e86dd7d] | 143 | }; |
---|
| 144 | #endif |
---|