1 /* Blackfin Core Event Controller (CEC) model. 2 3 Copyright (C) 2010-2011 Free Software Foundation, Inc. 4 Contributed by Analog Devices, Inc. 5 6 This file is part of simulators. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 3 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 21 #ifndef DV_BFIN_CEC_H 22 #define DV_BFIN_CEC_H 23 24 #include "sim-main.h" 25 26 #define BFIN_COREMMR_CEC_BASE 0xFFE02100 27 #define BFIN_COREMMR_CEC_SIZE (4 * 5) 28 29 /* 0xFFE02100 ... 0xFFE02110 */ 30 #define BFIN_COREMMR_EVT_OVERRIDE (BFIN_COREMMR_CEC_BASE + (4 * 0)) 31 #define BFIN_COREMMR_IMASK (BFIN_COREMMR_CEC_BASE + (4 * 1)) 32 #define BFIN_COREMMR_IPEND (BFIN_COREMMR_CEC_BASE + (4 * 2)) 33 #define BFIN_COREMMR_ILAT (BFIN_COREMMR_CEC_BASE + (4 * 3)) 34 #define BFIN_COREMMR_IPRIO (BFIN_COREMMR_CEC_BASE + (4 * 4)) 35 36 #define IVG_EMU 0 37 #define IVG_RST 1 38 #define IVG_NMI 2 39 #define IVG_EVX 3 40 #define IVG_IRPTEN 4 /* Global is Reserved */ 41 #define IVG_IVHW 5 42 #define IVG_IVTMR 6 43 #define IVG7 7 44 #define IVG8 8 45 #define IVG9 9 46 #define IVG10 10 47 #define IVG11 11 48 #define IVG12 12 49 #define IVG13 13 50 #define IVG14 14 51 #define IVG15 15 52 #define IVG_USER 16 /* Not real; for internal use */ 53 54 #define IVG_EMU_B (1 << IVG_EMU) 55 #define IVG_RST_B (1 << IVG_RST) 56 #define IVG_NMI_B (1 << IVG_NMI) 57 #define IVG_EVX_B (1 << IVG_EVX) 58 #define IVG_IRPTEN_B (1 << IVG_IRPTEN) 59 #define IVG_IVHW_B (1 << IVG_IVHW) 60 #define IVG_IVTMR_B (1 << IVG_IVTMR) 61 #define IVG7_B (1 << IVG7) 62 #define IVG8_B (1 << IVG8) 63 #define IVG9_B (1 << IVG9) 64 #define IVG10_B (1 << IVG10) 65 #define IVG11_B (1 << IVG11) 66 #define IVG12_B (1 << IVG12) 67 #define IVG13_B (1 << IVG13) 68 #define IVG14_B (1 << IVG14) 69 #define IVG15_B (1 << IVG15) 70 #define IVG_UNMASKABLE_B \ 71 (IVG_EMU_B | IVG_RST_B | IVG_NMI_B | IVG_EVX_B | IVG_IRPTEN_B) 72 #define IVG_MASKABLE_B \ 73 (IVG_IVHW_B | IVG_IVTMR_B | IVG7_B | IVG8_B | IVG9_B | \ 74 IVG10_B | IVG11_B | IVG12_B | IVG13_B | IVG14_B | IVG15_B) 75 76 #define VEC_SYS 0x0 77 #define VEC_EXCPT01 0x1 78 #define VEC_EXCPT02 0x2 79 #define VEC_EXCPT03 0x3 80 #define VEC_EXCPT04 0x4 81 #define VEC_EXCPT05 0x5 82 #define VEC_EXCPT06 0x6 83 #define VEC_EXCPT07 0x7 84 #define VEC_EXCPT08 0x8 85 #define VEC_EXCPT09 0x9 86 #define VEC_EXCPT10 0xa 87 #define VEC_EXCPT11 0xb 88 #define VEC_EXCPT12 0xc 89 #define VEC_EXCPT13 0xd 90 #define VEC_EXCPT14 0xe 91 #define VEC_EXCPT15 0xf 92 #define VEC_STEP 0x10 /* single step */ 93 #define VEC_OVFLOW 0x11 /* trace buffer overflow */ 94 #define VEC_UNDEF_I 0x21 /* undefined instruction */ 95 #define VEC_ILGAL_I 0x22 /* illegal instruction combo (multi-issue) */ 96 #define VEC_CPLB_VL 0x23 /* DCPLB protection violation */ 97 #define VEC_MISALI_D 0x24 /* unaligned data access */ 98 #define VEC_UNCOV 0x25 /* unrecoverable event (double fault) */ 99 #define VEC_CPLB_M 0x26 /* DCPLB miss */ 100 #define VEC_CPLB_MHIT 0x27 /* multiple DCPLB hit */ 101 #define VEC_WATCH 0x28 /* watchpoint match */ 102 #define VEC_ISTRU_VL 0x29 /* ADSP-BF535 only */ 103 #define VEC_MISALI_I 0x2a /* unaligned instruction access */ 104 #define VEC_CPLB_I_VL 0x2b /* ICPLB protection violation */ 105 #define VEC_CPLB_I_M 0x2c /* ICPLB miss */ 106 #define VEC_CPLB_I_MHIT 0x2d /* multiple ICPLB hit */ 107 #define VEC_ILL_RES 0x2e /* illegal supervisor resource */ 108 /* 109 * The hardware reserves 63+ for future use - we use it to tell our 110 * normal exception handling code we have a hardware error 111 */ 112 #define VEC_HWERR 63 113 #define VEC_SIM_BASE 64 114 #define VEC_SIM_HLT (VEC_SIM_BASE + 1) 115 #define VEC_SIM_ABORT (VEC_SIM_BASE + 2) 116 #define VEC_SIM_TRAP (VEC_SIM_BASE + 3) 117 #define VEC_SIM_DBGA (VEC_SIM_BASE + 4) 118 extern void cec_exception (SIM_CPU *, int vec_excp); 119 120 #define HWERR_SYSTEM_MMR 0x02 121 #define HWERR_EXTERN_ADDR 0x03 122 #define HWERR_PERF_FLOW 0x12 123 #define HWERR_RAISE_5 0x18 124 extern void cec_hwerr (SIM_CPU *, int hwerr); 125 extern void cec_latch (SIM_CPU *, int ivg); 126 extern void cec_return (SIM_CPU *, int ivg); 127 128 extern int cec_get_ivg (SIM_CPU *); 129 extern bool cec_is_supervisor_mode (SIM_CPU *); 130 extern bool cec_is_user_mode (SIM_CPU *); 131 extern void cec_require_supervisor (SIM_CPU *); 132 133 extern bu32 cec_cli (SIM_CPU *); 134 extern void cec_sti (SIM_CPU *, bu32 ints); 135 136 extern void cec_push_reti (SIM_CPU *); 137 extern void cec_pop_reti (SIM_CPU *); 138 139 #endif 140