The API provides a set of functions for carrying out the following operations:
The individual control and status functions in the API are as follows:
int get_dma_residue(unsigned int chan);
Use this function to return the number of bytes to be processed for the transfer taken place on the channel chan. In the case of a linked list transfer, the number returned is the total for all the remaining transfers in the list. If the channel is currently inactive, or if the transfer has already completed, then the function returns zero.
int dma_get_status(unsigned int chan);
Use this function to get the status of the channel chan. The function returns one of the following values:
/* STLinux-2.2 only */ int dma_pause_channel(int flags, unsigned int chan); /*STLinux-2.3 only */ int dma_pause_channel(unsigned int chan);
Use this function to pause the channel chan. (For STLinux-2.2 only, the function accepts a flags parameter, which is either STM_DMA_CHANNEL_PAUSE_FLUSH or STM_DMA_CHANNEL_PAUSE_NOFLUSH. For STLinux-2.3, this function always flushes the buffer, so the flags parameter does not exist.)
void dma_unpause_channel(unsigned int chan);
Use this function to resume processing for the channel chan that was previously paused using dma_pause_channel(). If the channel is not in a paused state, then this function has no effect.
void dma_wait_for_completion(unsigned int chan);
Use this function to put the calling process to sleep while channel chan is processing data. The wake up signal is raised after the DMA engine completion interrupt, but before the execution of any callback functions that have been associated with the channel.
Note: It is not safe to call this function from an interrupt context.