2009-12-25 Robert Millan <rmh.grub@aybabtu.com>

* term/i386/pc/at_keyboard.c
	(keyboard_controller_wait_untill_ready): New function.
	(grub_keyboard_controller_write, grub_keyboard_controller_read)
	(keyboard_controller_led): Use keyboard_controller_wait_untill_ready()
	for keyboard polling, rather than duplicate the same loop.  This
	saves a few bytes in code size.
This commit is contained in:
Robert Millan 2009-12-25 21:38:09 +00:00
parent 7ebaa2b4ff
commit 3fdae612d9
2 changed files with 19 additions and 4 deletions

View file

@ -1,3 +1,12 @@
2009-12-25 Robert Millan <rmh.grub@aybabtu.com>
* term/i386/pc/at_keyboard.c
(keyboard_controller_wait_untill_ready): New function.
(grub_keyboard_controller_write, grub_keyboard_controller_read)
(keyboard_controller_led): Use keyboard_controller_wait_untill_ready()
for keyboard polling, rather than duplicate the same loop. This
saves a few bytes in code size.
2009-12-25 Vladimir Serbinenko <phcoder@gmail.com>
Support for (pxe[:server[:gateway]]) syntax and

View file

@ -72,9 +72,15 @@ static char keyboard_map_shift[128] =
static grub_uint8_t grub_keyboard_controller_orig;
static void
grub_keyboard_controller_write (grub_uint8_t c)
keyboard_controller_wait_untill_ready ()
{
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
}
static void
grub_keyboard_controller_write (grub_uint8_t c)
{
keyboard_controller_wait_untill_ready ();
grub_outb (KEYBOARD_COMMAND_WRITE, KEYBOARD_REG_STATUS);
grub_outb (c, KEYBOARD_REG_DATA);
}
@ -82,7 +88,7 @@ grub_keyboard_controller_write (grub_uint8_t c)
static grub_uint8_t
grub_keyboard_controller_read (void)
{
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
keyboard_controller_wait_untill_ready ();
grub_outb (KEYBOARD_COMMAND_READ, KEYBOARD_REG_STATUS);
return grub_inb (KEYBOARD_REG_DATA);
}
@ -90,9 +96,9 @@ grub_keyboard_controller_read (void)
static void
keyboard_controller_led (grub_uint8_t led_status)
{
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
keyboard_controller_wait_untill_ready ();
grub_outb (0xed, KEYBOARD_REG_DATA);
while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
keyboard_controller_wait_untill_ready ();
grub_outb (led_status & 0x7, KEYBOARD_REG_DATA);
}