S3C2410中斷機制及相關寄存器介紹

2021-01-08 電子產品世界
所謂中斷就是CPU在執行程序的過程中,出現了某些突發事件時,必須暫停當前正在執行的程序,轉而去處理突發事件,處理完成後,CPU接著執行被暫停的程序。實際上,有很多Linux的驅動都是通過中斷的方式來進行內核和硬體的交互。中斷機制提供了硬體和軟體之間異步傳遞信息的方式。硬體設備在發生某個事件時通過中斷通知軟體進行處理。中斷實現了硬體設備按需獲得處理器關注的機制,與查詢方式相比可以大大節省CPU資源的開銷。

1.中斷向量表

本文引用地址:http://www.eepw.com.cn/article/201611/317274.htm

每個中斷都對應一段中斷服務程序。當中斷發生時,處理器就執行該中斷對應的服務程序,實現該中斷所要求完成的任務。處理器如何找到對應的中斷服務程序呢?這就需要讀取處理器的中斷向量表。

中斷向量表其實就對應了系統的一段存儲區,它按照一定規律存儲了處理器中所有不同類型中斷的服務程序入口地址(又稱中斷向量)。S3C2410是基於ARM920T核,ARM920T的中斷向量表有兩種存放方式,一種是低端存放(從0x00000000處開始存放),另一種是高端存放(從0xfff000000處開始存放)。ARM920T能處理8個類型的中斷,他們分別是:

>Reset:當處理器的復位電平有效時,產生復位異常,程序跳轉到復位處理程序執行。

>Undefined instruction:當處理器遇到不能處理的指令時產生未定義指令中斷。

>Software Interrupt:執行SWI(軟體中斷)指令時產生,可用於用戶實現系統調用

>Abort (prefetch):當處理器預取指令的地址不存在或該地址不允許當前指令訪問時,存儲器會向處理器發出中止信號,但當預取的指令被執行時,才會產生指令預取中斷。

>Abort (data):當處理器訪問的指令地址不存在或該地址不允許當前指令訪問時,產生數據中止中斷。

>Reserved:保留。

>IRQ:當處理器的外部中斷請求引腳有效,且CPSR的I位為0時產生IRQ中斷。

>FIQ:當處理器的快速中斷請求引腳有效,且CPSR的F位為0時產生FIQ中斷。

對應的中斷向量表如表1-1所示。

中斷類型

中斷向量(入口地址)

Reset

0x00000000

Undefined instruction

0x00000004

Software Interrupt

0x00000008

Abort (prefetch)

0x0000000C

Abort (data)

0x00000010

Reserved

0x00000014

IRQ

0x00000018

FIQ

0x0000001C

表1-1中斷向量表

一般情況下,在每個入口地址處都存放了一條跳轉指令,我們知道Uboot是用來完成系統的啟動加載過程的,在u-boot的/cpu/start.S文件中,就有「b reset」指令,放在0x00000000地址。系統上電以後,CPU將會從0x00000000處得這條指令執行,執行完以後,CPU會跳轉到reset標識的代碼段去執行處理器復位程序。同樣,在系統運行過程中,每當有中斷發生,CPU會根據中斷類型(用中斷號標識),從內存的0x00000000處開始查表做相應的處理。比如系統觸發了一個IRQ中斷,IRQ為第6號中斷,則CPU將把PC指向0x00000018地址(4*6=24= 0x00000018)處運行,該地址的指令是跳轉到「IRQ中斷服務程序」處運行。

S3C2410中斷源,如圖1-1中斷源所示:

圖1-1中斷源

INTERRUPT CONTROLLER OPERATION

F-bit and I-bit of Program Status Register (PSR)

If the F-bit of PSR in ARM920T CPU is set to 1, the CPU does not accept the Fast Interrupt Request (FIQ) from the interrupt controller. Likewise, If I-bit of the PSR is set to 1, the CPU does not accept the Interrupt Request (IRQ) from the interrupt controller. So, the interrupt controller can receive interrupts by clearing F-bit or I-bit of the PSR to 0 and setting the corresponding bit of INTMSK to 0.

Interrupt Mode

The ARM920T has two types of Interrupt mode: FIQ or IRQ. All the interrupt sources determine which mode is used at interrupt request.

