19.4.3.1.2 Adding a Descriptor to a List
To add descriptors to a linked list, perform the following actions:
- Enable the Suspend Interrupt for the DMA channel.
- Enable the DMA channel.
- Reserve memory space in SRAM to configure a new descriptor.
- Configure the new descriptor:
- Set the Next Descriptor Address (DESCADDR) register
- Set the Block Transfer Destination Address (DSTADDR) register
- Set the Block Transfer Source Address (SRCADDR) register
- Configure the Block Transfer Control (BTCTRL) register and set the Descriptor Valid (VALID) bit
- Clear the VALID bit for the existing list and for the descriptor that needs to be updated.
- Read DESCADDR from the Write-Back memory.
- If the DMA has not already fetched the descriptor that requires changes (i.e., DESCADDR is incorrect):
- Update the DESCADDR location of the descriptor in the list
- Clear the Channel Suspend flag (CHINTFLAG.SUSP) if the Suspend Block Action was enabled (BTCTRL.BLOCKACT =
0x2) - Set the Descriptor Valid bit
- Issue a Resume software command (CHCTRLB.CMD =
0x02) if the channel was suspended
- If the DMA is executing the same descriptor as the one which requires changes:
- Issue the SUSPEND software command (CHCTRLB.CMD =
0x1) and wait for the Channel Suspend (CHINTFLAG.SUSP) interrupt flag to be set - Update the next descriptor address DESCRADDR in the Write-Back memory
- Clear CHINTFLAG.SUSP and issue the Resume software command (CHCTRLB.CMD =
0x02) - Update the DESCADDR location of the descriptor in the list
- Optionally clear the Suspend Block Action
- Set the Descriptor Valid (VALID) bit
- Issue the SUSPEND software command (CHCTRLB.CMD =
- If the DMA has not already fetched the descriptor that requires changes (i.e., DESCADDR is incorrect):
- Repeat from step three if more descriptors are needed.
