gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  * Authors: Gabe Black
29  */
30 
31 #ifndef __DEV_X86_I8259_HH__
32 #define __DEV_X86_I8259_HH__
33 
34 #include "dev/x86/intdev.hh"
35 #include "dev/io_device.hh"
36 #include "enums/X86I8259CascadeMode.hh"
37 #include "params/I8259.hh"
38 
39 namespace X86ISA
40 {
41 
42 class I8259 : public BasicPioDevice, public IntDevice
43 {
44  protected:
45  static const int NumLines = 8;
47 
50  Enums::X86I8259CascadeMode mode;
52 
53  // Interrupt Request Register
54  uint8_t IRR;
55  // In Service Register
56  uint8_t ISR;
57  // Interrupt Mask Register
58  uint8_t IMR;
59 
60  // The higher order bits of the vector to return
61  uint8_t vectorOffset;
62 
64  // A bit vector of lines with slaves attached, or the slave id, depending
65  // on if this is a master or slave PIC.
66  uint8_t cascadeBits;
67 
69  bool readIRR;
70 
71  // State machine information for reading in initialization control words.
72  bool expectICW4;
74 
75  // Whether or not the PIC is in auto EOI mode.
76  bool autoEOI;
77 
78  void requestInterrupt(int line);
79  void handleEOI(int line);
80 
81  public:
82  typedef I8259Params Params;
83 
84  const Params *
85  params() const
86  {
87  return dynamic_cast<const Params *>(_params);
88  }
89 
90  I8259(Params * p);
91 
92  Tick read(PacketPtr pkt) override;
93  Tick write(PacketPtr pkt) override;
94 
95  void
97  {
98  IMR = 0xFF;
99  }
100 
101  void
103  {
104  IMR = 0x00;
105  }
106 
107  void signalInterrupt(int line) override;
108  void raiseInterruptPin(int number) override;
109  void lowerInterruptPin(int number) override;
110  int getVector();
111 
112  void serialize(CheckpointOut &cp) const override;
113  void unserialize(CheckpointIn &cp) override;
114 };
115 
116 } // namespace X86ISA
117 
118 #endif //__DEV_X86_I8259_HH__
uint8_t IMR
Definition: i8259.hh:58
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8259.cc:75
I8259(Params *p)
Definition: i8259.cc:39
void lowerInterruptPin(int number) override
Definition: i8259.cc:274
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: i8259.cc:327
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8259.cc:51
Tick latency
Definition: i8259.hh:48
I8259 * slave
Definition: i8259.hh:51
bool edgeTriggered
Definition: i8259.hh:68
PioDeviceParams Params
Definition: io_device.hh:116
bool cascadeMode
Definition: i8259.hh:63
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: i8259.cc:309
bool autoEOI
Definition: i8259.hh:76
uint8_t cascadeBits
Definition: i8259.hh:66
uint8_t ISR
Definition: i8259.hh:56
void handleEOI(int line)
Definition: i8259.cc:221
IntSourcePin * output
Definition: i8259.hh:49
void raiseInterruptPin(int number) override
Definition: i8259.cc:262
uint64_t Tick
Tick count type.
Definition: types.hh:63
static const int NumLines
Definition: i8259.hh:45
bool pinStates[NumLines]
Definition: i8259.hh:46
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
Enums::X86I8259CascadeMode mode
Definition: i8259.hh:50
void maskAll()
Definition: i8259.hh:96
std::ostream CheckpointOut
Definition: serialize.hh:67
void unmaskAll()
Definition: i8259.hh:102
int getVector()
Definition: i8259.cc:284
I8259Params Params
Definition: i8259.hh:82
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:107
uint8_t vectorOffset
Definition: i8259.hh:61
bool expectICW4
Definition: i8259.hh:72
void signalInterrupt(int line) override
Definition: i8259.cc:247
Bitfield< 0 > p
Definition: pagetable.hh:95
void requestInterrupt(int line)
Definition: i8259.cc:231
bool readIRR
Definition: i8259.hh:69
const Params * params() const
Definition: i8259.hh:85
uint8_t IRR
Definition: i8259.hh:54
int initControlWord
Definition: i8259.hh:73

Generated on Fri Jun 9 2017 13:03:47 for gem5 by doxygen 1.8.6