summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/v3021.h
blob: 5a968e30bfbc9a08a30c85e28d5fa9e009e62f8f (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
// license:BSD-3-Clause
// copyright-holders:Angelo Salese
/***************************************************************************

    v3021.h

    EM Microelectronic-Marin SA Ultra Low Power 32kHz CMOS RTC (DIP8)

    Serial Real Time Clock

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

#pragma once

#ifndef __v3021DEV_H__
#define __v3021DEV_H__



//**************************************************************************
//  INTERFACE CONFIGURATION MACROS
//**************************************************************************

#define MCFG_V3021_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, v3021, XTAL_32_768kHz)

//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

struct rtc_regs_t
{
	uint8_t sec, min, hour, day, wday, month, year;
};


// ======================> v3021_device

class v3021_device :    public device_t
{
public:
	// construction/destruction
	v3021_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	// I/O operations
	DECLARE_WRITE8_MEMBER( write );
	DECLARE_READ8_MEMBER( read );
	TIMER_CALLBACK_MEMBER(timer_callback);

protected:
	// device-level overrides
	virtual void device_validity_check(validity_checker &valid) const override;
	virtual void device_start() override;
	virtual void device_reset() override;

	uint8_t m_cal_mask,m_cal_com,m_cal_cnt,m_cal_val;

	rtc_regs_t m_rtc;
};


// device type definition
extern const device_type v3021;



//**************************************************************************
//  GLOBAL VARIABLES
//**************************************************************************



#endif