gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
33#include "dev/intpin.hh"
34#include "dev/io_device.hh"
35#include "params/I8254.hh"
36
37namespace gem5
38{
39
40namespace X86ISA
41{
42
43class 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 using Params = I8254Params;
73
74 Port &
75 getPort(const std::string &if_name, PortID idx=InvalidPortID) override
76 {
77 if (if_name == "int_pin")
78 return *intPin.at(idx);
79 else
80 return BasicPioDevice::getPort(if_name, idx);
81 }
82
83 I8254(const Params &p) : BasicPioDevice(p, 4), latency(p.pio_latency),
84 pit(p.name, this)
85 {
86 for (int i = 0; i < p.port_int_pin_connection_count; i++) {
88 "%s.int_pin[%d]", name(), i), i, this));
89 }
90 }
91
92 Tick read(PacketPtr pkt) override;
93 Tick write(PacketPtr pkt) override;
94
95 bool
96 outputHigh(unsigned int num)
97 {
98 return pit.outputHigh(num);
99 }
100
101 uint8_t
102 readCounter(unsigned int num)
103 {
104 return pit.readCounter(num);
105 }
106
107 void
108 writeCounter(unsigned int num, const uint8_t data)
109 {
110 pit.writeCounter(num, data);
111 }
112
113 void
115 {
117 }
118
119 void serialize(CheckpointOut &cp) const override;
120 void unserialize(CheckpointIn &cp) override;
121
122 void startup() override;
123
124};
125
126} // namespace X86ISA
127} // namespace gem5
128
129#endif //__DEV_X86_SOUTH_BRIDGE_I8254_HH__
const char data[]
Programmable Interval Timer (Intel 8254)
bool outputHigh(unsigned int num)
void writeCounter(unsigned int num, const uint8_t data)
const std::string & name() const
uint8_t readCounter(unsigned int num)
void writeControl(const CtrlReg data)
Write control word.
virtual std::string name() const
Definition named.hh:47
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition io_device.cc:67
Ports are used to interface objects to each other.
Definition port.hh:62
void counterInterrupt(unsigned int num)
Definition i8254.hh:53
X86Intel8254Timer(const std::string &name, I8254 *_parent)
Definition i8254.hh:59
uint8_t readCounter(unsigned int num)
Definition i8254.hh:102
void writeControl(uint8_t val)
Definition i8254.hh:114
bool outputHigh(unsigned int num)
Definition i8254.hh:96
void writeCounter(unsigned int num, const uint8_t data)
Definition i8254.hh:108
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition i8254.cc:91
I8254(const Params &p)
Definition i8254.hh:83
I8254Params Params
Definition i8254.hh:72
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition i8254.hh:75
std::vector< IntSourcePin< I8254 > * > intPin
Definition i8254.hh:67
void startup() override
startup() is the final initialization call before simulation.
Definition i8254.cc:97
X86Intel8254Timer pit
Definition i8254.hh:65
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition i8254.cc:69
void counterInterrupt(unsigned int num)
Definition i8254.cc:40
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition i8254.cc:53
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition i8254.cc:85
STL vector class.
Definition stl.hh:37
Bitfield< 7 > i
Definition misc_types.hh:67
Bitfield< 63 > val
Definition misc.hh:804
Bitfield< 0 > p
Definition pagetable.hh:151
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
const PortID InvalidPortID
Definition types.hh:246
std::ostream CheckpointOut
Definition serialize.hh:66
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition types.hh:245
uint64_t Tick
Tick count type.
Definition types.hh:58
std::string csprintf(const char *format, const Args &...args)
Definition cprintf.hh:161

Generated on Tue Jun 18 2024 16:24:04 for gem5 by doxygen 1.11.0