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
|
// license:BSD-3-Clause
// copyright-holders:R. Belmont
/**********************************************************************
rtc4543.h - Epson R4543 real-time clock emulation
by R. Belmont
**********************************************************************/
#pragma once
#ifndef __RTC4543_H__
#define __RTC4543_H__
#include "emu.h"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_RTC4543_ADD(_tag, _clock) \
MCFG_DEVICE_ADD(_tag, RTC4543, _clock)
#define MCFG_RTC4543_DATA_CALLBACK(_devcb) \
devcb = &rtc4543_device::set_data_cb(*device, DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> rtc4543_device
class rtc4543_device : public device_t,
public device_rtc_interface
{
public:
// construction/destruction
rtc4543_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_WRITE_LINE_MEMBER( ce_w );
DECLARE_WRITE_LINE_MEMBER( wr_w );
DECLARE_WRITE_LINE_MEMBER( clk_w );
DECLARE_READ_LINE_MEMBER( data_r );
DECLARE_WRITE_LINE_MEMBER( data_w );
template<class _Object> static devcb_base &set_data_cb(device_t &device, _Object object) { return downcast<rtc4543_device &>(device).data_cb.set_callback(object); }
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
// device_rtc_interface overrides
virtual void rtc_clock_updated(int year, int month, int day, int day_of_week, int hour, int minute, int second);
virtual bool rtc_feature_leap_year() { return true; }
private:
devcb_write_line data_cb;
int m_ce;
int m_clk;
int m_wr;
int m_data;
int m_shiftreg;
int m_regs[7];
int m_curreg;
int m_curbit;
// timers
emu_timer *m_clock_timer;
};
// device type definition
extern const device_type RTC4543;
#endif
|