irq_create_mapping() -- 中断号的映射
irq_create_mapping() -- 中断号的映射irq_create_mapping()----------------------------------------------linux-2.6.21.7/arch/powerpc/kernel/irq.c1 irq_create_mapping() -->2 irq_alloc_virt() // 分配虚拟中断号如
·
irq_create_mapping() -- 中断号的映射
irq_create_mapping()
----------------------------------------------
linux-2.6.21.7/arch/powerpc/kernel/irq.c
1 irq_create_mapping() -->
2 irq_alloc_virt() // 分配虚拟中断号
如果 (NUM_ISA_INTERRUPTS <=hwirq < NR_IRQS)
并且irq_map[hwirq].host = NULL
那么virq = hwirq(\"物理中断号\"和\"虚拟中断号\"相等)
1 /* Use hint for 1 interrupt if any */
2 if (count == 1 && hint >= NUM_ISA_INTERRUPTS &&
3 hint < irq_virq_count && irq_map[hint].host == NULL) {
4 found = hint;
5 goto hint_found;
6 }
如果 (0 <= hwirq < NUM_ISA_INTERRUPTS)
那么,依次扫描irq_map[NUM_ISA_INTERRUPTS]之后的中断映射表,
找到第一个irq_map[i].host为空的映射表项,那么该表项的下标就是virq
1 for (i = NUM_ISA_INTERRUPTS, j = 0; i < irq_virq_count; i++) {
2 if (irq_map[i].host != NULL)
3 j = 0;
4 else
5 j++;
6 if (j == count) {
7 found = i - count + 1;
8 break;
9 }
10 }
注:
1. #define NUM_ISA_INTERRUPTS 0x10
irq_map[] -- 中断映射向量表
-----------------------------------------
struct irq_map_entry irq_map[NR_IRQS];
struct irq_map_entry {
irq_hw_number_t hwirq;
struct irq_host *host;
};
注:
1. irq_map[virq].hwirq = hwirq;
2. irq_map[virq] irq_map[]数组下标对应\"虚拟中断号\"
3. irq_map[virq].hwirq: 保存物理中断号
4. 写一个函数用来打印irq_map[n]数组中已经映射的数组元素
5. irq_desc[] -- 中断向量表;中断向量表的下标对应\"虚拟中断号\"
irq_create_mapping()
----------------------------------------------
linux-2.6.21.7/arch/powerpc/kernel/irq.c
1 irq_create_mapping() -->
2 irq_alloc_virt() // 分配虚拟中断号
如果 (NUM_ISA_INTERRUPTS <=hwirq < NR_IRQS)
并且irq_map[hwirq].host = NULL
那么virq = hwirq(\"物理中断号\"和\"虚拟中断号\"相等)
1 /* Use hint for 1 interrupt if any */
2 if (count == 1 && hint >= NUM_ISA_INTERRUPTS &&
3 hint < irq_virq_count && irq_map[hint].host == NULL) {
4 found = hint;
5 goto hint_found;
6 }
如果 (0 <= hwirq < NUM_ISA_INTERRUPTS)
那么,依次扫描irq_map[NUM_ISA_INTERRUPTS]之后的中断映射表,
找到第一个irq_map[i].host为空的映射表项,那么该表项的下标就是virq
1 for (i = NUM_ISA_INTERRUPTS, j = 0; i < irq_virq_count; i++) {
2 if (irq_map[i].host != NULL)
3 j = 0;
4 else
5 j++;
6 if (j == count) {
7 found = i - count + 1;
8 break;
9 }
10 }
注:
1. #define NUM_ISA_INTERRUPTS 0x10
irq_map[] -- 中断映射向量表
-----------------------------------------
struct irq_map_entry irq_map[NR_IRQS];
struct irq_map_entry {
irq_hw_number_t hwirq;
struct irq_host *host;
};
注:
1. irq_map[virq].hwirq = hwirq;
2. irq_map[virq] irq_map[]数组下标对应\"虚拟中断号\"
3. irq_map[virq].hwirq: 保存物理中断号
4. 写一个函数用来打印irq_map[n]数组中已经映射的数组元素
5. irq_desc[] -- 中断向量表;中断向量表的下标对应\"虚拟中断号\"
更多推荐
已为社区贡献1条内容
所有评论(0)