feat(pic): move pic.c in pic dir

This commit is contained in:
aliamelo committed 2021-07-17 10:40:08 +02:00
1 parent 1cb57e6a9f
commit 26bdf84db4
5 files changed
+3 -3

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
#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 | PIC_PIN_2 |
PIC_PIN_3 | PIC_PIN_4 | PIC_PIN_5 |
PIC_PIN_6 | PIC_PIN_7); // masking PIT for now
asm volatile("sti");
}
+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.