- // Enable IRQ12 (handle_74)
- unmask_pic2(PIC2_IRQ12);
-}
-
-static void
-set_kbd_command_byte(u8 command_byte)
-{
- if (inb(PORT_PS2_STATUS) & 0x02)
- BX_PANIC(panic_msg_keyb_buffer_full, "setkbdcomm");
- outb(0xD4, PORT_PS2_STATUS);
-
- outb(0x60, PORT_PS2_STATUS); // write command byte
- outb(command_byte, PORT_PS2_DATA);
-}
-
-static u8
-inhibit_mouse_int_and_events()
-{
- // Turn off IRQ generation and aux data line
- if (inb(PORT_PS2_STATUS) & 0x02)
- BX_PANIC(panic_msg_keyb_buffer_full,"inhibmouse");
- outb(0x20, PORT_PS2_STATUS); // get command byte
- while ((inb(PORT_PS2_STATUS) & 0x01) != 0x01)
- ;
- u8 prev_command_byte = inb(PORT_PS2_DATA);
- u8 command_byte = prev_command_byte;
- //while ( (inb(PORT_PS2_STATUS) & 0x02) );
- if ( inb(PORT_PS2_STATUS) & 0x02 )
- BX_PANIC(panic_msg_keyb_buffer_full,"inhibmouse");
- command_byte &= 0xfd; // turn off IRQ 12 generation
- command_byte |= 0x20; // disable mouse serial clock line
- outb(0x60, PORT_PS2_STATUS); // write command byte
- outb(command_byte, PORT_PS2_DATA);
- return prev_command_byte;
-}
-
-static void
-enable_mouse_int_and_events()
-{
- // Turn on IRQ generation and aux data line
- if ( inb(PORT_PS2_STATUS) & 0x02 )
- BX_PANIC(panic_msg_keyb_buffer_full,"enabmouse");
- outb(0x20, PORT_PS2_STATUS); // get command byte
- while ((inb(PORT_PS2_STATUS) & 0x01) != 0x01)
- ;
- u8 command_byte = inb(PORT_PS2_DATA);
- //while ( (inb(PORT_PS2_STATUS) & 0x02) );
- if (inb(PORT_PS2_STATUS) & 0x02)
- BX_PANIC(panic_msg_keyb_buffer_full,"enabmouse");
- command_byte |= 0x02; // turn on IRQ 12 generation
- command_byte &= 0xdf; // enable mouse serial clock line
- outb(0x60, PORT_PS2_STATUS); // write command byte
- outb(command_byte, PORT_PS2_DATA);
-}
-
-static void
-send_to_mouse_ctrl(u8 sendbyte)
-{
- // wait for chance to write to ctrl
- if (inb(PORT_PS2_STATUS) & 0x02)
- BX_PANIC(panic_msg_keyb_buffer_full,"sendmouse");
- outb(0xD4, PORT_PS2_STATUS);
- outb(sendbyte, PORT_PS2_DATA);