随笔分类 -  Linux设备驱动

摘要:https://blog.csdn.net/dxm809/article/details/103799537 阅读全文
posted @ 2021-04-05 18:26 坦率 阅读(72) 评论(0) 推荐(0)
摘要:目标:实现同一时刻,只能有一个应用程序打开驱动设备。 方法:原子操作。 阅读全文
posted @ 2020-05-26 14:50 坦率 阅读(107) 评论(0) 推荐(0)
摘要:1 #include <stdio.h> 2 #include <signal.h> 3 4 void my_signal_handler(int signum) 5 { 6 static int cnt = 0; 7 printf("signal = %d, %d times\n",signum, 阅读全文
posted @ 2020-05-25 10:14 坦率 阅读(116) 评论(0) 推荐(0)
摘要:led-drv.c: 1 #include <linux/module.h> 2 #include <linux/kernel.h> 3 #include <linux/fs.h> 4 #include <linux/init.h> 5 #include <linux/delay.h> 6 #inc 阅读全文
posted @ 2020-05-19 21:53 坦率 阅读(171) 评论(0) 推荐(0)
摘要:__attribute__((section(".xxx")))子项section的使用方法,可以用来修饰变量或函数: 修饰变量: int var __attribute__((section(".xdata"))) = 0; 这样定义的变量 var 将被放入名为 .xdata 的输入段,(注意:_ 阅读全文
posted @ 2020-05-19 15:44 坦率 阅读(186) 评论(0) 推荐(0)
摘要:概念:按字节流进行读写操作的设备,读写数据分先后。 举例:led、button、I2C、SPI、LCD等。 Linux应用程序对驱动程序的调用: Linux一切皆文件,驱动程序加载成功之后就会在"/dev"目录下生成一个相对应的文件,应用程序通过对这个"/dev/xxx"进行open(),read( 阅读全文
posted @ 2020-05-17 18:32 坦率 阅读(267) 评论(0) 推荐(0)