PURPOSE
Registers an interrupt service routine (ISR) to be called upon
interrupt.
PROTOTYPE
DWORD WD_IntEnable( HANDLE hWD, WD_INTERRUPT *pInterrupt);
PARAMETERS
| Name | Type | Input/Output |
|---|---|---|
| HANDLE | Input | |
| WD_INTERRUPT* | ||
| HANDLE | Input | |
| DWORD | Input | |
| WD_TRANSFER* | Input | |
| DWORD | Input | |
| WD_KERNEL_PLUGIN_CALL | ||
| HANDLE | Input | |
| DWORD | N/A | |
| PVOID | N/A | |
| DWORD | N/A | |
| DWORD | Output | |
| DWORD | N/A | |
| DWORD | N/A | |
| DWORD | N/A | |
| DWORD | N/A | |
| DWORD | Output |
DESCRIPTION
| Name | Description |
|---|---|
| HWD | Handle to WinDriver's kernel-mode driver as received from WD_Open() [5.2] |
| pInterrupt | Pointer to an interrupt information structure: |
| Interrupt handle. The handle is returned by WD_CardRegister() [2.8] in pCardReg->Card.Item[i].I.Int.hInterrupt. | |
| A bit mask flag. May be 0 for no option, or: |
|
| An array of transfer commands information structures that
define the operations to be performed at the kernel level
upon the detection of an interrupt, or NULL if no
transfer commands are required. NOTE: When handling level sensitive interrupts (such as PCI interrupts) in the user mode (without a Kernel PlugIn driver), you must use this array to define the hardware-specific commands for acknowledging the interrupts in the kernel, immediately when they are received. The commands in the array can be either of the following: (Acceptance and rejection of the interrupt is relevant only when handling legacy interrupts; since MSI/MSI-X interrupts are not shared, WinDriver will always accept control of such interrupts.) NOTE: A CMD_MASK command must be preceded by a read transfer command (RM_XXX / RP_XXX). |
|
| Number of transfer commands in Cmd array | |
| Pointer to a Kernel PlugIn message information structure: | |
| Handle to Kernel PlugIn returned from WD_KernelPlugInOpen() [6.1] | |
| Set by the function to TRUE if WD_IntEnable() [3.2] succeeds | |
| Updated by the function to indicate the type of interrupt
enabled for the device. Can be set to any of the
following values: NOTE: |
RETURN VALUE
Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [A].
REMARKS
EXAMPLE
WD_INTERRUPT Intrp;
WD_CARD_REGISTER cardReg;
BZERO(cardReg);
cardReg.Card.dwItems = 1;
cardReg.Card.Item[0].item = ITEM_INTERRUPT;
cardReg.Card.Item[0].fNotSharable = TRUE;
cardReg.Card.Item[0].I.Int.dwInterrupt = 10; /* IRQ 10 */
/* INTERRUPT_LEVEL_SENSITIVE - set to level sensitive
interrupts, otherwise should be 0.
ISA cards are usually edge triggered while PCI cards
are usually level sensitive. */
cardReg.Card.Item[0].I.Int.dwOptions =
INTERRUPT_LEVEL_SENSITIVE;
cardReg.fCheckLockOnly = FALSE;
WD_CardRegister(hWD, &cardReg);
if (cardReg.hCard == 0)
printf("Could not lock device\n");
else
{
BZERO(Intrp);
Intrp.hInterrupt =
cardReg.Card.Item[0].I.Int.hInterrupt;
Intrp.Cmd = NULL;
Intrp.dwCmds = 0;
Intrp.dwOptions = 0;
WD_IntEnable(hWD, &Intrp);
}
if (!Intrp.fEnableOk)
{
printf("Failed enabling interrupt\n");
}