myled.c
#include <linux/gpio.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
/*
CNAME:LED 设备的名称。
LED1 的开关命令:
LED1_ON:将 LED1 打开。
LED1_OFF:将 LED1 关闭。
LED2 的开关命令:
LED2_ON:将 LED2 打开。
LED2_OFF:将 LED2 关闭。
LED3 的开关命令:
LED3_ON:将 LED3 打开。
LED3_OFF:将 LED3 关闭。
LED 状态命令:
LED1_STATUS:获取 LED1 的状态。
LED2_STATUS:获取 LED2 的状态。
LED3_STATUS:获取 LED3 的状态。
*/
#define CNAME "myled"
#define LED1_ON _IOW('L', 1, int)
#define LED1_OFF _IOW('L', 0, int)
#define LED2_ON _IOW('I', 1, int)
#define LED2_OFF _IOW('I', 0, int)
#define LED3_ON _IOW('J', 1, int)
#define LED3_OFF _IOW('J', 0, int)
// led状态cmd
#define LED1_STATUS _I