Max OS 0.3
Loading...
Searching...
No Matches
clock.h File Reference

Defines drivers for the Programmable Interval Timer (PIT) and APIC Clock. More...

#include <cstdint>
#include <common/time.h>
#include <drivers/driver.h>
#include <hardwarecommunication/interrupts.h>
#include <hardwarecommunication/apic.h>
#include <common/vector.h>
#include <common/eventHandler.h>

Go to the source code of this file.

Classes

struct  MaxOS::drivers::clock::PITCommand
 The command byte to send to the PIT, specifies the channel, access mode, operating mode and BCD mode. More...
 
class  MaxOS::drivers::clock::PIT
 Driver for the Programmable Interval Timer. More...
 
class  MaxOS::drivers::clock::Clock
 Driver for the APIC clock. More...
 

Typedefs

typedef struct MaxOS::drivers::clock::PITCommand MaxOS::drivers::clock::pit_command_t
 Alias for PITCommand struct.
 

Enumerations

enum class  MaxOS::drivers::clock::Channel { INTERRUPT , DRAM_REFRESH , SPEAKER }
 Where should the PIT raise an event to. More...
 
enum class  MaxOS::drivers::clock::AccessMode { LATCH_COUNT , LOW_BYTE , HIGH_BYTE , LOW_HIGH_BYTE }
 What mode should the PIT use for the selected channel. More...
 
enum class  MaxOS::drivers::clock::OperatingMode {
  INTERRUPT_ON_TERMINAL_COUNT , ONE_SHOT , RATE_GENERATOR , SQUARE_WAVE ,
  SOFTWARE_STROBE , HARDWARE_STROBE
}
 What should the PIT do. More...
 
enum class  MaxOS::drivers::clock::BCDMode { BINARY , BCD }
 Specifies the data encoding mode used by the PIT. More...
 

Variables

constexpr uint16_t MaxOS::drivers::clock::TICK_CALIBRATE_LENGTH = 10
 How many loops to spin for calibration.
 

Detailed Description

Defines drivers for the Programmable Interval Timer (PIT) and APIC Clock.

Date
10th April 2023
Author
Max Tyson

Definition in file clock.h.

Enumeration Type Documentation

◆ AccessMode

What mode should the PIT use for the selected channel.

Definition at line 39 of file clock.h.

39 {
40 LATCH_COUNT,
41 LOW_BYTE,
42 HIGH_BYTE,
43 LOW_HIGH_BYTE,
44 };

◆ BCDMode

enum class MaxOS::drivers::clock::BCDMode
strong

Specifies the data encoding mode used by the PIT.

Definition at line 63 of file clock.h.

63 {
64 BINARY,
65 BCD,
66 };

◆ Channel

enum class MaxOS::drivers::clock::Channel
strong

Where should the PIT raise an event to.

Warning
DRAM_REFRESH may not exist on all systems

Definition at line 29 of file clock.h.

29 {
30 INTERRUPT,
31 DRAM_REFRESH,
32 SPEAKER,
33 };

◆ OperatingMode

What should the PIT do.

Definition at line 50 of file clock.h.

50 {
51 INTERRUPT_ON_TERMINAL_COUNT,
52 ONE_SHOT,
53 RATE_GENERATOR,
54 SQUARE_WAVE,
55 SOFTWARE_STROBE,
56 HARDWARE_STROBE,
57 };

Variable Documentation

◆ TICK_CALIBRATE_LENGTH

constexpr uint16_t MaxOS::drivers::clock::TICK_CALIBRATE_LENGTH = 10
constexpr

How many loops to spin for calibration.

Definition at line 89 of file clock.h.