
27
P/N:PM0729 REV. 1.1, MAY. 28, 2001
MX98726EC
4.1 P acket Transmission
GMAC supports two ways to prepare packet(s) for trans-
mission, one wa y is the host can write a pack et directly
into TX FIFO through an IO por t and send the packet
directly from FIFO , this wa y is called direct FIFO mode.
The other wa y is to write pack et(s) into TX b uffer ring in
the pack et memory and activate TX local DMA to send
out packet(s). Using direct FIFO mode can eliminate
TX local DMA completely which will leave packet
memory's total bandwidth to RX local DMA and host.
Therefore, receiving at the full line speed is more achiev-
able in this way. The disadvantage is that only one packet
is prepared and sent out at a time, next packet must
wait until current packet is sent out and FIFO is empty
bef ore it can be moved into TX FIFO . In another word,
you can not issue multiple packet transmission with a
single command. But you still can prepare new packet(s)
in TX buffer ring while a packet in direct FIFO mode is
still active, so once the packet in direct FIFO mode is
finished, you can active TX DMA right aw a y.
The TX local DMA mode is used between GMAC and
packet memory during transmission of packet. TRP (
Transmit Read Page pointer ) is used by local DMA to
fetch the first page of the desired packet in the packet
memory. When GMAC receive a TX DMA send com-
mand ( register 00h.ST1=0, ST0=1 ), data in the packet
memory will be moved into GMAC's transmit FIFO.
GMAC will append preamble, sync and CRC field dur-
ing the actual tranmission. The adv antage of this mode
is multiple packets can be processed with a single
comannd, also new packet(s) can be prepared while
TX local DMA is active. Therefore, potential higher
through-put of TX channel can be achie ved. The disad-
v antage is packet memory bandwidth is now shared by
host, TX channel and RX channel. This means band-
width might not be enough for all three to run at their full
speed which may result in TX FIFO underrun, or RX
FIFO overrun and slow host accesses, especially in a
system where you only hav e a 8 bit packet memory.
It may be desireable to mix both direct FIFO mode anf
TX local DMA mode so that bandwidth of packet memory
and convenience of concurrent processing of mutiple
pack ets can be compromised for the best interest of the
system's perf ormance. Some cautions should be taken
when you using mixed mode. Do not write to FIFO while
TX local DMA is activ e, because such write will corrupt
whatever packet being transmitted in the FIFO. Do not
activate TX local DMA while direct FIFO send has not
been finished f or current packet's transmission. Regis-
ter 00h.ST1 and ST0 bits are both command and sta-
tus, before host issues any packet send command. Al-
wa ys read these two bits and make sure they are both 0
which indicate a transmit cnahhel IDLE ( FIFO is also
empty ). The rule of the mixed modes is always activate
one mode at a time, ST1 and ST0 must be both 0 be-
f ore the other mode is used.
Prior to transmission in direct FIFO mode
When ST1 and ST0 bits are both 0, host can write a
packet no longer than 1518 bytes through IO port regis-
ter 48h. GMAC will record the byte count. Since register
48h is write only port, it can not be read. Before the
entire packet is completely inside FIFO, host can do
other operations except activating TX local DMA. Issu-
ing TX local DMA before current direct FIFO wr ite op-
erations or TX FIFO send completion will "corrupt" cur-
rent packet inside TX FIFO. When the entire packet is in
the FIFO , host can issue ST1=1 and ST0=0 ( TX FIFO
send command ). When this packet is sent out com-
pletely, transmit status will be recorded in register 04h
and both ST1 and ST0 are cleared to 0 to indicate IDLE
state.
Prior to transmission in TX local DMA mode
The transmit descriptor located at the beginning of the
first page of the desired packet in the packet memor y
must be properly set by device driver prior to a transmit
command. By using TWP ( Transmit Write Page Pointer
), device driver can fill up pack et(s) in the transmit buffer
ring. For single packet transmission, the Next Packet
P age P ointer field should be equal to TRP page pointer
which links to the current pack et itself. If multiple pac k-
ets are to be transmitted, then Next Packet P age Pointer
field of transmit descriptor should be set to the start
page of next packet. Current Packet Length ( in b yte ) is
set to indicate the size of current pac ket. Transmit Sta-
tus bit 7 ( O WN bit ) of the descriptor needed to be set
to 1 to indicate that device driver has finished preparing
the current packet. Then the packet can be transferred
to GMAC for transmission. At this point, transmit com-
mand can be issued by setting Reg00h.ST1=0, ST0=1
( TX DMA poll command ) to activate transmit opera-
tion. ST1 and ST0 bits will be cleared to 0 when trans-
mission is done.