keyb_arc.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:13k
- /*
- * linux/drivers/acorn/char/keyb_arc.c
- *
- * Copyright (C) 2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Acorn keyboard driver for ARM Linux.
- *
- * The Acorn keyboard appears to have a ***very*** buggy reset protocol -
- * every reset behaves differently. We try to get round this by attempting
- * a few things...
- */
- #include <linux/config.h>
- #include <linux/sched.h>
- #include <linux/interrupt.h>
- #include <linux/tty.h>
- #include <linux/tty_flip.h>
- #include <linux/mm.h>
- #include <linux/slab.h>
- #include <linux/ptrace.h>
- #include <linux/signal.h>
- #include <linux/timer.h>
- #include <linux/random.h>
- #include <linux/ctype.h>
- #include <linux/init.h>
- #include <linux/kbd_ll.h>
- #include <linux/kbd_kern.h>
- #include <linux/delay.h>
- #include <asm/bitops.h>
- #include <asm/keyboard.h>
- #include <asm/irq.h>
- #include <asm/hardware.h>
- #include <asm/hardware/ioc.h>
- #include "../../char/busmouse.h"
- extern struct tasklet_struct keyboard_tasklet;
- extern void kbd_reset_kdown(void);
- #define VERSION 108
- #define KBD_REPORT_ERR
- #define KBD_REPORT_UNKN
- #include <asm/io.h>
- #include <asm/system.h>
- static char kbd_txval[4];
- static unsigned char kbd_txhead, kbd_txtail;
- #define KBD_INCTXPTR(ptr) ((ptr) = ((ptr) + 1) & 3)
- static int kbd_id = -1;
- static DECLARE_WAIT_QUEUE_HEAD(kbd_waitq);
- #ifdef CONFIG_KBDMOUSE
- static int mousedev;
- #endif
- /*
- * Protocol codes to send the keyboard.
- */
- #define HRST 0xff /* reset keyboard */
- #define RAK1 0xfe /* reset response */
- #define RAK2 0xfd /* reset response */
- #define BACK 0x3f /* Ack for first keyboard pair */
- #define SMAK 0x33 /* Last data byte ack (key scanning + mouse movement scanning) */
- #define MACK 0x32 /* Last data byte ack (mouse movement scanning) */
- #define SACK 0x31 /* Last data byte ack (key scanning) */
- #define NACK 0x30 /* Last data byte ack (no scanning, mouse data) */
- #define RQMP 0x22 /* Request mouse data */
- #define PRST 0x21 /* nothing */
- #define RQID 0x20 /* Request ID */
- #define UP_FLAG 1
- #ifdef CONFIG_MAGIC_SYSRQ
- unsigned char a5kkbd_sysrq_xlate[] =
- {
- 27, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- '`', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', '0', '-', '=', '