3 implementing the el_tint routine, 1 counting the transmit interrupt – Compaq TRU64 AA-RNG2A-TE User Manual

Page 148

Advertising
background image

if ((sc->debug) && (count <= 0))

printf("el%d: Receive in INFINITE loop %04X\n", ifp->if_unit, status);

}

1

Calls the WRITE_CMD macro to write data to the command port register.
The data to be written is the receive discard top packet command
(CMD_RXDTP).

13.3 Implementing the el_tint Routine

The if_el device driver’s el_tint( ) routine is the transmit interrupt
completion routine. It performs the following tasks:

•

Counts the transmit interrupt (Section 13.3.1)

•

Reads the transmit status and counts all significant events
(Section 13.3.2)

•

Manages excessive data collisions (Section 13.3.3)

•

Writes to the status register to obtain the next value (Section 13.3.4)

•

Queues other transmits (Section 13.3.5)

13.3.1 Counting the Transmit Interrupt

The following code shows how the el_tint( ) routine counts the transmit
interrupt:

#define TXLOOP ((16*1024)/64)

static void el_tint(struct el_softc *sc,

struct ifnet *ifp)

{

int count=TXLOOP;

volatile unsigned int status;

sc->tint++;

1

1

Increments a counter of the number of the transmit interrupts that
have been processed.

13.3.2 Reading the Transmit Status and Counting All Significant

Events

The following code shows how the el_tint( ) routine reads the transmit
status and counts all significant events:

status = READ_TXS(sc);

1

while ((status & (TX_CM<<8)) && (count-- > 0)) {

if (status & ((TX_JB|TX_UN)<<8)) {

2

ifp->if_oerrors++;

sc->ctrblk.est_sendfail++;

sc->txreset++;

WRITE_TXS(sc, status);

3

13–10 Implementing the Interrupt Section

Advertising