timer wait behavior is really fucked and debugging this is an awful pain so juust check todos

This commit is contained in:
shockrahwow 2019-11-29 00:46:42 -08:00
parent e3317e5d64
commit 1fb8c16514
2 changed files with 9 additions and 3 deletions

8
pit.c
View File

@ -4,7 +4,7 @@
#include "serial.h" #include "serial.h"
#include "stlio.h" #include "stlio.h"
u32 timer_ticks = 0; volatile u32 timer_ticks = 0;
void inc_ticks(struct cpu_reg_state* cpu) { void inc_ticks(struct cpu_reg_state* cpu) {
timer_ticks++; timer_ticks++;
@ -13,6 +13,10 @@ void inc_ticks(struct cpu_reg_state* cpu) {
} }
} }
void timer_wait(u32 time) {
u32 ticks = time + timer_ticks;
while(timer_ticks < ticks);
}
void pit_install_timer(void) { void pit_install_timer(void) {
init_irq_handler(0, inc_ticks); // timer interrupt request falls into int 0 init_irq_handler(0, inc_ticks); // timer interrupt request falls into int 0
} }

4
pit.h
View File

@ -9,4 +9,6 @@
void inc_ticks(struct cpu_reg_state*); void inc_ticks(struct cpu_reg_state*);
void pit_install_timer(void); void timer_wait(u32);
void pit_install_timer(void);