Interrupt Pending Register

The S3C2410A has two interrupt pending resisters: source pending register (SRCPND) and interrupt pending register (INTPND). These pending registers indicate whether or not an interrupt request is pending. When the interrupt sources request interrupt service, the corresponding bits of SRCPND register are set to 1, and at the same time, only one bit of the INTPND register is set to 1 automatically after arbitration procedure. If interrupts are masked, the corresponding bits of the SRCPND register are set to 1. This does not cause the bit of INTPND register changed. When a pending bit of the INTPND register is set, the interrupt service routine starts whenever the I-flag or F-flag is cleared to 0. The SRCPND and INTPND registers can be read and written, so the service routine must clear the pending condition by writing a 1 to the corresponding bit in the SRCPND register first and then clear the pending condition in the INTPND registers by using the same method.

Interrupt Mask Register

This register indicates that an interrupt has been disabled if the corresponding mask bit is set to 1. If an interrupt mask bit of INTMSK is 0, the interrupt will be serviced normally. If the corresponding mask bit is 1 and the interrupt is generated, the source pending bit will be set.

S3C2410的中斷控制器原理如圖1-2所示。

圖1-2中斷控制器原理

由上圖可以看出S3C2410的中斷控制器主要通過幾個控制寄存器來實現:中斷源待決寄存器(Source Pending Register,SRCPND/SUBSRCPND)、中斷模式寄存器(Interrupt Mode Register,INTMOD)、中斷屏蔽寄存器(Interrupt Mask Register,INTMASK/INTSUBMSK)、中斷優先級控制寄存器(IRQ PRIORITY Control Register,PRIORITY)、中斷待決寄存器(Interrupt Pending Register,INTPND)。

該圖也顯示了S3C2410的中斷處理流程:首先要有中斷源產生中斷,這裡面有兩條路徑表示中斷源,上面一條是次級中斷源,當次級中斷產生後,首先在SUBSRCPND寄存器中登記,然後經過次級屏蔽寄存器(SUBMASK)來決定這個次級中斷源所產生的中斷是否被屏蔽掉,被屏蔽掉的中斷將不會被執行。次級中斷源所產生的中斷在經過SUBMASK之後將會與主中斷源所產生的中斷匯合,然後在SRCPND寄存器中登記,再經過主屏蔽寄存器,得出該中斷是否被送往CPU處理的決定。當然,在送往CPU處理之前,還要根據中斷模式寄存器的設置判斷一下該中斷是屬於IRQ中斷還是FIQ中斷,如果是FIQ中斷則直接觸發。如果是IRQ中斷,則還要判斷中斷的優先級別,級別高的先執行。

(1)中斷源待決寄存器SRCPND/ SUBSRCPND

這兩個寄存器在功能上是相同的,它們是中斷源待決寄存器。在一個中斷處理流程中,中斷信號傳進中斷控制器後首先遇到的就是SRCPND/ SUBSRCPND,這兩個寄存器的作用是用於標示出哪個中斷請求被觸發。SRCPND的有效位為32,SUBSRCPND的有效位為11,它們中的每一位分別代表一個中斷源。SRCPND為主中斷源待決寄存器,SUBSRCPND為次中斷源待決寄存器。

The SRCPND register is composed of 32 bits each of which is related to an interrupt source. Each bit is set to 1 if the corresponding interrupt source generates the interrupt request and waits for the interrupt to be serviced. Accordingly, this register indicates which interrupt source is waiting for the request to be serviced. Note that each bit of the SRCPND register is automatically set by the interrupt sources regardless of the masking bits in the INTMASK register. In addition, the SRCPND register is not affected by the priority logic of interrupt controller.

In the interrupt service routine for a specific interrupt source, the corresponding bit of the SRCPND register has to be cleared to get the interrupt request from the same source correctly. If you return from the ISR without clearing the bit, the interrupt controller operates as if another interrupt request came in from the same source. In other words, if a specific bit of the SRCPND register is set to 1, it is always considered as a valid interrupt request waiting to be serviced.

The time to clear the corresponding bit depends on the users requirement. If you want to receive another valid request from the same source, you should clear the corresponding bit first, and then enable the interrupt.

