Electronic Components Datasheet Search
  New Zealand  ▼
ALLDATASHEET.CO.NZ

X  

AN2593 Datasheet(PDF) 9 Page - STMicroelectronics

Part # AN2593
Description  STR91x interrupt management
PDF  15 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN2593 Datasheet(HTML) 9 Page - STMicroelectronics

Back Button AN2593 Datasheet HTML 5Page - STMicroelectronics AN2593 Datasheet HTML 6Page - STMicroelectronics AN2593 Datasheet HTML 7Page - STMicroelectronics AN2593 Datasheet HTML 8Page - STMicroelectronics AN2593 Datasheet HTML 9Page - STMicroelectronics AN2593 Datasheet HTML 10Page - STMicroelectronics AN2593 Datasheet HTML 11Page - STMicroelectronics AN2593 Datasheet HTML 12Page - STMicroelectronics AN2593 Datasheet HTML 13Page - STMicroelectronics Next Button
Zoom Inzoom in Zoom Outzoom out
 9 / 15 page
background image
AN2593
Software recommendations for handling interrupts
9/15
The IENABLE macro ensures the reenabling of interrupts in system mode in order to allow
interrupt nesting. IDISABLE disables IRQs when exiting from the interrupt service routine
and returning to IRQ mode.
#define IENABLE asm(" MRS LR, SPSR"); /* Copy SPSR_irq to LR */ \
asm("STMFD SP!, {LR} "); /* Save SPSR_irq */ \
asm("MSR CPSR_c, #0x1F ");
/* Switch to SYS mode with IRQ enabled*/ \
asm("STMFD SP!, {LR} ") ;
/* Save SYS mode LR */
#define IDISABLE asm("LDMFD SP!, {LR}") ;
/* Restore SYS mode LR */ \
asm("MSR CPSR_c, #0x92") ; /* Switch to IRQ mode with IRQ disabled*/ \
asm("LDMFD SP!, {R0}") ;
/* Restore SPSR_irq to R0 */ \
asm("MSR SPSR_cxsf, R0") ; /* Copy R0 to SPSR_irq */
Example
: Timer0 interrupt (interrupt on VIC0)
void TIM0_IRQHandler (void)
{
/* switch to system mode with IRQ enabled*/
IENABLE;
/* clear interrupt flag and process interrupt */
...
...
...
/* switch to IRQ mode with IRQ disabled*/
IDISABLE;
/* write any value to VIC0 Vector address register */
VIC0->VAR = 0xFF
}
2.3.2
Without interrupt nesting support
If your application does not need nested interrupt support then you should not insert the
IENABLE and IDISABLE macros.
But you still need to write any value to VIC0 Vector Address register at end of interrupt
processing, if the interrupt originates from VIC0, this is in order to update the VIC0 priority
logic after reading the VIC0 Vector Address in order to jump to the interrupt service routine.
Because there is no priority managment to be done, you are not obliged to do a read of
VIC1 Vector address register at the start of a VIC1 interrupt service routine nor to do a write
to this register at the end of interrupt processing.



Html Pages

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


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
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