Direct Memory Access (DMA) Configuration for Series 2#
Direct Memory Access (DMA) support is available in most peripheral drivers for Series 2 devices and can be enabled as needed.
The DMA API of Zephyr is documented upstream. This document describes how to configure and use DMA on Series 2 devices.
DMA Transfer Configuration#
DMA configuration is performed using struct dma_config, which contains a linked list of
struct dma_block_config structures that represent individual transfers.
On Series 2 devices, the DMA driver for the Linked Direct Memory Access (LDMA) peripheral creates a list of LDMA hardware
descriptors (LDMA_Descriptor_t) from the list of struct dma_block_config items passed to the driver.
Each struct dma_block_config item requires at least one LDMA descriptor. If the block transfer count
exceeds the maximum transfer size of a single descriptor (4096), multiple linked LDMA descriptors
are created to represent the block.
The Kconfig option CONFIG_DMA_MAX_DESCRIPTOR
configures the size of the memory pool used for LDMA descriptors, and is shared by all DMA users
in the system.
Serial (USART)#
The Serial driver for the USART peripheral, using the
silabs,usart-uart binding,
uses DMA to implement the asynchronous UART API (enabled using
CONFIG_UART_ASYNC_API).
Prerequisites#
Enable the LDMA Devicetree node.
&dma0 { status = "okay"; };For UART instances that should use DMA, configure two
dmasproperties namedtxandrxto connect to the appropriate LDMA peripheral request signals.&usart0 { dmas = <&dma0 DMA_REQSEL_USART0TXBL>, <&dma0 DMA_REQSEL_USART0RXDATAV>; dma-names = "tx", "rx"; };For UART instances that should not use DMA, do not include DMA configurations in their Devicetree node.
Set
CONFIG_UART_ASYNC_APItoy.
SPI (EUSART)#
The SPI driver for the EUSART peripheral, using the
silabs,eusart-spi binding,
can optionally use DMA for both blocking and asynchronous operations.
Configuration#
The Kconfig option CONFIG_SPI_SILABS_EUSART_DMA_MAX_BLOCKS
configures the maximum number of struct dma_block_config used to represent the
transfers in a struct spi_buf_set.
Prerequisites#
Enable the LDMA node in Devicetree:
&dma0 { status = "okay"; };. For EUSART instances that should use DMA, configure two
dmasproperties namedtxandrxto connect to the appropriate LDMA peripheral request signals.&eusart1 { dmas = <&dma0 DMA_REQSEL_EUSART1TXFL>, <&dma0 DMA_REQSEL_EUSART1RXFL>; dma-names = "tx", "rx"; };For EUSART instances that should not use DMA, do not include DMA configurations in their Devicetree node.
Set
CONFIG_SPI_SILABS_EUSART_DMAtoy.This is selected automatically if
CONFIG_SPI_ASYNCisy.Set manually if using blocking operations, and DMA support is desired.
I2C#
The driver for the I2C peripheral, using the
silabs,i2c binding,
can optionally use DMA for both blocking and asynchronous operations.
Prerequisites#
Enable the LDMA Devicetree node.
&dma0 { status = "okay"; };For I2C instances that should use DMA, configure two
dmasproperties namedtxandrxto connect to the appropriate LDMA peripheral request signals.&i2c0 { dmas = <&dma0 DMA_REQSEL_I2C0TXBL>, <&dma0 DMA_REQSEL_I2C0RXDATAV>; dma-names = "tx", "rx"; };For I2C instances that should not use DMA, do not include DMA configurations in their Devicetree node.
Set
CONFIG_DMAtoy.
Flash#
The on-chip flash driver, defined by the
silabs,series2-flash-controller binding, supports optional DMA for write and read operations.
Prerequisites#
Enable the LDMA Devicetree node.
&dma0 { status = "okay"; };The MSC must configure a
dmasproperty that connects to the appropriate LDMA peripheral request signal.&msc { dmas = <&dma0 DMA_REQSEL_MSCWDATA>; };Set
CONFIG_DMAtoy.To enable DMA for write operations, set
CONFIG_SOC_FLASH_SILABS_S2_DMA_WRITEtoy. This option is selected automatically if the Devicetree node has admasproperty.To use DMA for read operations, set
CONFIG_SOC_FLASH_SILABS_S2_DMA_READtoy. This option must be selected manually.