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
|
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
/***************************************************************************
Seiko/Epson S-3520CF
***************************************************************************/
#ifndef MAME_MACHINE_S3520CF_H
#define MAME_MACHINE_S3520CF_H
#pragma once
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_S3520CF_ADD(tag) \
MCFG_DEVICE_ADD((tag), S3520CF, XTAL(32'768))
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> s3520cf_device
class s3520cf_device : public device_t
{
public:
// construction/destruction
s3520cf_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// I/O operations
DECLARE_READ_LINE_MEMBER( read_bit );
DECLARE_WRITE_LINE_MEMBER( set_dir_line );
DECLARE_WRITE_LINE_MEMBER( set_cs_line );
DECLARE_WRITE_LINE_MEMBER( set_clock_line );
DECLARE_WRITE_LINE_MEMBER( write_bit );
TIMER_CALLBACK_MEMBER(timer_callback);
protected:
enum state_t
{
RTC_SET_ADDRESS = 0,
RTC_SET_DATA
};
struct rtc_regs_t
{
uint8_t sec, min, hour, day, wday, month, year;
};
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
inline uint8_t rtc_read(uint8_t offset);
inline void rtc_write(uint8_t offset,uint8_t data);
int m_dir;
int m_latch;
int m_reset_line;
int m_read_latch;
uint8_t m_current_cmd;
uint8_t m_cmd_stream_pos;
uint8_t m_rtc_addr;
uint8_t m_mode, m_sysr;
state_t m_rtc_state;
rtc_regs_t m_rtc;
emu_timer *m_timer;
};
// device type definition
DECLARE_DEVICE_TYPE(S3520CF, s3520cf_device)
#endif // MAME_MACHINE_S3520CF_H
|