mccs1850: devcb2. (nw)

This commit is contained in:
Curt Coder 2014-03-18 13:59:30 +00:00
parent dbfcc63c41
commit fd2cbd7d49
3 changed files with 35 additions and 26 deletions

View File

@ -282,28 +282,24 @@ inline void mccs1850_device::advance_seconds()
// mccs1850_device - constructor
//-------------------------------------------------
mccs1850_device::mccs1850_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MCCS1850, "MCCS1850", tag, owner, clock, "mccs1850", __FILE__),
device_rtc_interface(mconfig, *this),
device_nvram_interface(mconfig, *this),
m_pse(1),
m_counter(0),
m_ce(0),
m_sck(0),
m_sdo(1),
m_sdi(0),
m_state(STATE_ADDRESS),
m_bits(0)
mccs1850_device::mccs1850_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, MCCS1850, "MCCS1850", tag, owner, clock, "mccs1850", __FILE__),
device_rtc_interface(mconfig, *this),
device_nvram_interface(mconfig, *this),
int_cb(*this),
pse_cb(*this),
nuc_cb(*this),
m_pse(1),
m_counter(0),
m_ce(0),
m_sck(0),
m_sdo(1),
m_sdi(0),
m_state(STATE_ADDRESS),
m_bits(0)
{
}
void mccs1850_device::set_cb(line_cb_t _int_cb, line_cb_t _pse_cb, line_cb_t _nuc_cb)
{
int_cb = _int_cb;
pse_cb = _pse_cb;
nuc_cb = _nuc_cb;
}
//-------------------------------------------------
// device_start - device-specific startup
@ -311,6 +307,11 @@ void mccs1850_device::set_cb(line_cb_t _int_cb, line_cb_t _pse_cb, line_cb_t _nu
void mccs1850_device::device_start()
{
// resolve callbacks
int_cb.resolve();
pse_cb.resolve();
nuc_cb.resolve();
// allocate timers
m_clock_timer = timer_alloc(TIMER_CLOCK);
m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768));

View File

@ -33,9 +33,15 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_MCCS1850_ADD(_tag, _clock, _int_cb, _pse_cb, _nuc_cb) \
MCFG_DEVICE_ADD(_tag, MCCS1850, _clock) \
downcast<mccs1850_device *>(device)->set_cb(_int_cb, _pse_cb, _nuc_cb);
#define MCFG_MCCS1850_INT_CALLBACK(_write) \
devcb = &mccs1850_device::set_int_wr_callback(*device, DEVCB2_##_write);
#define MCFG_MCCS1850_PSE_CALLBACK(_write) \
devcb = &mccs1850_device::set_pse_wr_callback(*device, DEVCB2_##_write);
#define MCFG_MCCS1850_NUC_CALLBACK(_write) \
devcb = &mccs1850_device::set_nuc_wr_callback(*device, DEVCB2_##_write);
//**************************************************************************
@ -51,7 +57,10 @@ class mccs1850_device : public device_t,
public:
// construction/destruction
mccs1850_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void set_cb(line_cb_t int_cb, line_cb_t pse_cb, line_cb_t nuc_cb);
template<class _Object> static devcb2_base &set_int_wr_callback(device_t &device, _Object object) { return downcast<mccs1850_device &>(device).int_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_pse_wr_callback(device_t &device, _Object object) { return downcast<mccs1850_device &>(device).pse_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_nuc_wr_callback(device_t &device, _Object object) { return downcast<mccs1850_device &>(device).nuc_cb.set_callback(object); }
DECLARE_WRITE_LINE_MEMBER( ce_w );
DECLARE_WRITE_LINE_MEMBER( sck_w );
@ -81,7 +90,7 @@ private:
static const device_timer_id TIMER_CLOCK = 0;
line_cb_t int_cb, pse_cb, nuc_cb;
devcb2_write_line int_cb, pse_cb, nuc_cb;
UINT8 m_ram[0x80]; // RAM

View File

@ -960,8 +960,7 @@ static MACHINE_CONFIG_START( next_base, next_state )
// devices
MCFG_NSCSI_BUS_ADD("scsibus")
MCFG_MCCS1850_ADD("rtc", XTAL_32_768kHz,
line_cb_t(), line_cb_t(), line_cb_t())
MCFG_DEVICE_ADD("rtc", MCCS1850, XTAL_32_768kHz)
MCFG_DEVICE_ADD("scc", SCC8530, XTAL_25MHz)
MCFG_Z8530_INTRQ_CALLBACK(WRITELINE(next_state, scc_irq))
MCFG_NEXTKBD_ADD("keyboard",