1.字符设备驱动的框架结构
2.字符设备驱动创建的API
#include <linux/fs.h> int register_chrdev(unsigned int major, const char *name, const struct file_operations *fops) 功能:创建字符设备驱动 参数: @major:主设备号(这个函数申请了256个设备,次设备号的范围是[0-255]) major > 0 :静态指定主设备号 major = 0 :系统自动分配主设备号 @name:设备驱动的名字 cat /proc/devices 245 watchdog 主设备号 名字 @fops:操作方法结构体 struct file_operations { int (*open) (struct inode *, struct file *); ssize_t (*read) (struct file