You can clear a specific bit of the SRCPND register by writing a data to this register.It clears only the bit positions of the SRCPND corresponding to those set to one in the data. The bit positions corresponding tothose that are set to 0 in the data remains as they are.

SRCPND的各個位信息如表1-3所示。

SRCPND

BIT

描述

INT_ADC

[31]

0:Not requested,1:Requested

INT_RTC

[30]

0:Not requested,1:Requested

INT_SPI1

[29]

0:Not requested,1:Requested

INT_UART0

[28]

0:Not requested,1:Requested

INT_IIC

[27]

0:Not requested,1:Requested

INT_USBH

[26]

0:Not requested,1:Requested

INT_USBD

[25]

0:Not requested,1:Requested

Reserved

[24]

Not used

INT_UART1

[23]

0:Not requested,1:Requested

INT_SPI0

[22]

0:Not requested,1:Requested

INT_SDI

[21]

0:Not requested,1:Requested

INT_DMA3

[20]

0:Not requested,1:Requested

INT_DMA2

[19]

0:Not requested,1:Requested

INT_DMA1

[18]

0:Not requested,1:Requested

INT_DMA0

[17]

0:Not requested,1:Requested

INT_LCD

[16]

0:Not requested,1:Requested

INT_UART2

[15]

0:Not requested,1:Requested

INT_TIMER4

[14]

0:Not requested,1:Requested

INT_TIMER3

[13]

0:Not requested,1:Requested

INT_TIMER2

[12]

0:Not requested,1:Requested

INT_TIMER1

[11]

0:Not requested,1:Requested

INT_TIMER0

[10]

0:Not requested,1:Requested

INT_WDT

[9]

0:Not requested,1:Requested

INT_TICK

[8]

Reserved

INT_BATT_FLT

[7]

0:Not requested,1:Requested

Reserved

[6]

Reserved

INT_EINT8_23

[5]

0:Not requested,1:Requested

INT_EINT4_7

[4]

0:Not requested,1:Requested

INT_EINT3

[3]

0:Not requested,1:Requested

INT_EINT2

[2]

0:Not requested,1:Requested

INT_EINT1

[1]

0:Not requested,1:Requested

INT_EINT0

[0]

0:Not requested,1:Requested

表1-3 SRCPND各位信息

SRCPN寄存器中每個位的初始值皆為0。假設現在系統觸發了EINT0中斷,則第0位將被置1,代表EINT0中斷被觸發,該中斷請求即將被處理(若該中斷沒有被屏蔽的話)。SUBSRCPND情況與SRCPND相同,如表1-4所示。

Reserved

[31:11]

0:Not requested,1:Requested

INT_ADC

[10]

0:Not requested,1:Requested

INT_TC

[9]

0:Not requested,1:Requested

INT_ERR2

[8]

0:Not requested,1:Requested

INT_TXD2

[7]

0:Not requested,1:Requested

INT_RXD2

[6]

0:Not requested,1:Requested

INT_ERR1

[5]

0:Not requested,1:Requested

INT_TXD1

[4]

0:Not requested,1:Requested

INT_RXD1

[3]

0:Not requested,1:Requested

INT_ERR0

[2]

0:Not requested,1:Requested

INT_TXD0

[1]

0:Not requested,1:Requested

INT_RXD0

[0]

0:Not requested,1:Requested

表1-4 SUBSRCPND各位信息

(2)中斷模式寄存器INTMOD

該寄存器用來指定中斷源處理模式(IRQ還是FIQ),有效位為32位,每一位與SRCPND中各位相對應,若某位為0,則該位相對應的中斷按IRQ模式處理,為1則以FIQ模式進行處理,該寄存器初始化值為0x00000000,即所有中斷皆以IRQ模式進行處理。如表1-5所示。

This register is composed of 32 bits each of which is related to an interrupt source. If a specific bit is set to 1, the corresponding interrupt is processed in the FIQ (fast interrupt) mode. Otherwise, it is processed in the IRQ mode (normal interrupt).

Note that only one interrupt source can be serviced in the FIQ mode in the interrupt controller (you should use the FIQ mode only for the urgent interrupt). Thus,only one bit of INTMOD can be set to 1.

