kbc: Use u16 for timeout
The timeout will never be negative. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Jeremy Soller
parent
2a3830fb57
commit
f27d6350f2
@ -33,8 +33,8 @@ extern struct Kbc __code KBC;
|
||||
|
||||
uint8_t kbc_status(struct Kbc * kbc);
|
||||
uint8_t kbc_read(struct Kbc * kbc);
|
||||
bool kbc_keyboard(struct Kbc * kbc, uint8_t data, int16_t timeout);
|
||||
bool kbc_mouse(struct Kbc * kbc, uint8_t data, int16_t timeout);
|
||||
bool kbc_keyboard(struct Kbc * kbc, uint8_t data, uint16_t timeout);
|
||||
bool kbc_mouse(struct Kbc * kbc, uint8_t data, uint16_t timeout);
|
||||
|
||||
volatile uint8_t __xdata __at(0x1300) KBHICR;
|
||||
volatile uint8_t __xdata __at(0x1302) KBIRQR;
|
||||
|
@ -20,7 +20,7 @@ uint8_t kbc_read(struct Kbc * kbc) {
|
||||
return *(kbc->data_in);
|
||||
}
|
||||
|
||||
static bool kbc_wait(struct Kbc * kbc, int16_t timeout) {
|
||||
static bool kbc_wait(struct Kbc * kbc, uint16_t timeout) {
|
||||
while (*(kbc->status) & KBC_STS_OBF) {
|
||||
if (timeout == 0) return false;
|
||||
timeout -= 1;
|
||||
@ -29,14 +29,14 @@ static bool kbc_wait(struct Kbc * kbc, int16_t timeout) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool kbc_keyboard(struct Kbc * kbc, uint8_t data, int16_t timeout) {
|
||||
bool kbc_keyboard(struct Kbc * kbc, uint8_t data, uint16_t timeout) {
|
||||
if (!kbc_wait(kbc, timeout)) return false;
|
||||
*(kbc->status) &= ~0x20;
|
||||
*(kbc->keyboard_out) = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool kbc_mouse(struct Kbc * kbc, uint8_t data, int16_t timeout) {
|
||||
bool kbc_mouse(struct Kbc * kbc, uint8_t data, uint16_t timeout) {
|
||||
if (!kbc_wait(kbc, timeout)) return false;
|
||||
*(kbc->status) |= 0x20;
|
||||
*(kbc->mouse_out) = data;
|
||||
|
Reference in New Issue
Block a user