Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
While writing own keyboard driver for my OS, I got the problem with keyboard leds - my system just freezes when I try to set them. I've noticed that it happens "thankfully" to the keyboard buffer - it just doesn't get empty. What's the matter?
Hmm... that's interesting. When I try to change leds status, I get keyboard interrupts with some strange scancodes. One could make conclusion that this is the source of all errors, but my keyboard ISR seems to 'eat' all the scancodes, so I just don't realize why doesn't it work.
P.S. I've downloaded some books from the net. Hope there is something that would help me.
"A
computer program
does what you tell it
to do, not what you
want it to do." --
Greer's Third Law
You should never do this when talking to hardware. You should calculate how long you expect to wait for the bit to change and then use a counter or timer to break out of the loop if something goes wrong. You can then reset the hardware and try again.
If a trainstation is where trains stop, what is a workstation ?
gerryg400 wrote:You should calculate how long you expect to wait for the bit to change and then use a counter or timer to break out of the loop if something goes wrong.
I'm not at all sure about it, but if you have an interrupt handler that also "eats" the input from port 0x64 and also affects it, this code might never be able to read it. Maybe as a quick test you could try disabling interrupts before starting the test, and reenabling it afterwards.
Edit: Ah the interrupt handler is there. And I believe it actually send data to the port.
Finally it works properly)
Many thanks to gerryg400 for his great advice about loop in the kbd_wait function (actually there was such function when I started this topic, but now I have got two ones: kbd_wait_inbuf and kbd_wait_outbuf, but it doesn't matter, they also have such loops) and to evoex for giving right directions on where should I search for the source of all my errors.
"A
computer program
does what you tell it
to do, not what you
want it to do." --
Greer's Third Law