-//== 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(void)\r
-{\r
- int timeout=100000;\r
- while( timeout-- && (inb(0x64) & 1) == 0); // Wait for Flag to set\r
- return inb(0x60);\r
-}\r
-static inline void mouseSendCommand(Uint8 cmd)\r
-{\r
- mouseOut64(0xD4);\r
- mouseOut60(cmd);\r
-}\r
-\r
-void PS2Mouse_Enable(void)\r
-{\r
- Uint8 status;\r
- Log_Log("PS2Mouse", "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 &= ~0x20; // Clear "Disable Mouse Clock"\r
- status |= 0x02; // Set IRQ12 Enable\r
- mouseOut64(0x60); // Send Command\r
- mouseOut60(status); // Set Status\r
- \r
- //mouseSendCommand(0xF6); // Set Default Settings\r
- mouseSendCommand(0xF4); // Enable Packets\r
-}\r