feat(keyboard): add simple keyboard handler
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
parent
ac1b1f5376
commit
0e43e73fc7
@ -34,7 +34,8 @@ OBJS = \
|
||||
gdt.o \
|
||||
events/idt.o \
|
||||
events/isr.o \
|
||||
events/pic/pic.o
|
||||
events/pic/pic.o \
|
||||
events/pic/keyboard.o
|
||||
|
||||
|
||||
DEPS = $(OBJS:.o=.d)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "idt.h"
|
||||
#include "stdio.h"
|
||||
#include "pic/pic.h"
|
||||
#include "pic/keyboard.h"
|
||||
#include "io.h"
|
||||
|
||||
static struct idt idt = { 0 };
|
||||
@ -45,6 +46,14 @@ static struct idt_entry_descriptor idt_entries_descriptors[IDT_NB_ENTRIES] = {
|
||||
void interrupt_handler(struct isr_param *isr_param)
|
||||
{
|
||||
printf("Oh no %d!\r\n", isr_param->int_vector);
|
||||
|
||||
switch (isr_param->int_vector)
|
||||
{
|
||||
case KEYBOARD_INT_VECTOR:
|
||||
keyboard_handler();
|
||||
break;
|
||||
}
|
||||
|
||||
if (isr_param->int_vector > IDT_RESERVED_ENTRIES
|
||||
&& isr_param->int_vector < IDT_RESERVED_ENTRIES + 16)
|
||||
acknowledge(isr_param->int_vector);
|
||||
|
@ -12,6 +12,8 @@
|
||||
#define INTERRUPT_TYPE 0x6
|
||||
#define TRAP_TYPE 0x7
|
||||
|
||||
#define KEYBOARD_INT_VECTOR 33
|
||||
|
||||
struct idt_entry
|
||||
{
|
||||
uint16_t offset_1 : 16;
|
||||
|
7
k/events/pic/keyboard.c
Normal file
7
k/events/pic/keyboard.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "keyboard.h"
|
||||
#include "io.h"
|
||||
|
||||
void keyboard_handler(void)
|
||||
{
|
||||
inb(KEYBOARD_IO);
|
||||
}
|
9
k/events/pic/keyboard.h
Normal file
9
k/events/pic/keyboard.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef KEYBOARD_H
|
||||
#define KEYBOARD_H
|
||||
|
||||
#define KEYBOARD_IO 0x60
|
||||
#define KEYBOARD_STATUS 0x64
|
||||
|
||||
void keyboard_handler(void);
|
||||
|
||||
#endif /* !KEYBOARD_H */
|
Loading…
Reference in New Issue
Block a user