mirror of
https://github.com/tailix/kernel.git
synced 2024-12-04 11:34:42 -05:00
Add PIC driver
This commit is contained in:
parent
6dfbf64d3f
commit
17e96678c1
4 changed files with 30 additions and 13 deletions
|
@ -29,6 +29,8 @@ OBJS += exception.c.o
|
||||||
OBJS += hwint.c.o
|
OBJS += hwint.c.o
|
||||||
OBJS += syscall.c.o
|
OBJS += syscall.c.o
|
||||||
|
|
||||||
|
OBJS += pic.c.o
|
||||||
|
|
||||||
all: kernel
|
all: kernel
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
20
arch/pic.c
Normal file
20
arch/pic.c
Normal 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
6
arch/pic.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef KERNELMQ_INCLUDED_PIC
|
||||||
|
#define KERNELMQ_INCLUDED_PIC 1
|
||||||
|
|
||||||
|
void pic_initialize();
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "asm.h"
|
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
#include "hwint.h"
|
#include "hwint.h"
|
||||||
#include "tss.h"
|
#include "tss.h"
|
||||||
|
#include "pic.h"
|
||||||
|
|
||||||
#include <kernelmq/stdlib.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)
|
void protected_initialize(const struct KernelMQ_Info *const kinfo)
|
||||||
{
|
{
|
||||||
logger_info_from("protected", "Remap the IRQ table.");
|
pic_initialize();
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
logger_info_from("protected", "Setup GDT.");
|
logger_info_from("protected", "Setup GDT.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue