- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
inux设备模型(总线、设备、驱动程序和类)
2014年7月3日 Linux设备模型(总线、设备、驱动程序和类) - 天不会黑 - 博客园
/yuanfang/archive/2010/12/24/1916232.html 1/8
之一:bus_type
总线是处理器和一个或多个设备之间的通道,在设备模型中,所有的设备都通过总线相连,甚至是内部的虚
拟platform总线。可以通过ls -l /sys/bus看到系统加载的所有总线。
drwxr-xr-x root root 1970-01-01 00:02 platform
drwxr-xr-x root root 1970-01-01 00:02 spi
drwxr-xr-x root root 1970-01-01 00:02 scsi
drwxr-xr-x root root 1970-01-01 00:02 usb
drwxr-xr-x root root 1970-01-01 00:02 serio
drwxr-xr-x root root 1970-01-01 00:02 i2c
drwxr-xr-x root root 1970-01-01 00:02 mmc
drwxr-xr-x root root 1970-01-01 00:02 sdio
drwxr-xr-x root root 1970-01-01 00:02 ac97
总线可以相互插入。设备模型展示了总线和它们所控制的设备之间的实际连接。在Linux 设备模型中,总线由
bus_type 结构表示,定义在 linux/device.h :
struct bus_type {
const char *name; /*总线类型名称*/
struct bus_attribute *bus_attrs; /*总线属性*/
struct device_attribute *dev_attrs; /*设备属性,指为每个加入总线的设备建立的默认属性链表*/
struct driver_attribute *drv_attrs; /*驱动程序属性*/
int (*match)(struct device *dev, struct device_driver *drv); /*总线操作函数*/
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
int (*probe)(struct device *dev);
int (*remove)(struct device *dev);
void (*shutdown)(struct device *dev);
int (*suspend)(struct device *dev, pm_message_t state); /*电源管理函数*/
int (*suspend_late)(struct device *dev, pm_message_t state);
int (*resume_early)(struct device *dev);
int (*resume)(struct device *dev);
struct pm_ext_ops *pm;
struct bus_type_private *p;
};
1,总线的注册和删除,总线的主要注册步骤:
(1)申明和初始化bus_type 结构体。只有很少的bus_type 成员需要初始化,大部分都由设备模型核心控制。
但必须为总线指定名字及一些必要的方法。例如:
struct bus_type ldd_bus_type = {
.name = ldd,
.match = ldd_match,
.uevent = ldd_uevent,
};
(2)调用bus_register函数注册总线。int bus_register(struct bus_type *bus),该调用可能失败,所以必须
始终检查返回值。
ret = bus_register(ldd_bus_type);
if (ret)
return ret;
若成功,新的总线子
您可能关注的文档
- ICO Handbook for Medical Students Learning Ophthalmology.pdf
- ICEM-Intro_13.0_WS5.2a_Wingbody_Prism.pdf
- ICHQ2(R1)中英文对照.pdf
- ican’09 the third prize Automated Barbecue based on sensors presentation ican automated barbecue.pdf
- ICF introduction.pdf
- ICPR 2012 会议总结.pdf
- ICP刻蚀原理:气体、功率的选择--ICP操作流程.pdf
- Icosahedral quasicrystals by optical interference holography.pdf
- ID-Based cryptography from composite degree residuosity,” IACR Cryptology ePrint Archive,.pdf
- IDC_Cloud_Computing.pdf
- Introductory Course.pdf
- Inverse Q Filtering for High Resolution with High Fidelity and High S_N Ratio.pdf
- Intro_to_ Penetrant.pdf
- Invariant densities of delayed maps in the limit of large time delay.pdf
- Introductions Non-photorealistic(NPR) Rendering Conclusions and References Non-photorealist.pdf
- Investigation of Convective Downburst Hazards to Marine Transportation.pdf
- Investigation of Self-Organized Criticality in Packet-Based Communications Networks..pdf
- investment portfolio summary.pdf
- ionic实战系列之——使用cordova插件.docx
- IOI2009中国国家队选拔赛 Day2.pdf
最近下载
- 2025年上海市崇明区中考二模英语试题(含答案).pdf VIP
- 第4课 乡愁(余光中)课件(共19张PPT) 2024-2025学年统编版语文九年级上册.pptx VIP
- 计算机网络网络安全PPT(完整版).pptx VIP
- 2025年邮政职业技能鉴定考试(储汇业务员·高级)历年参考题库含答案详解(5卷).docx VIP
- 供应室去污区课件.pptx VIP
- 三年级快乐阅读社团活动教案.docx VIP
- 预决算管理制度.docx VIP
- 《大学生恋爱心理》PPT课件.ppt VIP
- GB50017-2017钢结构设计标准.doc VIP
- 2025-2026学年初中信息科技冀教版2024七年级全一册-冀教版2024教学设计合集.docx
文档评论(0)