- 论坛徽章:
- 0
|
回复 8# rocklinux
兄弟,对这块的源码我还没有深入研究过,但是我曾经做过一个实验,发现:硬件上设置的level还是edge方式,其实操作系统是不管的,操作系统只负责最终执行到你的自己注册的中断处理函数,然后你在中断处理函数中去处理到底是edge,还是level,对于edge和level的方式处理还是不一样的。。。我的实现过程如下:
第一段注册中断处理函数:注意我在硬件上设置的edge方式
/*
* 设置外部中断IRQ1为上升沿触发htm
*/
ptr = (volatile u32 *) (mbar_base + 0x50000+0x0020); (*ptr) |= BIT8; (*ptr) &= ~BIT9;
/*
* 设置外部中断IRQ2优先级为15,最高优先级
*/
(*ptr) |= (BIT12|BIT13|BIT14|BIT15);
virq=irq_create_mapping(NULL,1);
printk("virq is %d.\n", virq);
if (request_irq(virq, Htm_Int2_irq, 0, "HTM INT2 IRQ", NULL)) {
printk(KERN_ERR "htm: HTM INT2 irq allocation failed\n");
}
第二段注册中断处理函数:注意我在硬件上设置的edge方式
/*
/*
* 设置外部中断IRQ2(对应/INT_UART)为上升沿触发
*/
ptr = (volatile u32 *) (mbar_base + 0x50000+0x0040); (*ptr) |= BIT8; (*ptr) &= ~BIT9;
/*
* 设置外部中断IRQ2优先级为14,低于IRQ1管脚对应的优先级设置
*/
(*ptr) |= (BIT12|BIT13|BIT14);
virq=irq_create_mapping(NULL,2);
printk("virq is %d.\n", virq);
if (request_irq(virq, Uart_int_irq, 0, "Serial_com_irq", NULL)) {
printk(KERN_ERR "Serial_com: Serial_com_irq allocation failed\n");
}
下面是我加载驱动后通过:
/home # cat /proc/interrupts
CPU0 CPU1
17: 0 0 OpenPIC Level eth0_g1_tx
18: 0 0 OpenPIC Level eth0_g1_rx
19: 0 0 OpenPIC Level fsl-lbc
20: 0 0 OpenPIC Level HTM DMA IRQ
21: 0 0 OpenPIC Level fsldma-channel
22: 0 0 OpenPIC Level fsldma-channel
23: 0 0 OpenPIC Level fsldma-channel
24: 0 0 OpenPIC Level eth0_g1_er
29: 0 6 OpenPIC Level eth0_g0_tx
30: 115 0 OpenPIC Level eth0_g0_rx
34: 0 0 OpenPIC Level eth0_g0_er
37: 0 0 OpenPIC Level Serial_com_irq
38: 0 0 OpenPIC Edge HTM INT2 IRQ
42: 108 22 OpenPIC Level serial
43: 0 0 OpenPIC Level i2c-mpc, i2c-mpc
59: 2 0 OpenPIC Level fsl-espi
72: 162 0 OpenPIC Level mmc0
247: 0 0 OpenPIC Edge mpic timer 0
251: 0 0 OpenPIC Edge ipi call function
252: 1328 1806 OpenPIC Edge ipi reschedule
253: 417 383 OpenPIC Edge ipi call function single
可以看到:37和38号中断号的对应的处理方式不一样,一个是edge一个是level,所以我个人认为:这个有可能和操作系统方面是edge还是level没有多大的关系,理解不到此处还往指出 |
|