/* Blackfin Core Event Controller (CEC) model.
- Copyright (C) 2010-2011 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
This file is part of simulators.
#define mmr_base() offsetof(struct bfin_cec, evt_override)
#define mmr_offset(mmr) (offsetof(struct bfin_cec, mmr) - mmr_base())
-static const char * const mmr_names[] = {
+static const char * const mmr_names[] =
+{
"EVT_OVERRIDE", "IMASK", "IPEND", "ILAT", "IPRIO",
};
#define mmr_name(off) mmr_names[(off) / 4]
bu32 mmr_off;
bu32 value;
+ /* Invalid access mode is higher priority than missing register. */
+ if (!dv_bfin_mmr_require_32 (me, addr, nr_bytes, true))
+ return 0;
+
value = dv_load_4 (source);
mmr_off = addr - cec->base;
/* Read-only register. */
break;
case mmr_offset(ilat):
- dv_w1c_4 (&cec->ilat, value, 0);
+ dv_w1c_4 (&cec->ilat, value, 0xffee);
break;
case mmr_offset(iprio):
cec->iprio = (value & IVG_UNMASKABLE_B);
bu32 mmr_off;
bu32 *valuep;
+ /* Invalid access mode is higher priority than missing register. */
+ if (!dv_bfin_mmr_require_32 (me, addr, nr_bytes, false))
+ return 0;
+
mmr_off = addr - cec->base;
valuep = (void *)((unsigned long)cec + mmr_base() + mmr_off);
return nr_bytes;
}
-static const struct hw_port_descriptor bfin_cec_ports[] = {
+static const struct hw_port_descriptor bfin_cec_ports[] =
+{
{ "emu", IVG_EMU, 0, input_port, },
{ "rst", IVG_RST, 0, input_port, },
{ "nmi", IVG_NMI, 0, input_port, },
cec->ipend = IVG_RST_B | IVG_IRPTEN_B;
}
-const struct hw_descriptor dv_bfin_cec_descriptor[] = {
+const struct hw_descriptor dv_bfin_cec_descriptor[] =
+{
{"bfin_cec", bfin_cec_finish,},
{NULL, NULL},
};
-static const char * const excp_decoded[] = {
+static const char * const excp_decoded[] =
+{
[VEC_SYS ] = "Custom exception 0 (system call)",
[VEC_EXCPT01 ] = "Custom exception 1 (software breakpoint)",
[VEC_EXCPT02 ] = "Custom exception 2 (KGDB hook)",
else
SET_PCREG (cec_get_evt (cpu, ivg));
- TRACE_BRANCH (cpu, oldpc, PCREG, -1, "CEC changed PC (to EVT%i):", ivg);
+ BFIN_TRACE_BRANCH (cpu, oldpc, PCREG, -1, "CEC changed PC (to EVT%i):", ivg);
BFIN_CPU_STATE.did_jump = true;
/* Enable the global interrupt mask upon interrupt entry. */
{
bu32 oldpc = PCREG;
SET_PCREG (cec_read_ret_reg (cpu, ivg));
- TRACE_BRANCH (cpu, oldpc, PCREG, -1, "CEC changed PC");
+ BFIN_TRACE_BRANCH (cpu, oldpc, PCREG, -1, "CEC changed PC");
return;
}
if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
{
SET_PCREG (cec_read_ret_reg (cpu, ivg));
- TRACE_BRANCH (cpu, oldpc, PCREG, -1, "CEC changed PC");
+ BFIN_TRACE_BRANCH (cpu, oldpc, PCREG, -1, "CEC changed PC");
return;
}
/* XXX: Delayed clear shows bad PCREG register trace above ? */
SET_PCREG (newpc & ~1);
- TRACE_BRANCH (cpu, oldpc, PCREG, -1, "CEC changed PC (from EVT%i)", ivg);
+ BFIN_TRACE_BRANCH (cpu, oldpc, PCREG, -1, "CEC changed PC (from EVT%i)", ivg);
- /* Update ipend after the TRACE_BRANCH so dv-bfin_trace
+ /* Update ipend after the BFIN_TRACE_BRANCH so dv-bfin_trace
knows current CEC state wrt overflow. */
if (!snen)
cec->ipend &= ~(1 << ivg);