29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

RM0008<br />

INCR4, INCR8, INCR16 <strong>and</strong> SINGLE transactions. Otherwise (no fixed-length burst), it<br />

transfers data using INCR (undefined length) <strong>and</strong> SINGLE transactions.<br />

The Receive DMA initiates a data transfer only when sufficient data for the configured burst<br />

is available in Receive FIFO or when the end of frame (when it is less than the configured<br />

burst length) is detected in the Receive FIFO. The DMA indicates the start address <strong>and</strong> the<br />

number of transfers required to the AHB master interface. When the AHB interface is<br />

configured for fixed-length burst, then it transfers data using the best combination of INCR4,<br />

INCR8, INCR16 <strong>and</strong> SINGLE transactions. If the end of frame is reached before the fixedburst<br />

ends on the AHB interface, then dummy transfers are performed in order to complete<br />

the fixed-length burst. Otherwise (FB bit in ETH_DMABMR is reset), it transfers data using<br />

INCR (undefined length) <strong>and</strong> SINGLE transactions.<br />

When the AHB interface is configured for address-aligned beats, both DMA engines ensure<br />

that the first burst transfer the AHB initiates is less than or equal to the size of the configured<br />

PBL. Thus, all subsequent beats start at an address that is aligned to the configured PBL.<br />

The DMA can only align the address for beats up to size 16 (for PBL > 16), because the<br />

AHB interface does not support more than INCR16.<br />

27.6.3 Host data buffer alignment<br />

The transmit <strong>and</strong> receive data buffers do not have any restrictions on start address<br />

alignment. In our system with 32-bit memory, the start address for the buffers can be aligned<br />

to any of the four bytes. However, the DMA always initiates transfers with address aligned to<br />

the bus width with dummy data for the byte lanes not required. This typically happens during<br />

the transfer of the beginning or end of an Ethernet frame.<br />

● Example of buffer read:<br />

If the Transmit buffer address is 0x0000 0FF2, <strong>and</strong> 15 bytes need to be transferred,<br />

then the DMA will read five full words from address 0x0000 0FF0, but when transferring<br />

data to the Transmit FIFO, the extra bytes (the first two bytes) will be dropped or<br />

ignored. Similarly, the last 3 bytes of the last transfer will also be ignored. The DMA<br />

always ensures it transfers a full 32-bit data items to the Transmit FIFO, unless it is the<br />

end of frame.<br />

● Example of buffer write:<br />

If the Receive buffer address is 0x0000 0FF2, <strong>and</strong> 16 bytes of a received frame need to<br />

be transferred, then the DMA will write five full 32-bit data items from address<br />

0x0000 0FF0. But the first 2 bytes of the first transfer <strong>and</strong> the last 2 bytes of the third<br />

transfer will have dummy data.<br />

27.6.4 Buffer size calculations<br />

The DMA does not update the size fields in the transmit <strong>and</strong> receive descriptors. The DMA<br />

updates only the status fields (xDES0) of the descriptors. The driver has to calculate the<br />

sizes. The transmit DMA transfers the exact number of bytes (indicated by buffer size field in<br />

TDES1) towards the MAC core. If a descriptor is marked as first (FS bit in TDES0 is set),<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 <strong>and</strong> 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 />

880/995 Doc ID 13902 Rev 9

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

Saved successfully!

Ooh no, something went wrong!