gem5  v20.1.0.0
malta_io.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2005 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
33 #ifndef __DEV_MALTA_IO_HH__
34 #define __DEV_MALTA_IO_HH__
35 
36 #include "dev/mips/malta.hh"
37 #include "dev/mips/malta_cchip.hh"
38 #include "dev/intel_8254_timer.hh"
39 #include "dev/io_device.hh"
40 #include "dev/mc146818.hh"
41 #include "params/MaltaIO.hh"
42 #include "sim/eventq.hh"
43 
48 class MaltaIO : public BasicPioDevice
49 {
50  protected:
51 
52  class RTC : public MC146818
53  {
54  public:
56  RTC(const std::string &name, const MaltaIOParams *p);
57 
58  protected:
59  void handleEvent()
60  {
61  //Actually interrupt the processor here
62  malta->cchip->postRTC();
63  }
64  };
65 
67  uint8_t mask1;
68 
70  uint8_t mask2;
71 
73  uint8_t mode1;
74 
76  uint8_t mode2;
77 
79  uint8_t picr; //Raw PIC interrput register
80 
83 
86 
89 
91 
96  uint16_t timerData;
97 
98  public:
103  Tick frequency() const;
104 
105  typedef MaltaIOParams Params;
106 
107  const Params *
108  params() const
109  {
110  return dynamic_cast<const Params *>(_params);
111  }
112 
117  MaltaIO(const Params *p);
118 
119  Tick read(PacketPtr pkt) override;
120  Tick write(PacketPtr pkt) override;
121 
122 
124  void postIntr(uint8_t interrupt);
125 
127  void clearIntr(uint8_t interrupt);
128 
129  void serialize(CheckpointOut &cp) const override;
130  void unserialize(CheckpointIn &cp) override;
131 
135  void startup() override;
136 
137 };
138 
139 #endif // __DEV_MALTA_IO_HH__
MaltaIO::picr
uint8_t picr
Raw PIC interrupt register before masking.
Definition: malta_io.hh:79
Malta::cchip
MaltaCChip * cchip
Pointer to the Malta CChip.
Definition: malta.hh:69
io_device.hh
MaltaIO::clearIntr
void clearIntr(uint8_t interrupt)
Clear an Interrupt to the CPU.
Definition: malta_io.cc:102
MaltaIO::RTC
Definition: malta_io.hh:52
MaltaIO::rtc
RTC rtc
Definition: malta_io.hh:90
malta.hh
MaltaIO::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: malta_io.cc:88
MaltaIO::malta
Malta * malta
A pointer to the Malta device which be belong to.
Definition: malta_io.hh:85
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
MaltaIO::mode2
uint8_t mode2
Mode of PIC2.
Definition: malta_io.hh:76
MaltaIO::pitimer
Intel8254Timer pitimer
Intel 8253 Periodic Interval Timer.
Definition: malta_io.hh:88
MaltaIO::RTC::RTC
RTC(const std::string &name, const MaltaIOParams *p)
Definition: malta_io.cc:56
malta_cchip.hh
MaltaIO::mask1
uint8_t mask1
Mask of the PIC1.
Definition: malta_io.hh:67
MaltaIO::params
const Params * params() const
Definition: malta_io.hh:108
cp
Definition: cprintf.cc:40
MaltaIO::mode1
uint8_t mode1
Mode of PIC1.
Definition: malta_io.hh:73
Intel8254Timer
Programmable Interval Timer (Intel 8254)
Definition: intel_8254_timer.hh:43
PioDevice::Params
PioDeviceParams Params
Definition: io_device.hh:131
MaltaIO::mask2
uint8_t mask2
Mask of the PIC2.
Definition: malta_io.hh:70
MC146818
Real-Time Clock (MC146818)
Definition: mc146818.hh:38
MaltaIO::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: malta_io.cc:125
intel_8254_timer.hh
MaltaCChip::postRTC
void postRTC()
post an RTC interrupt to the CPU
Definition: malta_cchip.cc:97
MaltaIO::RTC::malta
Malta * malta
Definition: malta_io.hh:55
MaltaIO::postIntr
void postIntr(uint8_t interrupt)
Post an Interrupt to the CPU.
Definition: malta_io.cc:95
MaltaIO::frequency
Tick frequency() const
Return the freqency of the RTC.
Definition: malta_io.cc:75
SimObject::_params
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
MC146818::name
const std::string & name() const
Definition: mc146818.hh:85
Malta
Top level class for Malta Chipset emulation.
Definition: malta.hh:53
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
MaltaIO::timerData
uint16_t timerData
The interval is set via two writes to the PIT.
Definition: malta_io.hh:96
BasicPioDevice
Definition: io_device.hh:150
MaltaIO::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: malta_io.cc:109
MaltaIO::Params
MaltaIOParams Params
Definition: malta_io.hh:105
MaltaIO
Malta I/O device is a catch all for all the south bridge stuff we care to implement.
Definition: malta_io.hh:48
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
MaltaIO::RTC::handleEvent
void handleEvent()
Definition: malta_io.hh:59
MaltaIO::picInterrupting
bool picInterrupting
Is the pic interrupting right now or not.
Definition: malta_io.hh:82
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
MaltaIO::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: malta_io.cc:81
CheckpointIn
Definition: serialize.hh:67
MaltaIO::MaltaIO
MaltaIO(const Params *p)
Initialize all the data for devices supported by Malta I/O.
Definition: malta_io.cc:62
mc146818.hh
MaltaIO::startup
void startup() override
Start running.
Definition: malta_io.cc:141
eventq.hh

Generated on Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17