diff options
Diffstat (limited to 'src/emu/machine/rp5c15.c')
-rw-r--r-- | src/emu/machine/rp5c15.c | 96 |
1 files changed, 29 insertions, 67 deletions
diff --git a/src/emu/machine/rp5c15.c b/src/emu/machine/rp5c15.c index 3da17c9c6be..714a7149da0 100644 --- a/src/emu/machine/rp5c15.c +++ b/src/emu/machine/rp5c15.c @@ -110,66 +110,7 @@ enum //************************************************************************** // devices -const device_type RP5C15 = rp5c15_device_config::static_alloc_device_config; - - - -//************************************************************************** -// DEVICE CONFIGURATION -//************************************************************************** - -//------------------------------------------------- -// rp5c15_device_config - constructor -//------------------------------------------------- - -rp5c15_device_config::rp5c15_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) - : device_config(mconfig, static_alloc_device_config, "RP5C15", tag, owner, clock), - device_config_rtc_interface(mconfig, *this) -{ -} - - -//------------------------------------------------- -// static_alloc_device_config - allocate a new -// configuration object -//------------------------------------------------- - -device_config *rp5c15_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) -{ - return global_alloc(rp5c15_device_config(mconfig, tag, owner, clock)); -} - - -//------------------------------------------------- -// alloc_device - allocate a new device object -//------------------------------------------------- - -device_t *rp5c15_device_config::alloc_device(running_machine &machine) const -{ - return auto_alloc(machine, rp5c15_device(machine, *this)); -} - - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void rp5c15_device_config::device_config_complete() -{ - // inherit a copy of the static data - const rp5c15_interface *intf = reinterpret_cast<const rp5c15_interface *>(static_config()); - if (intf != NULL) - *static_cast<rp5c15_interface *>(this) = *intf; - - // or initialize to defaults if none provided - else - { - memset(&m_out_alarm_func, 0, sizeof(m_out_alarm_func)); - memset(&m_out_clkout_func, 0, sizeof(m_out_clkout_func)); - } -} +const device_type RP5C15 = &device_creator<rp5c15_device>; @@ -351,28 +292,49 @@ inline void rp5c15_device::check_alarm() // rp5c15_device - constructor //------------------------------------------------- -rp5c15_device::rp5c15_device(running_machine &_machine, const rp5c15_device_config &config) - : device_t(_machine, config), - device_rtc_interface(_machine, config, *this), +rp5c15_device::rp5c15_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, RP5C15, "RP5C15", tag, owner, clock), + device_rtc_interface(mconfig, *this), m_alarm(1), m_alarm_on(1), m_1hz(1), m_16hz(1), - m_clkout(1), - m_config(config) + m_clkout(1) { } //------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void rp5c15_device::device_config_complete() +{ + // inherit a copy of the static data + const rp5c15_interface *intf = reinterpret_cast<const rp5c15_interface *>(static_config()); + if (intf != NULL) + *static_cast<rp5c15_interface *>(this) = *intf; + + // or initialize to defaults if none provided + else + { + memset(&m_out_alarm_cb, 0, sizeof(m_out_alarm_cb)); + memset(&m_out_clkout_cb, 0, sizeof(m_out_clkout_cb)); + } +} + + +//------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- void rp5c15_device::device_start() { // resolve callbacks - devcb_resolve_write_line(&m_out_alarm_func, &m_config.m_out_alarm_func, this); - devcb_resolve_write_line(&m_out_clkout_func, &m_config.m_out_clkout_func, this); + devcb_resolve_write_line(&m_out_alarm_func, &m_out_alarm_cb, this); + devcb_resolve_write_line(&m_out_clkout_func, &m_out_clkout_cb, this); // allocate timers m_clock_timer = timer_alloc(TIMER_CLOCK); |