Home |
RTKernel-32 Programming Manual Multitasking, Real-Time, and RTKernel-32 Alternate APIs for RTKernel-32 Installing Shared Interrupt Handlers Interrupt Handler for RTKSetIRQHandler Preemptive or Cooperative Multitasking? Starting Objects' Methods as Tasks Performance and Interrupt Response Times Task Switches in Cooperative Scheduling Using the FPU in Interrupt Handlers |
Installing Shared Interrupt HandlersAn interrupt handler to be installed with RTInstallSharedIRQHandlerEx should have the following structure:
Note that the handler will be called with interrupts enabled and that the handler should not call any interrupt controller specific functions. Example:int IRQ = 3; int IOBase = 0x2F8; int RTKAPI IntHandler(void * P) // high level interrupt handler { int IOBase = * (int*)P; // get the device context int Count = 0; while (RTIn(IOBase+IIR) & 0x0C) // receive int? { char Data = RTIn(IOBase+RXB); // get the received byte RTKPutCond(Buffer, &Data); // and insert in mailbox Count = 1; } return Count; } ... int main(void) { ... RTInstallSharedIRQHandlerEx(IRQ, IntHandler, &IOBase); // program device to start sending interrupts here ... // program device to stop sending interrupts here RTRemoveSharedIRQHandlerEx(IRQ, IntHandler, &IOBase); ... } Interrupt Handler for RTKSetIRQHandler
|