1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
// license:BSD-3-Clause
// copyright-holders:Dirk Best
/***************************************************************************
Amiga Keyboard Interface
Serial data and reset control
- KDAT (serial data)
- KCLK (serial clock)
- KRST (reset output)
***************************************************************************/
#ifndef MAME_BUS_AMIGA_KEYBOARD_H
#define MAME_BUS_AMIGA_KEYBOARD_H
#pragma once
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class device_amiga_keyboard_interface;
// ======================> amiga_keyboard_bus_device
class amiga_keyboard_bus_device : public device_t, public device_single_card_slot_interface<device_amiga_keyboard_interface>
{
public:
// construction/destruction
template <typename T>
amiga_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt)
: amiga_keyboard_bus_device(mconfig, tag, owner)
{
option_reset();
opts(*this);
set_default_option(dflt);
set_fixed(false);
}
amiga_keyboard_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock = XTAL());
virtual ~amiga_keyboard_bus_device();
// callbacks
auto kclk_handler() { return m_kclk_handler.bind(); }
auto kdat_handler() { return m_kdat_handler.bind(); }
auto krst_handler() { return m_krst_handler.bind(); }
// called from keyboard
DECLARE_WRITE_LINE_MEMBER(kclk_w) { m_kclk_handler(state); }
DECLARE_WRITE_LINE_MEMBER(kdat_w) { m_kdat_handler(state); }
DECLARE_WRITE_LINE_MEMBER(krst_w) { m_krst_handler(state); }
// called from host
DECLARE_WRITE_LINE_MEMBER(kdat_in_w);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
device_amiga_keyboard_interface *m_kbd;
devcb_write_line m_kclk_handler;
devcb_write_line m_kdat_handler;
devcb_write_line m_krst_handler;
};
// ======================> device_amiga_keyboard_interface
class device_amiga_keyboard_interface : public device_interface
{
public:
// construction/destruction
virtual ~device_amiga_keyboard_interface();
virtual DECLARE_WRITE_LINE_MEMBER(kdat_w) = 0;
protected:
device_amiga_keyboard_interface(const machine_config &mconfig, device_t &device);
amiga_keyboard_bus_device *m_host;
};
// device type definition
DECLARE_DEVICE_TYPE(AMIGA_KEYBOARD_INTERFACE, amiga_keyboard_bus_device)
// supported devices
void amiga_keyboard_devices(device_slot_interface &device);
void a500_keyboard_devices(device_slot_interface &device);
void a600_keyboard_devices(device_slot_interface &device);
#endif // MAME_BUS_AMIGA_KEYBOARD_H
|