diff options
Diffstat (limited to 'src/devices/machine/bq48x2.cpp')
-rw-r--r-- | src/devices/machine/bq48x2.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/devices/machine/bq48x2.cpp b/src/devices/machine/bq48x2.cpp index 40bfde5a754..a4524367d3c 100644 --- a/src/devices/machine/bq48x2.cpp +++ b/src/devices/machine/bq48x2.cpp @@ -8,13 +8,13 @@ #include "emu.h" #include "bq48x2.h" -#define LOG_WARN (1U<<1) // Warnings -#define LOG_CLOCK (1U<<2) // Clock operation -#define LOG_REGW (1U<<3) // Register write -#define LOG_WATCHDOG (1U<<4) // Watchdog -#define LOG_SRAM (1U<<5) // SRAM +#define LOG_WARN (1U << 1) // Warnings +#define LOG_CLOCK (1U << 2) // Clock operation +#define LOG_REGW (1U << 3) // Register write +#define LOG_WATCHDOG (1U << 4) // Watchdog +#define LOG_SRAM (1U << 5) // SRAM -#define VERBOSE ( LOG_GENERAL | LOG_WARN ) +#define VERBOSE (LOG_GENERAL | LOG_WARN) #include "logmacro.h" // device type definition @@ -474,7 +474,7 @@ TIMER_CALLBACK_MEMBER(bq48x2_device::rtc_watchdog_cb) Indicates that there is an interrupt condition. Also used to drive the outgoing line. */ -READ_LINE_MEMBER(bq48x2_device::intrq_r) +int bq48x2_device::intrq_r() { bool alarm = (is_set(reg_interrupts, FLAG_AIE) && is_set(reg_flags, FLAG_AF)); bool period = (is_set(reg_interrupts, FLAG_PIE) && is_set(reg_flags, FLAG_PF)); @@ -507,19 +507,13 @@ int bq48x2_device::get_delay() void bq48x2_device::device_start() { - m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq48x2_device::rtc_clock_cb), this)); + m_clock_timer = timer_alloc(FUNC(bq48x2_device::rtc_clock_cb), this); // Periodic timer - m_periodic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq48x2_device::rtc_periodic_cb), this)); + m_periodic_timer = timer_alloc(FUNC(bq48x2_device::rtc_periodic_cb), this); // Watchdog timer - m_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(bq48x2_device::rtc_watchdog_cb), this)); - - // Interrupt line - m_interrupt_cb.resolve_safe(); - - // Reset output - m_resetout_cb.resolve_safe(); + m_watchdog_timer = timer_alloc(FUNC(bq48x2_device::rtc_watchdog_cb), this); m_sram = std::make_unique<u8 []>(m_memsize); @@ -541,18 +535,24 @@ void bq48x2_device::nvram_default() std::fill_n(m_sram.get(), m_memsize, 0); } -void bq48x2_device::nvram_read(emu_file &file) +bool bq48x2_device::nvram_read(util::read_stream &file) { - file.read(m_sram.get(), m_memsize); + auto const [err, actual] = util::read(file, m_sram.get(), m_memsize); + if (err || (actual != m_memsize)) + return false; transfer_to_access(); // Transfer the system time into the readable registers // Clear the saved flags set_register(reg_flags, 0xf8, true); + + return true; } -void bq48x2_device::nvram_write(emu_file &file) +bool bq48x2_device::nvram_write(util::write_stream &file) { transfer_to_access(); - file.write(m_sram.get(), m_memsize); + + auto const [err, actual] = util::write(file, m_sram.get(), m_memsize); + return !err; } |