beautypg.com

Rockwell Automation 2711P Software Development Kit User Manual User Manual

Page 91

background image

Publication 2711P-UM005A-EN-P - March 2007

Device Drivers 91

#if defined(DRV_USE_ISR)

//

// If a DLL name was not assigned yet, just default the name for

// use with the Microsoft GIISR chain handler.

//

if (NULL == pDrvData->Dii.szIsrDll)

{

_tcscpy(pDrvData->Dii.szIsrDll,_T("giisr.dll"));

}

//

// If a ISRHandler name was not assigned yet, just default the name for

// use with the Microsoft GIISR chain handler.

//

if (NULL == pDrvData->Dii.szIsrHandler)

{

_tcscpy(pDrvData->Dii.szIsrHandler,_T("IsrHandler"));

}

//

// Install ISR handler if there is one

//

pDrvData->hIsrHandler = LoadIntChainHandler(pDrvData->Dii.szIsrDll,

pDrvData->Dii.szIsrHandler,

(BYTE)pDrvData->Dii.dwIrq);

if (INVALID_HANDLE_VALUE == pDrvData->hIsrHandler)

{

ERRORMSG(1,(_T("DRV_Init: Couldn't install ISR handler!\r\n")));

DEBUGMSG(ZONE_FUNC, (TEXT("DRV_Init-\r\n")));

DRV_Deinit((DWORD)pDrvData);

return (0);

}

///////////////////////////////////////////////////////////////////////

//

// Communicate with the chain handler and pass to it the info needed to

// detect a IRQ intended for this device.

//

// NOTE: This code assumes the chain handler conforms to the exact same

// interface as the GIISR.

//

/////////////////////////////////////////////////////////////////////////////

if (!KernelLibIoControl(pDrvData->hIsrHandler, IOCTL_GIISR_INFO,

&pDrvData->Gii, sizeof(GIISR_INFO), NULL, 0, NULL))

{

ERRORMSG(1,(_T("DRV_Init: KernelLibIoControl call failed!\r\n")));

DEBUGMSG(ZONE_FUNC, (TEXT("DRV_Init-\r\n")));

DRV_Deinit((DWORD)pDrvData);

return (0);

}

#endif // defined(DRV_USE_ISR)

//

// Create the IST event.

//