随笔分类 -  驱动

摘要:Linux I2C 驱动结构i2c体系结构由三部分组成i2C core i2c core提供了i2c 总线驱动 和 设备驱动的注册,注销方法 i2C and SMBus protocol 实现i2C “bus” driver algorithm driver adap... 阅读全文
posted @ 2018-08-03 21:26 feiwatson 阅读(319) 评论(0) 推荐(0)
摘要:转一个挺不错的文章使用 /sys 文件系统访问 Linux 内核https://www.ibm.com/developerworks/cn/linux/l-cn-sysfs/ 如果你正在开发的设备驱动程序中需要与用户层的接口,一般可选的方法有: 注册虚拟的字符... 阅读全文
posted @ 2018-08-01 21:27 feiwatson 阅读(249) 评论(0) 推荐(0)
摘要:通过wiringPi等library, 在user space 通过/dev/i2c来读写i2c设备的方案不在本文讨论了。编译SENSORS_PCF8591 模块在Default raspberryPi的内核中,pcf591模块是没有编译的。查看drivers\hwm... 阅读全文
posted @ 2018-07-31 15:06 feiwatson 阅读(1040) 评论(0) 推荐(0)
摘要:硬件SPI0,CE0 SPI Master Driver设备树arch\arm\boot\dts\bcm2710-rpi-3-b.dts&gpio { spi0_pins: spi0_pins { brcm,pins = ; brcm... 阅读全文
posted @ 2018-07-21 20:57 feiwatson 阅读(497) 评论(0) 推荐(0)
摘要:上文中讨论了通过sysfs来实例化i2c设备 (rtc ds3231) https://blog.csdn.net/feiwatson/article/details/81048616本文继续看看如何通过 DeviceTree Overlays来实例化rtc ds32... 阅读全文
posted @ 2018-07-16 22:17 feiwatson 阅读(832) 评论(0) 推荐(0)
摘要:硬件平台RaspberryPi-3B+Pioneer600外扩版i2c芯片为DS3231,adddress 0x68首先来看一下i2ctool的使用i2ctool 使用https://i2c.wiki.kernel.org/index.php/I2C_Tools ht... 阅读全文
posted @ 2018-07-14 23:19 feiwatson 阅读(757) 评论(0) 推荐(0)
摘要:使用device-tree (DT) overlay应该是更方便的方法:http://blog.gegg.us/2017/01/setting-up-a-gpio-button-keyboard-on-a-raspberry-pi/Back in late 2013,... 阅读全文
posted @ 2018-07-04 23:07 feiwatson 阅读(319) 评论(0) 推荐(0)
摘要:测试 安装 input-utilspi@raspberrypi:~ $ sudo apt-get install input-utilsReading package lists... DoneBuilding dependency tree Readin... 阅读全文
posted @ 2018-07-04 22:47 feiwatson 阅读(161) 评论(0) 推荐(0)
摘要:输入设备(如按键,键盘,触摸屏等)是典型的字符设备,其一般工作原理是底层在按键或触摸等动作发生时产生一个中断,然后CPU通过SPI,I2C总线读取键值。 在这些工作中之后中断和读键值是与设备相关的,而输入事件的缓冲区管理,字符设备驱动的file_operations接... 阅读全文
posted @ 2018-07-01 22:14 feiwatson 阅读(619) 评论(0) 推荐(0)
摘要:在上文中分析了gpio-led platform_device是如何定义并注册的。 那么gpio-led platform_device 和 gpio-led platform_driver是如何匹配的呢我们还是先分析probe函数 drivers\leds\leds... 阅读全文
posted @ 2018-07-01 00:51 feiwatson 阅读(754) 评论(0) 推荐(0)
摘要:我们还是先看看platform device是如何define的platform device 是如何定义的example1在板级驱动中定义, 通过platform_add_devices()函数将这个platform device注册进系统. arch\arm\pl... 阅读全文
posted @ 2018-07-01 00:50 feiwatson 阅读(333) 评论(0) 推荐(0)
摘要:树莓派3b板上有两个LED, pwr (power) 和 act (activity)。是platform_driver gpio-led驱动。可以通过设备树和gpio-led来额外控制一个LED。如下图在P25和GND之间接入一个发光二极管。 在设备树bcm2710... 阅读全文
posted @ 2018-06-26 22:27 feiwatson 阅读(477) 评论(0) 推荐(0)
摘要:以树莓派为例子,分析一下其中LED的 platform device 和 platform driver.查看LED设备,被挂载在/sys/devices/platform下。注意其中的driver指向, driver -> ../../../bus/platform... 阅读全文
posted @ 2018-06-24 23:20 feiwatson 阅读(634) 评论(0) 推荐(0)
摘要:点亮或熄灭LED硬件上,一个LED灯接在pi的Pin-25. 该引脚为BCM的GPIO26$ gpio readall +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-... 阅读全文
posted @ 2018-06-24 18:25 feiwatson 阅读(433) 评论(0) 推荐(0)
摘要:树莓派上Linux驱动,从hello world 开始 ... hello.c #include #include #include MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(vo... 阅读全文
posted @ 2018-06-18 15:54 feiwatson 阅读(259) 评论(0) 推荐(0)