寄存器

地址

描述

INTMOD

0X4A000004

0 = IRQ mode,1=FIQ mode

表1-5 INTMOD寄存器

NOTE: If an interrupt mode is set to FIQ mode in the INTMOD register, FIQ interrupt will not affect both INTPND and INTOFFSET registers. In this case, the two registers are valid only for IRQ mode interrupt source.

(3)中斷屏蔽寄存器INTMSK/ INTSUBMSK

This register also has 32 bits each of which is related to an interrupt source. If a specific bit is set to 1, the CPU does not service the interrupt request from the corresponding interrupt source (note that even in such a case, the corresponding bit of SRCPND register is set to 1). If the mask bit is 0, the interrupt request can be serviced.

INTMSK為主中斷屏蔽寄存器,INTSUBMSK為次中斷屏蔽寄存器。INTMSK有效位為32,INTSUBMSK有效位為11,這兩個寄存器各個位與SRCPND和SUBSRCPND分別對應。它們的作用是決定該位相應的中斷請求是否被處理。若某位被設置為1,則該位相對應的中斷產生後將被忽略(CPU不處理該中斷請求),設置為0則對其進行處理。這兩個寄存器初始化後的值是0xFFFFFFFF和0x7FF,既默認情況下所有的中斷都是被屏蔽的。如表1-6所示。

寄存器

地址

描述

INTMSK

0X4A000008

0 =Interrupt service is available,

1= Interrupt service is masked

表1-6INTMSK寄存器

(4)PRIORITY寄存器

一個嵌入式系統一般有多個中斷請求源。當多個中斷源同時請求中斷時,就會存在CPU應該優先響應哪個中斷請求源的問題,如果處理不當將會引起混亂,導致系統不能正常工作。通常解決這個問題的方法是根據中斷源事件的輕重緩急規定中斷源的優先級,CPU優先響應中斷優先級高的中斷請求。

S3C2410的優先級判斷分為兩級。如圖1-3所示,SRCPND寄存器對應的32個中斷源總共被分為6個組,每個組由一個ARBITER(0~5)寄存器對其進行管理。中斷必須先由所屬組的ARBITER(0~5)進行第一次優先級判斷(第一級判斷)後再發往ARBITER6進行最終的判斷(第二級判斷)。ARBITER(0~5)這六個組的優先級已經固定,由ARBITER0控制的組優先級最高,其次是ARBITER1, ARBITER2, ARBITER3, ARBITER4, ARBITER5。但是每個組中的各個中斷的優先級是可以控制的,我們只需要設置PRIORITY的相應位。

圖1-3 Priority Generating Block

INTERRUPT PRIORITY

Each arbiter can handle six interrupt requests based on the one bit arbiter mode control (ARB_MODE) and two bits of selection control signals (ARB_SEL) as follows:

— If ARB_SEL bits are 00b, the priority order is REQ0, REQ1, REQ2, REQ3, REQ4, and REQ5.

— If ARB_SEL bits are 01b, the priority order is REQ0, REQ2, REQ3, REQ4, REQ1, and REQ5.

— If ARB_SEL bits are 10b, the priority order is REQ0, REQ3, REQ4, REQ1, REQ2, and REQ5.

— If ARB_SEL bits are 11b, the priority order is REQ0, REQ4, REQ1, REQ2, REQ3, and REQ5.

Note that REQ0 of an arbiter always has the highest priority, and REQ5 has the lowest one. In addition, by changing the ARB_SEL bits, we can rotate the priority of REQ1 to REQ4.

Here,if ARB_MODE bit is set to 0, ARB_SEL bits are not automatically changed, making the arbiter to operate in the fixed priority mode (note that even in this mode, we can reconfigure the priority by manually changing the ARB_SEL bits). On the other hand, if ARB_MODE bit is 1, ARB_SEL bits are changed in rotation fashion, e.g., if REQ1 is serviced, ARB_SEL bits are changed to 01b automatically so as to put REQ1 into the lowest priority. The detailed rules of ARB_SEL change are as follows:

— If REQ0 or REQ5 is serviced, ARB_SEL bits are not changed at all.

