internal static void Setup() { Debug.Write("PS/2 Mouse Controller Setup\n"); MouseCycle = 0; MouseData = new byte[4]; MouseData[0] = MOUSE_MAGIC; MousePipe = new Pipe(4, 1024); IDT.RegisterInterrupt(HandleIRQ, 0x2C); Wait(true); PortIO.Out8(MOUSE_STATUS, 0xA8); Wait(true); PortIO.Out8(MOUSE_STATUS, 0x20); Wait(false); byte status = (byte)(PortIO.In8(MOUSE_PORT) | 2); Wait(true); PortIO.Out8(MOUSE_STATUS, 0x60); Wait(true); PortIO.Out8(MOUSE_PORT, status); Write(0xF6); Read(); Write(0xF4); Read(); Debug.Write("Mouse Done\n"); }
internal IDE(bool IsPrimary, bool IsMaster = true) { UInt16 xBAR0 = (UInt16)(IsPrimary ? 0x01F0 : 0x0170); UInt16 xBAR1 = (UInt16)(IsPrimary ? 0x03F6 : 0x0376); mChannel = IsPrimary ? Channel.PRIMARY : Channel.SECONDARY; mType = IsMaster ? Type.MASTER : Type.SLAVE; DataReg = (UInt16)(xBAR0 + (byte)Register.ATA_REG_DATA); FeatureReg = (UInt16)(xBAR0 + (byte)Register.ATA_REG_FEATURES); SectorCountReg = (UInt16)(xBAR0 + (byte)Register.ATA_REG_SECCOUNT0); CommandReg = (UInt16)(xBAR0 + (byte)Register.ATA_REG_COMMAND); StatusReg = (UInt16)(xBAR0 + (byte)Register.ATA_REG_STATUS); AltStatusReg = (UInt16)(xBAR1 + (byte)Register.ATA_REG_ALTSTATUS); ControlReg = (UInt16)(xBAR1 + (byte)Register.ATA_REG_CONTROL); LBA0 = (UInt16)(xBAR0 + (byte)Register.ATA_REG_LBA0); LBA1 = (UInt16)(xBAR0 + (byte)Register.ATA_REG_LBA1); LBA2 = (UInt16)(xBAR0 + (byte)Register.ATA_REG_LBA2); DeviceSelect = (UInt16)(xBAR0 + (byte)Register.ATA_REG_HDDEVSEL); // Disable IRQ PortIO.Out8(ControlReg, 0x2); // Discover what we have =P Discover(); if (mDevice != Device.IDE_None) { IRQInvoked = false; // Register Interrupt Handler :-) IDT.RegisterInterrupt( delegate(ref IRQContext xContext) { IRQInvoked = true; }, (uint)(IsPrimary ? 0x2E : 0x2F)); } }
internal static void Setup() { IDT.RegisterInterrupt(Handler, 0x7F); }
internal static void Setup() { Debug.Write("PS/2 Keyboard Controller Setup\n"); IDT.RegisterInterrupt(HandleIRQ, 0x21); }