1.
Enable the Suspend interrupt for the DMA channel.
2.
Enable the DMA channel.
3.
Reserve memory space in SRAM to configure a new descriptor.
4.
Configure the new descriptor:
–
Set the next descriptor address (
–
Set the destination address (
)
–
)
–
Configure the block transfer control (
•
Optionally enable the Suspend block action
•
Set the descriptor VALID bit
5.
Clear the VALID bit for the existing list and for the descriptor which has to be updated.
6.
Read
from the Write-Back memory.
–
If the DMA has not already fetched the descriptor which requires changes (i.e., DESCADDR
is wrong):
•
location of the descriptor from the List
•
Optionally clear the Suspend block action
•
Set the descriptor VALID bit to '1'
•
Optionally enable the Resume software command
–
If the DMA is executing the same descriptor as the one which requires changes:
•
Set the Channel Suspend software command and wait for the Suspend interrupt
•
Update the next descriptor address (
) in the write-back memory
•
Clear the interrupt sources and set the Resume software command
•
location of the descriptor from the List
•
Optionally clear the Suspend block action
•
Set the descriptor VALID bit to '1'
7.
Go to step 4 if needed.
Adding a Descriptor Between Existing Descriptors
To insert a new descriptor 'C' between two existing descriptors ('A' and 'B'), the descriptor currently
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 to execute descriptor A, follow the steps:
2.1.
Set the descriptor A VALID bit to '0'.
2.2.
Set the
value of descriptor A to point to descriptor C instead of descriptor B.
2.3.
Set the
value of descriptor C to point to descriptor B.
2.4.
Set the descriptor A VALID bit to '1'.
3.
If DMA is executing descriptor A:
3.1.
Apply the software suspend command to the channel and
3.2.
Perform steps 2.1 through 2.4.
3.3.
Apply the software resume command to the channel.
26.6.3.2. Channel Suspend
The channel operation can be suspended at any time by software by writing a '1' to the Suspend
command in the Command bit field of Channel Control B register (CHCTRLB.CMD). After the ongoing
burst transfer is completed, the channel operation is suspended and the suspend command is
automatically cleared.
Atmel SAM L22G / L22J / L22N [DATASHEET]
Atmel-42402E-SAM L22G / L22J / L22N_Datasheet_Complete-07/2016
446