5.3.5
Entering the Packet Transmit Loop . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–20
5.3.6
Saving Counters Prior to the Transmit Operation . .. . .. . .. .
5–21
5.3.7
Allocating Memory for a Test Packet . .. . .. . .. . .. . . .. . .. . .. . .. .
5–21
5.3.8
Using the Default from the ROM . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–21
5.3.9
Setting the Media in the Hardware . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–22
5.3.10
Building the Test Packet . . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–22
5.3.11
Transmitting the Test Packet . . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–22
5.3.12
Setting a Timer for the Current Kernel Thread . .. . .. . .. . .. .
5–23
5.3.13
Testing for Loss of Carrier .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–23
5.3.14
Determining Whether Packets Were Transmitted
Successfully . .. . .. . .. . .. . . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–24
5.3.15
Printing Debug Information . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–24
5.3.16
Setting Up New Media . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–24
5.3.17
Establishing the Media . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
5–25
6
Implementing the Autoconfiguration Support Section (attach)
6.1
Setting Up the el_attach Routine . . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
6–1
6.2
Initializing the Media Address and Media Header Lengths .. .
6–2
6.3
Setting Up the Media .. . .. . . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
6–3
6.4
Initializing Simple Lock Information . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
6–5
6.5
Printing a Success Message .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
6–6
6.6
Specifying the Network Driver Interfaces . . .. . .. . .. . . .. . .. . .. . .. .
6–6
6.7
Setting the Baud Rate . . .. . . .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
6–8
6.8
Attaching to the Packet Filter and the Network Layer .. . .. . .. .
6–8
6.9
Setting Network Attributes and Registering the Adapter .. . .. .
6–9
6.10
Handling the Reinsert Operation . . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
6–9
6.11
Enabling the Interrupt Handler . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
6–10
6.12
Starting the Polling Process .. . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
6–10
7
Implementing the unattach Routine
7.1
Setting Up the el_unattach Routine . . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
7–1
7.2
Verifying That the Interface Has Shut Down . .. . .. . . .. . .. . .. . .. .
7–2
7.3
Obtaining the Simple Lock and Shutting Down the Device . .. .
7–2
7.4
Disabling the Interrupt Handler .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
7–3
7.5
Terminating the Autosense Kernel Thread . .. . .. . .. . . .. . .. . .. . .. .
7–3
7.6
Unregistering the PCMCIA Event Callback Routine . . .. . .. . .. .
7–4
7.7
Stopping the Polling Process . . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
7–4
7.8
Unregistering the Shutdown Routine .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
7–4
7.9
Terminating the Simple Lock . .. . .. . .. . .. . . .. . .. . .. . .. . . .. . .. . .. . .. .
7–4
Contents v