feat(pit): add pit isr, empty handler and unmasked pit irq
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
parent
cf020eae84
commit
5064efa101
@ -36,6 +36,7 @@ OBJS = \
|
||||
events/isr.o \
|
||||
events/pic/pic.o \
|
||||
events/pic/keyboard.o \
|
||||
events/pic/pit.o \
|
||||
utils/ring_buffer.o
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "stdio.h"
|
||||
#include "pic/pic.h"
|
||||
#include "pic/keyboard.h"
|
||||
#include "pic/pit.h"
|
||||
#include "io.h"
|
||||
|
||||
static struct idt idt = { 0 };
|
||||
@ -39,8 +40,8 @@ static struct idt_entry_descriptor idt_entries_descriptors[IDT_NB_ENTRIES] = {
|
||||
{0, {0, 0, 0}, 0}, // 29
|
||||
{0, {0, 0, 0}, 0}, // 30
|
||||
{0, {0, 0, 0}, 0}, // 31
|
||||
{0, {0, 0, 0}, 0}, // 32
|
||||
{(uint32_t)&isr_keyboard, KERNEL_CS_SEGMENT_SELECTOR, INTERRUPT_TYPE}, // 33
|
||||
{(uint32_t)&isr_pit, KERNEL_CS_SEGMENT_SELECTOR, INTERRUPT_TYPE}, // 32
|
||||
{(uint32_t)&isr_keyboard, KERNEL_CS_SEGMENT_SELECTOR, INTERRUPT_TYPE} // 33
|
||||
};
|
||||
|
||||
void interrupt_handler(struct isr_param *isr_param)
|
||||
@ -49,6 +50,9 @@ void interrupt_handler(struct isr_param *isr_param)
|
||||
|
||||
switch (isr_param->int_vector)
|
||||
{
|
||||
case PIT_INT_VECTOR:
|
||||
pit_handler();
|
||||
break;
|
||||
case KEYBOARD_INT_VECTOR:
|
||||
keyboard_handler();
|
||||
break;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define INTERRUPT_TYPE 0x6
|
||||
#define TRAP_TYPE 0x7
|
||||
|
||||
#define PIT_INT_VECTOR 32
|
||||
#define KEYBOARD_INT_VECTOR 33
|
||||
|
||||
struct idt_entry
|
||||
|
@ -44,4 +44,5 @@ isr_callback_no_error(isr_machine_check, 18)
|
||||
isr_callback_no_error(isr_simd_floating_point_exception, 19)
|
||||
isr_callback_no_error(isr_virtualization_exception, 20)
|
||||
isr_callback_error(isr_control_protection_exception, 21)
|
||||
isr_callback_no_error(isr_pit, 32)
|
||||
isr_callback_no_error(isr_keyboard, 33)
|
||||
|
@ -28,6 +28,7 @@ void isr_machine_check(void);
|
||||
void isr_simd_floating_point_exception(void);
|
||||
void isr_virtualization_exception(void);
|
||||
void isr_control_protection_exception(void);
|
||||
void isr_pit(void);
|
||||
void isr_keyboard(void);
|
||||
|
||||
#endif /* !ISR_H */
|
||||
|
@ -31,7 +31,8 @@ static void send_icw4(void)
|
||||
|
||||
static void mask_irqs(void)
|
||||
{
|
||||
outb(MASTER_PIC_B, 0xff ^ 0x2);
|
||||
outb(MASTER_PIC_B, IRQ2_PIN | IRQ3_PIN | IRQ4_PIN | IRQ5_PIN | IRQ6_PIN
|
||||
| IRQ7_PIN);
|
||||
outb(SLAVE_PIC_B, 0xff);
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,15 @@
|
||||
|
||||
#define ICW1 0x11
|
||||
|
||||
#define IRQ0_PIN 0x1
|
||||
#define IRQ1_PIN 0x2
|
||||
#define IRQ2_PIN 0x4
|
||||
#define IRQ3_PIN 0x8
|
||||
#define IRQ4_PIN 0x10
|
||||
#define IRQ5_PIN 0x20
|
||||
#define IRQ6_PIN 0x40
|
||||
#define IRQ7_PIN 0x80
|
||||
|
||||
void init_pic(void);
|
||||
void acknowledge(uint32_t int_vector);
|
||||
|
||||
|
9
k/events/pic/pit.c
Normal file
9
k/events/pic/pit.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include "pit.h"
|
||||
|
||||
void pit_handler(void)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned long gettick(void)
|
||||
{
|
||||
}
|
12
k/events/pic/pit.h
Normal file
12
k/events/pic/pit.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef PIT_H
|
||||
#define PIT_H
|
||||
|
||||
#define PIT_COUNTER_0 0x40
|
||||
#define PIT_COUNTER_1 0x41
|
||||
#define PIT_COUNTER_2 0x42
|
||||
#define PIT_CONTROL_REGISTER 0x43
|
||||
|
||||
void pit_handler(void);
|
||||
unsigned long gettick(void);
|
||||
|
||||
#endif /* !PIT_H */
|
2
k/k.c
2
k/k.c
@ -53,8 +53,6 @@ void k_main(unsigned long magic, multiboot_info_t *info)
|
||||
:);
|
||||
printf("bonjour\r\n");
|
||||
|
||||
|
||||
|
||||
for (unsigned i = 0; ; ) {
|
||||
*fb = star[i++ % 4];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user