gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  * Authors: Gabe Black
29  */
30 
31 #ifndef __DEV_X86_I8254_HH__
32 #define __DEV_X86_I8254_HH__
33 
34 #include "dev/intel_8254_timer.hh"
35 #include "dev/io_device.hh"
36 #include "params/I8254.hh"
37 
38 namespace X86ISA
39 {
40 
41 class IntSourcePin;
42 
43 class I8254 : public BasicPioDevice
44 {
45  protected:
48  {
49  protected:
51 
52  void
53  counterInterrupt(unsigned int num)
54  {
56  }
57 
58  public:
59  X86Intel8254Timer(const std::string &name, I8254 * _parent) :
60  Intel8254Timer(_parent, name), parent(_parent)
61  {}
62  };
63 
64 
66 
68 
69  void counterInterrupt(unsigned int num);
70 
71  public:
72  typedef I8254Params Params;
73 
74  const Params *
75  params() const
76  {
77  return dynamic_cast<const Params *>(_params);
78  }
79 
80  I8254(Params *p) : BasicPioDevice(p, 4), latency(p->pio_latency),
81  pit(p->name, this), intPin(p->int_pin)
82  {
83  }
84  Tick read(PacketPtr pkt) override;
85 
86  Tick write(PacketPtr pkt) override;
87 
88  bool
89  outputHigh(unsigned int num)
90  {
91  return pit.outputHigh(num);
92  }
93 
94  uint8_t
95  readCounter(unsigned int num)
96  {
97  return pit.readCounter(num);
98  }
99 
100  void
101  writeCounter(unsigned int num, const uint8_t data)
102  {
103  pit.writeCounter(num, data);
104  }
105 
106  void
107  writeControl(uint8_t val)
108  {
109  pit.writeControl(val);
110  }
111 
112  void serialize(CheckpointOut &cp) const override;
113  void unserialize(CheckpointIn &cp) override;
114 
115  void startup() override;
116 
117 };
118 
119 } // namespace X86ISA
120 
121 #endif //__DEV_X86_SOUTH_BRIDGE_I8254_HH__
void writeControl(const CtrlReg data)
Write control word.
Tick latency
Definition: i8254.hh:46
void counterInterrupt(unsigned int num)
Definition: i8254.cc:39
void startup() override
startup() is the final initialization call before simulation.
Definition: i8254.cc:94
Programmable Interval Timer (Intel 8254)
PioDeviceParams Params
Definition: io_device.hh:116
void counterInterrupt(unsigned int num)
Definition: i8254.hh:53
uint8_t readCounter(unsigned int num)
X86Intel8254Timer pit
Definition: i8254.hh:65
void writeCounter(unsigned int num, const uint8_t data)
Bitfield< 63 > val
Definition: misc.hh:770
const char data[]
Definition: circlebuf.cc:43
IntSourcePin * intPin
Definition: i8254.hh:67
bool outputHigh(unsigned int num)
void writeCounter(unsigned int num, const uint8_t data)
Definition: i8254.hh:101
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: i8254.cc:88
void writeControl(uint8_t val)
Definition: i8254.hh:107
uint64_t Tick
Tick count type.
Definition: types.hh:63
bool outputHigh(unsigned int num)
Definition: i8254.hh:89
X86Intel8254Timer(const std::string &name, I8254 *_parent)
Definition: i8254.hh:59
uint8_t readCounter(unsigned int num)
Definition: i8254.hh:95
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
I8254(Params *p)
Definition: i8254.hh:80
virtual const std::string name() const
Definition: sim_object.hh:117
I8254Params Params
Definition: i8254.hh:72
const std::string & name() const
std::ostream CheckpointOut
Definition: serialize.hh:67
const SimObjectParams * _params
Cached copy of the object parameters.
Definition: sim_object.hh:107
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8254.cc:66
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: i8254.cc:82
Bitfield< 0 > p
Definition: pagetable.hh:95
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8254.cc:50
const Params * params() const
Definition: i8254.hh:75

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