2. 驱动源代码
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <asm/uaccess.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/arch/regs-gpio.h>
#include <asm/hardware.h>
#include <linux/poll.h>
static struct class *four_drv_class;
static struct class_device *four_drv_class_dev;
typedef struct
{
unsigned int pin;
unsigned int key_val;
}s3c2440_buttons_desc;
s3c2440_buttons_desc pins_desc[]={
{
S3C2410_GPF0, 0x01},
{
S3C2410_GPF2, 0x02},
{
S3C2410_GPG3, 0x03},
{
S3C2410_GPG11, 0x04},
};
unsigned int key_val;
static DECLARE_WAIT_QUEUE_HEAD(button_waitq);
static volatile int ev_press = 0;
irqreturn_t buttons_irq(int irq, void *dev_id