1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief M32C CPU Assembly File |
---|
5 | */ |
---|
6 | |
---|
7 | /* cpu_asm.c ===> cpu_asm.S or cpu_asm.s |
---|
8 | * |
---|
9 | * This file contains the basic algorithms for all assembly code used |
---|
10 | * in an specific CPU port of RTEMS. These algorithms must be implemented |
---|
11 | * in assembly language |
---|
12 | * |
---|
13 | * NOTE: This is supposed to be a .S or .s file NOT a C file. |
---|
14 | * |
---|
15 | * M32C does not yet have interrupt support. When this functionality |
---|
16 | * is written, this file should become obsolete. |
---|
17 | * |
---|
18 | * COPYRIGHT (c) 1989-2008. |
---|
19 | * On-Line Applications Research Corporation (OAR). |
---|
20 | * |
---|
21 | * The license and distribution terms for this file may be |
---|
22 | * found in the file LICENSE in this distribution or at |
---|
23 | * http://www.rtems.org/license/LICENSE. |
---|
24 | */ |
---|
25 | |
---|
26 | /* |
---|
27 | * This is supposed to be an assembly file. This means that system.h |
---|
28 | * and cpu.h should not be included in a "real" cpu_asm file. An |
---|
29 | * implementation in assembly should include "cpu_asm.h> |
---|
30 | */ |
---|
31 | |
---|
32 | #ifdef HAVE_CONFIG_H |
---|
33 | #include "config.h" |
---|
34 | #endif |
---|
35 | |
---|
36 | #include <rtems/system.h> |
---|
37 | #include <rtems/score/cpu.h> |
---|
38 | |
---|
39 | void _ISR_Handler(void); |
---|
40 | |
---|
41 | /* void __ISR_Handler() |
---|
42 | * |
---|
43 | * This routine provides the RTEMS interrupt management. |
---|
44 | * |
---|
45 | * M32C Specific Information: |
---|
46 | * |
---|
47 | * Interrupts are not currently supported. |
---|
48 | */ |
---|
49 | void _ISR_Handler(void) |
---|
50 | { |
---|
51 | /* |
---|
52 | * This discussion ignores a lot of the ugly details in a real |
---|
53 | * implementation such as saving enough registers/state to be |
---|
54 | * able to do something real. Keep in mind that the goal is |
---|
55 | * to invoke a user's ISR handler which is written in C and |
---|
56 | * uses a certain set of registers. |
---|
57 | * |
---|
58 | * Also note that the exact order is to a large extent flexible. |
---|
59 | * Hardware will dictate a sequence for a certain subset of |
---|
60 | * _ISR_Handler while requirements for setting |
---|
61 | */ |
---|
62 | |
---|
63 | /* |
---|
64 | * At entry to "common" _ISR_Handler, the vector number must be |
---|
65 | * available. On some CPUs the hardware puts either the vector |
---|
66 | * number or the offset into the vector table for this ISR in a |
---|
67 | * known place. If the hardware does not give us this information, |
---|
68 | * then the assembly portion of RTEMS for this port will contain |
---|
69 | * a set of distinct interrupt entry points which somehow place |
---|
70 | * the vector number in a known place (which is safe if another |
---|
71 | * interrupt nests this one) and branches to _ISR_Handler. |
---|
72 | * |
---|
73 | * save some or all context on stack |
---|
74 | * may need to save some special interrupt information for exit |
---|
75 | * |
---|
76 | * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE ) |
---|
77 | * if ( _ISR_Nest_level == 0 ) |
---|
78 | * switch to software interrupt stack |
---|
79 | * #endif |
---|
80 | * |
---|
81 | * _ISR_Nest_level++; |
---|
82 | * |
---|
83 | * _Thread_Dispatch_disable_level++; |
---|
84 | * |
---|
85 | * (*_ISR_Vector_table[ vector ])( vector ); |
---|
86 | * |
---|
87 | * _Thread_Dispatch_disable_level--; |
---|
88 | * |
---|
89 | * --_ISR_Nest_level; |
---|
90 | * |
---|
91 | * if ( _ISR_Nest_level ) |
---|
92 | * goto the label "exit interrupt (simple case)" |
---|
93 | * |
---|
94 | * if ( _Thread_Dispatch_disable_level ) |
---|
95 | * goto the label "exit interrupt (simple case)" |
---|
96 | * |
---|
97 | * if ( _Thread_Dispatch_necessary ) { |
---|
98 | * call _Thread_Dispatch() or prepare to return to _ISR_Dispatch |
---|
99 | * prepare to get out of interrupt |
---|
100 | * return from interrupt (maybe to _ISR_Dispatch) |
---|
101 | * |
---|
102 | * LABEL "exit interrupt (simple case): |
---|
103 | * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE ) |
---|
104 | * if outermost interrupt |
---|
105 | * restore stack |
---|
106 | * #endif |
---|
107 | * prepare to get out of interrupt |
---|
108 | * return from interrupt |
---|
109 | */ |
---|
110 | } |
---|