1 /* Headers for DZ11-based DEC 5000/200 serial chip emulation.
2    Copyright 2003 Brian R. Gaeke.
3 
4 This file is part of VMIPS.
5 
6 VMIPS is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2 of the License, or (at your
9 option) any later version.
10 
11 VMIPS is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15 
16 You should have received a copy of the GNU General Public License along
17 with VMIPS; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
19 
20 #ifndef _DECSERIAL_H_
21 #define _DECSERIAL_H_
22 
23 #include "decserialreg.h"
24 #include "deviceint.h"
25 #include "devicemap.h"
26 #include "terminalcontroller.h"
27 class Clock;
28 
29 class DECSerialDevice : public DeviceMap, public DeviceInt,
30                         public TerminalController {
31   static const int KEYBOARD_POLL_NS = 100;
32   static const int KEYBOARD_REPOLL_NS = 100;
33   static const int DISPLAY_READY_DELAY_NS = 100;
34   void master_clear ();
35   uint32 csr, rbuf, lpr, tcr, msr;
36   uint8 deccsr_irq;
37   bool keyboard_interrupt_enable;
38   bool display_interrupt_enable;
39   void assertCSRInt ();
40   void deassertCSRInt ();
41   bool receiver_done (const int line) const;
42   bool transmitter_ready (const int line) const;
43   bool keyboardInterruptReadyForLine (const int line) const;
44   bool displayInterruptReadyForLine (const int line) const;
45  public:
46   DECSerialDevice (Clock *clock, uint8 deccsr_irq_);
~DECSerialDevice()47   virtual ~DECSerialDevice() { }
48   uint32 fetch_word (uint32 offset, int mode, DeviceExc *client);
49   void store_word (uint32 offset, uint32 data, DeviceExc *client);
descriptor_str()50   const char *descriptor_str () const { return "DECstation 5000/200 DZ11 Serial"; }
51 
52   /* Call the routines in TerminalController and then assert or
53      deassert the appropriate interrupt. */
54   virtual void ready_display (int line);
55   virtual void unready_display (int line, char data);
56   virtual void unready_keyboard (int line);
57 protected:
58   virtual void ready_keyboard (int line);
59 };
60 
61 #endif /* _DECSERIAL_H_ */
62