要操作S3C2440的IO口,首先要进行IO的初始化,根据MINI2440的原理图,应将按键对应GPIO口设置为输出模式,内核源码arch/arm/plat_s3c24xx/gpio.c中提供了初始化管脚功能的函数void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function),将初始化函数写在buttons_polling_drv_open函数中,代码如下:
点击(此处)折叠或打开
static unsigned long buttons_polling_table[]={
S3C2410_GPG0,
S3C2410_GPG3,
S3C2410_GPG5,
S3C2410_GPG6,
S3C2410_GPG7,
S3C2410_GPG11,
};
static unsigned long buttons_polling_cfg_table[]={
S3C2410_GPB0_INP,
S3C2410_GPB3_INP,
S3C2410_GPB5_INP,
S3C2410_GPB6_INP,
S3C2410_GPB7_INP,
S3C2410_GPB8_INP,
};
static int buttons_polling_drv_open(struct inode *inode, struct file *file)