48 constinit static pit_t
pit {};
57 const auto requested {(frequency < PIT_MIN_FREQUENCY) ? PIT_MIN_FREQUENCY : frequency};
73 "PIT frequency:\t%d Hz\n",
101 if ((0_u16 !=
pit.frequency) && (0_usize == (
pit.ticks %
pit.frequency))) [[unlikely]] {
107 const auto seconds {
static_cast<igros_dword_t>(res.quotient)};
108 const auto minutes {seconds / 60_u32};
109 const auto hours {minutes / 60_u32};
113 "Time:\t%02d:%02d:%02d.%03d (~1 sec.)\n",
static auto readPort8(const port_t addr) noexcept -> igros_byte_t
Read byte from port.
static void writePort8(const port_t addr, const igros_byte_t value) noexcept
Write byte to port.
static void install() noexcept
Install IRQ handler.
static void unmask(const irq_t number) noexcept
Unmask interrupt.
std::uint16_t igros_word_t
16-bit unsigned integer
std::size_t igros_usize_t
Unsigned size.
std::uint8_t igros_byte_t
8-bit unsigned integer
std::uint32_t igros_dword_t
32-bit unsigned integer
std::uint64_t igros_quad_t
64-bit unsigned integer
Architecture interrupts type deduction.
Kernel math functions definitions.
Kernel text print functions.
Architecture-independent interface: drivers and aliases of current architecture types.
static void pitInterruptHandler(const register_t *regs) noexcept
PIT interrupt (#0) handler.
void pitSetupFrequency(const igros_word_t frequency) noexcept
Setup PIT frequency.
constexpr auto PIT_CHANNEL_0
Channel 0 data port (system timer).
constexpr auto PIT_MAIN_FREQUENCY
PIT frequency (1.193181(3) MHz).
constexpr auto PIT_CONTROL
Mode/command register.
auto pitGetTicks() noexcept -> igros_quad_t
Get expired ticks.
constexpr auto PIT_DEFAULT_FREQUENCY
Default pit frequency (100 Hz).
static constinit pit_t pit
PIT state.
auto pitSetup() noexcept -> bool
Setup programmable interrupt timer.
void kprintf(const char *const format,...) noexcept
Kernel printf function (arguments are checked against format at compile time).
constexpr auto kdivmod(const T dividend, const D divisor) noexcept -> divmod_t< T >
Divide integer by integer of the same signedness.
igros_word_t port_t
Define port data type which is 16bit word.
Programmable interrupt timer.
Architecture register type deduction.
igros_word_t divisor
Current divisor.
igros_usize_t ticks
IRQ ticks count.
igros_word_t frequency
Current frequency.
x86_64 task switch registers save
Common C++ types redefinition.