本文将介绍在EXYNOS4412平台上实现对LED灯开关的控制
首先定义命令在led.h文件中
#define LED_MAGIC 'L'
#define LED_ON _IO(LED_MAGIC,1)
#define LED_OFF _IO(LED_MAGIC,0)
LED2对应控制寄存器为GPL2
LED3对应控制寄存器为GPK1
接下来编写led控制驱动程序
#include <linux/module.h>
#include <linux/init.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/io.h>
#include "led.h"
#define GPL2CON 0x11000100
//GPL2CON寄存器的物理地址
#define GPL2DAT 0x11000104
//GPL2DAT寄存器的物理地址
#define GPK1CON 0x11000060
//GPK1CON寄存器的物理地址
#define GPK1DAT 0x11000064
//GPK1DAT寄存器的物理地址
static int