6.11 Enabling the Interrupt Handler
The following code shows how the
el_attach( )
routine enables the
interrupt handler:
handler_enable(sc->hid);
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 && !sc->polling_flag) {
1
sc->polling_flag = 1;
timeout((void *)el_intr, (void *)unit, (1*hz)/el_pollint);
} else
sc->polling_flag = 0;
2
return(0);
}
1
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.
2
If the user requests that polling be disabled,
el_attach( )
sets the
polling_flag
member to 0 (false).
6–10 Implementing the Autoconfiguration Support Section (attach)