[0aee2be5] | 1 | /* |
---|
| 2 | * raw_execption.h |
---|
| 3 | * |
---|
| 4 | * This file contains implementation of C function to |
---|
[8430205] | 5 | * Instantiate mpc5xx primary exception entries. |
---|
| 6 | * More detailled information can be found on the Motorola |
---|
| 7 | * site and more precisely in the following book: |
---|
[0aee2be5] | 8 | * |
---|
[8430205] | 9 | * MPC555/MPC556 User's Manual |
---|
| 10 | * Motorola REF : MPC555UM/D Rev. 3, 2000 October 15 |
---|
[0aee2be5] | 11 | * |
---|
| 12 | * |
---|
[8430205] | 13 | * MPC5xx port sponsored by Defence Research and Development Canada - Suffield |
---|
| 14 | * Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca) |
---|
| 15 | * |
---|
| 16 | * Derived from libcpu/powerpc/mpc8xx/exceptions/raw_exception.h: |
---|
| 17 | * |
---|
| 18 | * Copyright (C) 1999 Eric Valette (valette@crf.canon.fr) |
---|
| 19 | * Canon Centre Recherche France. |
---|
[0aee2be5] | 20 | * |
---|
| 21 | * The license and distribution terms for this file may be |
---|
[e71a3a84] | 22 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 23 | * http://www.rtems.org/license/LICENSE. |
---|
[0aee2be5] | 24 | */ |
---|
| 25 | |
---|
[a859df85] | 26 | #ifndef _LIBCPU_RAW_EXCEPTION_H |
---|
| 27 | #define _LIBCPU_RAW_EXCEPTION_H |
---|
[0aee2be5] | 28 | |
---|
[8430205] | 29 | #include <libcpu/vectors.h> |
---|
| 30 | |
---|
[0aee2be5] | 31 | /* |
---|
[8430205] | 32 | * Exception Vectors as defined in the MPC555 User's Manual |
---|
[0aee2be5] | 33 | */ |
---|
| 34 | |
---|
[8430205] | 35 | #define ASM_RESET_VECTOR 0x01 |
---|
| 36 | #define ASM_MACH_VECTOR 0x02 |
---|
[0aee2be5] | 37 | |
---|
[8430205] | 38 | #define ASM_EXT_VECTOR 0x05 |
---|
| 39 | #define ASM_ALIGN_VECTOR 0x06 |
---|
| 40 | #define ASM_PROG_VECTOR 0x07 |
---|
| 41 | #define ASM_FLOAT_VECTOR 0x08 |
---|
| 42 | #define ASM_DEC_VECTOR 0x09 |
---|
[0aee2be5] | 43 | |
---|
[8430205] | 44 | #define ASM_SYS_VECTOR 0x0C |
---|
| 45 | #define ASM_TRACE_VECTOR 0x0D |
---|
| 46 | #define ASM_FLOATASSIST_VECTOR 0x0E |
---|
[0aee2be5] | 47 | |
---|
[8430205] | 48 | #define ASM_SOFTEMUL_VECTOR 0x10 |
---|
[0aee2be5] | 49 | |
---|
[8430205] | 50 | #define ASM_IPROT_VECTOR 0x13 |
---|
| 51 | #define ASM_DPROT_VECTOR 0x14 |
---|
[0aee2be5] | 52 | |
---|
[8430205] | 53 | #define ASM_DBREAK_VECTOR 0x1C |
---|
| 54 | #define ASM_IBREAK_VECTOR 0x1D |
---|
| 55 | #define ASM_MEBREAK_VECTOR 0x1E |
---|
| 56 | #define ASM_NMEBREAK_VECTOR 0x1F |
---|
[0aee2be5] | 57 | |
---|
[8430205] | 58 | #define LAST_VALID_EXC ASM_NMEBREAK_VECTOR |
---|
[0aee2be5] | 59 | |
---|
| 60 | #ifndef ASM |
---|
| 61 | |
---|
| 62 | /* |
---|
[359e537] | 63 | * Type definition for raw exceptions. |
---|
[0aee2be5] | 64 | */ |
---|
| 65 | |
---|
| 66 | typedef unsigned char rtems_vector; |
---|
| 67 | struct __rtems_raw_except_connect_data__; |
---|
| 68 | typedef unsigned char rtems_raw_except_hdl_size; |
---|
| 69 | |
---|
| 70 | typedef struct { |
---|
| 71 | rtems_vector vector; |
---|
[8430205] | 72 | rtems_exception_handler_t* raw_hdl; |
---|
[0aee2be5] | 73 | }rtems_raw_except_hdl; |
---|
[359e537] | 74 | |
---|
[0aee2be5] | 75 | typedef void (*rtems_raw_except_enable) (const struct __rtems_raw_except_connect_data__*); |
---|
| 76 | typedef void (*rtems_raw_except_disable) (const struct __rtems_raw_except_connect_data__*); |
---|
| 77 | typedef int (*rtems_raw_except_is_enabled) (const struct __rtems_raw_except_connect_data__*); |
---|
| 78 | |
---|
| 79 | typedef struct __rtems_raw_except_connect_data__{ |
---|
| 80 | /* |
---|
| 81 | * Exception vector (As defined in the manual) |
---|
| 82 | */ |
---|
| 83 | rtems_vector exceptIndex; |
---|
| 84 | /* |
---|
| 85 | * Exception raw handler. See comment on handler properties below in function prototype. |
---|
| 86 | */ |
---|
| 87 | rtems_raw_except_hdl hdl; |
---|
| 88 | /* |
---|
| 89 | * function for enabling raw exceptions. In order to be consistent |
---|
| 90 | * with the fact that the raw connexion can defined in the |
---|
| 91 | * libcpu library, this library should have no knowledge of |
---|
| 92 | * board specific hardware to manage exceptions and thus the |
---|
| 93 | * "on" routine must enable the except at processor level only. |
---|
[359e537] | 94 | * |
---|
[0aee2be5] | 95 | */ |
---|
[359e537] | 96 | rtems_raw_except_enable on; |
---|
[0aee2be5] | 97 | /* |
---|
| 98 | * function for disabling raw exceptions. In order to be consistent |
---|
| 99 | * with the fact that the raw connexion can defined in the |
---|
| 100 | * libcpu library, this library should have no knowledge of |
---|
| 101 | * board specific hardware to manage exceptions and thus the |
---|
| 102 | * "on" routine must disable the except both at device and PIC level. |
---|
[359e537] | 103 | * |
---|
[0aee2be5] | 104 | */ |
---|
| 105 | rtems_raw_except_disable off; |
---|
| 106 | /* |
---|
| 107 | * function enabling to know what exception may currently occur |
---|
| 108 | */ |
---|
| 109 | rtems_raw_except_is_enabled isOn; |
---|
| 110 | }rtems_raw_except_connect_data; |
---|
| 111 | |
---|
| 112 | typedef struct { |
---|
| 113 | /* |
---|
| 114 | * size of all the table fields (*Tbl) described below. |
---|
| 115 | */ |
---|
| 116 | unsigned int exceptSize; |
---|
| 117 | /* |
---|
| 118 | * Default handler used when disconnecting exceptions. |
---|
| 119 | */ |
---|
| 120 | rtems_raw_except_connect_data defaultRawEntry; |
---|
| 121 | /* |
---|
| 122 | * Table containing initials/current value. |
---|
| 123 | */ |
---|
| 124 | rtems_raw_except_connect_data* rawExceptHdlTbl; |
---|
| 125 | }rtems_raw_except_global_settings; |
---|
| 126 | |
---|
| 127 | /* |
---|
| 128 | * C callable function enabling to set up one raw idt entry |
---|
| 129 | */ |
---|
| 130 | extern int mpc5xx_set_exception (const rtems_raw_except_connect_data*); |
---|
| 131 | |
---|
| 132 | /* |
---|
| 133 | * C callable function enabling to get one current raw idt entry |
---|
| 134 | */ |
---|
| 135 | extern int mpc5xx_get_current_exception (rtems_raw_except_connect_data*); |
---|
| 136 | |
---|
| 137 | /* |
---|
| 138 | * C callable function enabling to remove one current raw idt entry |
---|
| 139 | */ |
---|
| 140 | extern int mpc5xx_delete_exception (const rtems_raw_except_connect_data*); |
---|
| 141 | |
---|
| 142 | /* |
---|
| 143 | * C callable function enabling to check if vector is valid |
---|
| 144 | */ |
---|
| 145 | extern int mpc5xx_vector_is_valid(rtems_vector vector); |
---|
| 146 | |
---|
| 147 | inline static void* mpc5xx_get_vector_addr(rtems_vector vector) |
---|
| 148 | { |
---|
| 149 | return ((void*) (((unsigned) vector) << 8)); |
---|
| 150 | } |
---|
| 151 | /* |
---|
| 152 | * Exception global init. |
---|
| 153 | */ |
---|
| 154 | extern int mpc5xx_init_exceptions (rtems_raw_except_global_settings* config); |
---|
| 155 | extern int mpc5xx_get_exception_config (rtems_raw_except_global_settings** config); |
---|
| 156 | |
---|
| 157 | # endif /* ASM */ |
---|
| 158 | |
---|
[8430205] | 159 | #define SIZEOF_ |
---|
| 160 | |
---|
[0aee2be5] | 161 | #endif |
---|