| dpdma Vitis Drivers API Documentation

- Overview
- APIs
- File List

Functions
xdpdma.c File Reference

## Overview

This file contains the implementation of the interface functions of the XDpDma driver.

Refer to xdpdma.h for detailed information.

Note
  None.

    MODIFICATION HISTORY:

    Ver     Who   Date     Changes

    1.0  aad   04/12/16 Initial release.
    1.1  aad   04/26/18 Fixed Warnings
    1.6  arm   11/27/23 Fixed Coverity Warnings

## Functions
void | XDpDma_CfgInitialize (XDpDma *InstancePtr, XDpDma_Config *CfgPtr)
| This functions retrieves the configuration for this DPDMA driver and fills in the InstancePtr->Config structure. More...
int | XDpDma_SetChannelState (XDpDma *InstancePtr, XDpDma_ChannelType Channel, XDpDma_ChannelState ChannelState)
| This functions controls the states in which a channel should go into. More...
int | XDpDma_SetVideoFormat (XDpDma *InstancePtr, XAVBuf_VideoFormat Format)
| This function allocates DPDMA Video Channels depending on the number of planes in the video. More...
int | XDpDma_SetGraphicsFormat (XDpDma *InstancePtr, XAVBuf_VideoFormat Format)
| This function allocates DPDMA Graphics Channels. More...
void | XDpDma_SetQOS (XDpDma *InstancePtr, u8 QOS)
| This function starts the operation on the a given channel. More...
int | XDpDma_Trigger (XDpDma *InstancePtr, XDpDma_ChannelType Channel)
| This function Triggers DPDMA to start the transaction. More...
int | XDpDma_ReTrigger (XDpDma *InstancePtr, XDpDma_ChannelType Channel)
| This function Retriggers DPDMA to fetch data from new descriptor. More...
void | XDpDma_InitVideoDescriptor (XDpDma_Descriptor *CurrDesc, XDpDma_FrameBuffer *FrameBuffer)
| This function initializes Video Descriptor for Video and Graphics channel. More...
void | XDpDma_InitAudioDescriptor (XDpDma_AudioChannel *Channel, XDpDma_AudioBuffer *AudioBuffer)
| This function initializes Descriptors for transactions on Audio Channel. More...
void | XDpDma_DisplayVideoFrameBuffer (XDpDma *InstancePtr, XDpDma_FrameBuffer *Plane0, XDpDma_FrameBuffer *Plane1, XDpDma_FrameBuffer *Plane2)
| This function sets the next Frame Buffers to be displayed on the Video Channel. More...
void | XDpDma_DisplayGfxFrameBuffer (XDpDma *InstancePtr, XDpDma_FrameBuffer *Plane)
| This function sets the next Frame Buffers to be displayed on the Graphics Channel. More...
int | XDpDma_PlayAudio (XDpDma *InstancePtr, XDpDma_AudioBuffer *Buffer, u8 ChannelNum)
| This function sets the next Audio Buffer to be played on Audio Channel 0. More...
void | XDpDma_SetupChannel (XDpDma *InstancePtr, XDpDma_ChannelType Channel)
| This function sets the channel with the latest framebuffer and the available descriptor for transfer on the next Vsync. More...

## Function Documentation

void XDpDma_CfgInitialize | ( | XDpDma * | InstancePtr,
|  | XDpDma_Config * | CfgPtr
| ) |  |

This functions retrieves the configuration for this DPDMA driver and fills in the InstancePtr->Config structure.

Parameters

  InstancePtr | is a pointer to the driver instance.
  CfgPtr | is a pointer to the configuration structure that will be used to copy the settings from.

Returns
  None.

Note
  None.

Referenced by InitDpDmaSubsystem().

void XDpDma_DisplayGfxFrameBuffer | ( | XDpDma * | InstancePtr,
|  | XDpDma_FrameBuffer * | Plane
| ) |  |

This function sets the next Frame Buffers to be displayed on the Graphics Channel.

Parameters

  InstancePtr | is pointer to the instance of DPDMA.
  Plane | is a pointer to the Frame Buffer structure.

Returns
  None.

Note
  None.

Referenced by DpPsu_Run().

void XDpDma_DisplayVideoFrameBuffer | ( | XDpDma * | InstancePtr,
|  | XDpDma_FrameBuffer * | Plane0,
|  | XDpDma_FrameBuffer * | Plane1,
|  | XDpDma_FrameBuffer * | Plane2
| ) |  |

This function sets the next Frame Buffers to be displayed on the Video Channel.

Parameters

  InstancePtr | is pointer to the instance of DPDMA.
  Plane0 | is a pointer to the Frame Buffer structure.
  Plane1 | is a pointer to the Frame Buffer structure.
  Plane2 | is a pointer to the Frame Buffer structure.

Returns
  None.

Note
  For interleaved mode use Plane0. For semi-planar mode use Plane0 and Plane1. For planar mode use Plane0, Plane1 and Plane2

void XDpDma_InitAudioDescriptor | ( | XDpDma_AudioChannel * | Channel,
|  | XDpDma_AudioBuffer * | AudioBuffer
| ) |  |

This function initializes Descriptors for transactions on Audio Channel.

Parameters

  Channel | is a pointer to the XDpDma_AudioChannel instance
  AudioBuffer | is a pointer to the Audio Buffer structure

Returns
  None.

