7第七部分嵌入式linux系统驱动开发教材.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 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

文档评论(0)

1112111 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档