blob: bac4c1f3f15eb530594fb208a41226cd895dd074 (
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
|
// license:BSD-3-Clause
// copyright-holders:David Haywood
#ifndef MAME_MACHINE_GENERALPLUS_GPL_TIMEBASE_H
#define MAME_MACHINE_GENERALPLUS_GPL_TIMEBASE_H
#pragma once
#include "machine/timer.h"
class gpl_timebase_device : public device_t
{
public:
gpl_timebase_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template<u16 Timer> bool timebase_irq_flag() { return ((m_timebase_ctrl[Timer] & 0x8000) && (m_timebase_ctrl[Timer] & 0x4000)) ? true : false; }
auto updateirqs_callback() { return m_updateirqs_cb.bind(); }
u16 timebasea_ctrl_r();
u16 timebaseb_ctrl_r();
u16 timebasec_ctrl_r();
void timebasea_ctrl_w(u16 data);
void timebaseb_ctrl_w(u16 data);
void timebasec_ctrl_w(u16 data);
void timebase_reset_w(u16 data);
protected:
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
private:
template<u16 Timer> TIMER_DEVICE_CALLBACK_MEMBER(timebase_cb);
template<u16 Timer> u16 timebase_ctrl_r();
template<u16 Timer> void timebase_ctrl_w(u16 data);
attotime get_timer_period(int timer, int ctrlval);
u16 m_timebase_ctrl[3];
u16 m_timebase_reset;
required_device_array<timer_device, 3> m_timebasetimer;
devcb_write_line m_updateirqs_cb;
};
DECLARE_DEVICE_TYPE(GPL_TIMEBASE, gpl_timebase_device)
#endif // MAME_MACHINE_GENERALPLUS_GPL_TIMEBASE_H
|