In a multitasking environment we want to use the SCI at 921kbps.
To avoid overloading the processor, we want to use DMA.
On the transmit side, it seems easy.
Store packets in a packet buffer, and send each packet using DMA.
When the packet transmission is complete, take an interrupt, and send the next packet.
On reception, it is more difficult.
What you would like to do is to implement a ring buffer, letting the DMA fill the ring buffer.
At the end of the ring buffer, the DMA should reset to the start of the ring buffer.
Some solution is needed to guarantee, the ring buffer does not overflow.
Alternatively, the DMA should stop at the end of the buffer, and generate an interrupt.
In the interrupt, the DMA is reconfigured to start at the beginning of the buffer.
(The SCI then probably need to have a FIFO allowing the interrupt to be processed
without losing characters)
A "getc" routine would check the current status of the DMA to determine if any characters
have been received, and if so, return the character or else, a negative status.
Since there appears to be no way to determine the status of the DMA, since
the Working Area is only updated when channels are changed, and appears not to
be updated with the last transfer, this seems not to be possible.
So how do you reliably use the DMA with SCI on receiving varying sized packages?
Is it possible to set frame size to '1', and block size to the size of the ring buffer?
Would the Working Area be updated every time a frame (one character) is received?