Moving components modules to a more proper directory
This commit is contained in:
19
components/pit/pit.c
Normal file
19
components/pit/pit.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "pit.h"
|
||||
#include "types.h"
|
||||
#include "interrupts.h"
|
||||
#include "serial.h"
|
||||
#include "stlio.h"
|
||||
|
||||
void pit_inc_ticks(__attribute__((unused)) struct cpu_reg_state* cpu) {
|
||||
pit_timer_ticks++;
|
||||
}
|
||||
|
||||
void pit_timer_wait(u32 time) {
|
||||
u32 ticks = time + pit_timer_ticks;
|
||||
while(pit_timer_ticks < ticks);
|
||||
}
|
||||
|
||||
void pit_install_timer(void) {
|
||||
init_irq_handler(0, pit_inc_ticks); // timer interrupt request falls into irq 0
|
||||
pit_timer_ticks = 0;
|
||||
}
|
||||
19
components/pit/pit.h
Normal file
19
components/pit/pit.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef PIT_H
|
||||
#define PIT_H
|
||||
#include "interrupts.h"
|
||||
#include "types.h"
|
||||
|
||||
// 60hz timer for now
|
||||
#define PIT_TIMER_INTERVAL 100
|
||||
#define PIT_TIME_DATA0 0x40
|
||||
#define PIT_TIME_DATA1 0x41
|
||||
#define PIT_TIME_DATA2 0x42
|
||||
|
||||
volatile u32 pit_timer_ticks;
|
||||
|
||||
void pit_inc_ticks(struct cpu_reg_state*);
|
||||
|
||||
void pit_timer_wait(u32);
|
||||
|
||||
void pit_install_timer(void);
|
||||
#endif
|
||||
Reference in New Issue
Block a user