XilinxProcessorIPLib/drivers/v_sditx/src/xv_sditx.c
u32 XV_SdiTx_SetStream(XV_SdiTx *InstancePtr, XV_SdiTx_StreamSelId SelId,
			u32 Data, u8 StreamId)
{
	const XVidC_VideoTiming *TimingPtr;

	/* Verify arguments. */
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(StreamId < 8);

	switch (SelId) {
	case XV_SDITX_STREAMSELID_VMID:
		if((Data == XVIDC_VM_1920x1080_96_I) ||
		   (Data == XVIDC_VM_1920x1080_100_I) ||
		   (Data == XVIDC_VM_1920x1080_120_I) ) {
			u32 index;

			index = Data - XVIDC_VM_1920x1080_96_I;
			TimingPtr = &(XVidC_SdiVidTimingModes[index].Timing);
		} else if ((Data == XVIDC_VM_2048x1080_96_I) ||
			   (Data == XVIDC_VM_2048x1080_100_I) ||
			   (Data == XVIDC_VM_2048x1080_120_I)) {
			u32 index;

			index = Data - XVIDC_VM_2048x1080_96_I +
				XSDITX_VIDMODE_SHIFT;
			TimingPtr = &(XVidC_SdiVidTimingModes[index].Timing);
		} else {
			/* Get the timing from the video timing table. */
			TimingPtr = XVidC_GetTimingInfo((u32)Data);
		}

		if (!TimingPtr) {
			return XST_FAILURE;
		}

		InstancePtr->Stream[StreamId].Video.VmId = (u32)Data;
		InstancePtr->Stream[StreamId].Video.Timing = *TimingPtr;
		InstancePtr->Stream[StreamId].Video.FrameRate
				= XVidC_GetFrameRate((u32)Data);
		InstancePtr->Stream[StreamId].Video.IsInterlaced
				= XVidC_IsInterlaced((u32)Data);
		break;

	case XV_SDITX_STREAMSELID_COLORFORMAT:
		Xil_AssertNonvoid( ((u32)Data == XVIDC_CSF_YCBCR_422) || ((u32)Data == XVIDC_CSF_YCBCR_420)
					|| ((u32)Data == XVIDC_CSF_YCBCR_444) || ((u32)Data == XVIDC_CSF_RGB));

		InstancePtr->Stream[StreamId].Video.ColorFormatId = (u32)Data;
		break;

	case XV_SDITX_STREAMSELID_BPC:
		Xil_AssertNonvoid((u32)Data == XVIDC_BPC_10);

		InstancePtr->Stream[StreamId].Video.ColorDepth = (u32)Data;
		break;

	case XV_SDITX_STREAMSELID_PPC:
		Xil_AssertNonvoid((u32)Data == XVIDC_PPC_2);

		InstancePtr->Stream[StreamId].Video.PixPerClk = (u32)Data;
		break;

	case XV_SDITX_STREAMSELID_ASPECTRATIO:
		InstancePtr->Stream[StreamId].Video.AspectRatio = (u32)Data & 0x1;
		break;

	case XV_SDITX_STREAMSELID_STANDARD:
		InstancePtr->Stream[StreamId].Standard = (u32)Data & 0xFF;
		break;

	case XV_SDITX_STREAMSELID_STREAMINTERLACE:
		InstancePtr->Stream[StreamId].IsStreamInterlaced = (u32)Data & 0x1;
		break;

	case XV_SDITX_STREAMSELID_CHANNEL:
		InstancePtr->Stream[StreamId].CAssignment = (u32)Data & 0x7;
		break;

	default:

		break;

	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sets the SDI TX stream parameters.
*
* @param    InstancePtr is a pointer to the XV_SdiTx core instance.
* @param    SelId specifies which parameter of the stream to be set.
*       - 0 = XV_SDITX_STREAMSELID_VMID
*       - 1 = XV_SDITX_STREAMSELID_COLORFORMAT
*       - 2 = XV_SDITX_STREAMSELID_BPC
*       - 3 = XV_SDITX_STREAMSELID_PPC
*       - 4 = XV_SDITX_STREAMSELID_ASPECTRATIO
*       - 5 = XV_SDITX_STREAMSELID_STANDARD
*       - 6 = XV_SDITX_STREAMSELID_STREAMINTERLACE
*       - 7 = XV_SDITX_STREAMSELID_CHANNEL
* @param    Data specifies what data to be set for the selected parameter.
* @param    StreamId specifies which of the streams to be set.
*
* @return
*	- XST_SUCCESS on successful Set stream
*		- XST_FAILURE if TimingPtr is not derived
*
*
* @note     None.
*
******************************************************************************/
This function sets the SDI TX stream parameters.
This function sets the SDI TX stream parameters .
u32 XV_SdiTx_SetStream(XV_SdiTx *InstancePtr, XV_SdiTx_StreamSelId SelId,
			u32 Data, u8 StreamId)
{
	const XVidC_VideoTiming *TimingPtr;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(StreamId < 8);
	switch (SelId) {
	case XV_SDITX_STREAMSELID_VMID:
		if((Data == XVIDC_VM_1920x1080_96_I) ||
		   (Data == XVIDC_VM_1920x1080_100_I) ||
		   (Data == XVIDC_VM_1920x1080_120_I) ) {
			u32 index;
			index = Data - XVIDC_VM_1920x1080_96_I;
			TimingPtr = &(XVidC_SdiVidTimingModes[index].Timing);
		} else if ((Data == XVIDC_VM_2048x1080_96_I) ||
			   (Data == XVIDC_VM_2048x1080_100_I) ||
			   (Data == XVIDC_VM_2048x1080_120_I)) {
			u32 index;
			index = Data - XVIDC_VM_2048x1080_96_I +
				XSDITX_VIDMODE_SHIFT;
			TimingPtr = &(XVidC_SdiVidTimingModes[index].Timing);
		} else {
			TimingPtr = XVidC_GetTimingInfo((u32)Data);
		}
		if (!TimingPtr) {
			return XST_FAILURE;
		}
		InstancePtr->Stream[StreamId].Video.VmId = (u32)Data;
		InstancePtr->Stream[StreamId].Video.Timing = *TimingPtr;
		InstancePtr->Stream[StreamId].Video.FrameRate
				= XVidC_GetFrameRate((u32)Data);
		InstancePtr->Stream[StreamId].Video.IsInterlaced
				= XVidC_IsInterlaced((u32)Data);
		break;
	case XV_SDITX_STREAMSELID_COLORFORMAT:
		Xil_AssertNonvoid( ((u32)Data == XVIDC_CSF_YCBCR_422) || ((u32)Data == XVIDC_CSF_YCBCR_420)
					|| ((u32)Data == XVIDC_CSF_YCBCR_444) || ((u32)Data == XVIDC_CSF_RGB));
		InstancePtr->Stream[StreamId].Video.ColorFormatId = (u32)Data;
		break;
	case XV_SDITX_STREAMSELID_BPC:
		Xil_AssertNonvoid((u32)Data == XVIDC_BPC_10);
		InstancePtr->Stream[StreamId].Video.ColorDepth = (u32)Data;
		break;
	case XV_SDITX_STREAMSELID_PPC:
		Xil_AssertNonvoid((u32)Data == XVIDC_PPC_2);
		InstancePtr->Stream[StreamId].Video.PixPerClk = (u32)Data;
		break;
	case XV_SDITX_STREAMSELID_ASPECTRATIO:
		InstancePtr->Stream[StreamId].Video.AspectRatio = (u32)Data & 0x1;
		break;
	case XV_SDITX_STREAMSELID_STANDARD:
		InstancePtr->Stream[StreamId].Standard = (u32)Data & 0xFF;
		break;
	case XV_SDITX_STREAMSELID_STREAMINTERLACE:
		InstancePtr->Stream[StreamId].IsStreamInterlaced = (u32)Data & 0x1;
		break;
	case XV_SDITX_STREAMSELID_CHANNEL:
		InstancePtr->Stream[StreamId].CAssignment = (u32)Data & 0x7;
		break;
	default:
		break;
	}
	return XST_SUCCESS;
}
u32 XV_SdiTx_SetStream ( XV_SdiTx * InstancePtr , XV_SdiTx_StreamSelId SelId , u32 Data , u8 StreamId ) { const XVidC_VideoTiming * TimingPtr ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( StreamId < 8 ) ; switch ( SelId ) { case XV_SDITX_STREAMSELID_VMID : if ( ( Data == XVIDC_VM_1920x1080_96_I ) || ( Data == XVIDC_VM_1920x1080_100_I ) || ( Data == XVIDC_VM_1920x1080_120_I ) ) { u32 index ; index = Data - XVIDC_VM_1920x1080_96_I ; TimingPtr = & ( XVidC_SdiVidTimingModes [ index ] . Timing ) ; } else if ( ( Data == XVIDC_VM_2048x1080_96_I ) || ( Data == XVIDC_VM_2048x1080_100_I ) || ( Data == XVIDC_VM_2048x1080_120_I ) ) { u32 index ; index = Data - XVIDC_VM_2048x1080_96_I + XSDITX_VIDMODE_SHIFT ; TimingPtr = & ( XVidC_SdiVidTimingModes [ index ] . Timing ) ; } else { TimingPtr = XVidC_GetTimingInfo ( ( u32 ) Data ) ; } if ( ! TimingPtr ) { return XST_FAILURE ; } InstancePtr -> Stream [ StreamId ] . Video . VmId = ( u32 ) Data ; InstancePtr -> Stream [ StreamId ] . Video . Timing = * TimingPtr ; InstancePtr -> Stream [ StreamId ] . Video . FrameRate = XVidC_GetFrameRate ( ( u32 ) Data ) ; InstancePtr -> Stream [ StreamId ] . Video . IsInterlaced = XVidC_IsInterlaced ( ( u32 ) Data ) ; break ; case XV_SDITX_STREAMSELID_COLORFORMAT : Xil_AssertNonvoid ( ( ( u32 ) Data == XVIDC_CSF_YCBCR_422 ) || ( ( u32 ) Data == XVIDC_CSF_YCBCR_420 ) || ( ( u32 ) Data == XVIDC_CSF_YCBCR_444 ) || ( ( u32 ) Data == XVIDC_CSF_RGB ) ) ; InstancePtr -> Stream [ StreamId ] . Video . ColorFormatId = ( u32 ) Data ; break ; case XV_SDITX_STREAMSELID_BPC : Xil_AssertNonvoid ( ( u32 ) Data == XVIDC_BPC_10 ) ; InstancePtr -> Stream [ StreamId ] . Video . ColorDepth = ( u32 ) Data ; break ; case XV_SDITX_STREAMSELID_PPC : Xil_AssertNonvoid ( ( u32 ) Data == XVIDC_PPC_2 ) ; InstancePtr -> Stream [ StreamId ] . Video . PixPerClk = ( u32 ) Data ; break ; case XV_SDITX_STREAMSELID_ASPECTRATIO : InstancePtr -> Stream [ StreamId ] . Video . AspectRatio = ( u32 ) Data & 0x1 ; break ; case XV_SDITX_STREAMSELID_STANDARD : InstancePtr -> Stream [ StreamId ] . Standard = ( u32 ) Data & 0xFF ; break ; case XV_SDITX_STREAMSELID_STREAMINTERLACE : InstancePtr -> Stream [ StreamId ] . IsStreamInterlaced = ( u32 ) Data & 0x1 ; break ; case XV_SDITX_STREAMSELID_CHANNEL : InstancePtr -> Stream [ StreamId ] . CAssignment = ( u32 ) Data & 0x7 ; break ; default : break ; } return XST_SUCCESS ; }
This function sets the SDI TX stream parameters.
This function sets the SDI TX stream parameters .
/* Verify arguments. */ /* Get the timing from the video timing table. */