GPIO中断处理函数
来源:互联网 发布:富春山居图有多烂 知乎 编辑:程序博客网 时间:2024/05/17 19:23
Atheros的AP83的解决方案中,gpio的中断服务程序中设置了一个中断处理函数的入口,这个入口可以在其他方便的驱动程序中注册,就像一个钩子函数,感觉用法挺不错的,现在把它的框架记录下来。
int __init pbXX_simple_config_init(void)
{
req = request_irq (AR7100_GPIO_IRQn(JUMPSTART_GPIO), jumpstart_irq, 0,
"SW JUMPSTART", NULL);
return 0;
}
irqreturn_t jumpstart_irq(int cpl, void *dev_id, struct pt_regs *regs)
{
printk ("calling simple_config callback..\n");
if (registered_cb) {
return registered_cb (cpl, cb_arg, regs);
}
return IRQ_HANDLED;
}
typedef irqreturn_t(*sc_callback_t)(int, void *, struct pt_regs *);
static sc_callback_t registered_cb = NULL;
static void *cb_arg;
void register_simple_config_callback (void *callback, void *arg)
{
registered_cb = (sc_callback_t) callback;
cb_arg = arg;
}
EXPORT_SYMBOL(register_simple_config_callback);
void unregister_simple_config_callback (void)
{
registered_cb = NULL;
cb_arg = NULL;
}
EXPORT_SYMBOL(unregister_simple_config_callback);
In madwifi driver
/* Request Simple Config intr handler */
register_simple_config_callback ((void *) jumpstart_intr, (void *) dev);
/*
* Handler for front panel SW jumpstart switch
*/
static irqreturn_t
jumpstart_intr (int cpl, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = dev_id;
struct ath_softc_net80211 *scn = dev->priv;
struct ieee80211com *ic = &scn->sc_ic;
struct ieee80211vap *vap;
vap = TAILQ_FIRST(&ic->ic_vaps);
if (vap != NULL) {
ieee80211_notify_push_button (vap);
}
return IRQ_HANDLED;
}
这个函数就是这个GPIO中断最后对应的处理函数。
- GPIO中断处理函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- GPIO及中断API函数
- WinCE下的GPIO中断的处理
- WinCE下的GPIO中断的处理
- WinCE下的GPIO中断的处理
- WinCE下的GPIO中断的处理
- 《数字技术》连载10: 第2章 数字器件 第5节 TTL 门电路
- 算法基础【2】OJ网站整理
- 网络工程师必看 OSI七层模型协议
- python+multiprocess+theano+pylucene--内存泄露解决方案
- java网络编程
- GPIO中断处理函数
- 使用jackson进行字符串,集合和json之间的转换
- 海思开发板上添加ftp功能
- AnglurJS 常用过滤器
- 通过案例学调优之--Oracle Time Model(时间模型)
- 手把手| 用Python代码建个数据实验室,顺利入坑比特币
- struts2-9为应用指定多个配置文件
- 蓝桥杯 ADV-188 算法提高 排列数(java) 深度优先搜索 DFS
- Redundant_Connection