1 | /* |
---|
2 | * Motorola MC68xxx Dependent Source |
---|
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> |
---|
16 | #include <rtems/fatal.h> |
---|
17 | #include <rtems/core/isr.h> |
---|
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 - entry pointer to thread dispatcher |
---|
26 | * |
---|
27 | * OUTPUT PARAMETERS: NONE |
---|
28 | */ |
---|
29 | |
---|
30 | void _CPU_Initialize( |
---|
31 | rtems_cpu_table *cpu_table, |
---|
32 | void (*thread_dispatch) /* ignored on this CPU */ |
---|
33 | ) |
---|
34 | { |
---|
35 | _CPU_Table = *cpu_table; |
---|
36 | } |
---|
37 | |
---|
38 | /*PAGE |
---|
39 | * |
---|
40 | * _CPU_ISR_Get_level |
---|
41 | */ |
---|
42 | |
---|
43 | unsigned32 _CPU_ISR_Get_level( void ) |
---|
44 | { |
---|
45 | unsigned32 level; |
---|
46 | |
---|
47 | m68k_get_interrupt_level( level ); |
---|
48 | |
---|
49 | return level; |
---|
50 | } |
---|
51 | |
---|
52 | /*PAGE |
---|
53 | * |
---|
54 | * _CPU_ISR_install_raw_handler |
---|
55 | */ |
---|
56 | |
---|
57 | void _CPU_ISR_install_raw_handler( |
---|
58 | unsigned32 vector, |
---|
59 | proc_ptr new_handler, |
---|
60 | proc_ptr *old_handler |
---|
61 | ) |
---|
62 | { |
---|
63 | proc_ptr *interrupt_table = NULL; |
---|
64 | |
---|
65 | m68k_get_vbr( interrupt_table ); |
---|
66 | |
---|
67 | #if ( M68K_HAS_VBR == 1) |
---|
68 | *old_handler = interrupt_table[ vector ]; |
---|
69 | interrupt_table[ vector ] = new_handler; |
---|
70 | #else |
---|
71 | *old_handler = *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10); |
---|
72 | *(proc_ptr *)( (int)interrupt_table+ (int)vector*6-10) = new_handler; |
---|
73 | #endif /* M68K_HAS_VBR */ |
---|
74 | } |
---|
75 | |
---|
76 | /*PAGE |
---|
77 | * |
---|
78 | * _CPU_ISR_install_vector |
---|
79 | * |
---|
80 | * This kernel routine installs the RTEMS handler for the |
---|
81 | * specified vector. |
---|
82 | * |
---|
83 | * Input parameters: |
---|
84 | * vector - interrupt vector number |
---|
85 | * new_handler - replacement ISR for this vector number |
---|
86 | * old_handler - former ISR for this vector number |
---|
87 | * |
---|
88 | * Output parameters: NONE |
---|
89 | */ |
---|
90 | |
---|
91 | void _CPU_ISR_install_vector( |
---|
92 | unsigned32 vector, |
---|
93 | proc_ptr new_handler, |
---|
94 | proc_ptr *old_handler |
---|
95 | ) |
---|
96 | { |
---|
97 | proc_ptr ignored; |
---|
98 | |
---|
99 | *old_handler = _ISR_Vector_table[ vector ]; |
---|
100 | |
---|
101 | _CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored ); |
---|
102 | |
---|
103 | _ISR_Vector_table[ vector ] = new_handler; |
---|
104 | } |
---|
105 | |
---|
106 | |
---|
107 | /*PAGE |
---|
108 | * |
---|
109 | * _CPU_Install_interrupt_stack |
---|
110 | */ |
---|
111 | |
---|
112 | void _CPU_Install_interrupt_stack( void ) |
---|
113 | { |
---|
114 | #if ( M68K_HAS_SEPARATE_STACKS == 1 ) |
---|
115 | void *isp = _CPU_Interrupt_stack_high; |
---|
116 | |
---|
117 | asm volatile ( "movec %0,%%isp" : "=r" (isp) : "0" (isp) ); |
---|
118 | #else |
---|
119 | #warning "FIX ME... HOW DO I INSTALL THE INTERRUPT STACK!!!" |
---|
120 | #endif |
---|
121 | } |
---|
122 | |
---|
123 | #if ( M68K_HAS_BFFFO != 1 ) |
---|
124 | /* |
---|
125 | * Returns table for duplication of the BFFFO instruction (16 bits only) |
---|
126 | */ |
---|
127 | const unsigned char __BFFFOtable[256] = { |
---|
128 | 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
129 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
---|
130 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
131 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
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 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
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, |
---|
143 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
144 | }; |
---|
145 | #endif |
---|