— If REQ1 is serviced, ARB_SEL bits are changed to 01b.

— If REQ2 is serviced, ARB_SEL bits are changed to 10b.

— If REQ3 is serviced, ARB_SEL bits are changed to 11b.

— If REQ4 is serviced, ARB_SEL bits are changed to 00b.

PRIORITY

BIT

描述

ARB_SEL6

[20:19]

Arbiter 6 group priority order set

00:REQ 0-1-2-3-4-5,01:REQ 0-2-3-4-1-5

10:REQ 0-3-4-1-2-5,11:REQ 0-4-1-2-3-5

ARB_SEL5

[18:17]

Arbiter 5 group priority order set

00:REQ 0-1-2-3-4-5,01:REQ 0-2-3-4-1-5

10:REQ 0-3-4-1-2-5,11:REQ 0-4-1-2-3-5

ARB_SEL4

[16:15]

Arbiter 4 group priority order set

00:REQ 0-1-2-3-4-5,01:REQ 0-2-3-4-1-5

10:REQ 0-3-4-1-2-5,11:REQ 0-4-1-2-3-5

ARB_SEL3

[14:13]

Arbiter 3 group priority order set

00:REQ 0-1-2-3-4-5,01:REQ 0-2-3-4-1-5

10:REQ 0-3-4-1-2-5,11:REQ 0-4-1-2-3-5

ARB_SEL2

[12:11]

Arbiter 2 group priority order set

00:REQ 0-1-2-3-4-5,01:REQ 0-2-3-4-1-5

10:REQ 0-3-4-1-2-5,11:REQ 0-4-1-2-3-5

ARB_SEL1

[10:9]

Arbiter 1 group priority order set

00:REQ 0-1-2-3-4-5,01:REQ 0-2-3-4-1-5

10:REQ 0-3-4-1-2-5,11:REQ 0-4-1-2-3-5

ARB_SEL0

[8:7]

Arbiter 0 group priority order set

00:REQ 1-2-3-4,01:REQ 2-3-4-1

10:REQ 3-4-1-2,11:REQ 4-1-2-3

ARB_MODE6

[6]

Arbiter 6 group priority rotate enable

0:Priority does not rotate,1:Priority rotate enable

ARB_MODE5

[5]

Arbiter 5 group priority rotate enable

0:Priority does not rotate,1:Priority rotate enable

ARB_MODE4

[4]

Arbiter 4 group priority rotate enable

0:Priority does not rotate,1:Priority rotate enable

ARB_MODE3

[3]

Arbiter 3 group priority rotate enable

0:Priority does not rotate,1:Priority rotate enable

ARB_MODE2

[2]

Arbiter 2 group priority rotate enable

0:Priority does not rotate,1:Priority rotate enable

ARB_MODE1

[1]

Arbiter 1 group priority rotate enable

0:Priority does not rotate,1:Priority rotate enable

ARB_MODE0

[0]

Arbiter 0 group priority rotate enable

0:Priority does not rotate,1:Priority rotate enable

表1-7 PRIORITY寄存器

表1-7是PRIORITY寄存器各個位的參數表。從表上我們可以知道PRIORITY寄存器內部各個位被分為兩種類型,一種是ARB_MODE,另一種為ARB_SEL, ARB_MODE類型有5組,分別對應ARBITER(2~6),ARB_SEL類型有7組,分別對應ARBITER(0~6)。

