|
NOTE: This API call has been superceded by RtAttachInterrupt in RTSS. When writing RTSS applications, use RtAttachInterrupt, instead of RtAttachInterruptVector, which may be deprecated in the future.
RtAttachInterruptVector allows the user to associate a handler routine in user space with a hardware interrupt. Non-shared, level-triggered interrupts are supported only in the RTSS environment.
NOTE: RtAttachInterruptVector does not permit shared interrupts. The function call, RtAttachInterruptVectorEx, permits shared interrupts.
Syntax
HANDLE RtAttachInterruptVector( PSECURITY_ATTRIBUTES pThreadAttributes, ULONG StackSize, VOID (RTFCNDCL *pRoutineIST)(PVOID ContextIST), PVOID ContextIST, ULONG Priority, INTERFACE_TYPE InterfaceType, ULONG BusNumber, ULONG BusInterruptLevel, ULONG BusInterruptVector );
Parameters
pThreadAttributes (ignored by RTSS)
A security attributes structure used when the handler thread is created. See CreateThread in the Windows Win32 SDK.
StackSize
The number of bytes to allocate for the handler thread's stack. The stack size defaults to the thread's stack size. See Create Thread
pRoutineIST
A pointer to the handler routine to be run. The routine takes a single PVOID argument and returns VOID.
ContextIST
The argument to the handler routine, cast as a PVOID.
Priority
The thread priority for the handler routine. Executing equal and higher priority threads disables interrupts from the device; executing lower priority threads enable interrupts from the device.
InterfaceType
The type of bus interface on which the hardware is located. It can be one of the following types: Isa bus or PCIBus bus. The upper boundary on the bus types supported is always MaximumInterfaceType.
BusNumber
The bus that the device is on in a multiple bus environment. Bus numbers are zero-based. Note that this value applies to each bus type, so for a system with one ISA bus and one PCIBus, for example, each would have a BusNumber of 0.
BusInterruptLevel
A bus-specific interrupt level associated with the routine that will handle the interrupt.
BusInterruptVector
A bus-specific address associated with the routine that will handle the interrupt.
Return Values
An RTX-specific interrupt handle if the function succeeds, a NULL handle if the function fails
The function can fail for these reasons:
Remarks
RtAttachInterruptVector allows a user to associate a handling routine with a hardware interrupt on one of the supported buses on the computer. The routine gets the system-wide interrupt vector based on the bus-specific interrupt level and vector. If successful, it creates a handling thread in the user's application. When the interrupt occurs, the handling thread is notified and the thread runs the handling routine with the argument specified.
IMPORTANT! The handling routine must not change its thread priority.
To use this call, you must supply bus-specific parameters. For buses with automatic configurations, such as PCI you can obtain the parameter information by calling RtGetBusDataByOffset. For more information, look in the Bus I/O section of this help system.
As in a typical device driver, the user is responsible for initializing the hardware device, enabling the generation of interrupts, and acknowledging interrupts in the appropriate manner. Interrupt generation on the device can be enabled after a successful call to RtAttachInterruptVector. Conversely, the user must disable interrupts before disconnecting the interrupt with RtReleaseInterruptVector, and also disconnect the interrupt before exiting. In the interrupt handling routine, the user should perform the appropriate steps to acknowledge the device's interrupt. Typically, these operations are performed by writing commands to a device's command/status register, which is either memory-mapped or in the I/O address space of the system.
Requirements
Header | Rtapi.h |
Library | rtapi_w32.lib (Windows), Rtx_Rtss.lib (RTSS) |
See Also:
HalGetInterruptVector (in the Windows Driver Development Kit)