feat(pic): add remapping of pic

This commit is contained in:
aliamelo committed 2021-07-15 16:52:19 +02:00
1 parent 76174c5b4f
commit 5ed0955ce5
2 files changed
+65

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
#include "pic.h"
#include "io.h"
void remap_pic(void)
{
// ICW1
outb(MASTER_PORT_A, ICW1_INIT | ICW1_ICW4);
outb(SLAVE_PORT_A, ICW1_INIT | ICW1_ICW4);
// ICW2
outb(MASTER_PORT_B, ICW2_M_OFFSET);
outb(SLAVE_PORT_B, ICW2_S_OFFSET);
// ICW3
outb(MASTER_PORT_B, PIC_PIN_2);
outb(SLAVE_PORT_B, 2);
// ICW4
outb(MASTER_PORT_B, ICW4_INIT);
outb(SLAVE_PORT_B, ICW4_INIT);
// OCW1
outb(MASTER_PORT_B, PIC_PIN_0); // masking PIT for now
}
+41
View File
@@ -0,0 +1,41 @@
#ifndef PIC_H
#define PIC_H
#define MASTER_PORT_A 0x20
#define MASTER_PORT_B 0x21
#define SLAVE_PORT_A 0xa0
#define SLAVE_PORT_B 0xa1
// ICW1
#define ICW1_ICW4 0x1
#define ICW1_SINGLE 0x2
#define ICW_LT 0x8
#define ICW1_INIT 0x10
// ICW2
#define ICW2_M_OFFSET 0x20
#define ICW2_S_OFFSET 0x28
// ICW3 / OCW1
#define PIC_PIN_0 0x1
#define PIC_PIN_1 0x2
#define PIC_PIN_2 0x4
#define PIC_PIN_3 0x8
#define PIC_PIN_4 0x10
#define PIC_PIN_5 0x20
#define PIC_PIN_6 0x40
#define PIC_PIN_7 0x80
// ICW4
#define ICW4_INIT 0x1
#define ICW4_AUTO_EOI 0x2
#define ICW4_NESTED 0x10
// OCW2
#define OCW2_EOI 0x20
#define OCW2_SPEC 0x40
#define OCW2_ROT 0x80
void remap_pic(void);
#endif /* !PIC_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.