gem5  v20.1.0.0
i8254.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 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_I8254_HH__
30 #define __DEV_X86_I8254_HH__
31 
32 #include "dev/intel_8254_timer.hh"
33 #include "dev/intpin.hh"
34 #include "dev/io_device.hh"
35 #include "params/I8254.hh"
36 
37 namespace X86ISA
38 {
39 
40 class I8254 : public BasicPioDevice
41 {
42  protected:
45  {
46  protected:
48 
49  void
50  counterInterrupt(unsigned int num)
51  {
53  }
54 
55  public:
56  X86Intel8254Timer(const std::string &name, I8254 * _parent) :
57  Intel8254Timer(_parent, name), parent(_parent)
58  {}
59  };
60 
61 
63 
65 
66  void counterInterrupt(unsigned int num);
67 
68  public:
69  typedef I8254Params Params;
70 
71  Port &
72  getPort(const std::string &if_name, PortID idx=InvalidPortID) override
73  {
74  if (if_name == "int_pin")
75  return *intPin.at(idx);
76  else
77  return BasicPioDevice::getPort(if_name, idx);
78  }
79 
80  const Params *
81  params() const
82  {
83  return dynamic_cast<const Params *>(_params);
84  }
85 
86  I8254(Params *p) : BasicPioDevice(p, 4), latency(p->pio_latency),
87  pit(p->name, this)
88  {
89  for (int i = 0; i < p->port_int_pin_connection_count; i++) {
90  intPin.push_back(new IntSourcePin<I8254>(csprintf(
91  "%s.int_pin[%d]", name(), i), i, this));
92  }
93  }
94  Tick read(PacketPtr pkt) override;
95 
96  Tick write(PacketPtr pkt) override;
97 
98  bool
99  outputHigh(unsigned int num)
100  {
101  return pit.outputHigh(num);
102  }
103 
104  uint8_t
105  readCounter(unsigned int num)
106  {
107  return pit.readCounter(num);
108  }
109 
110  void
111  writeCounter(unsigned int num, const uint8_t data)
112  {
113  pit.writeCounter(num, data);
114  }
115 
116  void
117  writeControl(uint8_t val)
118  {
120  }
121 
122  void serialize(CheckpointOut &cp) const override;
123  void unserialize(CheckpointIn &cp) override;
124 
125  void startup() override;
126 
127 };
128 
129 } // namespace X86ISA
130 
131 #endif //__DEV_X86_SOUTH_BRIDGE_I8254_HH__
Intel8254Timer::readCounter
uint8_t readCounter(unsigned int num)
Definition: intel_8254_timer.hh:220
io_device.hh
data
const char data[]
Definition: circlebuf.test.cc:42
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
X86ISA::I8254::X86Intel8254Timer
Definition: i8254.hh:44
IntSourcePin
Definition: intpin.hh:109
X86ISA::I8254::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: i8254.cc:88
X86ISA::I8254::latency
Tick latency
Definition: i8254.hh:43
Intel8254Timer::writeCounter
void writeCounter(unsigned int num, const uint8_t data)
Definition: intel_8254_timer.hh:227
X86ISA::I8254::I8254
I8254(Params *p)
Definition: i8254.hh:86
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
X86ISA::I8254::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: i8254.cc:94
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
Intel8254Timer::writeControl
void writeControl(const CtrlReg data)
Write control word.
Definition: intel_8254_timer.cc:54
std::vector
STL vector class.
Definition: stl.hh:37
Intel8254Timer::outputHigh
bool outputHigh(unsigned int num)
Definition: intel_8254_timer.hh:234
X86ISA::I8254::params
const Params * params() const
Definition: i8254.hh:81
X86ISA::I8254::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: i8254.cc:82
X86ISA::I8254::X86Intel8254Timer::X86Intel8254Timer
X86Intel8254Timer(const std::string &name, I8254 *_parent)
Definition: i8254.hh:56
Intel8254Timer::name
const std::string & name() const
Definition: intel_8254_timer.hh:194
X86ISA::I8254::writeCounter
void writeCounter(unsigned int num, const uint8_t data)
Definition: i8254.hh:111
X86ISA::I8254::pit
X86Intel8254Timer pit
Definition: i8254.hh:62
X86ISA::I8254::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8254.cc:66
X86ISA::I8254
Definition: i8254.hh:40
cp
Definition: cprintf.cc:40
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
X86ISA::I8254::writeControl
void writeControl(uint8_t val)
Definition: i8254.hh:117
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
Intel8254Timer
Programmable Interval Timer (Intel 8254)
Definition: intel_8254_timer.hh:43
PioDevice::Params
PioDeviceParams Params
Definition: io_device.hh:131
X86ISA::I8254::intPin
std::vector< IntSourcePin< I8254 > * > intPin
Definition: i8254.hh:64
X86ISA::I8254::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: i8254.hh:72
X86ISA::I8254::X86Intel8254Timer::parent
I8254 * parent
Definition: i8254.hh:47
X86ISA::I8254::readCounter
uint8_t readCounter(unsigned int num)
Definition: i8254.hh:105
X86ISA::val
Bitfield< 63 > val
Definition: misc.hh:769
X86ISA
This is exposed globally, independent of the ISA.
Definition: acpi.hh:55
X86ISA::I8254::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8254.cc:50
intel_8254_timer.hh
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:133
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::I8254::outputHigh
bool outputHigh(unsigned int num)
Definition: i8254.hh:99
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::I8254::X86Intel8254Timer::counterInterrupt
void counterInterrupt(unsigned int num)
Definition: i8254.hh:50
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
X86ISA::I8254::Params
I8254Params Params
Definition: i8254.hh:69
X86ISA::I8254::counterInterrupt
void counterInterrupt(unsigned int num)
Definition: i8254.cc:37
intpin.hh
CheckpointIn
Definition: serialize.hh:67
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158

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