1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-12-11 11:35:39 -05:00

Add PIC driver

This commit is contained in:
Braiden Vasco 2017-11-06 10:18:43 +00:00
parent 6dfbf64d3f
commit 17e96678c1
4 changed files with 30 additions and 13 deletions

View file

@ -29,6 +29,8 @@ OBJS += exception.c.o
OBJS += hwint.c.o
OBJS += syscall.c.o
OBJS += pic.c.o
all: kernel
clean:

20
arch/pic.c Normal file
View file

@ -0,0 +1,20 @@
#include "pic.h"
#include "logger.h"
#include "asm.h"
void pic_initialize()
{
logger_info_from("pic", "Remap the IRQ table.");
outportb(0x20, 0x11);
outportb(0xA0, 0x11);
outportb(0x21, 0x20);
outportb(0xA1, 0x28);
outportb(0x21, 0x04);
outportb(0xA1, 0x02);
outportb(0x21, 0x01);
outportb(0xA1, 0x01);
outportb(0x21, 0x00);
outportb(0xA1, 0x00);
}

6
arch/pic.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef KERNELMQ_INCLUDED_PIC
#define KERNELMQ_INCLUDED_PIC 1
void pic_initialize();
#endif

View file

@ -2,10 +2,10 @@
#include "config.h"
#include "logger.h"
#include "asm.h"
#include "interrupt.h"
#include "hwint.h"
#include "tss.h"
#include "pic.h"
#include <kernelmq/stdlib.h>
@ -53,18 +53,7 @@ void idt_flush(const struct IdtPointer *pointer);
void protected_initialize(const struct KernelMQ_Info *const kinfo)
{
logger_info_from("protected", "Remap the IRQ table.");
outportb(0x20, 0x11);
outportb(0xA0, 0x11);
outportb(0x21, 0x20);
outportb(0xA1, 0x28);
outportb(0x21, 0x04);
outportb(0xA1, 0x02);
outportb(0x21, 0x01);
outportb(0xA1, 0x01);
outportb(0x21, 0x00);
outportb(0xA1, 0x00);
pic_initialize();
logger_info_from("protected", "Setup GDT.");