ioctl() vs unlocked_ioctl() vs compat_ioctl()
2018-6-11
ioctl()被大内核锁锁住,在多核系统上,性能较低。unlcoked_ioctl()让每个驱动自己上锁。compat_ioctl() 让64位内核支持32位用户态程序,ioctl的最后一个参数,依赖于驱动自己解释,所以没有通用的方法做这个转化,因此需要compat_ioctl().参考:https
Platform driver
2018-7-22
像PCI bus和USB bus,可以发现连接到bus上的设备。有些设备是CPU不能发现的。因此需要通过某种方式显示地告诉有指定的设备。platform devices就是这种设备。platform driver就是处理这些设备的驱动。Platform driversstruct platform_
Platform devices and device trees
2018-7-22
前一篇文章,描述了内核处理不可发现设备的机制:platform devices。platform device scheme有一个很长的历史,而且使用广泛,但是它有一个缺点,必须在代码中实例化这些设备。device tree机制是后续更好的解决方法。device tree中的设备节点,有一个comp
使用platform driver和device tree开发树莓派led驱动
2018-7-27
本文在树莓派上实现了一个LED驱动,通过device tree和platform driver为驱动模型,注册led到内核led class中。1 device tree首先,device tree添加led节点: hy,led@0 { compatible = "hy,gpio-led";
添加proc接口
2018-7-29
很多内核模块都在/proc目录添加条目,用文件读写的方式来实现用户态和内核交换数据。1 创建删除在新的内核,创建proc条目的接口通常使用:extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
driver load error, deferred probe pending
2023-12-10
最近在移植一个驱动,启动后打印:platform i2c@0: deferred probe pendingdrivers/base/dd.c打印是:static void deferred_probe_timeout_work_func(struct work_struct *work){
Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.