09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Ethernet (ETH): media access control (MAC) with DMA controller <strong>RM0090</strong><br />

then the DMA marks the first transfer from the buffer as the start of frame. If a descriptor is<br />

marked as last (LS bit in TDES0), then the DMA marks the last transfer from that data buffer<br />

as the end of frame. The receive DMA transfers data to a buffer until the buffer is full or the<br />

end of frame is received. If a descriptor is not marked as last (LS bit in RDES0), then the<br />

buffer(s) that correspond to the descriptor are full and the amount of valid data in a buffer is<br />

accurately indicated by the buffer size field minus the data buffer pointer offset when the<br />

descriptor’s FS bit is set. The offset is zero when the data buffer pointer is aligned to the<br />

databus width. If a descriptor is marked as last, then the buffer may not be full (as indicated<br />

by the buffer size in RDES1). To compute the amount of valid data in this final buffer, the<br />

driver must read the frame length (FL bits in RDES0[29:16]) and subtract the sum of the<br />

buffer sizes of the preceding buffers in this frame. The receive DMA always transfers the<br />

start of next frame with a new descriptor.<br />

Note: Even when the start address of a receive buffer is not aligned to the system databus width<br />

the system should allocate a receive buffer of a size aligned to the system bus width. For<br />

example, if the system allocates a 1024 byte (1 KB) receive buffer starting from address<br />

0x1000, the software can program the buffer start address in the receive descriptor to have<br />

a 0x1002 offset. The receive DMA writes the frame to this buffer with dummy data in the first<br />

two locations (0x1000 and 0x1001). The actual frame is written from location 0x1002. Thus,<br />

the actual useful space in this buffer is 1022 bytes, even though the buffer size is<br />

programmed as 1024 bytes, due to the start address offset.<br />

29.6.5 DMA arbiter<br />

The arbiter inside the DMA takes care of the arbitration between transmit and receive<br />

channel accesses to the AHB master interface. Two types of arbitrations are possible:<br />

round-robin, and fixed-priority. When round-robin arbitration is selected (DA bit in<br />

ETH_DMABMR is reset), the arbiter allocates the databus in the ratio set by the PM bits in<br />

ETH_DMABMR, when both transmit and receive DMAs request access simultaneously.<br />

When the DA bit is set, the receive DMA always gets priority over the transmit DMA for data<br />

access.<br />

29.6.6 Error response to DMA<br />

For any data transfer initiated by a DMA channel, if the slave replies with an error response,<br />

that DMA stops all operations and updates the error bits and the fatal bus error bit in the<br />

Status register (ETH_DMASR register). That DMA controller can resume operation only<br />

after soft- or hard-resetting the peripheral and re-initializing the DMA.<br />

29.6.7 Tx DMA configuration<br />

TxDMA operation: default (non-OSF) mode<br />

The transmit DMA engine in default mode proceeds as follows:<br />

1. The user sets up the transmit descriptor (TDES0-TDES3) and sets the OWN bit<br />

(TDES0[31]) after setting up the corresponding data buffer(s) with Ethernet frame data.<br />

2. Once the ST bit (ETH_DMAOMR register[13]) is set, the DMA enters the Run state.<br />

3. While in the Run state, the DMA polls the transmit descriptor list for frames requiring<br />

transmission. After polling starts, it continues in either sequential descriptor ring order<br />

or chained order. If the DMA detects a descriptor flagged as owned by the CPU, or if an<br />

error condition occurs, transmission is suspended and both the Transmit Buffer<br />

943/1416 Doc ID 018909 Rev 3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!