mirror of https://github.com/E-Almqvist/eOS
parent
7f90abb200
commit
da65e49c60
@ -1,7 +1,14 @@ |
||||
unsigned char port_inb(); |
||||
void port_outb(); |
||||
unsigned char inb(unsigned short); |
||||
void outb(unsigned short, unsigned char); |
||||
|
||||
unsigned short port_inw(); |
||||
void port_outw(); |
||||
unsigned short inw(unsigned short); |
||||
void outw(unsigned short, unsigned short); |
||||
|
||||
static inline void io_wait(); |
||||
|
||||
// wrappers but with io_wait
|
||||
unsigned char inb_w(unsigned short); |
||||
void outb_w(unsigned short, unsigned char); |
||||
|
||||
unsigned short inw_w(unsigned short); |
||||
void outw_w(unsigned short, unsigned short); |
||||
|
@ -1,8 +1,25 @@ |
||||
#include "pic.h" |
||||
#include "io.h" |
||||
|
||||
void PIC_sendEOI(uint8 irq) { |
||||
if( irq >= 8 )
|
||||
port_outb(PIC2_CMD, PIC_EOI); |
||||
port_outb(PIC1_CMD, PIC_EOI); |
||||
outb(PIC2_CMD, PIC_EOI); |
||||
outb(PIC1_CMD, PIC_EOI); |
||||
} |
||||
|
||||
void PIC_remap(uint offset_1, uint offset_2) { |
||||
uint8 a1, a2;
|
||||
a1 = inb(PIC1_DATA); |
||||
a2 = inb(PIC2_DATA); |
||||
|
||||
// Start the init sequance
|
||||
outb_w( PIC1_CMD, ICW_INIT_MASK ); |
||||
|
||||
outb_w(PIC2_CMD, ICW_INIT_MASK ); |
||||
|
||||
outb_w(PIC1_DATA, offset_1); // ICW2 master offset
|
||||
outb_w(PIC2_DATA, offset_2); // ICW2 slave offset
|
||||
|
||||
outb_w(PIC1_DATA, 0x4); |
||||
outb_w(PIC2_DATA, 0x2); |
||||
} |
||||
|
Loading…
Reference in new issue