equal to the size of the configured
PBL
in the
EMACDMABUSMOD
register. Thus, all subsequent
transfers start at an address that is aligned to the configured
PBL
. The DMA can only align the
address for burst transfers up to size 16 because only bursts of 16 are supported.
20.3.2.2
Data Buffer Alignment
The transmit and receive data buffers do not have any restrictions on the start address alignment.
For example, in systems with 32-bit memory, the start address for the buffers can be aligned to any
of the four bytes. However, the DMA always initiates write transfers, with address aligned to the bus
width and dummy data (old data) in the byte lanes that are not valid. This typically happens during
the transfer of the beginning or end of an Ethernet frame. The software driver should discard the
dummy bytes based on the start address of the buffer and size of the frame.
For example, if the transmit buffer address is 0x0000.0FF2, and 15 bytes need to be transferred,
then the DMA reads five full words from address 0x0000.0FF0, but when transferring data to the
TX FIFO, the extra bytes (the first two bytes) are dropped or ignored. Similarly, the last 3 bytes of
the last transfer are also ignored. The DMA always ensures that it transfers a full 32-bit data to the
TX FIFO, unless it is the end of frame.
If the receive buffer address is 0x0000.0FF2 and 15 bytes of a received frame need to be transferred,
then the DMA writes five full words from address 0x0000.0FF0. However, the first two bytes of first
transfer and the last three bytes of the fifth transfer have dummy data. The DMA considers the offset
address only if it is the first Receive buffer of the frame. The DMA ignores the offset address and
performs full word writes for the middle and the last Receive buffer of the frame.
20.3.2.3
Buffer Size Calculations
The DMA does not update the size fields in the Transmit and Receive descriptors. The DMA updates
only the status fields (RDES and TDES) of the descriptors. The driver has to perform the size
calculations. The TX DMA transfers the exact number of bytes (indicated by buffer size fields of
TDES1) to the MAC. If a descriptor is marked as first (FS bit of TDES0 is set), then the DMA marks
the first transfer from the buffer as the start-of-frame (SOF). If a descriptor is marked as last (LS bit
of TDES0), then the DMA marks the last transfer from that data buffer as the end-of frame (EOF).
The RX DMA transfers data to a buffer until the buffer is full or the end-of frame is received from
the RX/TX Controller. If a descriptor is not marked as last (LS bit of RDES0), then the descriptor's
corresponding buffer(s) are full and the amount of valid data in a buffer is accurately indicated by
its buffer size field minus the data buffer pointer offset when the FS bit of that descriptor is set. The
offset is zero when the data buffer pointer is aligned to the data bus width. If a descriptor is marked
as last, then the buffer may not be full (as indicated by the buffer size in RDES1). To compute the
amount of valid data in this final buffer, the driver must read the frame length (FL bits of RDES0)
and subtract the sum of the buffer sizes of the preceding buffers in this frame. The Receive DMA
always transfers the start of next frame with a new descriptor.
Note:
Even when the start address of a receive buffer is not aligned to the data width of 32-bit
system bus, the system should allocate a receive buffer of a size aligned to the system bus
width. For example, if the system allocates a 1,024-byte (1 KB) receive buffer starting from
address 0x1000, the software can program the buffer start address in the Receive descriptor
to have a 0x1002 offset. The Receive DMA writes the frame to this buffer with dummy data
in the first two locations (0x1000 and 0x1001). The actual frame is written from location
0x1002. Thus, the actual useful space in this buffer is 1,022 bytes, even though the buffer
size is programmed as 1,024 bytes, because of the start address offset.
June 18, 2014
1412
Texas Instruments-Production Data
Ethernet Controller