/* Blackfin Real Time Clock (RTC) model.
- Copyright (C) 2010-2011 Free Software Foundation, Inc.
+ Copyright (C) 2010-2016 Free Software Foundation, Inc.
Contributed by Analog Devices, Inc.
This file is part of simulators.
#define mmr_base() offsetof(struct bfin_rtc, stat)
#define mmr_offset(mmr) (offsetof(struct bfin_rtc, mmr) - mmr_base())
-static const char * const mmr_names[] = {
+static const char * const mmr_names[] =
+{
"RTC_STAT", "RTC_ICTL", "RTC_ISTAT", "RTC_SWCNT", "RTC_ALARM", "RTC_PREN",
};
#define mmr_name(off) mmr_names[(off) / 4]
bu32 *value32p;
void *valuep;
+ /* Invalid access mode is higher priority than missing register. */
+ if (!dv_bfin_mmr_require_16_32 (me, addr, nr_bytes, true))
+ return 0;
+
if (nr_bytes == 4)
value = dv_load_4 (source);
else
/* XXX: Ignore these since we are wired to host. */
break;
case mmr_offset(istat):
- dv_w1c_2 (value16p, value, 1 << 14);
+ dv_w1c_2 (value16p, value, ~(1 << 14));
break;
case mmr_offset(alarm):
break;
bu32 *value32p;
void *valuep;
+ /* Invalid access mode is higher priority than missing register. */
+ if (!dv_bfin_mmr_require_16_32 (me, addr, nr_bytes, false))
+ return 0;
+
mmr_off = addr - rtc->base;
valuep = (void *)((unsigned long)rtc + mmr_base() + mmr_off);
value16p = valuep;
return nr_bytes;
}
-static const struct hw_port_descriptor bfin_rtc_ports[] = {
+static const struct hw_port_descriptor bfin_rtc_ports[] =
+{
{ "rtc", 0, 0, output_port, },
{ NULL, 0, 0, 0, },
};
/* Initialize the RTC. */
}
-const struct hw_descriptor dv_bfin_rtc_descriptor[] = {
+const struct hw_descriptor dv_bfin_rtc_descriptor[] =
+{
{"bfin_rtc", bfin_rtc_finish,},
{NULL, NULL},
};