XilinxProcessorIPLib/drivers/v_hdmiphy1/src/xhdmiphy1.c
void XHdmiphy1_CfgInitialize(XHdmiphy1 *InstancePtr,
		XHdmiphy1_Config *ConfigPtr,
		UINTPTR EffectiveAddr)
{
#if (XPAR_HDMIPHY1_0_TRANSCEIVER != XHDMIPHY1_GTYE5)
	u8 Sel;
#endif

	/* Verify arguments. */
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(ConfigPtr != NULL);
	Xil_AssertVoid(EffectiveAddr != 0x0);

	(void)memset((void *)InstancePtr, 0, sizeof(XHdmiphy1));
	InstancePtr->IsReady = 0;

	InstancePtr->Config = *ConfigPtr;
	InstancePtr->Config.BaseAddr = EffectiveAddr;

#if (XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTHE4)
	InstancePtr->GtAdaptor = &XHdmiphy1_Gthe4Config;
#elif (XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTYE4)
	InstancePtr->GtAdaptor = &XHdmiphy1_Gtye4Config;
#elif (XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTYE5)
	InstancePtr->GtAdaptor = &Gtye5Config;
#endif

#if (XPAR_HDMIPHY1_0_TRANSCEIVER != XHDMIPHY1_GTYE5)
	const XHdmiphy1_SysClkDataSelType SysClkCfg[7][2] = {
		{(XHdmiphy1_SysClkDataSelType)0,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_CPLL_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)1,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL0_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)2,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL1_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)3,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)4,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_PLL0_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)5,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_PLL1_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)6,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL0_OUTCLK},
	};
	for (Sel = 0; Sel < 7; Sel++) {
		if (InstancePtr->Config.TxSysPllClkSel == SysClkCfg[Sel][0]) {
			InstancePtr->Config.TxSysPllClkSel = SysClkCfg[Sel][1];
		}
		if (InstancePtr->Config.RxSysPllClkSel == SysClkCfg[Sel][0]) {
			InstancePtr->Config.RxSysPllClkSel = SysClkCfg[Sel][1];
		}
	}

	InstancePtr->Config.TxRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.TxRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
	InstancePtr->Config.RxRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.RxRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
	InstancePtr->Config.TxFrlRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.TxFrlRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
	InstancePtr->Config.RxFrlRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.RxFrlRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
	InstancePtr->Config.DruRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.DruRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
#endif

	InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
}
/******************************************************************************/
/**
 * This function retrieves the configuration for this Video PHY instance and
 * fills in the InstancePtr->Config structure.
 *
 * @param	InstancePtr is a pointer to the XHdmiphy1 instance.
 * @param	ConfigPtr is a pointer to the configuration structure that will
 *		be used to copy the settings from.
 * @param	EffectiveAddr is the device base address in the virtual memory
 *		space. If the address translation is not used, then the physical
 *		address is passed.
 *
 * @return	None.
 *
 * @note	Unexpected errors may occur if the address mapping is changed
 *		after this function is invoked.
 *
*******************************************************************************/
This function retrieves the configuration for this Video PHY instance and
fills in the InstancePtr->Config structure.

@param       InstancePtr is a pointer to the XHdmiphy1 instance.
@param       ConfigPtr is a pointer to the configuration structure that will
be used to copy the settings from.
@param       EffectiveAddr is the device base address in the virtual memory
space. If the address translation is not used, then the physical
address is passed.

@return      None.

@note        Unexpected errors may occur if the address mapping is changed
after this function is invoked.
This function retrieves the configuration for this Video PHY instance and fills in the InstancePtr - > Config structure . @param InstancePtr is a pointer to the XHdmiphy1 instance . @param ConfigPtr is a pointer to the configuration structure that will be used to copy the settings from . @param EffectiveAddr is the device base address in the virtual memory space . If the address translation is not used then the physical address is passed . @return None . @note Unexpected errors may occur if the address mapping is changed after this function is invoked .
void XHdmiphy1_CfgInitialize(XHdmiphy1 *InstancePtr,
		XHdmiphy1_Config *ConfigPtr,
		UINTPTR EffectiveAddr)
{
#if (XPAR_HDMIPHY1_0_TRANSCEIVER != XHDMIPHY1_GTYE5)
	u8 Sel;
#endif
	Xil_AssertVoid(InstancePtr != NULL);
	Xil_AssertVoid(ConfigPtr != NULL);
	Xil_AssertVoid(EffectiveAddr != 0x0);
	(void)memset((void *)InstancePtr, 0, sizeof(XHdmiphy1));
	InstancePtr->IsReady = 0;
	InstancePtr->Config = *ConfigPtr;
	InstancePtr->Config.BaseAddr = EffectiveAddr;
#if (XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTHE4)
	InstancePtr->GtAdaptor = &XHdmiphy1_Gthe4Config;
#elif (XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTYE4)
	InstancePtr->GtAdaptor = &XHdmiphy1_Gtye4Config;
#elif (XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTYE5)
	InstancePtr->GtAdaptor = &Gtye5Config;
#endif
#if (XPAR_HDMIPHY1_0_TRANSCEIVER != XHDMIPHY1_GTYE5)
	const XHdmiphy1_SysClkDataSelType SysClkCfg[7][2] = {
		{(XHdmiphy1_SysClkDataSelType)0,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_CPLL_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)1,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL0_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)2,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL1_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)3,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)4,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_PLL0_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)5,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_PLL1_OUTCLK},
		{(XHdmiphy1_SysClkDataSelType)6,
            XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL0_OUTCLK},
	};
	for (Sel = 0; Sel < 7; Sel++) {
		if (InstancePtr->Config.TxSysPllClkSel == SysClkCfg[Sel][0]) {
			InstancePtr->Config.TxSysPllClkSel = SysClkCfg[Sel][1];
		}
		if (InstancePtr->Config.RxSysPllClkSel == SysClkCfg[Sel][0]) {
			InstancePtr->Config.RxSysPllClkSel = SysClkCfg[Sel][1];
		}
	}
	InstancePtr->Config.TxRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.TxRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
	InstancePtr->Config.RxRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.RxRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
	InstancePtr->Config.TxFrlRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.TxFrlRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
	InstancePtr->Config.RxFrlRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.RxFrlRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
	InstancePtr->Config.DruRefClkSel = (XHdmiphy1_PllRefClkSelType)
			(InstancePtr->Config.DruRefClkSel +
					XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0);
