summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/upd765.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/upd765.h')
-rw-r--r--src/devices/machine/upd765.h53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/devices/machine/upd765.h b/src/devices/machine/upd765.h
index 458d832190c..143419114cd 100644
--- a/src/devices/machine/upd765.h
+++ b/src/devices/machine/upd765.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-#ifndef __UPD765_F_H__
-#define __UPD765_F_H__
+#ifndef MAME_DEVICES_MACHINE_UPD765_H
+#define MAME_DEVICES_MACHINE_UPD765_H
+
+#pragma once
#include "imagedev/floppy.h"
#include "fdc_pll.h"
@@ -70,12 +72,13 @@
/* Interface required for PC ISA wrapping */
class pc_fdc_interface : public device_t {
+protected:
+ using device_t::device_t;
+
public:
typedef delegate<uint8_t ()> byte_read_cb;
typedef delegate<void (uint8_t)> byte_write_cb;
- pc_fdc_interface(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source) {}
-
/* Note that the address map must cover and handle the whole 0-7
* range. The upd765, while conforming to the rest of the
* interface, is not eligible as a result.
@@ -94,11 +97,9 @@ class upd765_family_device : public pc_fdc_interface {
public:
enum { MODE_AT, MODE_PS2, MODE_M30 };
- upd765_family_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
-
- template<class _Object> static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast<upd765_family_device &>(device).intrq_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<upd765_family_device &>(device).drq_cb.set_callback(object); }
- template<class _Object> static devcb_base &set_hdl_wr_callback(device_t &device, _Object object) { return downcast<upd765_family_device &>(device).hdl_cb.set_callback(object); }
+ template <class Object> static devcb_base &set_intrq_wr_callback(device_t &device, Object &&cb) { return downcast<upd765_family_device &>(device).intrq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_drq_wr_callback(device_t &device, Object &&cb) { return downcast<upd765_family_device &>(device).drq_cb.set_callback(std::forward<Object>(cb)); }
+ template <class Object> static devcb_base &set_hdl_wr_callback(device_t &device, Object &&cb) { return downcast<upd765_family_device &>(device).hdl_cb.set_callback(std::forward<Object>(cb)); }
virtual DECLARE_ADDRESS_MAP(map, 8) override = 0;
@@ -140,6 +141,8 @@ public:
void soft_reset();
protected:
+ upd765_family_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
@@ -306,7 +309,7 @@ protected:
fdc_pll_t pll;
};
- static int rates[4];
+ static constexpr int rates[4] = { 500000, 300000, 250000, 1000000 };
bool ready_connected, ready_polled, select_connected;
@@ -491,7 +494,7 @@ public:
mcs3201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration helpers
- template<class _Object> static devcb_base &set_input_handler(device_t &device, _Object object) { return downcast<mcs3201_device &>(device).m_input_handler.set_callback(object); }
+ template <class Object> static devcb_base &set_input_handler(device_t &device, Object &&cb) { return downcast<mcs3201_device &>(device).m_input_handler.set_callback(std::forward<Object>(cb)); }
virtual DECLARE_ADDRESS_MAP(map, 8) override;
DECLARE_READ8_MEMBER( input_r );
@@ -518,17 +521,17 @@ private:
uint8_t m_cr1;
};
-extern const device_type UPD765A;
-extern const device_type UPD765B;
-extern const device_type I8272A;
-extern const device_type UPD72065;
-extern const device_type SMC37C78;
-extern const device_type N82077AA;
-extern const device_type PC_FDC_SUPERIO;
-extern const device_type DP8473;
-extern const device_type PC8477A;
-extern const device_type WD37C65C;
-extern const device_type MCS3201;
-extern const device_type TC8566AF;
-
-#endif
+DECLARE_DEVICE_TYPE(UPD765A, upd765a_device)
+DECLARE_DEVICE_TYPE(UPD765B, upd765b_device)
+DECLARE_DEVICE_TYPE(I8272A, i8272a_device)
+DECLARE_DEVICE_TYPE(UPD72065, upd72065_device)
+DECLARE_DEVICE_TYPE(SMC37C78, smc37c78_device)
+DECLARE_DEVICE_TYPE(N82077AA, n82077aa_device)
+DECLARE_DEVICE_TYPE(PC_FDC_SUPERIO, pc_fdc_superio_device)
+DECLARE_DEVICE_TYPE(DP8473, dp8473_device)
+DECLARE_DEVICE_TYPE(PC8477A, pc8477a_device)
+DECLARE_DEVICE_TYPE(WD37C65C, wd37c65c_device)
+DECLARE_DEVICE_TYPE(MCS3201, mcs3201_device)
+DECLARE_DEVICE_TYPE(TC8566AF, tc8566af_device)
+
+#endif // MAME_DEVICES_MACHINE_UPD765_H