demo.h
来自「Linux 2.6核下的字符驱动示例。以简单的代码表现Linux的驱动程序结构」· C头文件 代码 · 共 24 行
H
24 行
//demo.h#ifndef _DEMO_H_#define _DEMO_H_//设备号#define DEMO_MAJOR 224#define DEMO_MINOR 0//向设备下达的命令#define COMMAND1 1#define COMMAND2 2//自己定义的设备结构 struct DEMO_dev { struct cdev cdev; /* Char device structure */};//设备操作函数申明ssize_t DEMO_read(struct file *filp, char __user *buf, size_t count,loff_t *f_pos);ssize_t DEMO_write(struct file *filp, const char __user *buf, size_t count,loff_t *f_pos);int DEMO_open(struct inode *inode, struct file *filp);int DEMO_release(struct inode *inode, struct file *filp);int DEMO_ioctl(struct inode *inode, struct file *filp,unsigned int cmd, unsigned long arg);#endif /* _DEMO_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?