2.3.3 Configure DMAC
To use DMAC for transferring data it is necessary to configure a DMA resource and
transfer descriptor. The resource contains the peripheral trigger, the trigger action
and more channel configurations. The descriptor contains information regarding the
specific data transfer, such as source and destination address, data size, next
descriptor address, transfer counter and more. In the example, two different channels
are used to write to the TC registers. For this purpose, two resources and two
descriptors are needed. The resources are configured with the
configure_dma_resource()
function while the descriptors are
configured using the configure_dma_channel_x()
functions. Both DMA
channels are configured to run in standby with alternative TC overflow as trigger. The
next descriptor address field is used to loop the descriptors back to start, to enable
the message to be sent repeatedly. The first channel is used for updating the
alternative TC period. The source address is set to the array containing the different
periods and the destination is the period register. The second channel is used for
updating the alternative TC compare value register. The source address is set to the
array containing the different compare values and the destination is the compare value
register.