SDMA read/write pointer for SAI interface

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SDMA read/write pointer for SAI interface

376 Views
rwilkins
Contributor I
We are running Linux 4.9 under Xenomai 3.0.10 on an i.MX7D rev.5 v71 processor.
The SDMA engine is used to transfer data from main memory to and from the SAI interface.
The main memory buffer is around 40 kByte in size and the DMA uses it as a ring buffer for the data transfer.
In order to know where the DMA is currently reading or writing data inside this buffer, an interrupt is generated whenever 576 bytes of data have been transferred. The interrupt routine then updates a suitable buffer pointer which is used by our software.
The interrupt occurs on average every 250 µsec and is handled by a regular non-realtime Linux interrupt routine.
 
This works but there is a problem: The DMA interrupt and consequently the buffer pointer update is sometimes delayed for quite some time.  Occasionally, there is no interrupt for more than 2 msec, followed by nine interrupts in quick succession to make up for the delay.
 
We have no evidence that interrupts are ever lost. However, the delayed update of the buffer pointer causes problems in our software.
 
One idea we had was to read the current DMA read/write address directly from the SDMA hardware, rather than relying on the interrupt. We were unsuccessfully looking at the file imx-sdma.c in order to find this information.
 
In summary, we need to know the DMA's read/write address when the interrupt is triggered, with no or very little delay.
 
Any pointers would be greatly appreciated.  Thank you!
0 Kudos
1 Reply

350 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi 

Please see comments of struct sdma_context_data in imx-sdma.c

 

0 Kudos