LumaOS  v0.1.116
An experimental x86-64 OS
Loading...
Searching...
No Matches
pit.c File Reference

Handles timer interrupts from the PIT (Programmable Interrupt Timer). More...

#include <arch/x86_64/pit.h>
#include "arch/x86_64/io.h"
#include "arch/x86_64/irq.h"
#include "arch/x86_64/pic.h"
Include dependency graph for pit.c:

Go to the source code of this file.

Functions

static void timer_irq (struct interrupt_frame *frame)
 Handles the timer.
void pit_init (uint16_t frequency)
 Initialize the PIT timer.
void pit_sleep_ms (uint32_t ms)
 Sleep for a certain time using the PIT.

Variables

volatile uint64_t pit_ticks = 0
volatile uint16_t pit_frequency = 0

Detailed Description

Handles timer interrupts from the PIT (Programmable Interrupt Timer).

Author
Matheus Boscariol
Since
24/11/2026

Definition in file pit.c.

Function Documentation

◆ pit_init()

void pit_init ( uint16_t frequency)

Initialize the PIT timer.

Parameters
frequencyThe frequency of the timer in Hz

Definition at line 29 of file pit.c.

Here is the call graph for this function:

◆ pit_sleep_ms()

void pit_sleep_ms ( uint32_t ms)

Sleep for a certain time using the PIT.

Parameters
msAmount of milliseconds to sleep

Definition at line 45 of file pit.c.

◆ timer_irq()

void timer_irq ( struct interrupt_frame * frame)
static

Handles the timer.

Parameters
frameThe frame that caused the exception

Definition at line 23 of file pit.c.

Variable Documentation

◆ pit_frequency

volatile uint16_t pit_frequency = 0

Definition at line 17 of file pit.c.

◆ pit_ticks

volatile uint64_t pit_ticks = 0

Definition at line 16 of file pit.c.