-//== Internal Functions ==\r
-static inline void mouseOut64(Uint8 data)\r
-{\r
- int timeout=100000;\r
- while( timeout-- && inb(0x64) & 2 ); // Wait for Flag to clear\r
- outb(0x64, data); // Send Command\r
-}\r
-static inline void mouseOut60(Uint8 data)\r
-{\r
- int timeout=100000;\r
- while( timeout-- && inb(0x64) & 2 ); // Wait for Flag to clear\r
- outb(0x60, data); // Send Command\r
-}\r
-static inline Uint8 mouseIn60()\r
-{\r
- int timeout=100000;\r
- while( timeout-- && (inb(0x64) & 1) == 0); // Wait for Flag to set\r
- return inb(0x60);\r
-}\r
-static void mouseSendCommand(Uint8 cmd)\r
-{\r
- mouseOut64(0xD4);\r
- mouseOut60(cmd);\r
-}\r
-\r
-static void enableMouse()\r
-{\r
- Uint8 status;\r
- Log_Log("PS2 Mouse", "Enabling Mouse...");\r
- \r
- // Enable AUX PS/2\r
- mouseOut64(0xA8);\r
- \r
- // Enable AUX PS/2 (Compaq Status Byte)\r
- mouseOut64(0x20); // Send Command\r
- status = mouseIn60(); // Get Status\r
- status &= 0xDF; status |= 0x02; // Alter Flags (Set IRQ12 (2) and Clear Disable Mouse Clock (20))\r
- mouseOut64(0x60); // Send Command\r
- mouseOut60(status); // Set Status\r
- \r
- //mouseSendCommand(0xF6); // Set Default Settings\r
- mouseSendCommand(0xF4); // Enable Packets\r
-}\r