1 | /* |
---|
2 | * Hitachi H8300 CPU Dependent Source |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1999. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #include <rtems/system.h> |
---|
15 | #include <rtems/score/isr.h> |
---|
16 | #include <rtems/score/wkspace.h> |
---|
17 | |
---|
18 | /* _CPU_Initialize |
---|
19 | * |
---|
20 | * This routine performs processor dependent initialization. |
---|
21 | * |
---|
22 | * INPUT PARAMETERS: NONE |
---|
23 | */ |
---|
24 | |
---|
25 | |
---|
26 | void _CPU_Initialize(void) |
---|
27 | { |
---|
28 | /* |
---|
29 | * If there is not an easy way to initialize the FP context |
---|
30 | * during Context_Initialize, then it is usually easier to |
---|
31 | * save an "uninitialized" FP context here and copy it to |
---|
32 | * the task's during Context_Initialize. |
---|
33 | */ |
---|
34 | |
---|
35 | /* FP context initialization support goes here */ |
---|
36 | } |
---|
37 | |
---|
38 | /*PAGE |
---|
39 | * |
---|
40 | * _CPU_ISR_Get_level |
---|
41 | * |
---|
42 | * This routine returns the current interrupt level. |
---|
43 | */ |
---|
44 | |
---|
45 | uint32_t _CPU_ISR_Get_level( void ) |
---|
46 | { |
---|
47 | unsigned int _ccr; |
---|
48 | |
---|
49 | #if defined(__H8300__) |
---|
50 | #warning "How do we get ccr on base CPU models" |
---|
51 | #else |
---|
52 | asm volatile ( "stc ccr, %0" : "=m" (_ccr) : ); |
---|
53 | #endif |
---|
54 | |
---|
55 | if ( _ccr & 0x80 ) |
---|
56 | return 1; |
---|
57 | return 0; |
---|
58 | } |
---|
59 | |
---|
60 | /*PAGE |
---|
61 | * |
---|
62 | * _CPU_ISR_install_raw_handler |
---|
63 | */ |
---|
64 | |
---|
65 | void _CPU_ISR_install_raw_handler( |
---|
66 | uint32_t vector, |
---|
67 | proc_ptr new_handler, |
---|
68 | proc_ptr *old_handler |
---|
69 | ) |
---|
70 | { |
---|
71 | /* |
---|
72 | * This is where we install the interrupt handler into the "raw" interrupt |
---|
73 | * table used by the CPU to dispatch interrupt handlers. |
---|
74 | * Use Debug level IRQ Handlers |
---|
75 | */ |
---|
76 | H8BD_Install_IRQ(vector,new_handler,old_handler); |
---|
77 | } |
---|
78 | |
---|
79 | /*PAGE |
---|
80 | * |
---|
81 | * _CPU_ISR_install_vector |
---|
82 | * |
---|
83 | * This kernel routine installs the RTEMS handler for the |
---|
84 | * specified vector. |
---|
85 | * |
---|
86 | * Input parameters: |
---|
87 | * vector - interrupt vector number |
---|
88 | * old_handler - former ISR for this vector number |
---|
89 | * new_handler - replacement ISR for this vector number |
---|
90 | * |
---|
91 | * Output parameters: NONE |
---|
92 | * |
---|
93 | */ |
---|
94 | |
---|
95 | void _CPU_ISR_install_vector( |
---|
96 | uint32_t vector, |
---|
97 | proc_ptr new_handler, |
---|
98 | proc_ptr *old_handler |
---|
99 | ) |
---|
100 | { |
---|
101 | *old_handler = _ISR_Vector_table[ vector ]; |
---|
102 | |
---|
103 | /* |
---|
104 | * If the interrupt vector table is a table of pointer to isr entry |
---|
105 | * points, then we need to install the appropriate RTEMS interrupt |
---|
106 | * handler for this vector number. |
---|
107 | */ |
---|
108 | |
---|
109 | _CPU_ISR_install_raw_handler( vector, new_handler, old_handler ); |
---|
110 | |
---|
111 | /* |
---|
112 | * We put the actual user ISR address in '_ISR_vector_table'. This will |
---|
113 | * be used by the _ISR_Handler so the user gets control. |
---|
114 | */ |
---|
115 | |
---|
116 | _ISR_Vector_table[ vector ] = new_handler; |
---|
117 | } |
---|
118 | |
---|
119 | /*PAGE |
---|
120 | * |
---|
121 | * _CPU_Install_interrupt_stack |
---|
122 | */ |
---|
123 | |
---|
124 | void _CPU_Install_interrupt_stack( void ) |
---|
125 | { |
---|
126 | } |
---|
127 | |
---|
128 | /*PAGE |
---|
129 | * |
---|
130 | * _CPU_Thread_Idle_body |
---|
131 | * |
---|
132 | * NOTES: |
---|
133 | * |
---|
134 | * 1. This is the same as the regular CPU independent algorithm. |
---|
135 | * |
---|
136 | * 2. If you implement this using a "halt", "idle", or "shutdown" |
---|
137 | * instruction, then don't forget to put it in an infinite loop. |
---|
138 | * |
---|
139 | * 3. Be warned. Some processors with onboard DMA have been known |
---|
140 | * to stop the DMA if the CPU were put in IDLE mode. This might |
---|
141 | * also be a problem with other on-chip peripherals. So use this |
---|
142 | * hook with caution. |
---|
143 | */ |
---|
144 | |
---|
145 | #if 0 |
---|
146 | void *_CPU_Thread_Idle_body( uintptr_t ignored ) |
---|
147 | { |
---|
148 | |
---|
149 | for( ; ; ) |
---|
150 | IDLE_Monitor(); |
---|
151 | /*asm(" sleep \n"); */ |
---|
152 | /* insert your "halt" instruction here */ ; |
---|
153 | } |
---|
154 | #endif |
---|