WIP - pit timer

This commit is contained in:
2017-03-24 11:01:29 +01:00
parent 0b27ddca2c
commit 9ae3b014da
5 changed files with 94 additions and 1 deletions

View File

@@ -68,6 +68,7 @@
#ifndef __ASSEMBLER__
#include <stdint.h>
#include <apic.h>
struct int_gate_descriptor
{
@@ -88,7 +89,7 @@ struct idtr
void pic_init();
extern unsigned int irq_map[24];
#define IRQ_INT(irq) (INT_IRQ0 + irq)
#define IRQ_INT(irq) (INT_IRQ0 + IRQ(irq))
#define IRQ(irq) (irq_map[irq])
#define IRQ_MASK(irq) ioapic_mask(IRQ(irq))
#define IRQ_UNMASK(irq) ioapic_unmask(IRQ(irq))

5
kernel/include/pit.h Normal file
View File

@@ -0,0 +1,5 @@
#pragma once
#include <stdint.h>
void pit_delay(uint32_t ms);
void pit_init();

7
kernel/include/timer.h Normal file
View File

@@ -0,0 +1,7 @@
#pragma once
#include <stdint.h>
#define TICK_FREQ 1000
void pit_init();
uint64_t get_ticks();