⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intr_notimes.t

📁 RTEMS (Real-Time Executive for Multiprocessor Systems) is a free open source real-time operating sys
💻 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.4 2002/07/31 00:17:12 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 processor'sinterrupt response and control mechanisms as they pertain toRTEMS.@section Vectoring of an Interrupt HandlerDepending on whether or not the particular CPUsupports a separate interrupt stack, the XXX family has twodifferent interrupt handling models.@subsection Models Without Separate Interrupt StacksUpon receipt of an interrupt the XXX familymembers without separate interrupt stacks automatically performthe following actions:@itemize @bullet@item To Be Written@end itemize@subsection Models With Separate Interrupt StacksUpon receipt of an interrupt the XXX familymembers with separate interrupt stacks automatically perform thefollowing actions:@itemize @bullet@item saves the current status register (SR),@item clears the master/interrupt (M) bit of the SR toindicate the switch from master state to interrupt state,@item sets the privilege mode to supervisor,@item suppresses tracing,@item sets the interrupt mask level equal to the level of theinterrupt being serviced,@item pushes an interrupt stack frame (ISF), which includesthe program counter (PC), the status register (SR), and theformat/exception vector offset (FVO) word, onto the supervisorand interrupt stacks,@item switches the current stack to the interrupt stack andvectors to an interrupt service routine (ISR).  If the ISR wasinstalled with the interrupt_catch directive, then the RTEMSinterrupt handler will begin execution.  The RTEMS interrupthandler saves all registers which are not preserved according tothe calling conventions and invokes the application's ISR.@end itemizeA nested interrupt is processed similarly by theseCPU models with the exception that only a single ISF is placedon the interrupt stack and the current stack need not beswitched.The FVO word in the Interrupt Stack Frame is examinedby RTEMS to determine when an outer most interrupt is beingexited. Since the FVO is used by RTEMS for this purpose, theuser application code MUST NOT modify this field.The following shows the Interrupt Stack Frame forXXX CPU models with separate interrupt stacks:@ifset use-ascii@example@group               +----------------------+               |    Status Register   | 0x0               +----------------------+                   | Program Counter High | 0x2               +----------------------+                   | Program Counter Low  | 0x4               +----------------------+                   | Format/Vector Offset | 0x6               +----------------------+    @end group@end example@end ifset@ifset use-tex@sp 1@tex\centerline{\vbox{\offinterlineskip\halign{\strut\vrule#&\hbox to 2.00in{\enskip\hfil#\hfil}&\vrule#&\hbox to 0.50in{\enskip\hfil#\hfil}\cr\multispan{3}\hrulefill\cr& Status Register && 0x0\cr\multispan{3}\hrulefill\cr& Program Counter High && 0x2\cr\multispan{3}\hrulefill\cr& Program Counter Low && 0x4\cr\multispan{3}\hrulefill\cr& Format/Vector Offset && 0x6\cr\multispan{3}\hrulefill\cr}}\hfil}@end tex@end ifset@ifset use-html@html<CENTER>  <TABLE COLS=2 WIDTH="40%" BORDER=2><TR><TD ALIGN=center><STRONG>Status Register</STRONG></TD>    <TD ALIGN=center>0x0</TD></TR><TR><TD ALIGN=center><STRONG>Program Counter High</STRONG></TD>    <TD ALIGN=center>0x2</TD></TR><TR><TD ALIGN=center><STRONG>Program Counter Low</STRONG></TD>    <TD ALIGN=center>0x4</TD></TR><TR><TD ALIGN=center><STRONG>Format/Vector Offset</STRONG></TD>    <TD ALIGN=center>0x6</TD></TR>  </TABLE></CENTER>@end html@end ifset@section Interrupt LevelsEight levels (0-7) of interrupt priorities aresupported by XXX family members with level seven (7) beingthe highest priority.  Level zero (0) indicates that interruptsare fully enabled.  Interrupt requests for interrupts withpriorities less than or equal to the current interrupt masklevel are ignored.Although RTEMS supports 256 interrupt levels, theXXX family only supports eight.  RTEMS interrupt levels 0through 7 directly correspond to XXX interrupt levels.  Allother RTEMS interrupt levels are undefined and their behavior isunpredictable.@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 XXX 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 allocates the interrupt stack from theWorkspace Area.  The amount of memory allocated for theinterrupt stack is determined by the interrupt_stack_size fieldin the CPU Configuration Table.  During the initializationprocess, RTEMS will install its interrupt stack.The XXX port of RTEMS supports a software manageddedicated interrupt stack on those CPU models which do notsupport a separate interrupt stack in hardware.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -