linux中断的一些过程
硬件发生中断过程和软件识别中断过程是相反的
cpu读取中断控制器是那个模块发生了中断.
#if 0
/* Interrupt number assignments within Linux */
#define WM831X_IRQ_TEMP_THW 0
#define WM831X_IRQ_GPIO_1 1
#define WM831X_IRQ_GPIO_2 2
#define WM831X_IRQ_GPIO_3 3
#define WM831X_IRQ_GPIO_4 4
#endif
/* Interrupt number assignments within Linux */
#define WM831X_IRQ_TEMP_THW 0
#define WM831X_IRQ_GPIO_1 1
#define WM831X_IRQ_GPIO_2 2
#define WM831X_IRQ_GPIO_3 3
#define WM831X_IRQ_GPIO_4 4
#endif
irq:软件中断号 2.6内核以前在irq.h中
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
const char *name, void *dev)
现在有设备树:
interrupt-parent = <&gpio1>
interrupt = <5 Rising> // 5 hw irq 致命parent domain 5 --->GPIO
irq_domain-----> 转换为软件中断号
// 解析设备树
int (*xlate)(struct irq_domain *d, struct device_node *node,
const u32 *intspec, unsigned int intsize,
unsigned long *out_hwirq, unsigned int *out_type);
保存在platform_device
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
const char *name, void *dev)
// 硬件中断和软件中断之间的映射
/* reverse map data. The linear map gets appended to the irq_domain */
irq_hw_number_t hwirq_max;
unsigned int revmap_direct_max_irq;
unsigned int revmap_size;
struct radix_tree_root revmap_tree;
unsigned int linear_revmap[];
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
const char *name, void *dev)
现在有设备树:
interrupt-parent = <&gpio1>
interrupt = <5 Rising> // 5 hw irq 致命parent domain 5 --->GPIO
irq_domain-----> 转换为软件中断号
// 解析设备树
int (*xlate)(struct irq_domain *d, struct device_node *node,
const u32 *intspec, unsigned int intsize,
unsigned long *out_hwirq, unsigned int *out_type);
保存在platform_device
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
const char *name, void *dev)
// 硬件中断和软件中断之间的映射
/* reverse map data. The linear map gets appended to the irq_domain */
irq_hw_number_t hwirq_max;
unsigned int revmap_direct_max_irq;
unsigned int revmap_size;
struct radix_tree_root revmap_tree;
unsigned int linear_revmap[];
一勤天下无难事。