19.4.3.1.3 Adding a Descriptor Between Existing Descriptors

To insert a new descriptor ‘C’ between two existing descriptors (‘A’ and ‘B’), the descriptor currently being executed by the DMA must be identified.

  1. If DMA is executing descriptor B, descriptor C cannot be inserted.
  2. If DMA has not started executing descriptor A, follow the steps:
    1. Clear the Descriptor Valid (BTCTRL.VALID) bit of Descriptor A.
    2. Configure the Next Descriptor Address (DESCADDR) register of descriptor A to point to descriptor C instead of descriptor B.
    3. Configure the Next Descriptor Address (DESCADDR) register of descriptor C to point to descriptor B.
    4. Set the Descriptor Valid (BTCTRL.VALID) bit of descriptor A.
  3. If DMA is executing descriptor A:
    1. Issue a Suspend software command (CHCTRLB.CMD = 0x01) to the channel.
    2. Perform steps 2.a through 2.d.
    3. Issue a Resume software command (CHCTRLB.CMD = 0x02) to the channel.