(MESS) econet: devcb2. (nw)

This commit is contained in:
Curt Coder 2014-03-15 20:57:54 +00:00
parent 46a1b9e491
commit f2230d052c
3 changed files with 34 additions and 78 deletions

View File

@ -41,17 +41,8 @@ const device_type ECONET_SLOT = &device_creator<econet_slot_device>;
// device_econet_interface - constructor
//-------------------------------------------------
device_econet_interface::device_econet_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device)
{
}
//-------------------------------------------------
// ~device_econet_interface - destructor
//-------------------------------------------------
device_econet_interface::~device_econet_interface()
device_econet_interface::device_econet_interface(const machine_config &mconfig, device_t &device) :
device_slot_card_interface(mconfig, device)
{
}
@ -66,8 +57,8 @@ device_econet_interface::~device_econet_interface()
//-------------------------------------------------
econet_slot_device::econet_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, ECONET_SLOT, "Econet station", tag, owner, clock, "econet_slot", __FILE__),
device_slot_interface(mconfig, *this)
device_t(mconfig, ECONET_SLOT, "Econet station", tag, owner, clock, "econet_slot", __FILE__),
device_slot_interface(mconfig, *this)
{
}
@ -96,33 +87,6 @@ void econet_slot_device::device_start()
//**************************************************************************
// DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void econet_device::device_config_complete()
{
// inherit a copy of the static data
const econet_interface *intf = reinterpret_cast<const econet_interface *>(static_config());
if (intf != NULL)
*static_cast<econet_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
memset(&m_out_clk_cb, 0, sizeof(m_out_clk_cb));
memset(&m_out_data_cb, 0, sizeof(m_out_data_cb));
}
}
//**************************************************************************
// INLINE HELPERS
//**************************************************************************
@ -168,8 +132,8 @@ inline void econet_device::set_signal(device_t *device, int signal, int state)
{
switch (signal)
{
case CLK: m_out_clk_func(state); break;
case DATA: m_out_data_func(state); break;
case CLK: m_write_clk(state); break;
case DATA: m_write_data(state); break;
}
daisy_entry *entry = m_device_list.first();
@ -232,8 +196,10 @@ inline int econet_device::get_signal(int signal)
// econet_device - constructor
//-------------------------------------------------
econet_device::econet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ECONET, "Econet", tag, owner, clock, "econet", __FILE__)
econet_device::econet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, ECONET, "Econet", tag, owner, clock, "econet", __FILE__),
m_write_clk(*this),
m_write_data(*this)
{
for (int i = 0; i < SIGNAL_COUNT; i++)
{
@ -249,8 +215,8 @@ econet_device::econet_device(const machine_config &mconfig, const char *tag, dev
void econet_device::device_start()
{
// resolve callbacks
m_out_clk_func.resolve(m_out_clk_cb, *this);
m_out_data_func.resolve(m_out_data_cb, *this);
m_write_clk.resolve_safe();
m_write_data.resolve_safe();
}
@ -283,10 +249,10 @@ void econet_device::add_device(device_t *target, int address)
// daisy_entry - constructor
//-------------------------------------------------
econet_device::daisy_entry::daisy_entry(device_t *device)
: m_next(NULL),
m_device(device),
m_interface(NULL)
econet_device::daisy_entry::daisy_entry(device_t *device) :
m_next(NULL),
m_device(device),
m_interface(NULL)
{
for (int i = 0; i < SIGNAL_COUNT; i++)
{

View File

@ -30,13 +30,8 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_ECONET_ADD(_config) \
#define MCFG_ECONET_ADD() \
MCFG_DEVICE_ADD(ECONET_TAG, ECONET, 0) \
MCFG_DEVICE_CONFIG(_config)
#define ECONET_INTERFACE(_name) \
const econet_interface (_name) =
#define MCFG_ECONET_SLOT_ADD(_tag, _num, _slot_intf, _def_slot) \
@ -45,31 +40,31 @@
econet_slot_device::static_set_slot(*device, _num);
#define MCFG_ECONET_CLK_CALLBACK(_write) \
devcb = &econet_device::set_clk_wr_callback(*device, DEVCB2_##_write);
#define MCFG_ECONET_DATA_CALLBACK(_write) \
devcb = &econet_device::set_data_wr_callback(*device, DEVCB2_##_write);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> econet_interface
struct econet_interface
{
devcb_write_line m_out_clk_cb;
devcb_write_line m_out_data_cb;
};
// ======================> econet_device
class device_econet_interface;
class econet_device : public device_t,
public econet_interface
class econet_device : public device_t
{
public:
// construction/destruction
econet_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
template<class _Object> static devcb2_base &set_clk_wr_callback(device_t &device, _Object object) { return downcast<econet_device &>(device).m_write_clk.set_callback(object); }
template<class _Object> static devcb2_base &set_data_wr_callback(device_t &device, _Object object) { return downcast<econet_device &>(device).m_write_data.set_callback(object); }
void add_device(device_t *target, int address);
// writes for host (driver_device)
@ -89,7 +84,6 @@ protected:
};
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_stop();
@ -109,8 +103,8 @@ protected:
simple_list<daisy_entry> m_device_list;
private:
devcb_resolved_write_line m_out_clk_func;
devcb_resolved_write_line m_out_data_func;
devcb2_write_line m_write_clk;
devcb2_write_line m_write_data;
inline void set_signal(device_t *device, int signal, int state);
inline int get_signal(int signal);
@ -150,7 +144,7 @@ class device_econet_interface : public device_slot_card_interface
public:
// construction/destruction
device_econet_interface(const machine_config &mconfig, device_t &device);
virtual ~device_econet_interface();
virtual ~device_econet_interface() { }
device_econet_interface *next() const { return m_next; }
device_econet_interface *m_next;

View File

@ -645,12 +645,6 @@ WRITE_LINE_MEMBER(bbc_state::econet_clk_w)
m_adlc->txc_w(state);
}
static ECONET_INTERFACE( econet_intf )
{
DEVCB_DRIVER_LINE_MEMBER(bbc_state, econet_clk_w),
DEVCB_DEVICE_LINE_MEMBER("mc6854", mc6854_device, set_rx)
};
static MACHINE_CONFIG_FRAGMENT( bbc_cartslot )
MCFG_CARTSLOT_ADD("cart1")
MCFG_CARTSLOT_EXTENSION_LIST("rom")
@ -991,7 +985,9 @@ static MACHINE_CONFIG_START( bbcm, bbc_state )
/* econet */
MCFG_MC6854_ADD("mc6854", adlc_intf)
MCFG_ECONET_ADD(econet_intf)
MCFG_ECONET_ADD()
MCFG_ECONET_CLK_CALLBACK(WRITELINE(bbc_state, econet_clk_w))
MCFG_ECONET_DATA_CALLBACK(DEVWRITELINE("mc6854", mc6854_device, set_rx))
MCFG_ECONET_SLOT_ADD("econet254", 254, econet_devices, NULL)
MACHINE_CONFIG_END