WRITE_CMD(sc, CMD_RXENA); WRITE_CMD(sc, CMD_TXENA);

1

2

1

2

Calls the WRITE_CMD macro to write data to the command port register. The data to be written is the receive (RX) enable command (CMD_RXENA).

Calls the WRITE_CMD macro to write data to the command port register. In this call, the data to be written is the transmit (TX) enable command (CMD_TXENA).

8.2.13 Enabling Interrupts

The following code shows how the el_init_locked( ) routine enables interrupts. Make sure that you perform similar initialization tasks for the hardware device that your network driver controls.

LAN device drivers typically do not perform polling operations. However, this example shows how polling operations can be done on the 3Com 3C5x9 device.

if (!el_polling) { 1 WRITE_CMD(sc, CMD_ZINTMASK+0xfe);

WRITE_CMD(sc, CMD_SINTMASK+(S_AFS_TCS_RC));

} else { 2

WRITE_CMD(sc, CMD_ZINTMASK+0xfe); WRITE_CMD(sc, CMD_SINTMASK+0);

}

1

2

If the device is not polling (the el_polling flag is not set), calls the WRITE_CMD macro to set the interrupt mask and enable adapter failure (S_AF), transmit complete (S_TC), and receive complete (S_RC) interrupts.

If the device is polling, calls the WRITE_CMD macro to clear the interrupt mask and disable all interrupts.

8.2.14 Setting the Operational Window

The following code shows how the el_init_locked( ) routine sets the operational window. This task is specific to the 3Com 3C5x9 device.

WRITE_CMD(sc, CMD_WINDOW1); sc->txfree = READ_TXF(sc);

1

1

Calls the WRITE_CMD macro to set the operational window register.

8.2.15 Marking the Device as Running

The following code shows how the el_init_locked( ) routine marks the device as running. All network device drivers perform this task.

8–10Implementing the Initialization Section

Page 110
Image 110
Compaq AA-RNG2A-TE manual Enabling Interrupts, Setting the Operational Window, Marking the Device as Running