arm6410按键驱动程序
通过查询的方法获取按键值
驱动程序 botton_drive.c
驱动程序 botton_drive.c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/uaccess.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <linux/device.h>
//#include <asm/arch/regs-gpio.h>
//#include <asm/hardware.h>
static struct class *seconddrv_class;
static struct class_device
*seconddrv_class_dev;
volatile unsigned long *gpmcon = NULL;
volatile unsigned long *gpmdat = NULL;
volatile unsigned long *gpncon = NULL;
volatile unsigned long *gpndat = NULL;
static int second_drv_open(struct inode *inode, struct file *file)
{
//printk("second_drv_open\n");
/* 配置GPm0,1,2,3为输出 */
*gpmcon &= ~((0xf<<(4*0)) | (0xf<<(4*1)) | (0xf<<(4*2)) | (0xf<<(4*3)));
*gpmcon |= ((0x1<<(4*0)) | (0x1<<(4*1)) | (0x1<<(4*2)) | (0x1<<(4*3)));