示例#1
0
文件: keyboard.c 项目: AeroHand/xi391
/* 
 * keyboard_interruption()
 *
 * Description:
 * Triggered by a keyboard interrupt (routed from the idt).
 *
 * Inputs: none
 *
 * Outputs: none
 */
void keyboard_interruption() {
	
	/* Mask interrupts */
	cli();
	
	/* Scancode (byte) that we receive from the keyboard. */
	uint8_t keyboard_scancode;

	/* Status that we get from keyboard to see if the buffer is full. */
	uint8_t keyboard_status;

	do {
		/* Dequeue the typed character from the keyboard buffer. */
		keyboard_scancode = inb(KEYBOARD_PORT);
		
		/* Process the input from the keyboard. */
		process_keyboard_input(keyboard_scancode);

		/* Print the buffer */
		printthebuffer();
		
		/* Check to see if the keyboard buffer is full. */
		keyboard_status = inb(KEYBOARD_STATUS_PORT);

	/* If the buffer is still full, repeat the process until the buffer 
	 * is empty. */
	} while (keyboard_status & BUFFER_NOT_EMPTY);

	/* Send End-of-Interrupt */
	send_eoi(KEYBOARD_IRQ);

	/* Unmask interrupts */
	sti();

}
示例#2
0
static void process_input(void *data) {
    //fs_log("process_input\n");
    LPRAWINPUT raw_input = data;
    if (raw_input->header.dwType == RIM_TYPEMOUSE) {
        process_mouse_input(raw_input);
    }
    else if (raw_input->header.dwType == RIM_TYPEKEYBOARD) {
        process_keyboard_input(raw_input);
    }
}