gem5
v20.0.0.3
|
Counter element for PIT. More...
#include <intel_8254_timer.hh>
Classes | |
class | CounterEvent |
Event for counter interrupt. More... | |
Public Member Functions | |
Counter (Intel8254Timer *p, const std::string &name, unsigned int num) | |
void | latchCount () |
Latch the current count (if one is not already latched) More... | |
int | currentCount () |
Get the current count for this counter. More... | |
void | setRW (int rw_val) |
Set the read/write mode. More... | |
void | setMode (int mode_val) |
Set operational mode. More... | |
void | setBCD (int bcd_val) |
Set count encoding. More... | |
uint8_t | read () |
Read a count byte. More... | |
void | write (const uint8_t data) |
Write a count byte. More... | |
bool | outputHigh () |
Is the output high? More... | |
void | serialize (const std::string &base, CheckpointOut &cp) const |
Serialize this object to the given output stream. More... | |
void | unserialize (const std::string &base, CheckpointIn &cp) |
Reconstruct the state of this object from a checkpoint. More... | |
void | startup () |
Start ticking. More... | |
Private Types | |
enum | { LSB, MSB } |
Set of values for read_byte and write_byte. More... | |
Private Member Functions | |
const std::string & | name () const |
Private Attributes | |
std::string | _name |
unsigned int | num |
CounterEvent | event |
bool | running |
True after startup is called. More... | |
uint16_t | initial_count |
Initial count value. More... | |
uint16_t | latched_count |
Latched count. More... | |
uint16_t | period |
Interrupt period. More... | |
Tick | offset |
When to start ticking. More... | |
uint8_t | mode |
Current mode of operation. More... | |
bool | output_high |
Output goes high when the counter reaches zero. More... | |
bool | latch_on |
State of the count latch. More... | |
uint8_t | read_byte |
Determine which byte of a 16-bit count value to read/write. More... | |
uint8_t | write_byte |
Intel8254Timer * | parent |
Pointer to container. More... | |
Counter element for PIT.
Definition at line 77 of file intel_8254_timer.hh.
|
private |
Set of values for read_byte and write_byte.
Enumerator | |
---|---|
LSB | |
MSB |
Definition at line 138 of file intel_8254_timer.hh.
Intel8254Timer::Counter::Counter | ( | Intel8254Timer * | p, |
const std::string & | name, | ||
unsigned int | num | ||
) |
Definition at line 96 of file intel_8254_timer.cc.
int Intel8254Timer::Counter::currentCount | ( | ) |
Get the current count for this counter.
Definition at line 118 of file intel_8254_timer.cc.
References mode, Intel8254Timer::RateGen, Intel8254Timer::SquareWave, and warn_once.
Referenced by latchCount(), and read().
void Intel8254Timer::Counter::latchCount | ( | ) |
Latch the current count (if one is not already latched)
Definition at line 107 of file intel_8254_timer.cc.
References currentCount(), latch_on, latched_count, LSB, and read_byte.
|
inlineprivate |
Definition at line 107 of file intel_8254_timer.hh.
References _name.
bool Intel8254Timer::Counter::outputHigh | ( | ) |
Is the output high?
Definition at line 222 of file intel_8254_timer.cc.
References output_high.
Referenced by Intel8254Timer::outputHigh().
uint8_t Intel8254Timer::Counter::read | ( | ) |
Read a count byte.
Definition at line 132 of file intel_8254_timer.cc.
References X86ISA::count, currentCount(), latch_on, latched_count, LSB, MSB, panic, and read_byte.
Referenced by Intel8254Timer::readCounter().
void Intel8254Timer::Counter::serialize | ( | const std::string & | base, |
CheckpointOut & | cp | ||
) | const |
Serialize this object to the given output stream.
base | The base name of the counter object. |
os | The stream to serialize to. |
Definition at line 228 of file intel_8254_timer.cc.
References curTick(), event, initial_count, latch_on, latched_count, mode, output_high, paramOut(), period, read_byte, Event::scheduled(), Event::when(), and write_byte.
void Intel8254Timer::Counter::setBCD | ( | int | bcd_val | ) |
void Intel8254Timer::Counter::setMode | ( | int | mode_val | ) |
Set operational mode.
Definition at line 205 of file intel_8254_timer.cc.
References Intel8254Timer::InitTc, mode, panic, Intel8254Timer::RateGen, and Intel8254Timer::SquareWave.
void Intel8254Timer::Counter::setRW | ( | int | rw_val | ) |
Set the read/write mode.
Definition at line 198 of file intel_8254_timer.cc.
References panic, and Intel8254Timer::TwoPhase.
void Intel8254Timer::Counter::startup | ( | ) |
Start ticking.
Definition at line 264 of file intel_8254_timer.cc.
References curTick(), event, offset, parent, period, running, and EventManager::schedule().
Referenced by Intel8254Timer::outputHigh().
void Intel8254Timer::Counter::unserialize | ( | const std::string & | base, |
CheckpointIn & | cp | ||
) |
Reconstruct the state of this object from a checkpoint.
base | The base name of the counter object. |
cp | The checkpoint use. |
section | The section name of this object |
Definition at line 246 of file intel_8254_timer.cc.
References event, initial_count, latch_on, latched_count, mode, offset, output_high, paramIn(), period, read_byte, Event::scheduled(), and write_byte.
void Intel8254Timer::Counter::write | ( | const uint8_t | data | ) |
Write a count byte.
Definition at line 166 of file intel_8254_timer.cc.
References EventManager::deschedule(), event, initial_count, LSB, mode, MSB, offset, output_high, parent, period, Intel8254Timer::RateGen, running, Event::scheduled(), Intel8254Timer::SquareWave, and write_byte.
Referenced by Intel8254Timer::writeCounter().
|
private |
Definition at line 106 of file intel_8254_timer.hh.
Referenced by name(), and Intel8254Timer::name().
|
private |
Definition at line 111 of file intel_8254_timer.hh.
Referenced by serialize(), startup(), unserialize(), and write().
|
private |
Initial count value.
Definition at line 117 of file intel_8254_timer.hh.
Referenced by serialize(), unserialize(), and write().
|
private |
State of the count latch.
Definition at line 135 of file intel_8254_timer.hh.
Referenced by latchCount(), read(), serialize(), and unserialize().
|
private |
Latched count.
Definition at line 120 of file intel_8254_timer.hh.
Referenced by latchCount(), read(), serialize(), and unserialize().
|
private |
Current mode of operation.
Definition at line 129 of file intel_8254_timer.hh.
Referenced by currentCount(), Intel8254Timer::Counter::CounterEvent::process(), serialize(), setMode(), unserialize(), and write().
|
private |
Definition at line 109 of file intel_8254_timer.hh.
Referenced by Intel8254Timer::outputHigh(), Intel8254Timer::Counter::CounterEvent::process(), Intel8254Timer::readCounter(), and Intel8254Timer::writeCounter().
|
private |
When to start ticking.
Definition at line 126 of file intel_8254_timer.hh.
Referenced by Counter(), startup(), unserialize(), and write().
|
private |
Output goes high when the counter reaches zero.
Definition at line 132 of file intel_8254_timer.hh.
Referenced by outputHigh(), Intel8254Timer::Counter::CounterEvent::process(), serialize(), unserialize(), and write().
|
private |
Pointer to container.
Definition at line 144 of file intel_8254_timer.hh.
Referenced by Intel8254Timer::Counter::CounterEvent::process(), Intel8254Timer::Counter::CounterEvent::setTo(), startup(), and write().
|
private |
Interrupt period.
Definition at line 123 of file intel_8254_timer.hh.
Referenced by Counter(), Intel8254Timer::Counter::CounterEvent::process(), serialize(), startup(), unserialize(), and write().
|
private |
Determine which byte of a 16-bit count value to read/write.
Definition at line 141 of file intel_8254_timer.hh.
Referenced by latchCount(), read(), serialize(), and unserialize().
|
private |
True after startup is called.
Definition at line 114 of file intel_8254_timer.hh.
|
private |
Definition at line 141 of file intel_8254_timer.hh.
Referenced by serialize(), unserialize(), and write().