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