pit_install_timer def and cleaner interface

This commit is contained in:
shockrahwow 2019-11-14 17:35:54 -08:00
parent 98eb93bc71
commit d4108d8b24
2 changed files with 5 additions and 7 deletions

5
pit.c
View File

@ -1,9 +1,10 @@
#include "pit.h"
#include "types.h"
#include "interrupts.h"
#include "serial.h"
#include "stlio.h"
timer_ticks = 0;
u32 timer_ticks = 0;
void inc_ticks(struct cpu_reg_state* cpu) {
timer_ticks++;
@ -12,8 +13,6 @@ void inc_ticks(struct cpu_reg_state* cpu) {
}
}
void tick_width(u32 width) {
}
void pit_install_timer(void) {
init_irq_handler(0, inc_ticks); // timer interrupt request falls into int 0
}

7
pit.h
View File

@ -1,13 +1,12 @@
#include "interrupts.h"
#include "types.h"
u32 timer_ticks;
// 60hz timer for now
#define PIT_TIMER_INTERVAL 100
#define PIT_TIME_DATA0 0x40
#define PIT_TIME_DATA1 0x41
#define PIT_TIME_DATA2 0x42
// Sets the tick rate 100hz
void tick_width(u32);
void inc_ticks(struct cpu_reg_state*);
void inc_ticks(struct cpu_reg_state* cpu);
void pit_install_timer(void);