6.11 Enabling the Interrupt Handler
The following code shows how the el_attach( ) routine enables the interrupt handler:
1
1
Calls the handler_enable( ) routine to enable a previously registered interrupt handler. The el_probe( ) routine calls handler_add to register the interrupt handler and it stores the handler ID in the hid member of the el_softc data structure for this device.
6.12 Starting the Polling Process
The following code shows how the el_attach( ) routine starts the polling process:
if (el_polling &&
timeout((void *)el_intr, (void *)unit, (1*hz)/el_pollint);
}else
return(0);
}
1
2
Starts the polling process if the el_polling attribute specifies that polling is to be done.
To start the polling process, el_attach( ) sets the polling_flag member to 1 (true), then calls the timeout( ) routine to schedule the interrupt handler to run at some point in the future. timeout( ) is called with the following arguments:
•A pointer to the el_intr( ) routine, which is the if_el device driver’s interrupt handler.
•The unit variable, which contains the controller number associated with this device. This argument is passed to the el_intr( ) routine.
•The el_pollint variable, which specifies the amount of time to delay before calling the el_intr( ) routine.
If the user requests that polling be disabled, el_attach( ) sets the polling_flag member to 0 (false).