ps2: only read one byte per interrupt
This commit is contained in:
parent
2eafff563e
commit
bb10b27152
1 changed files with 12 additions and 21 deletions
|
|
@ -23,9 +23,14 @@
|
||||||
//returns -1 if no byte available
|
//returns -1 if no byte available
|
||||||
int read_ps2_byte();
|
int read_ps2_byte();
|
||||||
|
|
||||||
static void process_keyboard_byte(uint8_t byte) {
|
void on_keyboard_irq() {
|
||||||
(void)byte;
|
|
||||||
|
int byte = read_ps2_byte();
|
||||||
|
if (byte == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t mouse_packet[3];
|
static uint8_t mouse_packet[3];
|
||||||
|
|
@ -34,7 +39,11 @@ static int mouse_packet_length = 0;
|
||||||
static int total_x = 0;
|
static int total_x = 0;
|
||||||
static int total_y = 0;
|
static int total_y = 0;
|
||||||
|
|
||||||
static void process_mouse_byte(uint8_t byte) {
|
void on_mouse_irq() {
|
||||||
|
|
||||||
|
int byte = read_ps2_byte();
|
||||||
|
if (byte == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
mouse_packet[mouse_packet_length] = byte;
|
mouse_packet[mouse_packet_length] = byte;
|
||||||
if (mouse_packet_length < 2) {
|
if (mouse_packet_length < 2) {
|
||||||
|
|
@ -69,21 +78,3 @@ static void process_mouse_byte(uint8_t byte) {
|
||||||
fb_base[total_y * fb_pitch + total_x * 4 + 2] = 0xff;
|
fb_base[total_y * fb_pitch + total_x * 4 + 2] = 0xff;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_keyboard_irq() {
|
|
||||||
while (1) {
|
|
||||||
int byte = read_ps2_byte();
|
|
||||||
if (byte == -1)
|
|
||||||
return;
|
|
||||||
process_keyboard_byte(byte);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_mouse_irq() {
|
|
||||||
while (1) {
|
|
||||||
int byte = read_ps2_byte();
|
|
||||||
if (byte == -1)
|
|
||||||
return;
|
|
||||||
process_mouse_byte(byte);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue