标签:map char linux linux驱动 pair efi ecif err signed
在编写Linux驱动程序时。我想用某一个引脚做外部中断。可是在调用
int request_irq(unsigned int irq,
void (*handler)(int irq, void *dev_id, struct pt_regs *regs
),
unsigned long irqflags,
const char * devname,
void *dev_id);
这个函数的时候遇到了一个问题,irq是个硬件终端号,可是究竟这个引脚相应的终端号是多少呢?
我在网上找资料说的都稀里糊涂的,不是我想要的答案。
于是我便在内核代码里找,以下贴出Linux内核代码的一段arch\arm\mach-s3c64xx\include\mach\Irqs.h,能够解释这个问题:
/* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE * which we place after the pair of VICs. */ #define S3C_IRQ_EINT_BASE S3C_IRQ(64+5) #define S3C_EINT(x) ((x) + S3C_IRQ_EINT_BASE) #define IRQ_EINT(x) S3C_EINT(x) #define IRQ_EINT_BIT(x) ((x) - S3C_EINT(0)) /* Next the external interrupt groups. These are similar to the IRQ_EINT(x) * that they are sourced from the GPIO pins but with a different scheme for * priority and source indication. * * The IRQ_EINT(x) can be thought of as ‘group 0‘ of the available GPIO * interrupts, but for historical reasons they are kept apart from these * next interrupts. * * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the * machine specific support files. */ #define IRQ_EINT_GROUP1_NR (15) #define IRQ_EINT_GROUP2_NR (8) #define IRQ_EINT_GROUP3_NR (5) #define IRQ_EINT_GROUP4_NR (14) #define IRQ_EINT_GROUP5_NR (7) #define IRQ_EINT_GROUP6_NR (10) #define IRQ_EINT_GROUP7_NR (16) #define IRQ_EINT_GROUP8_NR (15) #define IRQ_EINT_GROUP9_NR (9) #define IRQ_EINT_GROUP_BASE S3C_EINT(28) #define IRQ_EINT_GROUP1_BASE (IRQ_EINT_GROUP_BASE + 0x00) #define IRQ_EINT_GROUP2_BASE (IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR) #define IRQ_EINT_GROUP3_BASE (IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR) #define IRQ_EINT_GROUP4_BASE (IRQ_EINT_GROUP3_BASE + IRQ_EINT_GROUP3_NR) #define IRQ_EINT_GROUP5_BASE (IRQ_EINT_GROUP4_BASE + IRQ_EINT_GROUP4_NR) #define IRQ_EINT_GROUP6_BASE (IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR) #define IRQ_EINT_GROUP7_BASE (IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR) #define IRQ_EINT_GROUP8_BASE (IRQ_EINT_GROUP7_BASE + IRQ_EINT_GROUP7_NR) #define IRQ_EINT_GROUP9_BASE (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR) #define IRQ_EINT_GROUP(group, no) (IRQ_EINT_GROUP##group##_BASE + (no))
IRQ_EINT(x) 第0组
IRQ_EINT_GROUP(group,no) 第1-9组
标签:map char linux linux驱动 pair efi ecif err signed
原文地址:http://www.cnblogs.com/jzdwajue/p/6761296.html