Basically, I have a keyboard isr, and it works... it fires fine and outputs to the screen whatever letter I typed, so I know its not an issue with the ISR or PIC or anything of the like. I wanted to extended the basic functionality that Bran kernel gave, so I added support for Uppercase letters, and Shift/Caps Lock support. Again that works fine. I wanted to make the keyboard a requestable device, now when a key is pressed it calles a function pointer to a user-definable keyboard handler. So I further tested it by assigning a "test" function that recieves the key code as a parameter and then prints it out on the screen... that works.
Now heres, the problem, I am trying to implement a "getch" function, and instead of doing a hard loop poling the keyboard port, I do something along the line of this (granted this is pseudo code, but the pricipal is the same)
Code: Select all
int keyEvent;
void keyhandler(int pKey)
{
kprintf("Event Handler Called.\n");
AddKeyToBuffer(pKey);
keyEvent = 1;
}
int getch()
{
int key;
SetKeyHandler(&keyhandler);
keyEvent = 0;
do {
//nothing
} while (keyEvent == 0);
key = GetKeyFromBuffer();
ClearKeyHandler();
}
Thanks,
Rich