以ARBITER2為例,我們來看一下PRIORITY寄存器中ARB_SEL, ARB_MODE之間的相互關係。首先我們看到ARBITER2寄存器管理的該組中斷裡包括了6個中斷,分別是INT_TIMER0,INT_TIMER1,INT_TIMER2,INT_TIMER3,INT_TIMER4,INT_UART2,它們的默認中斷請求號分別為REQ0,REQ1,REQ2,REQ3,REQ4,REQ5。我們先看PRIORITY寄存器中的ARB_SEL2,該參數由兩個位組成,初始值為00。從該表可以看出00定義了一個順序0-1-2-3-4-5,這個順序就是這組中斷組的優先級排列,這個順序指明了以中斷請求號為0(REQ0)的INT_TIMER0具有最高的中斷優先級,其次是INT_TIMER1,INT_TIMER2…。假設現在ARB_SEL2的值被我們設置為01。則一個新的優先級次序將被使用,01對應的優先級次序為0-2-3-4-1-5,從中可以看出優先級最高和最低的中斷請求和之前沒有變化,但本來處於第2優先級的INT_TIMER1中斷現在變成了第5優先級。從ARB_SEL2被設置為00,01,10,11各個值所出現的情況可以看出,除了最高和最低的優先級不變以外,其他各個中斷的優先級其實是在做一個旋轉排列(rotate)。為了達到對各個中斷平等對待這一目標,我們可以讓優先級次序在每個中斷請求被處理完之後自動進行一次旋轉,如何自動讓它旋轉呢?我們可以通過設置ARB_MODE2位達到這個目的,該位置1代表開啟對應中斷組的優先級次序自動旋轉,0則為關閉,按固定的次序排列優先級列表。

(5)中斷待決寄存器INTPND

Each of the 32 bits in the interrupt pending register shows whether the corresponding interrupt request, which is unmasked and waits for the interrupt to be serviced, has the highest priority .Since the INTPND register is located after the priority logic, only one bit can be set to 1, and that interrupt request generates IRQ to CPU.In interrupt service routine for IRQ, you can read this register to determine which interrupt source is serviced among the 32 sources.

Like the SRCPND register,this register has to be cleared in the interrupt service routine after clearing the SRCPND register. We can clear a specific bit of the INTPND register by writing a data to this register.It clears only the bit positions of the INTPND register corresponding to those set to one in the data. The bit positions corresponding to those that are set to 0 in the data remains as they are.

INTPND的詳細信息如表1-8所示:

INTPND

BIT

描述

INT_ADC

[31]

0:Not requested,1:Requested

INT_RTC

[30]

0:Not requested,1:Requested

INT_SPI1

[29]

0:Not requested,1:Requested

INT_UART0

[28]

0:Not requested,1:Requested

INT_IIC

[27]

0:Not requested,1:Requested

INT_USBH

[26]

0:Not requested,1:Requested

INT_USBD

[25]

0:Not requested,1:Requested

Reserved

[24]

Not used

INT_UART1

[23]

0:Not requested,1:Requested

INT_SPI0

[22]

0:Not requested,1:Requested

INT_SDI

[21]

0:Not requested,1:Requested

INT_DMA3

[20]

0:Not requested,1:Requested

INT_DMA2

[19]

0:Not requested,1:Requested

INT_DMA1

[18]

0:Not requested,1:Requested

INT_DMA0

[17]

0:Not requested,1:Requested

INT_LCD

[16]

0:Not requested,1:Requested

INT_UART2

[15]

0:Not requested,1:Requested

INT_TIMER4

[14]

0:Not requested,1:Requested

INT_TIMER3

[13]

0:Not requested,1:Requested

INT_TIMER2

[12]

0:Not requested,1:Requested

INT_TIMER1

[11]

0:Not requested,1:Requested

INT_TIMER0

[10]

0:Not requested,1:Requested

INT_WDT

[9]

0:Not requested,1:Requested

INT_TICK

[8]

Reserved

INT_BATT_FLT

[7]

0:Not requested,1:Requested

Reserved

[6]

Reserved

INT_EINT8_23

[5]

0:Not requested,1:Requested

INT_EINT4_7

[4]

0:Not requested,1:Requested

INT_EINT3

[3]

0:Not requested,1:Requested

INT_EINT2

[2]

0:Not requested,1:Requested

INT_EINT1

[1]

0:Not requested,1:Requested

INT_EINT0

[0]

0:Not requested,1:Requested

表1-8寄存器INTPND

