gem5  v22.1.0.0
i8237.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_I8237_HH__
30 #define __DEV_X86_I8237_HH__
31 
32 #include <array>
33 
34 #include "dev/io_device.hh"
35 #include "dev/reg_bank.hh"
36 #include "params/I8237.hh"
37 
38 namespace gem5
39 {
40 
41 namespace X86ISA
42 {
43 
44 class I8237 : public BasicPioDevice
45 {
46  public:
48 
49  protected:
51  uint8_t maskVal;
52  //XXX These should be serialized.
53  uint8_t requestVal;
54  uint8_t commandVal;
55  uint8_t statusVal;
56  uint8_t tempVal;
57  bool highByte;
58 
60 
61  struct Channel
62  {
63  class ChannelAddrReg : public Register
64  {
65  public:
67  };
68 
70  {
71  public:
73  };
74 
75  int number;
76 
77  //XXX These should be serialized.
78  uint8_t mode = 0x0;
79 
82 
83  Channel(int _num) : number(_num), addrReg(*this), remainingReg(*this)
84  {}
85  };
86 
87  class WriteOnlyReg : public Register
88  {
89  public:
90  WriteOnlyReg(const std::string &new_name, Addr offset);
91  };
92 
93  std::array<Channel, 4> channels;
94 
103 
104  void reset();
105  void setMaskBit(Register &reg, const uint8_t &command);
106  void setRequestBit(Register &reg, const uint8_t &command);
107 
108  public:
109  using Params = I8237Params;
110 
111  I8237(const Params &p);
112 
113  Tick read(PacketPtr pkt) override;
114  Tick write(PacketPtr pkt) override;
115 
116  void serialize(CheckpointOut &cp) const override;
117  void unserialize(CheckpointIn &cp) override;
118 };
119 
120 } // namespace X86ISA
121 } // namespace gem5
122 
123 #endif //__DEV_X86_I8237_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
PioDeviceParams Params
Definition: io_device.hh:134
WriteOnlyReg(const std::string &new_name, Addr offset)
Definition: i8237.cc:76
WriteOnlyReg modeReg
Definition: i8237.hh:98
void setMaskBit(Register &reg, const uint8_t &command)
Definition: i8237.cc:151
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8237.cc:169
uint8_t requestVal
Definition: i8237.hh:53
WriteOnlyReg clearMaskReg
Definition: i8237.hh:101
WriteOnlyReg requestReg
Definition: i8237.hh:96
std::array< Channel, 4 > channels
Definition: i8237.hh:93
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: i8237.cc:191
uint8_t maskVal
Definition: i8237.hh:51
void setRequestBit(Register &reg, const uint8_t &command)
Definition: i8237.cc:160
uint8_t commandVal
Definition: i8237.hh:54
uint8_t statusVal
Definition: i8237.hh:55
Register statusCommandReg
Definition: i8237.hh:95
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: i8237.cc:185
RegisterBankLE::Register8 Register
Definition: i8237.hh:47
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: i8237.cc:177
WriteOnlyReg clearFlipFlopReg
Definition: i8237.hh:99
I8237(const Params &p)
Definition: i8237.cc:84
Register temporaryMasterClearReg
Definition: i8237.hh:100
WriteOnlyReg setMaskBitReg
Definition: i8237.hh:97
uint8_t tempVal
Definition: i8237.hh:56
WriteOnlyReg writeMaskReg
Definition: i8237.hh:102
RegisterBankLE regs
Definition: i8237.hh:59
Bitfield< 5, 3 > reg
Definition: types.hh:92
Bitfield< 0 > p
Definition: pagetable.hh:151
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::ostream CheckpointOut
Definition: serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t Tick
Tick count type.
Definition: types.hh:58
ChannelAddrReg addrReg
Definition: i8237.hh:80
ChannelRemainingReg remainingReg
Definition: i8237.hh:81

Generated on Wed Dec 21 2022 10:22:35 for gem5 by doxygen 1.9.1