summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/ds1315.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/ds1315.h')
-rw-r--r--src/devices/machine/ds1315.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/devices/machine/ds1315.h b/src/devices/machine/ds1315.h
index 0468232cf31..132056e46b3 100644
--- a/src/devices/machine/ds1315.h
+++ b/src/devices/machine/ds1315.h
@@ -15,7 +15,15 @@
#pragma once
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+#define MCFG_DS1315_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, DS1315, 0)
+
+#define MCFG_DS1315_BACKING_HANDLER(_devcb) \
+ devcb = &ds1315_device::set_backing_handler(*device, DEVCB_##_devcb);
/***************************************************************************
MACROS
@@ -27,6 +35,9 @@ public:
ds1315_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~ds1315_device() {}
+ // this handler automates the bits 0/2 stuff
+ DECLARE_READ8_MEMBER(read);
+
DECLARE_READ8_MEMBER(read_0);
DECLARE_READ8_MEMBER(read_1);
DECLARE_READ8_MEMBER(read_data);
@@ -35,12 +46,17 @@ public:
bool chip_enable();
void chip_reset();
+ template <class Object> static devcb_base &set_backing_handler(device_t &device, Object &&cb)
+ { return downcast<ds1315_device &>(device).m_backing_read.set_callback(std::forward<Object>(cb)); }
+
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
+ devcb_read8 m_backing_read;
+
enum mode_t : u8
{
DS_SEEK_MATCHING,
@@ -61,12 +77,4 @@ ALLOW_SAVE_TYPE(ds1315_device::mode_t);
DECLARE_DEVICE_TYPE(DS1315, ds1315_device)
-/***************************************************************************
- DEVICE CONFIGURATION MACROS
-***************************************************************************/
-
-#define MCFG_DS1315_ADD(_tag) \
- MCFG_DEVICE_ADD(_tag, DS1315, 0)
-
-
#endif // MAME_MACHINE_DS1315_H