XilinxProcessorIPLib/drivers/v_sditx/src/xv_sditx.c
int XV_SdiTx_SetColorFormat(XV_SdiTx *InstancePtr, XVidC_ColorFormat ColorFormat)
{
	Xil_AssertNonvoid( (ColorFormat == XVIDC_CSF_YCBCR_422) ||
			    (ColorFormat == XVIDC_CSF_YCBCR_444) ||
			     ((ColorFormat == XVIDC_CSF_YCBCR_420) &&
			       (InstancePtr->Transport.TMode >= XSDIVID_MODE_6G)) );

	u32 Data;

	InstancePtr->IsStreamUp = FALSE;

	Data = XV_SdiTx_ReadReg(InstancePtr->Config.BaseAddress,
				(XV_SDITX_MDL_CTRL_OFFSET));
	Data &= ~XV_SDITX_MDL_CTRL_VID_FRMT_MASK;

	switch(ColorFormat)	 {
	case XVIDC_CSF_YCBCR_422:
		Data |= 0x0 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
		break;

	case XVIDC_CSF_YCBCR_420:
		Data |= 0x1 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
		break;

	case XVIDC_CSF_YCBCR_444:
		Data |= 0x1 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
		break;

	case XVIDC_CSF_RGB:
			Data |= 0x2 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
			break;

	default:
		Data |= 0x0 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
		break;
	}

	XV_SdiTx_WriteReg((InstancePtr)->Config.BaseAddress,
				(XV_SDITX_MDL_CTRL_OFFSET),
				(Data));

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function Set the video format of the SDI TX core.
*
* @param	InstancePtr is a pointer to the XV_SdiTx core instance.
* @param	ColorFormat is a variable of type XVidC_ColorFormat.
*
* @return
*		- XST_SUCCESS if register write is successfule for SDI stop
*		- XST_FAILURE if SDI stop write is failed
*
* @note		None.
*
******************************************************************************/
This function Set the video format of the SDI TX core.
This function Set the video format of the SDI TX core .
int XV_SdiTx_SetColorFormat(XV_SdiTx *InstancePtr, XVidC_ColorFormat ColorFormat)
{
	Xil_AssertNonvoid( (ColorFormat == XVIDC_CSF_YCBCR_422) ||
			    (ColorFormat == XVIDC_CSF_YCBCR_444) ||
			     ((ColorFormat == XVIDC_CSF_YCBCR_420) &&
			       (InstancePtr->Transport.TMode >= XSDIVID_MODE_6G)) );
	u32 Data;
	InstancePtr->IsStreamUp = FALSE;
	Data = XV_SdiTx_ReadReg(InstancePtr->Config.BaseAddress,
				(XV_SDITX_MDL_CTRL_OFFSET));
	Data &= ~XV_SDITX_MDL_CTRL_VID_FRMT_MASK;
	switch(ColorFormat)	 {
	case XVIDC_CSF_YCBCR_422:
		Data |= 0x0 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
		break;
	case XVIDC_CSF_YCBCR_420:
		Data |= 0x1 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
		break;
	case XVIDC_CSF_YCBCR_444:
		Data |= 0x1 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
		break;
	case XVIDC_CSF_RGB:
			Data |= 0x2 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
			break;
	default:
		Data |= 0x0 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT;
		break;
	}
	XV_SdiTx_WriteReg((InstancePtr)->Config.BaseAddress,
				(XV_SDITX_MDL_CTRL_OFFSET),
				(Data));
	return XST_SUCCESS;
}
int XV_SdiTx_SetColorFormat ( XV_SdiTx * InstancePtr , XVidC_ColorFormat ColorFormat ) { Xil_AssertNonvoid ( ( ColorFormat == XVIDC_CSF_YCBCR_422 ) || ( ColorFormat == XVIDC_CSF_YCBCR_444 ) || ( ( ColorFormat == XVIDC_CSF_YCBCR_420 ) && ( InstancePtr -> Transport . TMode >= XSDIVID_MODE_6G ) ) ) ; u32 Data ; InstancePtr -> IsStreamUp = FALSE ; Data = XV_SdiTx_ReadReg ( InstancePtr -> Config . BaseAddress , ( XV_SDITX_MDL_CTRL_OFFSET ) ) ; Data &= ~ XV_SDITX_MDL_CTRL_VID_FRMT_MASK ; switch ( ColorFormat ) { case XVIDC_CSF_YCBCR_422 : Data |= 0x0 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT ; break ; case XVIDC_CSF_YCBCR_420 : Data |= 0x1 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT ; break ; case XVIDC_CSF_YCBCR_444 : Data |= 0x1 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT ; break ; case XVIDC_CSF_RGB : Data |= 0x2 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT ; break ; default : Data |= 0x0 << XV_SDITX_MDL_CTRL_VID_FRMT_SHIFT ; break ; } XV_SdiTx_WriteReg ( ( InstancePtr ) -> Config . BaseAddress , ( XV_SDITX_MDL_CTRL_OFFSET ) , ( Data ) ) ; return XST_SUCCESS ; }
This function Set the video format of the SDI TX core.
This function Set the video format of the SDI TX core .