📄 intr_notimes.t
字号:
@c@c Interrupt Stack Frame Picture@c@c COPYRIGHT (c) 1988-2002.@c On-Line Applications Research Corporation (OAR).@c All rights reserved.@c@c $Id: intr_NOTIMES.t,v 1.2 2002/11/13 16:58:09 joel Exp $@c@chapter Interrupt Processing@section IntroductionDifferent types of processors respond to theoccurrence of an interrupt in its own unique fashion. Inaddition, each processor type provides a control mechanism toallow for the proper handling of an interrupt. The processordependent response to the interrupt modifies the currentexecution state and results in a change in the execution stream.Most processors require that an interrupt handler utilize somespecial control mechanisms to return to the normal processingstream. Although RTEMS hides many of the processor dependentdetails of interrupt processing, it is important to understandhow the RTEMS interrupt manager is mapped onto the processor'sunique architecture. Discussed in this chapter are the ARM'sinterrupt response and control mechanisms as they pertain toRTEMS.The ARM has 7 exception types:@itemize @bullet@item Reset@item Undefined instruction@item Software interrupt (SWI)@item Prefetch Abort@item Data Abort@item Interrupt (IRQ)@item Fast Interrupt (FIQ)@end itemizeOf these types, only IRQ and FIQ are handled through RTEMS's interruptvectoring.@section Vectoring of an Interrupt HandlerUnlike many other architectures, the ARM has seperate stacks for eachinterrupt. When the CPU receives an interrupt, it:@itemize @bullet@item switches to the exception mode corresponding to the interrupt,@item saves the Current Processor Status Register (CPSR) to theexception mode's Saved Processor Status Register (SPSR),@item masks off the IRQ and if the interrupt source was FIQ, the FIQis masked off as well,@item saves the Program Counter (PC) to the exception mode's LinkRegister (LR - same as R14), @item and sets the PC to the exception's vector address.@end itemizeThe vectors for both IRQ and FIQ point to the _ISR_Handler function. _ISR_Handler() calls the BSP specific handler, ExecuteITHandler(). Beforecalling ExecuteITHandler(), registers R0-R3, R12, and R14(LR) are saved so that it is safe to call C functions. Even ExecuteITHandler() can be writtenin C.@section Interrupt LevelsThe ARM architecture supports two external interrupts - IRQ and FIQ. FIQ has a higher priority than IRQ, and has its own version of register R8 - R14,however RTEMS does not take advantage of them. Both interrupts are enabledthrough the CPSR.The RTEMS interrupt level mapping scheme for the AEM is not a numeric levelas on most RTEMS ports. It is a bit mapping that corresponds the enable bits's postions in the CPSR:@table @b@item FIQSetting bit 6 (0 is least significant bit) disables the FIQ.@item IRQSetting bit 7 (0 is least significant bit) disables the IRQ. @end table @section Disabling of Interrupts by RTEMSDuring the execution of directive calls, criticalsections of code may be executed. When these sections areencountered, RTEMS disables interrupts to level seven (7) beforethe execution of this section and restores them to the previouslevel upon completion of the section. RTEMS has been optimizedto insure that interrupts are disabled for less than RTEMS_MAXIMUM_DISABLE_PERIOD microseconds on a RTEMS_MAXIMUM_DISABLE_PERIOD_MHZ Mhz processor with zero wait states. These numbers will vary based the number of wait states and processor speed present on the target board.[NOTE: The maximum period with interrupts disabled is hand calculated. Thiscalculation was last performed for Release RTEMS_RELEASE_FOR_MAXIMUM_DISABLE_PERIOD.]Non-maskable interrupts (NMI) cannot be disabled, andISRs which execute at this level MUST NEVER issue RTEMS systemcalls. If a directive is invoked, unpredictable results mayoccur due to the inability of RTEMS to protect its criticalsections. However, ISRs that make no system calls may safelyexecute as non-maskable interrupts.@section Interrupt StackRTEMS expects the interrupt stacks to be set up in bsp_start(). The memoryfor the stacks is reserved in the linker script.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -