随笔分类 -  linux 驱动开发杂项知识

linux设备驱动模型(kobject与kset)
摘要:Linux设备模型的目的:为内核建立一个统一的设备模型,从而又一个对系统结构的一般性抽象描述。换句话说,Linux设备模型提取了设备操作的共同属性,进行抽象,并将这部分共同的属性在内核中实现,而为需要新添加设备或驱动提供一般性的统一接口,这使得驱动程序的开发变得更简单了,而程序员只需要去学习接口就行了。 kobject 1.sysfs文件系统 1.1 sysfs文件系统与内核结构的关系linux内核中的结构sysfs中的结构 ... 阅读全文

posted @ 2013-10-23 14:46 熊猫酒仙是也 阅读(2836) 评论(0) 推荐(0)

模块参数和模块之间的通讯
摘要:一.模块参数 模块参数需要在加载模块时指定,e.g. insmod xxxx.ko param=1 定义:module_param(参数名,参数数据类型,参数读写权限); e.g. static long a =1; static int b =1; module_param(a,long,S_IRUGO); module_param(b,int,S_IRUGO);二.模块的文件格式ELF .test 代码段.data 数据段Section Table 所有段的信息.symtab 符号表三.模块之间的通讯 符号导出用 EXPORT_S... 阅读全文

posted @ 2013-10-11 21:20 熊猫酒仙是也 阅读(369) 评论(0) 推荐(0)

platform平台设备驱动简化示例代码
摘要:driver.c:#include #include #include #include #include #include #define DRIVER_NAME "my_dev"static int my_probe(struct device *dev){ printk("driver found device !!\n"); return 0;}static int my_remove(struct device *dev){ printk("driver found device unpluged !!\n"); retur 阅读全文

posted @ 2013-09-14 14:37 熊猫酒仙是也 阅读(455) 评论(0) 推荐(0)

platform_driver_register()--如何match之后调用probe
摘要:int platform_driver_register(struct platform_driver *drv){ drv->driver.bus = &platform_bus_type;/*关联总线*/ /*关联driver的设备方法*/ if (drv->probe) drv->driver.probe = platform_drv_probe; if (drv->remove) drv->driver.remove = platform_drv_remove; if (drv->shutdown) drv->dr... 阅读全文

posted @ 2013-09-13 14:24 熊猫酒仙是也 阅读(4442) 评论(0) 推荐(0)

导航