gem5  v21.1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
i8042.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_I8042_HH__
30 #define __DEV_X86_I8042_HH__
31 
32 #include <deque>
33 
34 #include "base/bitunion.hh"
35 #include "dev/intpin.hh"
36 #include "dev/io_device.hh"
37 #include "dev/ps2/device.hh"
38 #include "params/I8042.hh"
39 
40 namespace gem5
41 {
42 
43 namespace X86ISA
44 {
45 
46 class I8042 : public BasicPioDevice
47 {
48  protected:
49  enum Command
50  {
56  LoadPassword = 0xA5,
57  CheckPassword = 0xA6,
58  DisableMouse = 0xA7,
59  EnableMouse = 0xA8,
60  TestMouse = 0xA9,
61  SelfTest = 0xAA,
62  InterfaceTest = 0xAB,
66  ReadInputPort = 0xC0,
73  WriteToMouse = 0xD4,
74  DisableA20 = 0xDD,
75  EnableA20 = 0xDF,
78  SystemReset = 0xFE
79  };
80 
81  BitUnion8(StatusReg)
82  Bitfield<7> parityError;
83  Bitfield<6> timeout;
84  Bitfield<5> mouseOutputFull;
85  Bitfield<4> keyboardUnlocked;
86  Bitfield<3> commandLast;
87  Bitfield<2> passedSelfTest;
88  Bitfield<1> inputFull;
89  Bitfield<0> outputFull;
90  EndBitUnion(StatusReg)
91 
92  BitUnion8(CommandByte)
93  Bitfield<6> convertScanCodes;
94  Bitfield<5> disableMouse;
95  Bitfield<4> disableKeyboard;
96  Bitfield<2> passedSelfTest;
97  Bitfield<1> mouseFullInt;
98  Bitfield<0> keyboardFullInt;
99  EndBitUnion(CommandByte)
100 
101  Tick latency;
104 
105  StatusReg statusReg;
106  CommandByte commandByte;
107 
108  uint8_t dataReg;
109 
110  static const uint16_t NoCommand = (uint16_t)(-1);
111  uint16_t lastCommand;
112 
115 
118 
119  void writeData(uint8_t newData, bool mouse = false);
120  uint8_t readDataOut();
121 
122  public:
123  using Params = I8042Params;
124 
125  I8042(const Params &p);
126 
127  Port &
128  getPort(const std::string &if_name, PortID idx=InvalidPortID) override
129  {
130  if (if_name == "mouse_int_pin")
131  return *mouseIntPin.at(idx);
132  else if (if_name == "keyboard_int_pin")
133  return *keyboardIntPin.at(idx);
134  else
135  return BasicPioDevice::getPort(if_name, idx);
136  }
137 
138  AddrRangeList getAddrRanges() const override;
139 
140  Tick read(PacketPtr pkt) override;
141 
142  Tick write(PacketPtr pkt) override;
143 
144  void serialize(CheckpointOut &cp) const override;
145  void unserialize(CheckpointIn &cp) override;
146 };
147 
148 } // namespace X86ISA
149 } // namespace gem5
150 
151 #endif //__DEV_X86_I8042_HH__
gem5::X86ISA::I8042::EnableKeyboard
@ EnableKeyboard
Definition: i8042.hh:65
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:252
gem5::X86ISA::I8042::keyboardUnlocked
Bitfield< 4 > keyboardUnlocked
Definition: i8042.hh:85
io_device.hh
gem5::X86ISA::I8042::DisableA20
@ DisableA20
Definition: i8042.hh:74
gem5::X86ISA::I8042::mouseOutputFull
Bitfield< 5 > mouseOutputFull
Definition: i8042.hh:84
gem5::X86ISA::I8042::BitUnion8
BitUnion8(StatusReg) Bitfield< 7 > parityError
gem5::X86ISA::I8042::SelfTest
@ SelfTest
Definition: i8042.hh:61
gem5::X86ISA::I8042::outputFull
Bitfield< 0 > outputFull
Definition: i8042.hh:89
gem5::X86ISA::I8042::DisableMouse
@ DisableMouse
Definition: i8042.hh:58
gem5::X86ISA::I8042::writeData
void writeData(uint8_t newData, bool mouse=false)
Definition: i8042.cc:90
gem5::X86ISA::I8042::disableMouse
Bitfield< 5 > disableMouse
Definition: i8042.hh:94
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::X86ISA::I8042::mouse
ps2::Device * mouse
Definition: i8042.hh:116
gem5::X86ISA::I8042::GetCommandByte
@ GetCommandByte
Definition: i8042.hh:51
gem5::X86ISA::I8042::dataReg
uint8_t dataReg
Definition: i8042.hh:108
gem5::X86ISA::I8042::WriteToMouse
@ WriteToMouse
Definition: i8042.hh:73
gem5::X86ISA::I8042::SystemReset
@ SystemReset
Definition: i8042.hh:78
gem5::X86ISA::I8042::WriteControllerRamBase
@ WriteControllerRamBase
Definition: i8042.hh:54
std::vector
STL vector class.
Definition: stl.hh:37
gem5::X86ISA::I8042::PulseOutputBitBase
@ PulseOutputBitBase
Definition: i8042.hh:77
gem5::X86ISA::I8042::ReadTestInputs
@ ReadTestInputs
Definition: i8042.hh:76
gem5::X86ISA::I8042::ReadOutputPort
@ ReadOutputPort
Definition: i8042.hh:69
gem5::X86ISA::I8042::ReadInputPort
@ ReadInputPort
Definition: i8042.hh:66
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:253
gem5::X86ISA::I8042::WriteCommandByte
@ WriteCommandByte
Definition: i8042.hh:53
gem5::X86ISA::I8042::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: i8042.cc:291
gem5::X86ISA::I8042::write
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8042.cc:147
gem5::X86ISA::I8042::keyboard
ps2::Device * keyboard
Definition: i8042.hh:117
gem5::X86ISA::I8042::NoCommand
static const uint16_t NoCommand
Definition: i8042.hh:110
gem5::X86ISA::I8042::DiagnosticDump
@ DiagnosticDump
Definition: i8042.hh:63
gem5::PioDevice::Params
PioDeviceParams Params
Definition: io_device.hh:134
gem5::X86ISA::I8042::timeout
Bitfield< 6 > timeout
Definition: i8042.hh:83
gem5::X86ISA::I8042::InterfaceTest
@ InterfaceTest
Definition: i8042.hh:62
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::X86ISA::I8042::EnableMouse
@ EnableMouse
Definition: i8042.hh:59
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::X86ISA::I8042::ContinuousPollLow
@ ContinuousPollLow
Definition: i8042.hh:67
gem5::X86ISA::I8042::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: i8042.hh:128
bitunion.hh
gem5::X86ISA::I8042::I8042
I8042(const Params &p)
Definition: i8042.cc:50
gem5::X86ISA::I8042::WriteKeyboardOutputBuff
@ WriteKeyboardOutputBuff
Definition: i8042.hh:71
gem5::X86ISA::I8042::ContinuousPollHigh
@ ContinuousPollHigh
Definition: i8042.hh:68
gem5::X86ISA::I8042::inputFull
Bitfield< 1 > inputFull
Definition: i8042.hh:88
gem5::X86ISA::I8042::dataPort
Addr dataPort
Definition: i8042.hh:102
gem5::X86ISA::I8042::readDataOut
uint8_t readDataOut()
Definition: i8042.cc:114
gem5::X86ISA::I8042::commandByte
CommandByte commandByte
Definition: i8042.hh:106
gem5::X86ISA::I8042::LoadPassword
@ LoadPassword
Definition: i8042.hh:56
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::X86ISA::I8042::keyboardIntPin
std::vector< IntSourcePin< I8042 > * > keyboardIntPin
Definition: i8042.hh:114
device.hh
gem5::X86ISA::I8042::getAddrRanges
AddrRangeList getAddrRanges() const override
Determine the address ranges that this device responds to.
Definition: i8042.cc:80
gem5::X86ISA::I8042::ReadControllerRamBase
@ ReadControllerRamBase
Definition: i8042.hh:52
gem5::X86ISA::I8042::passedSelfTest
Bitfield< 2 > passedSelfTest
Definition: i8042.hh:87
gem5::ps2::Device
Definition: device.hh:60
gem5::X86ISA::I8042::read
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8042.cc:128
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::X86ISA::I8042::CheckPassword
@ CheckPassword
Definition: i8042.hh:57
gem5::X86ISA::I8042::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: i8042.cc:302
gem5::X86ISA::I8042::WriteMouseOutputBuff
@ WriteMouseOutputBuff
Definition: i8042.hh:72
gem5::X86ISA::I8042::disableKeyboard
Bitfield< 4 > disableKeyboard
Definition: i8042.hh:95
gem5::X86ISA::I8042::mouseIntPin
std::vector< IntSourcePin< I8042 > * > mouseIntPin
Definition: i8042.hh:113
gem5::X86ISA::I8042::lastCommand
uint16_t lastCommand
Definition: i8042.hh:111
gem5::X86ISA::p
Bitfield< 0 > p
Definition: pagetable.hh:151
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
intpin.hh
gem5::X86ISA::I8042::EnableA20
@ EnableA20
Definition: i8042.hh:75
gem5::X86ISA::I8042
Definition: i8042.hh:46
gem5::X86ISA::I8042::EndBitUnion
EndBitUnion(StatusReg) BitUnion8(CommandByte) Bitfield< 6 > convertScanCodes
gem5::X86ISA::I8042::commandLast
Bitfield< 3 > commandLast
Definition: i8042.hh:86
std::list< AddrRange >
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::X86ISA::I8042::TestMouse
@ TestMouse
Definition: i8042.hh:60
gem5::X86ISA::I8042::Command
Command
Definition: i8042.hh:49
gem5::X86ISA::I8042::mouseFullInt
Bitfield< 1 > mouseFullInt
Definition: i8042.hh:97
gem5::BasicPioDevice
Definition: io_device.hh:147
gem5::X86ISA::I8042::CheckForPassword
@ CheckForPassword
Definition: i8042.hh:55
gem5::X86ISA::I8042::WriteOutputPort
@ WriteOutputPort
Definition: i8042.hh:70
gem5::X86ISA::I8042::statusReg
StatusReg statusReg
Definition: i8042.hh:105
gem5::X86ISA::I8042::keyboardFullInt
Bitfield< 0 > keyboardFullInt
Definition: i8042.hh:98
gem5::X86ISA::I8042::commandPort
Addr commandPort
Definition: i8042.hh:103
gem5::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:67
gem5::X86ISA::I8042::DisableKeyboard
@ DisableKeyboard
Definition: i8042.hh:64

Generated on Wed Jul 28 2021 12:10:27 for gem5 by doxygen 1.8.17