Remove kernel namespace from PIC

This commit is contained in:
Eryn Wells 2016-03-09 00:28:19 -05:00
parent 867b89f65a
commit 0238e44efc
3 changed files with 9 additions and 13 deletions

View file

@ -51,7 +51,7 @@ kmain()
console.writeString("IDT loaded\n"); console.writeString("IDT loaded\n");
auto pic = kernel::x86::PIC::systemPIC(); auto pic = x86::PIC::systemPIC();
pic.remap(0x20, 0x28, 2); // Map hardware IRQs to interrupt vectors 32 through 48. pic.remap(0x20, 0x28, 2); // Map hardware IRQs to interrupt vectors 32 through 48.
console.writeString("Hardware interrupts programmed\n"); console.writeString("Hardware interrupts programmed\n");

View file

@ -42,7 +42,6 @@ namespace {
} PIC1 { 0x0020, 0x0021 }, PIC2 { 0x00A0, 0x00A1 }; } PIC1 { 0x0020, 0x0021 }, PIC2 { 0x00A0, 0x00A1 };
} }
namespace kernel {
namespace x86 { namespace x86 {
/* /*
@ -120,8 +119,8 @@ PIC::remap(uint8_t pic1Offset,
} }
// Save the current IRQ masks for each PIC // Save the current IRQ masks for each PIC
uint8_t pic1Mask = io::inb(PIC1.data); uint8_t pic1Mask = kernel::io::inb(PIC1.data);
uint8_t pic2Mask = io::inb(PIC2.data); uint8_t pic2Mask = kernel::io::inb(PIC2.data);
#ifdef CONFIG_PIC_SHOULD_WAIT #ifdef CONFIG_PIC_SHOULD_WAIT
# define waitIfRequired() io::wait() # define waitIfRequired() io::wait()
@ -130,7 +129,7 @@ PIC::remap(uint8_t pic1Offset,
#endif #endif
#define sendToPIC(port, byte) \ #define sendToPIC(port, byte) \
io::outb((port), (byte)); \ kernel::io::outb((port), (byte)); \
waitIfRequired() waitIfRequired()
sendToPIC(PIC1.command, ICW1::Initialize + ICW1::ICW4Required); sendToPIC(PIC1.command, ICW1::Initialize + ICW1::ICW4Required);
@ -147,8 +146,8 @@ PIC::remap(uint8_t pic1Offset,
#undef waitIfRequired #undef waitIfRequired
// Restore the saved masks // Restore the saved masks
io::outb(PIC2.data, pic1Mask); kernel::io::outb(PIC2.data, pic1Mask);
io::outb(PIC2.data, pic2Mask); kernel::io::outb(PIC2.data, pic2Mask);
} }
void void
@ -160,10 +159,9 @@ PIC::endOfInterrupt(uint8_t irq)
* notified. Otherwise, only PIC1 needs to be notified. * notified. Otherwise, only PIC1 needs to be notified.
*/ */
if (irq >= 8) { if (irq >= 8) {
io::outb(PIC2.command, OCW2::NOPEOI); kernel::io::outb(PIC2.command, OCW2::NOPEOI);
} }
io::outb(PIC1.command, OCW2::NOPEOI); kernel::io::outb(PIC1.command, OCW2::NOPEOI);
} }
} /* namespace x86 */ } /* namespace x86 */
} /* namespace kernel */

View file

@ -12,7 +12,6 @@
#include <stdint.h> #include <stdint.h>
namespace kernel {
namespace x86 { namespace x86 {
/** /**
@ -50,8 +49,7 @@ struct PIC
*/ */
void enableInterrupt(uint8_t irq, bool enabled); void enableInterrupt(uint8_t irq, bool enabled);
}; };
} /* namespace x86 */ } /* namespace x86 */
} /* namespace kernel */
#endif /* __PIC_HH__ */ #endif /* __PIC_HH__ */