数据搜索系统,热门电子元器件搜索
  Chinese  ▼
ALLDATASHEETCN.COM

X  

AN1776 数据表(PDF) 7 Page - STMicroelectronics

部件名 AN1776
功能描述  INTERRUPT HANDLING FOR STR7 MICROCONTROLLERS
PDF  13 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
制造商  STMICROELECTRONICS [STMicroelectronics]
网页  http://www.st.com
标志 STMICROELECTRONICS - STMicroelectronics

AN1776 数据表(HTML) 7 Page - STMicroelectronics

Back Button AN1776 Datasheet HTML 3Page - STMicroelectronics AN1776 Datasheet HTML 4Page - STMicroelectronics AN1776 Datasheet HTML 5Page - STMicroelectronics AN1776 Datasheet HTML 6Page - STMicroelectronics AN1776 Datasheet HTML 7Page - STMicroelectronics AN1776 Datasheet HTML 8Page - STMicroelectronics AN1776 Datasheet HTML 9Page - STMicroelectronics AN1776 Datasheet HTML 10Page - STMicroelectronics AN1776 Datasheet HTML 11Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 7 / 13 page
background image
7/13
INTERRUPT HANDLING FOR STR7 MICROCONTROLLERS
occurs before the current interrupt has finished. The likely consequence is that the subroutine
would return incorrectly.
The solution here is to disable IRQs in IRQ mode, save the lr_irq, spsr_irq and r0 to r12 reg-
isters to the IRQ stack, then change processor mode to system mode with IRQ enabled, so
the whole interrupt service routine will be executed in system mode. However, it is crucial that,
at the end of the handler the mode must be switched back to IRQ mode, the pending bit of the
related current served channel is cleared in the IPR register and the Saved Program Status
Register is restored in IRQ mode.
__irq therefore cannot be used to write a re-entrant IRQ handler, only a top level assembler
should be used.
6.4 NESTED INTERRUPT EXAMPLE
The following example shows a top level assembler for nested interrupt handler when an in-
struction is used with IVR.
IRQHandler
SUB
lr,lr,#4
STMFD
sp!,{r0-r12,lr}
MRS
r1,spsr
STMFD
sp!,{r1}
LDR
lr, =ReturnAddress
LDR
pc, = IVR_addr
ReturnAddress
LDR
r0, =EIC_Base_addr
LDR
r2, [r0, #CICR_off_addr]
MOV
r3,#1
MOV
r3,r3,LSL r2
STR
r3,[r0, #IPR_off_addr]
LDMFD
sp!,{r1}
MSR
spsr_cxsf,r1
LDMFD
sp!,{r0-r12,pc}^
T0TIMIIRQHandler
MSR
cpsr_c,#0x1F
STMFD
sp!,{lr}
BL
T0TIMI_IRQHandler
LDMFD
sp!,{lr}
MSR
cpsr_c,#0xD2
MOV
pc,lr
Starting off with a program in System mode (in the case of an interrupt routine) or User mode
(main program), suppose that an IRQ request is received and accepted by the EIC. Once the
current instruction has finished executing, the ARM core switches to IRQ mode, saves the re-
turn address and cpsr to lr_irq and spcr_irq, then jumps to address 0x18 and the instruction in



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13


数据表 下载

Go To PDF Page


链接网址



ALLDATASHEET是否为您带来帮助?  [ DONATE ] 

关于 Alldatasheet   |   广告服务   |   联系我们   |   隐私政策   |   数据表链接    |   链接交换   |   制造商名单
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com