openMSX
Main Page
Namespaces
Classes
Files
File List
File Members
serial
ClockPin.hh
Go to the documentation of this file.
1
#ifndef CLOCKPIN_HH
2
#define CLOCKPIN_HH
3
4
#include "
EmuTime.hh
"
5
#include "
Schedulable.hh
"
6
7
namespace
openmsx {
8
9
class
Scheduler
;
10
class
ClockPin
;
11
12
class
ClockPinListener
13
{
14
public
:
15
virtual
void
signal
(
ClockPin
& pin,
EmuTime::param
time) = 0;
16
virtual
void
signalPosEdge
(
ClockPin
& pin,
EmuTime::param
time) = 0;
17
protected
:
18
virtual
~ClockPinListener
() {}
19
};
20
21
class
ClockPin
:
public
Schedulable
22
{
23
public
:
24
explicit
ClockPin
(
Scheduler
& scheduler,
ClockPinListener
* listener =
nullptr
);
25
26
// input side
27
void
setState
(
bool
status,
EmuTime::param
time);
28
void
setPeriodicState
(
EmuDuration::param
total,
29
EmuDuration::param
hi,
EmuTime::param
time);
30
31
// output side
32
bool
getState
(
EmuTime::param
time)
const
;
33
bool
isPeriodic
()
const
;
34
EmuDuration::param
getTotalDuration
()
const
;
35
EmuDuration::param
getHighDuration
()
const
;
36
int
getTicksBetween
(
EmuTime::param
begin,
37
EmuTime::param
end)
const
;
38
39
// control
40
void
generateEdgeSignals
(
bool
wanted,
EmuTime::param
time);
41
42
template
<
typename
Archive>
43
void
serialize
(Archive& ar,
unsigned
version);
44
45
private
:
46
void
unschedule();
47
void
schedule(
EmuTime::param
time);
48
virtual
void
executeUntil(
EmuTime::param
time,
int
userData);
49
50
ClockPinListener
*
const
listener;
51
52
EmuDuration
totalDur;
53
EmuDuration
hiDur;
54
EmuTime
referenceTime;
55
56
bool
periodic;
57
bool
status;
58
bool
signalEdge;
59
};
60
61
}
// namespace openmsx
62
63
#endif
Generated on Tue May 14 2013 20:17:58 for openMSX by
1.8.1.2