- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
驱动开发;驱动简介;驱动考虑因素;调试方法;设备驱动的分类;字符设备(character devices);块设备 (block devices);网络接口(network device );常用概念;创建设备节点;/dev设备列表;file_operations;struct file_operations {
struct module *owner;
loff_t (*llseek) (struct file *, loff_t, int);
ssize_t (*read) (struct file *, char *, size_t, loff_t *);
ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
int (*readdir) (struct file *, void *, filldir_t);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
int (*mmap) (struct file *, struct vm_area_struct *);
int (*open) (struct inode *, struct file *);
int (*flush) (struct file *);
int (*release) (struct inode *, struct file *);
int (*fsync) (struct file *, struct dentry *, int datasync);
int (*fasync) (int, struct file *, int);
int (*lock) (struct file *, int, struct file_lock *);
ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
#ifdef MAGIC_ROM_PTR
int (*romptr) (struct file *, struct vm_area_struct *);
#endif /* MAGIC_ROM_PTR */
}; ;主要接口;;# define __KERNEL__
# define MODULE
#include linux/config.h
#include linux/module.h
#include linux/devfs_fs_kernel.h
#include linux/init.h
#include linux/kernel.h /* printk() */
#include linux/fs.h /* everything... */
#include linux/errno.h /* error codes */
#include linux/types.h /* size_t */
#include linux/proc_fs.h
#define DEVICE_NAME mydriver
#define demo_MAJOR 250
#define demo_MINOR 0;static ssize_t mydriver_write(struct file *file, const char *buffer, size_t count){
printk(user write to device\n);
return 0;
}
static ssize_t mydriver_read(struct file *file,char *buf,size_t count, loff_t *ppo
您可能关注的文档
最近下载
- 新款GC9790II型色谱仪说明书.pdf VIP
- 2025山东省环保发展集团有限公司业务中心及双碳业务板块招聘笔试模拟试题及答案解析.docx VIP
- 标准图集-04G101-3 筏形基础.PDF VIP
- (高清版)B-T 4798.3-2023 环境条件分类 环境参数组分类及其严酷程度分级 第3部分:有气候防护场所固定使用.pdf VIP
- 高中英语教学竞赛公开课、高考复习课件——2025年高考新课标一卷读后续写详析及参考范文专项课件.pptx VIP
- 安装工培训课件.pptx VIP
- 西安航空学院辅导员招聘考试备考真题题库汇编.pdf VIP
- 《蒸汽管道竣工全套资料表格》.docx VIP
- 《油气储存企业安全风险评估细则(2025年修订版)》解读与培训.pptx VIP
- 上海市交通大学附属中学2021届高三9月开学考试英语试题.docx VIP
文档评论(0)