Skip to content

Commit

Permalink
Update submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
liaocj committed Nov 24, 2024
1 parent 99d41fa commit 9c832c2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
Empty file.
46 changes: 45 additions & 1 deletion linux/内核-驱动/中断/硬中断--中断号映射.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,48 @@ int irq_domain_associate(struct irq_domain *domain, unsigned int virq,

return 0;
}
```
```
# 完成硬件中断号到软件中断号的映射
通过IRQ 中断号和 irq_domain获取struct irq_data 数据结构, 然后把硬件中断号 hwirq设置到 struct irq_data 数据结构中的hwirq 成员中, 这样就完成了硬件中断号到软件中断号的映射(!!!).
```c
/**
* irq_domain_set_info - Set the complete data for a @virq in @domain
* @domain: Interrupt domain to match
* @virq: IRQ number
* @hwirq: The hardware interrupt number
* @chip: The associated interrupt chip
* @chip_data: The associated interrupt chip data
* @handler: The interrupt flow handler
* @handler_data: The interrupt flow handler data
* @handler_name: The interrupt handler name
*/
void irq_domain_set_info(struct irq_domain *domain, unsigned int virq,
irq_hw_number_t hwirq, struct irq_chip *chip,
void *chip_data, irq_flow_handler_t handler,
void *handler_data, const char *handler_name)
{
irq_domain_set_hwirq_and_chip(domain, virq, hwirq, chip, chip_data);
__irq_set_handler(virq, handler, 0, handler_name);
irq_set_handler_data(virq, handler_data);
}
EXPORT_SYMBOL(irq_domain_set_info);
[kernel/irq/irqdomain.c]
int irq_domain_set_hwirq_and_chip(struct irq_domain *domain, unsigned int virq,
irq_hw_number_t hwirq, struct irq_chip *chip,
void *chip_data)
{
struct irq_data *irq_data = irq_domain_get_irq_data(domain, virq);
if (!irq_data)
return -ENOENT;
irq_data->hwirq = hwirq;
irq_data->chip = chip ? chip : &no_irq_chip;
irq_data->chip_data = chip_data;
return 0;
}
```

0 comments on commit 9c832c2

Please sign in to comment.