forked from PoliEcho-holding-org/kern
Implemented PIT
This commit is contained in:
@@ -16,7 +16,7 @@ struct isr_int_frame {
|
||||
typedef void (*isr_handler_ptr)(struct isr_int_frame* iframe);
|
||||
|
||||
int isr_init(void);
|
||||
void isr_register_IRQ(uint8_t i, isr_handler_ptr handler);
|
||||
void isr_register(uint8_t i, isr_handler_ptr handler);
|
||||
int isr_handle_interrupt(struct isr_int_frame iframe);
|
||||
|
||||
// Assembly definitions (isr.s)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <kernel.h>
|
||||
|
||||
// cpuid
|
||||
void cpuid(uint32_t* eax, uint32_t* ebx, uint32_t* ecx, uint32_t* edx);
|
||||
|
||||
// Ports
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef _TIMER_H
|
||||
#define _TIMER_H
|
||||
|
||||
#include <isr.h>
|
||||
|
||||
#define PIT_DIV 1193180
|
||||
#define PIT_CH0 0x40
|
||||
#define PIT_CH1 0x41
|
||||
#define PIT_CH2 0x42
|
||||
#define PIT_CMD 0x43
|
||||
|
||||
int timer_init(void);
|
||||
void timer_wait(size_t ticks);
|
||||
|
||||
int pit_init(void);
|
||||
void pit_phase(uint8_t ch, uint8_t mode, uint32_t hz);
|
||||
void pit_handler(struct isr_int_frame* iframe);
|
||||
|
||||
// TODO: rtc_init(void);
|
||||
// TODO: hpet_init(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user