feat(keyboard): add simple keyboard handler

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
juju committed 2021-07-26 09:04:30 +02:00
1 parent ac1b1f5376
commit 0e43e73fc7
5 files changed
+29 -1

No files matched your search

+2 -1
View File
@@ -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)
+9
View File
@@ -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);
+2
View File
@@ -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
View File
@@ -0,0 +1,7 @@
#include "keyboard.h"
#include "io.h"
void keyboard_handler(void)
{
inb(KEYBOARD_IO);
}
+9
View 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 */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.