dmaengine_prep_dma_cyclic

The interface has the following parameters.
  • Synopsis:
    static inline struct dma_async_tx_descriptor *
            dmaengine_prep_dma_cyclic(struct dma_chan *chan, 
                            dma_addr_t buf_addr,
                            size_t buf_len,
                            size_t period_len,
                            enum dma_transfer_direction dir,
                            unsigned long flags)
    
  • Description: The interface is used to prepare a transmission of the ring buffer. The interface is usually used in audio scenarios. In a DMA transmission with a certain length, every time when a certain amount of bytes (defined in period_len) has been transmitted, the system will request the callback function of transmission completion.
  • Parameter:
    • chan: The relevant DMA channel.
    • buf_addr: Destination address.
    • buf_len: The length of the transmission.
    • period_len: When a certain number of data bytes are transferred, the callback function that completes the transfer will be executed.
      Note: buf_len must be integral multiple of period_len.
    • dir: Transmission direction. For example:
      • DMA_MEM_TO_DEV: From memory to device.
      • DMA_DEV_TO_MEM: From device to memory.
    • flags: The macro definitions started with "DMA_PREP_", which provides additional information for the DMA Controller (DMAC) driver. For example:
      • DMA_PREP_INTERRUPT: The flag is used to inform DMAC that an interrupt will be generated after the transmission, so that DMAC will use the callback function from the client.
      • DMA_PREP_FENCE: The flag is used to inform DMAC that all the later transmissions rely on the success of the current transmission, so that DMAC will prioritize the DMA transmissions accordingly.
  • Return:
    • Success: A pointer to the transmission descriptor.
    • Failure: NULL.