StuBS
pit.cc File Reference
#include "machine/pit.h"
#include "machine/ioport.h"
#include "machine/core.h"
Include dependency graph for pit.cc:

Classes

union  PIT::Mode
union  PIT::Control

Namespaces

namespace  PIT
 Abstraction of the historical Programmable Interval Timer (PIT).

Enumerations

enum  PIT::AccessMode {
  PIT::LATCH_COUNT_VALUE = 0 ,
  PIT::LOW_BYTE_ONLY = 1 ,
  PIT::HIGH_BYTE_ONLY = 2 ,
  PIT::LOW_AND_HIGH_BYTE = 3
}
 Access mode. More...
enum  PIT::OperatingMode {
  PIT::INTERRUPT_ON_TERMINAL_COUNT = 0 ,
  PIT::PROGRAMMABLE_ONE_SHOT = 1 ,
  PIT::RATE_GENERATOR = 2 ,
  PIT::SQUARE_WAVE_GENERATOR = 3 ,
  PIT::SOFTWARE_TRIGGERED_STROBE = 4 ,
  PIT::HARDWARE_TRIGGERED_STROBE = 5
}
 Operating Mode. More...
enum  PIT::Format {
  PIT::BINARY = 0 ,
  PIT::BCD = 1
}
 data format More...

Functions

static IOPort PIT::data (0x40+CHANNEL)
bool PIT::set (uint16_t us)
 Start timer.
uint16_t PIT::get (void)
 Reads the current timer value.
bool PIT::isActive (void)
 Check if the timer is running.
bool PIT::waitForTimeout (void)
 (Active) waiting for timeout
bool PIT::delay (uint16_t us)
 Set the timer and wait for timeout.
void PIT::pcspeaker (uint32_t freq)
 Play a given frequency on the PC speaker.
void PIT::disable (void)
 Deactivate the timer.

Constants

const uint8_t PIT::CHANNEL = 2
static IOPort PIT::mode_register (0x43)
static IOPort PIT::controlRegister (0x61)
const uint64_t PIT::BASE_FREQUENCY = 1193182ULL