Hi Gandalf,
Today I found another site about the ps/2 interface:
http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html
It looks like Adams micro resources (
http://govschl.ndsu.nodak.edu/~achapwes ... index.html) really mixes up input- and ouput buffer. Here's how it really seems to be:
0x64 <write> input buffer (command)
0x60 <write> input buffer (data)
0x60 <read> output buffer
0x60 <read> status register
IBF - Controller is busy. Don't write to 0x64 nor to 0x60.
OBF - New data is available in the output buffer
MBF - 1: Data in the output buffer is from the mouse
0: Data is from the kbd
I wrote a few lines in order to test whether this site is right and it worked on all three computers I tried.
<c++>
MouseDriver::MouseDriver(void)
{
while(Port::ReadByte(0x64) &input_buffer);
Port::WriteByte(0x64, 0xD4);
while(Port::ReadByte(0x64) &input_buffer);
Port::WriteByte(0x60, 0xEA);
while(!(Port::ReadByte(0x64) &output_buffer + mouse_buffer));
console().WriteFormat("\n\nACK: 0x%8x\n", Port::ReadByte(0x60));
while(Port::ReadByte(0x64) &input_buffer);
Port::WriteByte(0x64, 0x60);
while(Port::ReadByte(0x64) &input_buffer);
Port::WriteByte(0x60, 0x43);
while(Port::ReadByte(0x64) &input_buffer);
Port::WriteByte(0x64, 0xD4);
while(Port::ReadByte(0x64) &input_buffer);
Port::WriteByte(0x60, 0xF4);
while(!(Port::ReadByte(0x64) &output_buffer + mouse_buffer));
console().WriteFormat("ACK: 0x%8x\n\n", Port::ReadByte(0x60));
//while(Port::ReadByte(0x64) &output_buffer)
// Port::ReadByte(0x60);
}
void MouseDriver::Execute() // My ISR
{
static int index = 0;
static uchar data[3];
if(index < 3)
{
while(!(Port::ReadByte(0x64) &output_buffer + mouse_buffer));
data[index] = Port::ReadByte(0x60);
index++;
}
if(index == 3)
{
index = 0;
console().WriteFormat("0x%8x ", data[0]);
console().WriteFormat("0x%8x ", data[1]);
console().WriteFormat("0x%8x\n", data[2]);
}
Port::WriteByte(0xA0, 0x20); // master
Port::WriteByte(0x20, 0x20); // slave
}
You (and hartyl) are right that the ISR will called 3 times for each datapacket, however, this should go for VMWare aswell. I propose that you run my code and when the mouse still looks dizzy you'll at least know that it's not sth with your mouse driver. There might be some conflict with other drivers, especially the keyboard driver, so you could try to disabling them.
Let me know whether it worked.
regards,
gaf