Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mit diesem Code initialisiere ich den PIT:
- public static void Mode0(uint frequency)
- {
- dewitcher.Core.IDT.Remap();
- uint divisor = 1193182 / frequency;
- IO.PortIO.outb(0x43, 0x30);
- IO.PortIO.outb(0x40, (byte)(divisor & 0xFF));
- IO.PortIO.outb(0x40, (byte)((divisor >> 8) & 0xFF));
- dewitcher.Core.IRQ.ClearMask(0);
- dewitcher.Core.IRQ.ClearMask(15);
- }
- Das hier ist der Originalcode für Mode2:
- public static void Mode2(uint frequency)
- {
- dewitcher.Core.IDT.Remap();
- uint divisor = 1193182 / frequency;
- IO.PortIO.outb(0x43, 0x36);
- IO.PortIO.outb(0x40, (byte)(divisor & 0xFF));
- IO.PortIO.outb(0x40, (byte)((divisor >> 8) & 0xFF));
- dewitcher.Core.IRQ.ClearMask(0);
- dewitcher.Core.IRQ.ClearMask(15);
- }
- Hiermit remappe ich den IDT:
- public static void Remap()
- {
- IO.PortIO.outb(0x20, 0x11);
- IO.PortIO.outb(0xA0, 0x11);
- IO.PortIO.outb(0x21, 0x20);
- IO.PortIO.outb(0xA1, 0x28);
- IO.PortIO.outb(0x21, 0x04);
- IO.PortIO.outb(0xA1, 0x02);
- IO.PortIO.outb(0x21, 0x01);
- IO.PortIO.outb(0xA1, 0x01);
- IO.PortIO.outb(0x21, 0x0);
- IO.PortIO.outb(0xA1, 0x0);
- }
- Das hier ist der Code für IRQ.ClearMask:
- public static void ClearMask(byte IRQline)
- {
- ushort port;
- byte value;
- if (IRQline < 8)
- {
- port = 0x20 + 1;
- }
- else
- {
- port = 0xA0 + 1;
- IRQline -= 8;
- }
- value = (byte)(IO.PortIO.inb(port) & ~(1 << IRQline));
- IO.PortIO.outb(port, value);
- }
Advertisement
Add Comment
Please, Sign In to add comment