#endif
	InstancePtr->IsReady = XIL_COMPONENT_IS_READY;
}
void XHdmiphy1_CfgInitialize ( XHdmiphy1 * InstancePtr , XHdmiphy1_Config * ConfigPtr , UINTPTR EffectiveAddr ) { #if ( XPAR_HDMIPHY1_0_TRANSCEIVER != XHDMIPHY1_GTYE5 ) u8 Sel ; #endif Xil_AssertVoid ( InstancePtr != NULL ) ; Xil_AssertVoid ( ConfigPtr != NULL ) ; Xil_AssertVoid ( EffectiveAddr != 0x0 ) ; ( void ) memset ( ( void * ) InstancePtr , 0 , sizeof ( XHdmiphy1 ) ) ; InstancePtr -> IsReady = 0 ; InstancePtr -> Config = * ConfigPtr ; InstancePtr -> Config . BaseAddr = EffectiveAddr ; #if ( XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTHE4 ) InstancePtr -> GtAdaptor = & XHdmiphy1_Gthe4Config ; #elif ( XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTYE4 ) InstancePtr -> GtAdaptor = & XHdmiphy1_Gtye4Config ; #elif ( XPAR_HDMIPHY1_0_TRANSCEIVER == XHDMIPHY1_GTYE5 ) InstancePtr -> GtAdaptor = & Gtye5Config ; #endif #if ( XPAR_HDMIPHY1_0_TRANSCEIVER != XHDMIPHY1_GTYE5 ) const XHdmiphy1_SysClkDataSelType SysClkCfg [ 7 ] [ 2 ] = { { ( XHdmiphy1_SysClkDataSelType ) 0 , XHDMIPHY1_SYSCLKSELDATA_TYPE_CPLL_OUTCLK } , { ( XHdmiphy1_SysClkDataSelType ) 1 , XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL0_OUTCLK } , { ( XHdmiphy1_SysClkDataSelType ) 2 , XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL1_OUTCLK } , { ( XHdmiphy1_SysClkDataSelType ) 3 , XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL_OUTCLK } , { ( XHdmiphy1_SysClkDataSelType ) 4 , XHDMIPHY1_SYSCLKSELDATA_TYPE_PLL0_OUTCLK } , { ( XHdmiphy1_SysClkDataSelType ) 5 , XHDMIPHY1_SYSCLKSELDATA_TYPE_PLL1_OUTCLK } , { ( XHdmiphy1_SysClkDataSelType ) 6 , XHDMIPHY1_SYSCLKSELDATA_TYPE_QPLL0_OUTCLK } , } ; for ( Sel = 0 ; Sel < 7 ; Sel ++ ) { if ( InstancePtr -> Config . TxSysPllClkSel == SysClkCfg [ Sel ] [ 0 ] ) { InstancePtr -> Config . TxSysPllClkSel = SysClkCfg [ Sel ] [ 1 ] ; } if ( InstancePtr -> Config . RxSysPllClkSel == SysClkCfg [ Sel ] [ 0 ] ) { InstancePtr -> Config . RxSysPllClkSel = SysClkCfg [ Sel ] [ 1 ] ; } } InstancePtr -> Config . TxRefClkSel = ( XHdmiphy1_PllRefClkSelType ) ( InstancePtr -> Config . TxRefClkSel + XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0 ) ; InstancePtr -> Config . RxRefClkSel = ( XHdmiphy1_PllRefClkSelType ) ( InstancePtr -> Config . RxRefClkSel + XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0 ) ; InstancePtr -> Config . TxFrlRefClkSel = ( XHdmiphy1_PllRefClkSelType ) ( InstancePtr -> Config . TxFrlRefClkSel + XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0 ) ; InstancePtr -> Config . RxFrlRefClkSel = ( XHdmiphy1_PllRefClkSelType ) ( InstancePtr -> Config . RxFrlRefClkSel + XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0 ) ; InstancePtr -> Config . DruRefClkSel = ( XHdmiphy1_PllRefClkSelType ) ( InstancePtr -> Config . DruRefClkSel + XHDMIPHY1_PLL_REFCLKSEL_TYPE_GTREFCLK0 ) ; #endif InstancePtr -> IsReady = XIL_COMPONENT_IS_READY ; }
This function retrieves the configuration for this Video PHY instance and
 fills in the InstancePtr->Config structure.
This function retrieves the configuration for this Video PHY instance and fills in the InstancePtr - > Config structure .
/* Verify arguments. */