2 * Copyright (c) 2008 The Regents of The University of Michigan
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.
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.
31 #ifndef __DEV_X86_I8254_HH__
32 #define __DEV_X86_I8254_HH__
34 #include "dev/intel_8254_timer.hh"
35 #include "dev/io_device.hh"
36 #include "params/I8254.hh"
43 class I8254 : public BasicPioDevice
47 class X86Intel8254Timer : public Intel8254Timer
53 counterInterrupt(unsigned int num)
55 parent->counterInterrupt(num);
59 X86Intel8254Timer(const std::string &name, I8254 * _parent) :
60 Intel8254Timer(_parent, name), parent(_parent)
65 X86Intel8254Timer pit;
69 void counterInterrupt(unsigned int num);
72 typedef I8254Params Params;
77 return dynamic_cast<const Params *>(_params);
80 I8254(Params *p) : BasicPioDevice(p, 4), latency(p->pio_latency),
81 pit(p->name, this), intPin(p->int_pin)
84 Tick read(PacketPtr pkt);
86 Tick write(PacketPtr pkt);
89 outputHigh(unsigned int num)
91 return pit.outputHigh(num);
95 readCounter(unsigned int num)
97 return pit.readCounter(num);
101 writeCounter(unsigned int num, const uint8_t data)
103 pit.writeCounter(num, data);
107 writeControl(uint8_t val)
109 pit.writeControl(val);
112 virtual void serialize(std::ostream &os);
113 virtual void unserialize(Checkpoint *cp, const std::string §ion);
114 virtual void startup();
118 } // namespace X86ISA
120 #endif //__DEV_X86_SOUTH_BRIDGE_I8254_HH__