Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:53

0001 /*
0002  * raw_execption.h
0003  *
0004  *      This file contains implementation of C function to
0005  *          Instantiate mpc5xx primary exception entries.
0006  *      More detailled information can be found on the Motorola
0007  *      site and more precisely in the following book:
0008  *
0009  *      MPC555/MPC556 User's Manual
0010  *      Motorola REF : MPC555UM/D Rev. 3, 2000 October 15
0011  *
0012  *
0013  *  MPC5xx port sponsored by Defence Research and Development Canada - Suffield
0014  *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
0015  *
0016  *  Derived from libcpu/powerpc/mpc8xx/exceptions/raw_exception.h:
0017  *
0018  *  Copyright (C) 1999  Eric Valette (valette@crf.canon.fr)
0019  *                     Canon Centre Recherche France.
0020  *
0021  *  The license and distribution terms for this file may be
0022  *  found in the file LICENSE in this distribution or at
0023  *  http://www.rtems.org/license/LICENSE.
0024  */
0025 
0026 #ifndef _LIBCPU_RAW_EXCEPTION_H
0027 #define _LIBCPU_RAW_EXCEPTION_H
0028 
0029 #include <libcpu/vectors.h>
0030 
0031 /*
0032  * Exception Vectors as defined in the MPC555 User's Manual
0033  */
0034 
0035 #define ASM_RESET_VECTOR    0x01
0036 #define ASM_MACH_VECTOR     0x02
0037 
0038 #define ASM_EXT_VECTOR      0x05
0039 #define ASM_ALIGN_VECTOR    0x06
0040 #define ASM_PROG_VECTOR     0x07
0041 #define ASM_FLOAT_VECTOR    0x08
0042 #define ASM_DEC_VECTOR      0x09
0043 
0044 #define ASM_SYS_VECTOR      0x0C
0045 #define ASM_TRACE_VECTOR    0x0D
0046 #define ASM_FLOATASSIST_VECTOR  0x0E
0047 
0048 #define ASM_SOFTEMUL_VECTOR 0x10
0049 
0050 #define ASM_IPROT_VECTOR    0x13
0051 #define ASM_DPROT_VECTOR    0x14
0052 
0053 #define ASM_DBREAK_VECTOR   0x1C
0054 #define ASM_IBREAK_VECTOR   0x1D
0055 #define ASM_MEBREAK_VECTOR  0x1E
0056 #define ASM_NMEBREAK_VECTOR 0x1F
0057 
0058 #ifndef ASM
0059 
0060 /*
0061  * Type definition for raw exceptions.
0062  */
0063 
0064 typedef unsigned char  rtems_vector;
0065 struct  __rtems_raw_except_connect_data__;
0066 typedef unsigned char   rtems_raw_except_hdl_size;
0067 
0068 typedef struct {
0069   rtems_vector          vector;
0070   rtems_exception_handler_t*    raw_hdl;
0071 }rtems_raw_except_hdl;
0072 
0073 typedef void (*rtems_raw_except_enable)     (const struct __rtems_raw_except_connect_data__*);
0074 typedef void (*rtems_raw_except_disable)    (const struct __rtems_raw_except_connect_data__*);
0075 typedef int  (*rtems_raw_except_is_enabled) (const struct __rtems_raw_except_connect_data__*);
0076 
0077 typedef struct __rtems_raw_except_connect_data__{
0078  /*
0079   * Exception vector (As defined in the manual)
0080   */
0081   rtems_vector          exceptIndex;
0082   /*
0083    * Exception raw handler. See comment on handler properties below in function prototype.
0084    */
0085   rtems_raw_except_hdl      hdl;
0086   /*
0087    * function for enabling raw exceptions. In order to be consistent
0088    * with the fact that the raw connexion can defined in the
0089    * libcpu library, this library should have no knowledge of
0090    * board specific hardware to manage exceptions and thus the
0091    * "on" routine must enable the except at processor level only.
0092    *
0093    */
0094     rtems_raw_except_enable on;
0095   /*
0096    * function for disabling raw exceptions. In order to be consistent
0097    * with the fact that the raw connexion can defined in the
0098    * libcpu library, this library should have no knowledge of
0099    * board specific hardware to manage exceptions and thus the
0100    * "on" routine must disable the except both at device and PIC level.
0101    *
0102    */
0103   rtems_raw_except_disable  off;
0104   /*
0105    * function enabling to know what exception may currently occur
0106    */
0107   rtems_raw_except_is_enabled   isOn;
0108 }rtems_raw_except_connect_data;
0109 
0110 typedef struct {
0111   /*
0112    * size of all the table fields (*Tbl) described below.
0113    */
0114   unsigned int              exceptSize;
0115   /*
0116    * Default handler used when disconnecting exceptions.
0117    */
0118   rtems_raw_except_connect_data     defaultRawEntry;
0119   /*
0120    * Table containing initials/current value.
0121    */
0122   rtems_raw_except_connect_data*    rawExceptHdlTbl;
0123 }rtems_raw_except_global_settings;
0124 
0125 /*
0126  * C callable function enabling to set up one raw idt entry
0127  */
0128 extern int mpc5xx_set_exception (const rtems_raw_except_connect_data*);
0129 
0130 /*
0131  * C callable function enabling to get one current raw idt entry
0132  */
0133 extern int mpc5xx_get_current_exception (rtems_raw_except_connect_data*);
0134 
0135 /*
0136  * C callable function enabling to remove one current raw idt entry
0137  */
0138 extern int mpc5xx_delete_exception (const rtems_raw_except_connect_data*);
0139 
0140 /*
0141  * C callable function enabling to check if vector is valid
0142  */
0143 extern int mpc5xx_vector_is_valid(rtems_vector vector);
0144 
0145 inline static  void* mpc5xx_get_vector_addr(rtems_vector vector)
0146 {
0147   return ((void*)  (((unsigned) vector) << 8));
0148 }
0149 /*
0150  * Exception global init.
0151  */
0152 extern int mpc5xx_init_exceptions (rtems_raw_except_global_settings* config);
0153 extern int mpc5xx_get_exception_config (rtems_raw_except_global_settings** config);
0154 
0155 # endif /* ASM */
0156 
0157 #define SIZEOF_
0158 
0159 #endif