![]() |
| Home |
|
|
Function RTKRestoreIRQHandlerFarRTKRestoreIRQHandlerFar can restore an interrupt handler previously saved using RTKSaveIRQHandlerFar: void RTKRestoreIRQHandlerFar(int IRQ, const RTKIRQDescriptor * Handler); ParametersIRQSpecifies the desired interrupt. HandlerPointer to a previously saved RTKIRQDescriptor structure. Example:To insert your own handler into an existing interrupt chain, you should use the following code:
#define IRQ ?? // desired IRQ
RTKIRQDescriptor OrgHandler;
void MyHandler(void) // application handler
{
... // the handler's processing
RTKCallIRQHandlerFar(&OrgHandler); // call the old handler
void Install(void) // install MyHandler
{
RTKSaveIRQHandlerFar(IRQ, &OrqHandler);
RTKSetIRQHandler(MyHandler);
}
void CleanUp(void) // deinstall MyHandler
{
RTKRestoreIRQHandlerFar(IRQ, &OrgHandler);
}
Please note that restoring interrupt handlers is not always required at program exit. RTKernel-32 restores all modified interrupt vectors when the program terminates. Instead of chaining, it is recommended to use RTInstallSharedIRQHandlerEx to install several handlers on the same IRQ.
|