blob: c0774bb2a90bba0e7fdd1496d702e58161933cee (
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
|
// license:BSD-3-Clause
// copyright-holders:smf
/***************************************************************************
Fujitsu Micro F2MC-16 series Clock Generator
***************************************************************************/
#ifndef MAME_CPU_F2MC16_F2MC16_CLOCK_H
#define MAME_CPU_F2MC16_F2MC16_CLOCK_H
#pragma once
#include "f2mc16.h"
#include "f2mc16_intc.h"
class f2mc16_clock_generator_device :
public device_t
{
public:
f2mc16_clock_generator_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, required_device<f2mc16_intc_device> &intc, uint8_t m_tbtc_vector);
f2mc16_clock_generator_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
auto timebase_hz() { return m_timebase_hz_cb.bind(); }
uint8_t lpmcr_r();
void lpmcr_w(uint8_t data);
uint8_t wdtc_r();
void wdtc_w(uint8_t data);
uint8_t tbtc_r();
void tbtc_w(uint8_t data);
uint8_t ckscr_r();
void ckscr_w(uint8_t data);
protected:
// device_t
virtual void device_start() override ATTR_COLD;
virtual void device_clock_changed() override;
virtual void device_reset() override ATTR_COLD;
void timebase_reset();
void timebase_update();
void timebase_update_counter();
TIMER_CALLBACK_MEMBER(soft_reset);
TIMER_CALLBACK_MEMBER(update_mainclock_hz);
TIMER_CALLBACK_MEMBER(timebase_timer_callback);
f2mc16_device *m_cpu;
required_device<f2mc16_intc_device> m_intc;
uint8_t m_tbtc_vector;
devcb_write32 m_timebase_hz_cb;
emu_timer *m_timebase_timer;
attotime m_timebase_start_time;
attotime m_tbtc_overflow_time;
attotime m_watchdog_overflow_time;
attotime m_mainclock_changed;
uint32_t m_timebase_counter;
uint32_t m_tbtc_hz;
uint32_t m_mainclock_hz;
uint8_t m_reset_reason;
uint8_t m_watchdog_overflow_count;
uint8_t m_wt;
uint8_t m_ckscr;
uint8_t m_lpmcr;
uint8_t m_tbtc;
uint8_t m_wdtc;
};
DECLARE_DEVICE_TYPE(F2MC16_CLOCK_GENERATOR, f2mc16_clock_generator_device)
#endif
|