summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/tanbus/etirtc.cpp
blob: 9875858bd44b09de52db2da48a6633ca4e5983e9 (plain) (blame)
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
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    ETI Real Time Clock/Calendar

    http://www.microtan.ukpc.net/pageProducts.html#CLOCK

**********************************************************************/


#include "emu.h"
#include "etirtc.h"


//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(TANBUS_ETIRTC, tanbus_etirtc_device, "tanbus_etirtc", "Microtan ETI Real Time Clock")

//-------------------------------------------------
//  device_add_mconfig - add device configuration
//-------------------------------------------------

void tanbus_etirtc_device::device_add_mconfig(machine_config &config)
{
	MM58174(config, "rtc", 32.768_kHz_XTAL);
}


//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  tanbus_etirtc_device - constructor
//-------------------------------------------------

tanbus_etirtc_device::tanbus_etirtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, TANBUS_ETIRTC, tag, owner, clock)
	, device_tanbus_interface(mconfig, *this)
	, m_rtc(*this, "rtc")
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void tanbus_etirtc_device::device_start()
{
}


//-------------------------------------------------
//  read - card read
//-------------------------------------------------

uint8_t tanbus_etirtc_device::read(offs_t offset, int inhrom, int inhram, int be)
{
	uint8_t data = 0xff;

	switch (offset & 0xfff0)
	{
	case 0xbc00:
		data = m_rtc->read(offset);
		break;
	}

	return data;
}


//-------------------------------------------------
//  write - card write
//-------------------------------------------------

void tanbus_etirtc_device::write(offs_t offset, uint8_t data, int inhrom, int inhram, int be)
{
	switch (offset & 0xfff0)
	{
	case 0xbc00:
		m_rtc->write(offset, data);
		break;
	}
}