表1-8是INTPND寄存器各位的詳細功能列表。不難發現,INTPND寄存器與SRCPND長得一模一樣,但他們在中斷處理中卻扮演著不同的角色。INTPND寄存器的每個位對應一個中斷請求,若該位被置1,則表示相應的中斷請求被觸發。說到這裡你可能會發現它不僅和SRCPND長得一模一樣,就連功能都一樣,其實不然,他們在功能上有著重大的區別。SRCPND是中斷源待決寄存器,某個位被置1表示相應的中斷被觸發,但我們知道在同一時刻內系統可以觸發若干個中斷,只要中斷被觸發了,SRCPND的相應位便被置1,也就是說SRCPND在同一時刻可以有若干位同時被置1,然而INTPND則不同,他在某一時刻只能有1個位被置1,INTPND某個位被置1,則表示CPU即將或已經在對該位相應的中斷進行處理。於是我們可以有一個總結:SRCPND說明了有什麼中斷被觸發了,INTPND說明了CPU即將或已經在對某一個中斷進行處理。

每當某一個中斷被處理完之後,我們必須手動將SRCPND/SUBSRCPND , INTPND三個寄存器中與該中斷相應的位由1設置為0。

(6)中斷偏移寄存器INTOFFSET

INTOFFSET寄存器的功能很簡單,它用於表明哪個中斷正在被處理。表1-9是該寄存器各位詳細功能列表:若當前INT_TIMER0被觸發了,則該寄存器的值為10,以此類推。

中斷源

偏移值

中斷源

偏移值

INT_ADC

31

INT_UART2

15

INT_RTC

30

INT_TIMER4

14

INT_SPI1

29

INT_TIMER3

13

INT_UART0

28

INT_TIMER2

12

INT_IIC

27

INT_TIMER1

11

INT_USBH

26

INT_TIMER0

10

INT_USBD

25

INT_WDT

9

Reserved

24

INT_TICK

8

INT_UART1

23

INT_BATT_FLT

7

INT_SPI0

22

Reserved

6

INT_SDI

21

INT_EINT8_23

5

INT_DMA3

20

INT_EINT4_7

4

INT_DMA2

19

INT_EINT3

3

INT_DMA1

18

INT_EINT2

2

INT_DMA0

17

INT_EINT1

1

INT_LCD

16

INT_EINT0

0

表1-9 INTOFFSET寄存器

