内核中的快速中断库函数有问题!!

jackadandy 2004-09-15 12:43:25
我用的内核版本linux--2.4.13
它提供了快速中断函数,我的机子里是在/usr/src/arm/linux/arch/arm/kernel/fiq.c 在该文件中,宏FIQ_START的值为64,那么在调用函数enable_fiq(fiq)时,他就会间接调用了enable_irq(fiq+FIQ_START)函数。其中enable_irq的参数会大于等于64,这样就出错了,因为下面数组irq_desc[]最大包含30个元素(struct irqdesc irq_desc[NR_IRQS]; NR_IRQS=30)

void enable_irq(unsigned int irq)
87 {
88 unsigned long flags;
89
90 spin_lock_irqsave(&irq_controller_lock, flags);
91 irq_desc[irq].probing = 0;
92 irq_desc[irq].triggered = 0;
93 irq_desc[irq].enabled = 1;
94 irq_desc[irq].unmask(irq);
95 spin_unlock_irqrestore(&irq_controller_lock, flags);
96 }

我在驱动中调用这个函数试就出错了!


还有一个
int claim_fiq(struct fiq_handler *f)
185 {
186 int ret = 0;
187
188 if (current_fiq) {
189 ret = -EBUSY;
190
191 if (current_fiq->fiq_op != NULL)
192 ret = current_fiq->fiq_op(current_fiq->dev_id, 1);
193 }
194
195 if (!ret) {
196 f->next = current_fiq;
197 current_fiq = f;
198 }
199
200 return ret;
201 }
中的current_fiq初始赋为 default_owner
而default_owner = {
89 name: "default",
90 fiq_op: fiq_def_op,
91 };
这样的话当第一次申请FIQ,调用claim_fiq时,current_fiq!=0(current_fiq->name!=NULL,current_fiq->fiq_op =NULL),这样的话,岂不是ret= -EBUSY,永远提示设备忙,不能申请啊?


谁了解,指点一下吧!!!

...全文
111 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jackadandy 2004-09-19
  • 打赏
  • 举报
回复
大家踊跃发言
有大奖。。。。
jackadandy 2004-09-16
  • 打赏
  • 举报
回复
为什么要笑哪
我哭。。。。。
suowei1979 2004-09-15
  • 打赏
  • 举报
回复
:)

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