Clean up kernel/devices/kbd

Remove a bunch of unused macros and variables.
This commit is contained in:
Kevin Lange 2012-12-04 15:41:01 -08:00
parent c90bf5cbc9
commit a201ea07b1

View File

@ -9,7 +9,6 @@
* Copyright 2011-2012 Kevin Lange
*
* TODO: Move this to a server
* TODO: Better handling of function keys
*/
#include <system.h>
@ -18,47 +17,28 @@
#include <pipe.h>
#include <process.h>
#define KEY_UP_MASK 0x80
#define KEY_CODE_MASK 0x7F
#define KEY_CTRL_MASK 0x40
#define KEY_DEVICE 0x60
#define KEY_PENDING 0x64
#define KEYBOARD_NOTICES 0
#define KEYBOARD_IRQ 1
/* A bit-map to store the keyboard states */
struct keyboard_states {
uint32_t shift : 1;
uint32_t alt : 1;
uint32_t ctrl : 1;
} keyboard_state;
typedef void (*keyboard_handler_t)(int scancode);
fs_node_t * keyboard_pipe;
extern uint8_t mouse_cycle;
void
keyboard_handler(
struct regs *r
) {
void keyboard_handler(struct regs *r) {
unsigned char scancode;
keyboard_wait();
scancode = inportb(KEY_DEVICE);
irq_ack(KEYBOARD_IRQ);
putch(scancode);
}
/*
* Install the keyboard driver and initialize the
* pipe device for userspace.
*/
void
keyboard_install() {
void keyboard_install() {
blog("Initializing PS/2 keyboard driver...");
LOG(INFO, "Initializing PS/2 keyboard driver");
@ -82,18 +62,14 @@ void keyboard_reset_ps2() {
/*
* Wait on the keyboard.
*/
void
keyboard_wait() {
void keyboard_wait() {
while(inportb(KEY_PENDING) & 2);
}
/*
* Add a character to the device buffer.
*/
void
putch(
unsigned char c
) {
void putch(unsigned char c) {
uint8_t buf[2];
buf[0] = c;
buf[1] = '\0';