- 5
- 0
- 约1.2万字
- 约 41页
- 2017-01-07 发布于湖北
- 举报
字符设备驱动 Linux字符设备驱动结构 读设备模板 ssize_t xxx_read(struct file *filp, char __user *buf, size_t count ,loff_t*f_pos) { ... copy_to_user(buf, ..., ... ); ... } 写设备模板 ssize_t xxx_write(struct file *fil p, const char __user *buf , size_t count ,loff_t *f_pos) { ... copy_from_user(..., buf, ... ); ... } 字符设备驱动 Linux字符设备驱动结构 ioctl函数 ioctl函数主要完成以下两个功能: 1) 为设备驱动程序执行“命令”提供了一个特有的入口点 2) 用来设置或者读取设备的属性信息 int ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); 事先定义的IO控制命令代码 arg为对应于cmd命令的参数 字符设备驱动 Linux字符设备驱动结构 cm
原创力文档

文档评论(0)