Enable interrupts on request

This commit is contained in:
Jeremy Soller 2019-11-08 11:28:40 -07:00
parent 97bbdf4a0b
commit 6e9f52efab
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1

View File

@ -4,9 +4,9 @@
#include <board/kbscan.h> #include <board/kbscan.h>
void kbc_init(void) { void kbc_init(void) {
// Disable interrupts
*(KBC.irq) = 0; *(KBC.irq) = 0;
// Enable IRQ1 on keyboard output and IRQ12 on mouse output *(KBC.control) = 0;
*(KBC.control) = 0x03;
} }
enum KbcState { enum KbcState {
@ -98,6 +98,18 @@ void kbc_event(struct Kbc * kbc) {
case KBC_STATE_WRITE_CONFIG: case KBC_STATE_WRITE_CONFIG:
printf(" write configuration byte\n"); printf(" write configuration byte\n");
state = KBC_STATE_NORMAL; state = KBC_STATE_NORMAL;
uint8_t control = *kbc->control;
if (data & 1) {
control |= 1;
} else {
control &= ~1;
}
if (data & (1 << 1)) {
control |= (1 << 1);
} else {
control &= ~(1 << 1);
}
*kbc->control = control;
break; break;
case KBC_STATE_SET_LEDS: case KBC_STATE_SET_LEDS:
printf(" set leds\n"); printf(" set leds\n");