gem5  v20.1.0.0
i8259.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 
29 #ifndef __DEV_X86_I8259_HH__
30 #define __DEV_X86_I8259_HH__
31 
32 #include "dev/intpin.hh"
33 #include "dev/io_device.hh"
34 #include "enums/X86I8259CascadeMode.hh"
35 #include "params/I8259.hh"
36 
37 namespace X86ISA
38 {
39 
40 class I8259 : public BasicPioDevice
41 {
42  protected:
43  static const int NumLines = 8;
45 
46  void init() override;
47 
51  Enums::X86I8259CascadeMode mode;
53 
54  // Interrupt Request Register
55  uint8_t IRR;
56  // In Service Register
57  uint8_t ISR;
58  // Interrupt Mask Register
59  uint8_t IMR;
60 
61  // The higher order bits of the vector to return
62  uint8_t vectorOffset;
63 
65  // A bit vector of lines with responders attached, or the
66  // responder id, depending
67  // on if this is a requestor or responder PIC.
68  uint8_t cascadeBits;
69 
71  bool readIRR;
72 
73  // State machine information for reading in initialization control words.
74  bool expectICW4;
76 
77  // Whether or not the PIC is in auto EOI mode.
78  bool autoEOI;
79 
80  void requestInterrupt(int line);
81  void handleEOI(int line);
82 
83  public:
84  typedef I8259Params Params;
85 
86  const Params *
87  params() const
88  {
89  return dynamic_cast<const Params *>(_params);
90  }
91 
92  I8259(Params * p);
93 
94  Port &
95  getPort(const std::string &if_name, PortID idx=InvalidPortID) override
96  {
97  if (if_name == "inputs")
98  return *inputs.at(idx);
99  else if (if_name == "output")
100  return *output.at(idx);
101  else
102  return BasicPioDevice::getPort(if_name, idx);
103  }
104 
105  Tick read(PacketPtr pkt) override;
106  Tick write(PacketPtr pkt) override;
107 
108  void
110  {
111  IMR = 0xFF;
112  }
113 
114  void
116  {
117  IMR = 0x00;
118  }
119 
120  void signalInterrupt(int line);
121  void raiseInterruptPin(int number);
122  void lowerInterruptPin(int number);
123  int getVector();
124 
125  void serialize(CheckpointOut &cp) const override;
126  void unserialize(CheckpointIn &cp) override;
127 };
128 
129 } // namespace X86ISA
130 
131 #endif //__DEV_X86_I8259_HH__
X86ISA::I8259::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: i8259.cc:351
io_device.hh
X86ISA::I8259::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: i8259.cc:333
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
X86ISA::I8259
Definition: i8259.hh:40
X86ISA::I8259::unmaskAll
void unmaskAll()
Definition: i8259.hh:115
X86ISA::I8259::NumLines
static const int NumLines
Definition: i8259.hh:43
X86ISA::I8259::I8259
I8259(Params *p)
Definition: i8259.cc:38
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
X86ISA::I8259::raiseInterruptPin
void raiseInterruptPin(int number)
Definition: i8259.cc:286
std::vector
STL vector class.
Definition: stl.hh:37
X86ISA::I8259::readIRR
bool readIRR
Definition: i8259.hh:71
X86ISA::I8259::cascadeBits
uint8_t cascadeBits
Definition: i8259.hh:68
X86ISA::I8259::pinStates
bool pinStates[NumLines]
Definition: i8259.hh:44
X86ISA::I8259::Params
I8259Params Params
Definition: i8259.hh:84
X86ISA::I8259::requestInterrupt
void requestInterrupt(int line)
Definition: i8259.cc:253
cp
Definition: cprintf.cc:40
X86ISA::I8259::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8259.cc:72
X86ISA::I8259::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8259.cc:96
X86ISA::I8259::autoEOI
bool autoEOI
Definition: i8259.hh:78
PioDevice::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: io_device.cc:64
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
X86ISA::I8259::IMR
uint8_t IMR
Definition: i8259.hh:59
X86ISA::I8259::initControlWord
int initControlWord
Definition: i8259.hh:75
PioDevice::Params
PioDeviceParams Params
Definition: io_device.hh:131
X86ISA::I8259::expectICW4
bool expectICW4
Definition: i8259.hh:74
X86ISA::I8259::maskAll
void maskAll()
Definition: i8259.hh:109
X86ISA
This is exposed globally, independent of the ISA.
Definition: acpi.hh:55
X86ISA::I8259::getVector
int getVector()
Definition: i8259.cc:308
X86ISA::I8259::inputs
std::vector< IntSinkPin< I8259 > * > inputs
Definition: i8259.hh:50
X86ISA::I8259::IRR
uint8_t IRR
Definition: i8259.hh:55
X86ISA::I8259::edgeTriggered
bool edgeTriggered
Definition: i8259.hh:70
X86ISA::I8259::signalInterrupt
void signalInterrupt(int line)
Definition: i8259.cc:271
X86ISA::I8259::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: i8259.hh:95
X86ISA::p
Bitfield< 0 > p
Definition: pagetable.hh:151
SimObject::_params
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:110
X86ISA::I8259::cascadeMode
bool cascadeMode
Definition: i8259.hh:64
X86ISA::I8259::output
std::vector< IntSourcePin< I8259 > * > output
Definition: i8259.hh:49
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
BasicPioDevice
Definition: io_device.hh:150
X86ISA::I8259::params
const Params * params() const
Definition: i8259.hh:87
X86ISA::I8259::latency
Tick latency
Definition: i8259.hh:48
X86ISA::I8259::lowerInterruptPin
void lowerInterruptPin(int number)
Definition: i8259.cc:298
X86ISA::I8259::mode
Enums::X86I8259CascadeMode mode
Definition: i8259.hh:51
X86ISA::I8259::slave
I8259 * slave
Definition: i8259.hh:52
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
intpin.hh
X86ISA::I8259::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: i8259.cc:63
CheckpointIn
Definition: serialize.hh:67
X86ISA::I8259::ISR
uint8_t ISR
Definition: i8259.hh:57
X86ISA::I8259::handleEOI
void handleEOI(int line)
Definition: i8259.cc:243
X86ISA::I8259::vectorOffset
uint8_t vectorOffset
Definition: i8259.hh:62

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