libpayload/i8042: Add API to peek on keyboard input queue
Change-Id: I60699e044b5bacd3f5292fed7edbf529ae133284 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47592 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
6e021d31f9
commit
4f7b687fb7
payloads/libpayload
@ -112,6 +112,19 @@ static u8 fifo_pop(struct fifo *fifo)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Peek on the head of fifo queue.
|
||||||
|
* Returns the oldest object on the queue if any.
|
||||||
|
* In case the queue is empty 0 is returned.
|
||||||
|
* @fifo: Fifo to use
|
||||||
|
*/
|
||||||
|
static u8 fifo_peek(struct fifo *fifo)
|
||||||
|
{
|
||||||
|
if (fifo_is_empty(fifo))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return fifo->buf[fifo->rx];
|
||||||
|
}
|
||||||
|
|
||||||
/** Destroys a fifo queue.
|
/** Destroys a fifo queue.
|
||||||
* @fifo: Fifo to use
|
* @fifo: Fifo to use
|
||||||
*/
|
*/
|
||||||
@ -390,6 +403,14 @@ u8 i8042_read_data_ps2(void)
|
|||||||
return fifo_pop(ps2_fifo);
|
return fifo_pop(ps2_fifo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns available keyboard data without advancing the queue.
|
||||||
|
*/
|
||||||
|
u8 i8042_peek_data_ps2(void)
|
||||||
|
{
|
||||||
|
return fifo_peek(ps2_fifo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns available mouse data, if any.
|
* Returns available mouse data, if any.
|
||||||
*/
|
*/
|
||||||
|
@ -233,6 +233,7 @@ u8 i8042_data_ready_ps2(void);
|
|||||||
u8 i8042_data_ready_aux(void);
|
u8 i8042_data_ready_aux(void);
|
||||||
|
|
||||||
u8 i8042_read_data_ps2(void);
|
u8 i8042_read_data_ps2(void);
|
||||||
|
u8 i8042_peek_data_ps2(void);
|
||||||
u8 i8042_read_data_aux(void);
|
u8 i8042_read_data_aux(void);
|
||||||
|
|
||||||
int i8042_wait_read_ps2(void);
|
int i8042_wait_read_ps2(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user