12

in the middle. The mfree( ) routine is called to free any zero-length memory buffers.

Otherwise, adds the length and sets the next memory buffer in the chain to the mp mbuf pointer.

9.2.3 Transmitting the Buffer

The following code shows how the el_start_locked( ) routine transmits the buffer:

WRITE_DATA(sc, len TX_INT); 1 dat = mtod(ms, unsigned char *); len = ms->m_len;

while (ms != NULL) {

io_blockwrite((vm_offset_t)dat, 2 sc->data, (u_long)(len & ~ 3),

HANDLE_LONGWORD);

dat += (len & ~ 3);

ms = ms->m_next;

i = len % 4; 3 if (ms == NULL) {

if (i) { val = 0;

for (j=0; j<i; j++)

val = (*dat++ << (8*j)); WRITE_DATA(sc, val);

}

} else {

if (i) { val = 0;

for (j=0; j<i; j++)

val = (*dat++ << (8*j));

dat = mtod(ms, unsigned char *);

if (ms->m_len <= (4-i)) {

for (j=0; j<ms->m_len; j++) val = (*dat++ << (8*(j+i)));

ms = NULL; } else {

len = ms->m_len - (4-i); for (j=i; j<4; j++)

val = (*dat++ << (8*j));

}

WRITE_DATA(sc, val); } else {

dat = mtod(ms, unsigned char *); len = ms->m_len;

}

}

}

1

Requests an interrupt upon completion of the transmit operation.

9–6Implementing the Start Section

Page 118
Image 118
Compaq AA-RNG2A-TE manual Transmitting the Buffer, Handlelongword