1 | /* |
---|
2 | * raw_execption.h |
---|
3 | * |
---|
4 | * This file contains implementation of C function to |
---|
5 | * Instanciate 8xx ppc primary exception entries. |
---|
6 | * More detailled information can be found on motorola |
---|
7 | * site and more precisely in the following book : |
---|
8 | * |
---|
9 | * MPC860 |
---|
10 | * Risc Microporcessor User's Manual |
---|
11 | * Motorola REF : MPC860UM/AD 07/98 Rev .1 |
---|
12 | * |
---|
13 | * Copyright (C) 1999 Eric Valette (valette@crf.canon.fr) |
---|
14 | * Canon Centre Recherche France. |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in found in the file LICENSE in this distribution or at |
---|
18 | * http://www.rtems.com/license/LICENSE. |
---|
19 | * |
---|
20 | * $Id$ |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef _LIBCPU_RAW_EXCEPTION_H |
---|
24 | #define _LIBCPU_RAW_EXCEPTION_H |
---|
25 | |
---|
26 | /* |
---|
27 | * Exception Vectors as defined in the MCP750 manual |
---|
28 | */ |
---|
29 | |
---|
30 | #define ASM_RESET_VECTOR 0x01 |
---|
31 | #define ASM_MACH_VECTOR 0x02 |
---|
32 | #define ASM_PROT_VECTOR 0x03 |
---|
33 | #define ASM_ISI_VECTOR 0x04 |
---|
34 | #define ASM_EXT_VECTOR 0x05 |
---|
35 | #define ASM_ALIGN_VECTOR 0x06 |
---|
36 | #define ASM_PROG_VECTOR 0x07 |
---|
37 | #define ASM_FLOAT_VECTOR 0x08 |
---|
38 | #define ASM_DEC_VECTOR 0x09 |
---|
39 | |
---|
40 | #define ASM_SYS_VECTOR 0x0C |
---|
41 | #define ASM_TRACE_VECTOR 0x0D |
---|
42 | #define ASM_FLOATASSIST_VECTOR 0x0E |
---|
43 | |
---|
44 | #define ASM_SOFTEMUL_VECTOR 0x10 |
---|
45 | #define ASM_ITLBMISS_VECTOR 0x11 |
---|
46 | #define ASM_DTLBMISS_VECTOR 0x12 |
---|
47 | #define ASM_ITLBERROR_VECTOR 0x13 |
---|
48 | #define ASM_DTLBERROR_VECTOR 0x14 |
---|
49 | |
---|
50 | #define ASM_DBREAK_VECTOR 0x1C |
---|
51 | #define ASM_IBREAK_VECTOR 0x1D |
---|
52 | #define ASM_PERIFBREAK_VECTOR 0x1E |
---|
53 | #define ASM_DEVPORT_VECTOR 0x1F |
---|
54 | |
---|
55 | #define LAST_VALID_EXC ASM_DEVPORT_VECTOR |
---|
56 | |
---|
57 | /* |
---|
58 | * Vector offsets as defined in the MPC860 manual |
---|
59 | */ |
---|
60 | |
---|
61 | #define ASM_RESET_VECTOR_OFFSET (ASM_RESET_VECTOR << 8) |
---|
62 | #define ASM_MACH_VECTOR_OFFSET (ASM_MACH_VECTOR << 8) |
---|
63 | #define ASM_PROT_VECTOR_OFFSET (ASM_PROT_VECTOR << 8) |
---|
64 | #define ASM_ISI_VECTOR_OFFSET (ASM_ISI_VECTOR << 8) |
---|
65 | #define ASM_EXT_VECTOR_OFFSET (ASM_EXT_VECTOR << 8) |
---|
66 | #define ASM_ALIGN_VECTOR_OFFSET (ASM_ALIGN_VECTOR << 8) |
---|
67 | #define ASM_PROG_VECTOR_OFFSET (ASM_PROG_VECTOR << 8) |
---|
68 | #define ASM_FLOAT_VECTOR_OFFSET (ASM_FLOAT_VECTOR << 8) |
---|
69 | #define ASM_DEC_VECTOR_OFFSET (ASM_DEC_VECTOR << 8) |
---|
70 | |
---|
71 | #define ASM_SYS_VECTOR_OFFSET (ASM_SYS_VECTOR << 8) |
---|
72 | #define ASM_TRACE_VECTOR_OFFSET (ASM_TRACE_VECTOR << 8) |
---|
73 | #define ASM_FLOATASSIST_VECTOR_OFFSET (ASM_FLOATASSIST_VECTOR << 8) |
---|
74 | |
---|
75 | #define ASM_SOFTEMUL_VECTOR_OFFSET (ASM_SOFTEMUL_VECTOR << 8) |
---|
76 | #define ASM_ITLBMISS_VECTOR_OFFSET (ASM_ITLBMISS_VECTOR << 8) |
---|
77 | #define ASM_DTLBMISS_VECTOR_OFFSET (ASM_DTLBMISS_VECTOR << 8) |
---|
78 | #define ASM_ITLBERROR_VECTOR_OFFSET (ASM_ITLBERROR_VECTOR << 8) |
---|
79 | #define ASM_DTLBERROR_VECTOR_OFFSET (ASM_DTLBERROR_VECTOR << 8) |
---|
80 | |
---|
81 | #define ASM_DBREAK_VECTOR_OFFSET (ASM_DBREAK_VECTOR << 8) |
---|
82 | #define ASM_IBREAK_VECTOR_OFFSET (ASM_IBREAK_VECTOR << 8) |
---|
83 | #define ASM_PERIFBREAK_VECTOR_OFFSET (ASM_PERIFBREAK_VECTOR << 8) |
---|
84 | #define ASM_DEVPORT_VECTOR_OFFSET (ASM_DEVPORT_VECTOR_OFFSET << 8) |
---|
85 | |
---|
86 | #ifndef ASM |
---|
87 | |
---|
88 | /* |
---|
89 | * Type definition for raw exceptions. |
---|
90 | */ |
---|
91 | |
---|
92 | typedef unsigned char rtems_vector; |
---|
93 | struct __rtems_raw_except_connect_data__; |
---|
94 | typedef void (*rtems_raw_except_func) (void); |
---|
95 | typedef unsigned char rtems_raw_except_hdl_size; |
---|
96 | |
---|
97 | typedef struct { |
---|
98 | rtems_vector vector; |
---|
99 | rtems_raw_except_func raw_hdl; |
---|
100 | rtems_raw_except_hdl_size raw_hdl_size; |
---|
101 | }rtems_raw_except_hdl; |
---|
102 | |
---|
103 | typedef void (*rtems_raw_except_enable) (const struct __rtems_raw_except_connect_data__*); |
---|
104 | typedef void (*rtems_raw_except_disable) (const struct __rtems_raw_except_connect_data__*); |
---|
105 | typedef int (*rtems_raw_except_is_enabled) (const struct __rtems_raw_except_connect_data__*); |
---|
106 | |
---|
107 | typedef struct __rtems_raw_except_connect_data__{ |
---|
108 | /* |
---|
109 | * Exception vector (As defined in the manual) |
---|
110 | */ |
---|
111 | rtems_vector exceptIndex; |
---|
112 | /* |
---|
113 | * Exception raw handler. See comment on handler properties below in function prototype. |
---|
114 | */ |
---|
115 | rtems_raw_except_hdl hdl; |
---|
116 | /* |
---|
117 | * function for enabling raw exceptions. In order to be consistent |
---|
118 | * with the fact that the raw connexion can defined in the |
---|
119 | * libcpu library, this library should have no knowledge of |
---|
120 | * board specific hardware to manage exceptions and thus the |
---|
121 | * "on" routine must enable the except at processor level only. |
---|
122 | * |
---|
123 | */ |
---|
124 | rtems_raw_except_enable on; |
---|
125 | /* |
---|
126 | * function for disabling raw exceptions. In order to be consistent |
---|
127 | * with the fact that the raw connexion can defined in the |
---|
128 | * libcpu library, this library should have no knowledge of |
---|
129 | * board specific hardware to manage exceptions and thus the |
---|
130 | * "on" routine must disable the except both at device and PIC level. |
---|
131 | * |
---|
132 | */ |
---|
133 | rtems_raw_except_disable off; |
---|
134 | /* |
---|
135 | * function enabling to know what exception may currently occur |
---|
136 | */ |
---|
137 | rtems_raw_except_is_enabled isOn; |
---|
138 | }rtems_raw_except_connect_data; |
---|
139 | |
---|
140 | typedef struct { |
---|
141 | /* |
---|
142 | * size of all the table fields (*Tbl) described below. |
---|
143 | */ |
---|
144 | unsigned int exceptSize; |
---|
145 | /* |
---|
146 | * Default handler used when disconnecting exceptions. |
---|
147 | */ |
---|
148 | rtems_raw_except_connect_data defaultRawEntry; |
---|
149 | /* |
---|
150 | * Table containing initials/current value. |
---|
151 | */ |
---|
152 | rtems_raw_except_connect_data* rawExceptHdlTbl; |
---|
153 | }rtems_raw_except_global_settings; |
---|
154 | |
---|
155 | /* |
---|
156 | * C callable function enabling to set up one raw idt entry |
---|
157 | */ |
---|
158 | extern int mpc8xx_set_exception (const rtems_raw_except_connect_data*); |
---|
159 | |
---|
160 | /* |
---|
161 | * C callable function enabling to get one current raw idt entry |
---|
162 | */ |
---|
163 | extern int mpc8xx_get_current_exception (rtems_raw_except_connect_data*); |
---|
164 | |
---|
165 | /* |
---|
166 | * C callable function enabling to remove one current raw idt entry |
---|
167 | */ |
---|
168 | extern int mpc8xx_delete_exception (const rtems_raw_except_connect_data*); |
---|
169 | |
---|
170 | /* |
---|
171 | * C callable function enabling to check if vector is valid |
---|
172 | */ |
---|
173 | extern int mpc8xx_vector_is_valid(rtems_vector vector); |
---|
174 | |
---|
175 | inline static void* mpc8xx_get_vector_addr(rtems_vector vector) |
---|
176 | { |
---|
177 | return ((void*) (((unsigned) vector) << 8)); |
---|
178 | } |
---|
179 | /* |
---|
180 | * Exception global init. |
---|
181 | */ |
---|
182 | extern int mpc8xx_init_exceptions (rtems_raw_except_global_settings* config); |
---|
183 | extern int mpc8xx_get_exception_config (rtems_raw_except_global_settings** config); |
---|
184 | |
---|
185 | # endif /* ASM */ |
---|
186 | |
---|
187 | #endif |
---|