index previous next




file name: intproc.hpp, intproc.cpp
classification: pure simulation
contents: class CInterruptProcess
derived from: class ACProcess
use: a process class that generates an interrupt, ie., calls InvokeISR() when it is active


Note: only use RaiseAfter() to schedule interrupts processes (it is different from normal scheduling). Never use any of the functions provided by the basic process class ACProcess.


global items used:


member variables:

 EBool enabled_: interrupts are only generated if enabled is True. If it is False, the process will not raise the interrupt.
default: False

 int vector_: the vector number of the interrupt.
default: NoAccount

 double waitTime_: contains the time until next interrupt.
default: NoAccount


member functions:

 CInterruptProcess (): Sets the members to their default values.

 EBool Active (): Returns True if the process is active, False if not.

 virtual void Body (): First, PreExecution() is executed. Then, if the interrupt is enabled, InvokeISR() is called with the vector stored. At last, PostExecution() is called. If RaiseAfter() was called during one of the functions, the process is scheduled for the next interrupt, else the process is suspended.

 void CancelInterrupt (): Deschedules the interrupt (if it is scheduled) and sets waitTime to NoAccount, which prevents rescheduling if the process is currently active.

 void Disable (): Disables the interrupt (till the next call to Enable()).

 void Enable (): Enables the interrupt. If it is not enabled at the time the interrupt should be generated, the interrupt service routine will not be called. If the interrupt vector has not been set, an assert fails.

 EBool Enabled (): Returns True if the interrupt is enabled, False if not.

 virtual void PostExecution (): empty
The function is executed after calling the ISR. A derived class should overload it if it needs to do anything after invoking the ISR.

 virtual void PreExecution (): empty
The function is executed prior to calling the ISR. A derived class can overload the function to implement interrupt specific things.

 void RaiseAfter (double delay): Generates an interrupt in delay seconds from now. The function may be called in the context of the interrupt (whereas the scheduling functions of ACProcess may not). If the process is active, it does not reschedule at once, but stores the delay until rescheduling is possible.

 void SetVector (int vector): Sets the interrupt vector. *Must* be called before the first interrupt is generated.


last modified: Fri Feb 5 18:56:23 1999