免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3294 | 回复: 4
打印 上一主题 下一主题

请问在2.6上如何使用request_irq, [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-01-19 10:21 |只看该作者 |倒序浏览
请问在2.6上如何使用request_irq,在2.4上是没问题的,使用都没问题;但是移到2.6上编译就来了个警告

warning:implicit  declaration of funtion ‘request_irq’
warning:implicit  declaration of funtion ‘free_irq’
使得我的中断程序在2.6上无法使用,一发生中断就产生了
handlers:
[<d0893782>] (soe_interrupt+0x0/0x167 [soenew])
irq event 3: bogus return value ff
[<c0107da9>] __report_bad_irq+0x3a/0x77
[<c01081b1>] note_interrupt+0x23/0x1c4
[<c01088c3>] do_IRQ+0x24d/0x309
[<c030c138>] common_interrupt+0x18/0x20
[<c0225961>] write_chan+0x95/0x1d6
[<c011cb66>] default_wake_function+0x0/0xc
[<c011cb66>] default_wake_function+0x0/0xc
[<c021e9cf>] tty_write+0x321/0x431
[<c02258cc>] write_chan+0x0/0x1d6
[<c01672fe>] vfs_write+0xb6/0xe2
[<c01673c8>] sys_write+0x3c/0x62
[<c030bf47>] syscall_call+0x7/0xb
[<c030007b>] xfrm_state_lookup+0xea/0x151
我不知道这些东西为什么内核要把他打印到dmesg内


还有就是到了2.6的时候“interruptible_sleep_on”编译的时候说反对用这种阻塞方式

warning :‘interruptible_sleep_on’ is deprecated

那位朋友能帮忙解决一下那

论坛徽章:
0
2 [报告]
发表于 2006-01-19 10:31 |只看该作者

回复 1楼 gqm 的帖子

版主能帮忙,或是高手朋友们能帮忙解决一下吗

论坛徽章:
0
3 [报告]
发表于 2006-01-19 13:49 |只看该作者
interruptible_sleep_on()会引起调度, 不能用在中断上下文

论坛徽章:
0
4 [报告]
发表于 2006-01-19 16:39 |只看该作者

回复 1楼 gqm 的帖子

这个问题我以解决了。现在和大家分享一下!
这个问题主要是应为在2.6中,中断函数的声明已经变了!
在2.4中中断注册声明在#include <asm/unistd.h>这个头文件中,在2.6中中断注册声明在#include <asm/irq.h>
在2.4中void soe_interrupt (int soe_irq,void *dev_id,struct pt_regs *regs)在内核调度是没有问题的
虽然在2.6中这样编译也可以用,但是内核会打印出
handlers:
[<d0893782>] (soe_interrupt+0x0/0x167 [soenew])
irq event 3: bogus return value ff
[<c0107da9>] __report_bad_irq+0x3a/0x77
[<c01081b1>] note_interrupt+0x23/0x1c4
[<c01088c3>] do_IRQ+0x24d/0x309
[<c030c138>] common_interrupt+0x18/0x20
[<c0225961>] write_chan+0x95/0x1d6
[<c011cb66>] default_wake_function+0x0/0xc
[<c011cb66>] default_wake_function+0x0/0xc
[<c021e9cf>] tty_write+0x321/0x431
[<c02258cc>] write_chan+0x0/0x1d6
[<c01672fe>] vfs_write+0xb6/0xe2
[<c01673c8>] sys_write+0x3c/0x62
[<c030bf47>] syscall_call+0x7/0xb
[<c030007b>] xfrm_state_lookup+0xea/0x151
这样我就不能急时的到中断数据,这样使用是有问题的!
解决方法如下:
在2.6中static irqreturn_t soe_interrupt (int soe_irq,void *dev_id,struct pt_regs *regs)才能调度

     int handled=0;
        return IRQ_RETVAL(handled);

问题就没有了。详细的可一看一下kernel文件内的8139too.c程序!
还有就是我用的那个阻塞方式interruptible_sleep_on在2.6中反对用的个
现在用wait_event_interruptible(wd ,condition);
在2.4中也有这个宏!
说的可能不是很详细,又要问的在给我回贴子!希望能有帮助

论坛徽章:
0
5 [报告]
发表于 2006-01-19 16:43 |只看该作者

回复 1楼 gqm 的帖子

interruptible_sleep_on这个宏我用到了read函数中了!没用用在中断中
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP