中断底半部及工作队列的用法
来源:互联网 发布:java多线程 pdf 编辑:程序博客网 时间:2024/05/16 18:59
使用场景:
a)如果一个任务对时间非常敏感,将其放在中断处理程序中执行。
b)如果一个任务和硬件相关,将其放在中断处理程序中执行。
c)如果一个任务要保证不被其他中断(特别是相同的中断)打断,将其放在中断处理程序中执行。
d)其他所有任务,考虑放在下半部去执行。
e)不能睡眠
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/of_irq.h>
#include <linux/rtpm_prio.h>
static unsigned int ft_touch_irq=0
static unsigned int hf_flag=0
staic DECLARE_WAIT_QUEUE_HEAD(waiter);
void led_tasklet_action(void);
DECLARE_TASKLET(test_tasklet,led_tasklet_action,0);
staic irqreturn_t eint_interrupt_handler(int irq,void *dev_id)
{
tasklet_schedule(&test_tasklet);
return IRQ_HANDLED;
}
static int irq_registration(void)//最好写在probe中
{
struct device_node *node=NULL;
int ret=0;
u32 ints[2]={0,0};
node = of_find_matching_node(node,touch_of_match);
if(node){
of_property_read_u32_array(node,”debounce”,ints,ARRAY_SIZE(ints));
gpio_set_debounce(ints[0],ints[1]);
ft_touch_irq=irq_of_parse_and_map(node,0);
ret=request_irq(ft_touch_irq,eint_interrupt_handler,IRQF_TRIGGER_RISING,”TOUCH_PANEL-eint”,NULL);
}
else{
printk(“can not find eint device node!”);
}
return 0;
}
void led_tasklet_action(void)
{
......
......
......//执行代码
}
个人原创,可直接复制在代码中使用,请勿转载
- 中断底半部及工作队列的用法
- 工作队列、tasklet、软中断的用法总结
- 中断处理的工作队列机制
- 中断处理的工作队列机制
- Linux中断/task/工作队列的应用
- 中断 和工作队列的应用
- 中断处理的工作队列机制
- Linux内核中断底半部处理--工作队列
- 中断下半部-工作队列
- 中断下半部-工作队列
- 中断控制---工作队列
- 中断控制---工作队列
- 中断控制---工作队列
- 中断 下半部及下半部推后的工作
- 软中断/tasklet/工作队列
- 软中断/tasklet/工作队列
- 软中断/tasklet/工作队列
- 软中断/tasklet/工作队列
- C语言之桶排序,冒泡排序,快速排序,选择排序算法学习
- loj#6169. 相似序列
- NYOJ-备用2350 彩排(位运算)
- 文件上传(加水印、生成预览图)
- Enum枚举类型的使用
- 中断底半部及工作队列的用法
- 判断用户使用的是什么浏览器,是什么终端设备
- Qt中点击关闭任务栏而不退出程序的实现方法
- eclise 部署web工程报 There are no resources that can be added or removed from the server.
- 七 iOS之 矩阵操作(图形上下文的平移、缩放、旋转)
- 阅读Vue.jsAPI
- dp Vijos P1370 分苹果
- UVa12096(集合中的集合+stl)集合栈计算机
- 数据库SQL实战