大家好,又见面了,我是你们的朋友全栈君。
S3c2440支持多达36个内部中断源和24个外部中断源,分别使用内部终端屏蔽寄存器INTMSK和外部中断寄存器MSK进行屏蔽控制。其中,外部中断源通过GPIO以复用的方式成为内部中断源的一部分。
但是我们清楚,INTMSK是一个32位的寄存器,最多只能支持32中断,它是如何对应这么多中断的呢?
首先我们先看INTMSK对应的位。 INTERRUPT MASK (INTMSK) REGISTER (Continued) INT_ADC [31] 0 = Service available, 1 = Masked 1 INT_RTC [30] 0 = Service available, 1 = Masked 1 INT_SPI1 [29] 0 = Service available, 1 = Masked 1 INT_UART0 [28] 0 = Service available, 1 = Masked 1 INT_IIC [27] 0 = Service available, 1 = Masked 1 INT_USBH [26] 0 = Service available, 1 = Masked 1 INT_USBD [25] 0 = Service available, 1 = Masked 1 INT_NFCON [24] 0 = Service available, 1 = Masked 1 INT_UART1 [23] 0 = Service available, 1 = Masked 1 INT_SPI0 [22] 0 = Service available, 1 = Masked 1 INT_SDI [21] 0 = Service available, 1 = Masked 1 INT_DMA3 [20] 0 = Service available, 1 = Masked 1 INT_DMA2 [19] 0 = Service available, 1 = Masked 1 INT_DMA1 [18] 0 = Service available, 1 = Masked 1 INT_DMA0 [17] 0 = Service available, 1 = Masked 1 INT_LCD [16] 0 = Service available, 1 = Masked 1 INT_UART2 [15] 0 = Service available, 1 = Masked 1 INT_TIMER4 [14] 0 = Service available, 1 = Masked 1 INT_TIMER3 [13] 0 = Service available, 1 = Masked 1 INT_TIMER2 [12] 0 = Service available, 1 = Masked 1 INT_TIMER1 [11] 0 = Service available, 1 = Masked 1 INT_TIMER0 [10] 0 = Service available, 1 = Masked 1 INT_WDT_AC97 [9] 0 = Service available, 1 = Masked 1 INT_TICK [8] 0 = Service available, 1 = Masked 1 nBATT_FLT [7] 0 = Service available, 1 = Masked 1 INT_CAM [6] 0 = Service available, 1 = Masked 1 EINT8_23 [5] 0 = Service available, 1 = Masked 1 EINT4_7 [4] 0 = Service available, 1 = Masked 1 EINT3 [3] 0 = Service available, 1 = Masked 1 EINT2 [2] 0 = Service available, 1 = Masked 1 EINT1 [1] 0 = Service available, 1 = Masked 1 EINT0 [0] 0 = Service available, 1 = Masked 1
我们发现INTMSK的第5,6位对应了EINT4_7, EINT8_23,20个外部中断,也就是所,这20个GPIO引脚只能触发这两个中断。 但是当中断到来时,我们如果判断是由哪一个GPIO引脚触发的呢?这个时候我们可以通过查询EINTMASK来判断中断源。 EINTMASK Bit Description EINT23 [23] 0 = enable interrupt 1= masked EINT22 [22] 0 = enable interrupt 1= masked EINT21 [21] 0 = enable interrupt 1= masked EINT20 [20] 0 = enable interrupt 1= masked EINT19 [19] 0 = enable interrupt 1= masked EINT18 [18] 0 = enable interrupt 1= masked EINT17 [17] 0 = enable interrupt 1= masked EINT16 [16] 0 = enable interrupt 1= masked EINT15 [15] 0 = enable interrupt 1= masked EINT14 [14] 0 = enable interrupt 1= masked EINT13 [13] 0 = enable interrupt 1= masked EINT12 [12] 0 = enable interrupt 1= masked EINT11 [11] 0 = enable interrupt 1= masked EINT10 [10] 0 = enable interrupt 1= masked EINT9 [9] 0 = enable interrupt 1= masked EINT8 [8] 0 = enable interrupt 1= masked EINT7 [7] 0 = enable interrupt 1= masked EINT6 [6] 0 = enable interrupt 1= masked EINT5 [5] 0 = enable interrupt 1= masked EINT4 [4] 0 = enable interrupt 1= masked Reserved [3:0] Reserved 但是还有一个疑问,不是说60个中断源吗?除去24个外部中断源应该还有60-24 -(32-6)=10个内部中断源啊。他们在哪呢?
其实这里涉及到了子中断源的概念。 Sub Sources Descriptions Source INT_AC97 AC97 interrupt INT_WDT_AC97 INT_WDT Watchdoc interrupt INT_WDT_AC97 INT_CAM_P P-port capture interrupt in camera interface INT_CAM INT_CAM_C C-port capture interrupt in camera interface INT_CAM INT_ADC_S ADC interrupt INT_ADC INT_TC Touch screen interrupt (pen up/down) INT_ADC INT_ERR2 UART2 error interrupt INT_UART2 INT_TXD2 UART2 transmit interrupt INT_UART2 INT_RXD2 UART2 receive interrupt INT_UART2 INT_ERR1 UART1 error interrupt INT_UART1 INT_TXD1 UART1 transmit interrupt I NT_UART1 INT_RXD1 UART1 receive interrupt INT_UART1 INT_ERR0 UART0 error interrupt INT_UART0 INT_TXD0 UART0 transmit interrupt INT_UART0 INT_RXD0 UART0 receive interrupt NT_UART0
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/107101.html原文链接:https://javaforall.cn