關(guān)于ARM2440中斷源個數(shù)的一點(diǎn)想法
S3c2440支持多達(dá)36個內(nèi)部中斷源和24個外部中斷源,分別使用內(nèi)部終端屏蔽寄存器INTMSK和外部中斷寄存器MSK進(jìn)行屏蔽控制。其中,外部中斷源通過GPIO以復(fù)用的方式成為內(nèi)部中斷源的一部分。
本文引用地址:http://www.ex-cimer.com/article/201608/295111.htm但是我們清楚,INTMSK是一個32位的寄存器,最多只能支持32中斷,它是如何對應(yīng)這么多中斷的呢?
首先我們先看INTMSK對應(yīng)的位。
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
我們發(fā)現(xiàn)INTMSK的第5,6位對應(yīng)了EINT4_7, EINT8_23,20個外部中斷,也就是所,這20個GPIO引腳只能觸發(fā)這兩個中斷。
但是當(dāng)中斷到來時,我們?nèi)绻袛嗍怯赡囊粋€GPIO引腳觸發(fā)的呢?這個時候我們可以通過查詢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個外部中斷源應(yīng)該還有60-24 -(32-6)=10個內(nèi)部中斷源啊。他們在哪呢?
其實(shí)這里涉及到了子中斷源的概念。
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
評論