📄 keydriver.h
字号:
#ifndef _KEYDRIVER_H
#define _KEYDRIVER_H
#include <linux/version.h>
#include <linux/kernel.h> /* We're doing kernel work */
#include <linux/module.h> /* Specifically, a module */
#include <linux/interrupt.h> /* We want interrupts */
#include <linux/miscdevice.h> /* for misc_register() and misc_deregister() */
#include <linux/fs.h> /* for struct 'file_operations' */
#include <linux/timer.h> /* for timeout interrupts */
#include <linux/param.h> /* for HZ. HZ = 100 and the timer step is 1/100 */
#include <linux/sched.h> /* for jiffies definition. jiffies is incremented
* once for each clock tick; thus it's incremented*/
#include <linux/mm.h> /* for verify_area */
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/init.h>
//#include <string.h>
//#include <stdlib.h>
#include <asm/irq.h> /* For IRQ_MACHSPEC */
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/arch/irqs.h>
#include <asm/arch/hardware.h>
#include <asm/arch/44b.h>
#include <asm/arch/def.h>
#include "key.h"
#define DEVICE_NAME "s3c44b0key"
#define KEY_MAJOR 123
#define KEY_MINOR 0
#define KEY_BUF_SIZE 16 // key buffer size
#define KEY_TIMER_DELAY (HZ/10) /*100ms*/
#define KEY_TIMER_DELAY1 (HZ/50) /*10ms*/
#define delayLoopCount (400)
#ifdef CONFIG_DEVFS_FS
static devfs_handle_t devfs_kbd_dir,devfs_kbdraw;
#endif
//struct KEYDEV;
//****************************************
//****************************************
/*static struct file_operations key_fops=
{
owner: THIS_MODULE,
read : key_read,
ioctl: key_ioctl,
open : key_open,
release: key_release,
};
*/
typedef struct _KBDDEV{
//static struct KBDDEV{
unsigned int head;
unsigned int tail;
//unsigned int keystatus;
unsigned char buf[KEY_BUF_SIZE];
wait_queue_head_t wq;
struct fasync_struct *fasync_queue;
} KBDDEV,*PKBDDEV;
//}
static KBDDEV *keydev;
#define BUF_HEAD (keydev->buf[keydev->head]) //缓冲区头
#define BUF_TAIL (keydev->buf[keydev->tail]) //缓冲区尾
#define INCBUF(x,mod) ((++(x)&(mod)-1)) //移动缓冲区指针
//static U16 key;
//static struct timer_list key_timer;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -