XilinxProcessorIPLib/drivers/dpdma/src/xdpdma.c
void XDpDma_SetupChannel(XDpDma *InstancePtr, XDpDma_ChannelType Channel)
{
	XDpDma_Channel *Chan;
	XDpDma_AudioChannel *AudChan;
	XDpDma_FrameBuffer *FB;
	XDpDma_AudioBuffer *AudioBuffer;
	u8 Index, NumPlanes;
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(Channel <= AudioChan1);

	switch(Channel) {
		case VideoChan:
			Xil_AssertVoid(InstancePtr->Video.VideoInfo != NULL);
			Xil_AssertVoid(InstancePtr->Video.FrameBuffer != NULL);
			NumPlanes = (u8)InstancePtr->Video.VideoInfo->Mode;
			for(Index = 0; Index <= NumPlanes; Index++) {
				Chan = &InstancePtr->Video.Channel[Index];
				FB = InstancePtr->Video.FrameBuffer[Index];
				XDpDma_UpdateVideoDescriptor(Chan);
				XDpDma_InitVideoDescriptor(Chan->Current, FB);
				XDpDma_SetDescriptorAddress(InstancePtr,
							    Index);
			}
			break;

		case GraphicsChan:
			Xil_AssertVoid(InstancePtr->Gfx.VideoInfo != NULL);
			Xil_AssertVoid(InstancePtr->Gfx.FrameBuffer != NULL);
			Chan = &InstancePtr->Gfx.Channel;
			FB = InstancePtr->Gfx.FrameBuffer;
			XDpDma_UpdateVideoDescriptor(Chan);
			XDpDma_InitVideoDescriptor(Chan->Current, FB);
			XDpDma_SetDescriptorAddress(InstancePtr,
						    XDPDMA_GRAPHICS_CHANNEL);
			break;

		case AudioChan0:
			Xil_AssertVoid(InstancePtr->Audio[0].Buffer != NULL);
			AudChan = &InstancePtr->Audio[0];
			AudioBuffer = InstancePtr->Audio[0].Buffer;
			XDpDma_InitAudioDescriptor(AudChan, AudioBuffer);
			XDpDma_SetDescriptorAddress(InstancePtr,
						    XDPDMA_AUDIO_CHANNEL0);
			break;
		case AudioChan1:
			Xil_AssertVoid(InstancePtr->Audio[1].Buffer != NULL);
			AudChan = &InstancePtr->Audio[1];
			AudioBuffer = InstancePtr->Audio[1].Buffer;
			XDpDma_InitAudioDescriptor(AudChan, AudioBuffer);
			XDpDma_SetDescriptorAddress(InstancePtr,
						    XDPDMA_AUDIO_CHANNEL1);
			break;
		default:
			/* This will never occur */
			break;
	}
}
/*************************************************************************/
/**
 *
 * This function sets the channel with the latest framebuffer and the
 * available descriptor for transfer on the next Vsync.
 *
 * @param    InstancePtr is pointer to the instance of DPDMA.
 * @param    Channel indicates which channels are being setup for transfer.
 *
 * @return   None.
 *
 * @note     None.
 *
 **************************************************************************/
This function sets the channel with the latest framebuffer and the
available descriptor for transfer on the next Vsync.

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

@return   None.