相關焦點

  • 控制IO埠 s3c2410_gpio_setpin()的使用
    ;}printk("thedeviceisopened/n");io_con_set();cnt=0;return0;}voidio_con_set()//IO埠控制寄存器初始化{s3c2410_gpio_cfgpin(S3C2410_GPF0,S3C2410_GPF0_EINT0);s3c2410_gpio_cfgpin(S3C2410_GPF2,S3C2410_GPF2_EINT2);s3c2410
  • s3c2410上iis接口的uda341驅動的學習
    ){channel = 2;//因為是輸出,所以源是內存source = S3C2410_DMASRC_MEM;hwcfg = 3;//2410的iis接口中fifo數據寄存器的物理地址,16bit寬devaddr = 0x55000010;//DCON寄存器的初始值,這裡的取值表示://handshake mode,傳輸完成產生中斷,DREQ and DACK are
  • ARM+Linux中斷系統詳細分析
    這就是一個外部中斷完整的執行流程了,下面以具體寄存器來更具體的了解ARM的中斷機制。IRQ_EINT0在include/asm/arch-s3c2410/irqs.h中定義.從這裡可以看出,中斷號的具體值是有平臺相關的代碼決定的,和硬體中斷掛起寄存器中的中斷號是不等的。
  • ARM Linux中斷機制之中斷的申請
    例如外部中斷 IRQ_EINT0 ~ IRQ_EINT3都用以下操作函數集:static struct irq_chip s3c_irq_eint0t4 = {.name= "s3c-ext0",.ack= s3c_irq_ack,.mask= s3c_irq_mask,.unmask= s3c_irq_unmask,.set_wake
  • Uboot在S3C2440上的移植詳解(一)
    #if defined(CONFIG_S3C2400)|| defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)/* turn off the watchdog */# if defined(CONFIG_S3C2400)# define pWTCON 0x15300000# define INTMSK
  • linux2.6.26內核中ARM中斷實現詳解
    IRQ_EINT0在 include/asm/arch-s3c2410/irqs.h中定義.從這裡可以看出,中斷號的具體值是有平臺相關的代碼決定的,和硬體中斷掛起寄存器中的中斷號是不等的。void *dev_id; //設備id,本文後面部分介紹中斷共享時會詳細說明這個參數的作用struct irqaction *next; //如果有中斷共享,則繼續執行,int irq; //中斷號,註冊時提供struct proc_dir_entry *dir; //指向IRQn相關的/proc/irq/n目錄的描述符};在註冊中斷號為irq
  • arm linux 下中斷流程簡要分析註冊中斷
    本文引用地址:http://www.eepw.com.cn/article/201611/317832.htmdrivers/char/watchdog/s3c2410_wdt.c:static int s3c2410wdt_probe(struct platform_device *pdev){
  • ucos II+ucGUI+s3c2410+LCD+觸控螢幕整合
    環境:ads2.2+ARM9 +s3c2410本文引用地址:http://www.eepw.com.cn/article/201610/305841.htm注意:由於編譯器(ads1.2或2.2)對全局變量初始化為0的不完全支持,有時必須手動初始化為0,切記!!!
  • IO埠映射和IO內存映射(詳解S3C24XX_GPIO驅動)
    3)虛擬地址:現代作業系統普遍採用虛擬內存管理(Virtual Memory Management)機制,這需要MMU(Memory Management Unit)的支持。定義一些寄存器(數據寄存器,配置寄存器)
  • S3C2440驅動篇—看門狗驅動分析
    = len; i++) {char c;if (get_user(c, data + i))return -EFAULT;if (c == V)expect_close = 42;}}/*上面的意思是想要看門狗定時器可以被關閉,則內核不要配置CONFIG_WATCHDOG_NOWAYOUT選項,對於下面這裡還要「餵狗」一次,我剛開始覺得不需要,因為在看門狗定時器中斷
  • 中斷源寄存器的介紹
    中斷源寄存器中斷源寄存器包括定時器/計數器控制寄存器TCON和串行通信口控制寄存器SCON。1.定時器/計數器控制寄存器TCON定時器/計數器控制寄存器 TCON 的功能主要是接收外部中斷源( INT0、INT1 )和定時器/計數器(T0、T1)送來的中斷請求信號。
  • ARM11---中斷---向量中斷控制器(VIC)---結合s3c6410
    為每個中斷請求分配一個中斷請求輸出埠,以能連接到處理器的VIC埠。> 2.可以用軟體屏蔽掉任意制定的中斷源的中斷。 IRQACK和IRQADDRV在VIC和處理器之間實現了一個四次握手的機制。(後面有解釋。)(二)、中斷處理函數的退出: 往中斷對應的向量地址寄存器裡執行寫操作。
  • linux內核移植-移植2.6.35.4內核到s3c2440
    刪掉s3c2410 ARCH_S3C2410 S3C2410 182然後將s3c2440 ARCH_S3C2440進入linux-2.6.35目錄,把s3c2410的默認配置寫入config文件。
  • ARM寄存器介紹
    總結:ARM的學習中,寄存器貫穿始終,基本上每一本教材資料的開篇都會先介紹工作模式和寄存器知識,這部分內容十分重要,但是往往不能引起初學者的注意,ARM處理器模式就不細說了,這個都知道,關於寄存器,概括來講,就是我們說的R0-R16這個不是唯一的,而是每個寄存器名稱可能對應多個物理寄存器,具體對應幾個,下面有介紹,其中要尤其注意
  • ARM系統中觸控螢幕的中斷處理方法
    (2)S3C2410A觸控螢幕控制器  S3C2410A觸控螢幕的外接電路主要是控制上下兩層導電層的通斷情況以及取電壓,取電壓之後還需要將這個模擬量轉換成數字量,這部分工作主要是靠S3C2410A晶片中的模數轉換器來實現的。即觸控螢幕的功能實現實際上分兩部分,分別是觸控螢幕的外接電路部分和S3C2410A晶片自帶的A/D轉換控制部分。
  • ARM的中斷原理
    當完成中斷服務子程序後,將SPSR中保存的程序運行狀態恢復到CPSR中,R14中保存的被中斷程序的地址恢復到PC中,繼續執行被中斷的程序。 2.S3C2410A的中斷控制器 ARM920T CPU的中斷可分為FIQ和IRQ。為了使CPU能夠響應中斷,必須首先對程序狀態寄存器(PSR)中的F位和I位進行正確設置。