libsidplayfp  2.0.2
SerialPort.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2019 Leandro Nini <drfiemost@users.sourceforge.net>
5  * Copyright 2009-2014 VICE Project
6  * Copyright 2007-2010 Antti Lankila
7  * Copyright 2000 Simon White
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef SERIALPORT_H
25 #define SERIALPORT_H
26 
27 #include "interrupt.h"
28 
29 #include "Event.h"
30 
31 namespace libsidplayfp
32 {
33 
34 class MOS6526;
35 
36 class SerialPort : private Event
37 {
38 private:
40  MOS6526 &parent;
41 
43  EventScheduler &eventScheduler;
44 
45  int count;
46 
47  bool buffered;
48 
49  uint8_t out;
50 
51 private:
52  void event() override;
53 
54 public:
55  explicit SerialPort(EventScheduler &scheduler, MOS6526 &parent) :
56  Event("Serial Port interrupt"),
57  parent(parent),
58  eventScheduler(scheduler)
59  {}
60 
61  void reset();
62 
63  void setBuffered() { buffered = true; }
64 
65  void handle(uint8_t serialDataReg);
66 };
67 
68 }
69 
70 #endif // SERIALPORT_H
libsidplayfp::MOS6526
Definition: mos6526.h:182
libsidplayfp::EventScheduler
Definition: EventScheduler.h:62
libsidplayfp::Event::Event
Event(const char *const name)
Definition: Event.h:59
libsidplayfp::SerialPort
Definition: SerialPort.h:37
libsidplayfp::Event
Definition: Event.h:39