@note     None.
This function sets the channel with the latest framebuffer and the available descriptor for transfer on the next Vsync . @param InstancePtr is pointer to the instance of DPDMA . @param Channel indicates which channels are being setup for transfer . @return None . @note None .
void XDpDma_SetupChannel(XDpDma *InstancePtr, XDpDma_ChannelType Channel)
{
	XDpDma_Channel *Chan;
	XDpDma_AudioChannel *AudChan;
	XDpDma_FrameBuffer *FB;
	XDpDma_AudioBuffer *AudioBuffer;
	u8 Index, NumPlanes;
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(Channel <= AudioChan1);
	switch(Channel) {
		case VideoChan:
			Xil_AssertVoid(InstancePtr->Video.VideoInfo != NULL);
			Xil_AssertVoid(InstancePtr->Video.FrameBuffer != NULL);
			NumPlanes = (u8)InstancePtr->Video.VideoInfo->Mode;
			for(Index = 0; Index <= NumPlanes; Index++) {
				Chan = &InstancePtr->Video.Channel[Index];
				FB = InstancePtr->Video.FrameBuffer[Index];
				XDpDma_UpdateVideoDescriptor(Chan);
				XDpDma_InitVideoDescriptor(Chan->Current, FB);
				XDpDma_SetDescriptorAddress(InstancePtr,
							    Index);
			}
			break;
		case GraphicsChan:
			Xil_AssertVoid(InstancePtr->Gfx.VideoInfo != NULL);
			Xil_AssertVoid(InstancePtr->Gfx.FrameBuffer != NULL);
			Chan = &InstancePtr->Gfx.Channel;
			FB = InstancePtr->Gfx.FrameBuffer;
			XDpDma_UpdateVideoDescriptor(Chan);
			XDpDma_InitVideoDescriptor(Chan->Current, FB);
			XDpDma_SetDescriptorAddress(InstancePtr,
						    XDPDMA_GRAPHICS_CHANNEL);
			break;
		case AudioChan0:
			Xil_AssertVoid(InstancePtr->Audio[0].Buffer != NULL);
			AudChan = &InstancePtr->Audio[0];
			AudioBuffer = InstancePtr->Audio[0].Buffer;
			XDpDma_InitAudioDescriptor(AudChan, AudioBuffer);
			XDpDma_SetDescriptorAddress(InstancePtr,
						    XDPDMA_AUDIO_CHANNEL0);
			break;
		case AudioChan1:
			Xil_AssertVoid(InstancePtr->Audio[1].Buffer != NULL);
			AudChan = &InstancePtr->Audio[1];
			AudioBuffer = InstancePtr->Audio[1].Buffer;
			XDpDma_InitAudioDescriptor(AudChan, AudioBuffer);
			XDpDma_SetDescriptorAddress(InstancePtr,
						    XDPDMA_AUDIO_CHANNEL1);
			break;
		default:
			break;
	}
}
void XDpDma_SetupChannel ( XDpDma * InstancePtr , XDpDma_ChannelType Channel ) { XDpDma_Channel * Chan ; XDpDma_AudioChannel * AudChan ; XDpDma_FrameBuffer * FB ; XDpDma_AudioBuffer * AudioBuffer ; u8 Index , NumPlanes ; Xil_AssertVoid ( InstancePtr != NULL ) ; Xil_AssertVoid ( Channel <= AudioChan1 ) ; switch ( Channel ) { case VideoChan : Xil_AssertVoid ( InstancePtr -> Video . VideoInfo != NULL ) ; Xil_AssertVoid ( InstancePtr -> Video . FrameBuffer != NULL ) ; NumPlanes = ( u8 ) InstancePtr -> Video . VideoInfo -> Mode ; for ( Index = 0 ; Index <= NumPlanes ; Index ++ ) { Chan = & InstancePtr -> Video . Channel [ Index ] ; FB = InstancePtr -> Video . FrameBuffer [ Index ] ; XDpDma_UpdateVideoDescriptor ( Chan ) ; XDpDma_InitVideoDescriptor ( Chan -> Current , FB ) ; XDpDma_SetDescriptorAddress ( InstancePtr , Index ) ; } break ; case GraphicsChan : Xil_AssertVoid ( InstancePtr -> Gfx . VideoInfo != NULL ) ; Xil_AssertVoid ( InstancePtr -> Gfx . FrameBuffer != NULL ) ; Chan = & InstancePtr -> Gfx . Channel ; FB = InstancePtr -> Gfx . FrameBuffer ; XDpDma_UpdateVideoDescriptor ( Chan ) ; XDpDma_InitVideoDescriptor ( Chan -> Current , FB ) ; XDpDma_SetDescriptorAddress ( InstancePtr , XDPDMA_GRAPHICS_CHANNEL ) ; break ; case AudioChan0 : Xil_AssertVoid ( InstancePtr -> Audio [ 0 ] . Buffer != NULL ) ; AudChan = & InstancePtr -> Audio [ 0 ] ; AudioBuffer = InstancePtr -> Audio [ 0 ] . Buffer ; XDpDma_InitAudioDescriptor ( AudChan , AudioBuffer ) ; XDpDma_SetDescriptorAddress ( InstancePtr , XDPDMA_AUDIO_CHANNEL0 ) ; break ; case AudioChan1 : Xil_AssertVoid ( InstancePtr -> Audio [ 1 ] . Buffer != NULL ) ; AudChan = & InstancePtr -> Audio [ 1 ] ; AudioBuffer = InstancePtr -> Audio [ 1 ] . Buffer ; XDpDma_InitAudioDescriptor ( AudChan , AudioBuffer ) ; XDpDma_SetDescriptorAddress ( InstancePtr , XDPDMA_AUDIO_CHANNEL1 ) ; break ; default : break ; } }
This function sets the channel with the latest framebuffer and the
 available descriptor for transfer on the next Vsync.
This function sets the channel with the latest framebuffer and the available descriptor for transfer on the next Vsync .
/* This will never occur */