/* i8042.c - Intel 8042 keyboard driver routines */
+#define LOG_CATEGORY UCLASS_KEYBOARD
+
#include <common.h>
#include <dm.h>
#include <env.h>
0x00 /* map end */
};
+/**
+ * kbd_input_empty() - Wait until the keyboard is ready for a command
+ *
+ * Checks the IBF flag (input buffer full), waiting for it to indicate that
+ * any previous command has been processed.
+ *
+ * Return: true if ready, false if it timed out
+ */
static int kbd_input_empty(void)
{
int kbd_timeout = KBD_TIMEOUT * 1000;
return kbd_timeout != -1;
}
+/**
+ * kbd_output_full() - Wait until the keyboard has data available
+ *
+ * Checks the OBF flag (output buffer full), waiting for it to indicate that
+ * a response to a previous command is available
+ */
static int kbd_output_full(void)
{
int kbd_timeout = KBD_TIMEOUT * 1000;
{
int config;
+ if (!kbd_input_empty())
+ goto err;
+
/* controller self test */
if (kbd_cmd_read(CMD_SELF_TEST) != KBC_TEST_OK)
goto err;