summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/psx/ctlrport.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/psx/ctlrport.h')
-rw-r--r--src/devices/bus/psx/ctlrport.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/devices/bus/psx/ctlrport.h b/src/devices/bus/psx/ctlrport.h
index d3578eb9b3a..0fc7fba52d7 100644
--- a/src/devices/bus/psx/ctlrport.h
+++ b/src/devices/bus/psx/ctlrport.h
@@ -44,7 +44,7 @@ protected:
private:
virtual bool get_pad(int count, uint8_t *odata, uint8_t idata) = 0;
virtual void do_pad();
- void ack_timer(void *ptr, int param);
+ void ack_timer(int32_t param);
uint8_t m_odata;
uint8_t m_idata;
@@ -89,9 +89,9 @@ public:
auto dsr() { return m_dsr_handler.bind(); }
auto rxd() { return m_rxd_handler.bind(); }
- DECLARE_WRITE_LINE_MEMBER(write_sck);
- DECLARE_WRITE_LINE_MEMBER(write_dtr);
- DECLARE_WRITE_LINE_MEMBER(write_txd);
+ void write_sck(int state);
+ void write_dtr(int state);
+ void write_txd(int state);
protected:
virtual void device_start() override;
@@ -108,6 +108,8 @@ class psx_controller_port_device : public device_t,
public device_single_card_slot_interface<device_psx_controller_interface>
{
public:
+ typedef device_delegate<void ()> void_cb;
+
template <typename T>
psx_controller_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt)
: psx_controller_port_device(mconfig, tag, owner, (uint32_t)0)
@@ -119,29 +121,30 @@ public:
}
psx_controller_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- typedef delegate<void ()> void_cb;
- void ack() { if(!ack_cb.isnull()) ack_cb(); }
- void setup_ack_cb(void_cb cb) { ack_cb = cb; }
+ template <typename... T>
+ void set_ack_cb(T &&... args) { m_ack_cb.set(std::forward<T>(args)...); }
+
+ void ack() { m_ack_cb(); }
- DECLARE_WRITE_LINE_MEMBER(tx_w) { m_tx = state; }
- DECLARE_WRITE_LINE_MEMBER(sel_w) { if(m_dev) m_dev->sel_w(state); m_card->sel_w(state); }
- DECLARE_WRITE_LINE_MEMBER(clock_w) { if(m_dev) m_dev->clock_w(state); m_card->clock_w(state); }
+ void tx_w(int state) { m_tx = state; }
+ void sel_w(int state) { if(m_dev) m_dev->sel_w(state); m_card->sel_w(state); }
+ void clock_w(int state) { if(m_dev) m_dev->clock_w(state); m_card->clock_w(state); }
- DECLARE_READ_LINE_MEMBER(rx_r) { return (m_dev?m_dev->rx_r():true) && m_card->rx_r(); }
- DECLARE_READ_LINE_MEMBER(ack_r) { return (m_dev?m_dev->ack_r():true) && m_card->ack_r(); }
- DECLARE_READ_LINE_MEMBER(tx_r) { return m_tx; }
+ int rx_r() { return (m_dev?m_dev->rx_r():true) && m_card->rx_r(); }
+ int ack_r() { return (m_dev?m_dev->ack_r():true) && m_card->ack_r(); }
+ int tx_r() { return m_tx; }
void disable_card(bool status);
protected:
- virtual void device_start() override {}
+ virtual void device_start() override { m_ack_cb.resolve_safe(); }
virtual void device_reset() override { m_tx = true; }
virtual void device_config_complete() override;
virtual void device_add_mconfig(machine_config &config) override;
private:
- void_cb ack_cb;
+ void_cb m_ack_cb;
bool m_tx;
device_psx_controller_interface *m_dev;