Note
  None.

Referenced by XDpDma_PlayAudio(), and XDpDma_SetupChannel().

void XDpDma_InitVideoDescriptor | ( | XDpDma_Descriptor * | CurrDesc,
|  | XDpDma_FrameBuffer * | FrameBuffer
| ) |  |

This function initializes Video Descriptor for Video and Graphics channel.

Parameters

  CurrDesc | is a pointer to the current Descriptor of Video or Graphics Channel.
  FrameBuffer | is a pointer to the Frame Buffer structure

Returns
  None.

Note
  None.

Referenced by XDpDma_SetupChannel().

int XDpDma_PlayAudio | ( | XDpDma * | InstancePtr,
|  | XDpDma_AudioBuffer * | Buffer,
|  | u8 | ChannelNum
| ) |  |

This function sets the next Audio Buffer to be played on Audio Channel 0.

Parameters

  InstancePtr | is pointer to the instance of DPDMA.
  Buffer | is a pointer to the attributes of the Audio information to be played.
  ChannelNum | selects between Audio Channel 0 and Audio Channel 1

Returns
  XST_SUCCESS when the play audio request is successful. XST_FAILURE when the play audio request fails, user has to retry to play the audio.

Note
  The user has to schedule new audio buffer before half the audio information is consumed by DPDMA to have a seamless playback.

References XDpDma_InitAudioDescriptor().

int XDpDma_ReTrigger | ( | XDpDma * | InstancePtr,
|  | XDpDma_ChannelType | Channel
| ) |  |

This function Retriggers DPDMA to fetch data from new descriptor.

Parameters

  InstancePtr | is a pointer to the XDpDma instance.
  Channel | is the XDpDma_ChannelType on which the transaction is to be retriggered.

Returns
  XST_SUCCESS The channel has successfully been Triggered. XST_FAILURE When the triggering Video and Graphics channel without setting the Video Formats.

Note
  None.

References XDPDMA_GBL, and XDpDma_WriteReg.

Referenced by XDpDma_VSyncHandler().

int XDpDma_SetChannelState | ( | XDpDma * | InstancePtr,
|  | XDpDma_ChannelType | Channel,
|  | XDpDma_ChannelState | ChannelState
| ) |  |

This functions controls the states in which a channel should go into.

Parameters

  InstancePtr | is a pointer to the driver instance.
  Channel | is an enum of XDpDma_ChannelType.
  ChannelState | is an enum of type XDpDma_ChannelState.

Returns
  XST_SUCCESS when the mentioned channel is enabled successfully. XST_FAILURE when the mentioned channel fails to be enabled.

Note
  None.

Referenced by DpPsu_Run(), XDpDma_InterruptHandler(), and XDpDma_VSyncHandler().

int XDpDma_SetGraphicsFormat | ( | XDpDma * | InstancePtr,
|  | XAVBuf_VideoFormat | Format
| ) |  |

This function allocates DPDMA Graphics Channels.

Parameters

  InstancePtr | is a pointer to the driver instance.
  Format | is the video format to be used for the DPDMA transfer

Returns
  XST_SUCCESS, When the format is a valid Graphics Format. XST_FAILURE, When the format is not valid Graphics Format.

Note
  None.

Referenced by InitDpDmaSubsystem().

void XDpDma_SetQOS | ( | XDpDma * | InstancePtr,
|  | u8 | QOS
| ) |  |

This function starts the operation on the a given channel.

Parameters

  InstancePtr | is a pointer to the driver instance.
  QOS | is the Quality of Service value to be selected.

Returns
  None.

Note
  .

References XDPDMA_CH0_CNTL, and XDpDma_ReadModifyWrite.

Referenced by InitDpDmaSubsystem().

void XDpDma_SetupChannel | ( | XDpDma * | InstancePtr,
|  | XDpDma_ChannelType | Channel
| ) |  |

This function sets the channel with the latest framebuffer and the available descriptor for transfer on the next Vsync.

Parameters

  InstancePtr | is pointer to the instance of DPDMA.
  Channel | indicates which channels are being setup for transfer.

Returns
  None.

Note
  None.

References XDpDma_InitAudioDescriptor(), and XDpDma_InitVideoDescriptor().

Referenced by XDpDma_VSyncHandler().

int XDpDma_SetVideoFormat | ( | XDpDma * | InstancePtr,
|  | XAVBuf_VideoFormat | Format
| ) |  |

This function allocates DPDMA Video Channels depending on the number of planes in the video.

Parameters

  InstancePtr | is a pointer to the driver instance.
  Format | is the video format to be used for the DPDMA transfer

Returns
  XST_SUCCESS, When the format is valid Video Format. XST_FAILURE, When the format is not valid Video Format

Note
  None.

int XDpDma_Trigger | ( | XDpDma * | InstancePtr,
|  | XDpDma_ChannelType | Channel
| ) |  |

This function Triggers DPDMA to start the transaction.

Parameters

  InstancePtr | is a pointer to the XDpDma instance.
  Channel | is the XDpDma_ChannelType on which the transaction is to be triggered.

Returns
  XST_SUCCESS The channel has successfully been Triggered. XST_FAILURE When the triggering Video and Graphics channel without setting the Video Formats.

Note
  None.

References XDPDMA_GBL, and XDpDma_WriteReg.

Referenced by XDpDma_VSyncHandler().