XilinxProcessorIPLib/drivers/avbuf/src/xavbuf_clk.c
int XAVBuf_SetPixelClock(u64 FreqHz)
{
	u32 PllAssigned;
	XAVBuf_Pll PllInstancePtr;
	u8 Pll;
	u8 CrossDomain;
	u8 Flag;

	/*Verify Input Arguments*/
	Xil_AssertNonvoid(FreqHz < XDPSSU_MAX_VIDEO_FREQ);

	PllAssigned = XAVBuf_ReadReg(XAVBUF_CLK_FPD_BASEADDR,
		XAVBUF_VIDEO_REF_CTRL) & XAVBUF_VIDEO_REF_CTRL_SRCSEL_MASK;

	switch (PllAssigned) {
		case XAVBUF_VPLL_SRC_SEL:
				Pll = VPLL;
				CrossDomain = 0;
				break;
		case XAVBUF_DPLL_SRC_SEL:
				Pll = DPLL;
				CrossDomain = 0;
				break;
		case XAVBUF_RPLL_TO_FPD_SRC_SEL:
				Pll = RPLL;
				CrossDomain = 1;
				break;
		default:
				return XST_FAILURE;
	}

	/*Calculate configure PLL and External Divider*/
	XAVBuf_PllInitialize(&PllInstancePtr, Pll, CrossDomain,
		XAVBUF_EXTERNAL_DIVIDER);
	Flag = XAVBuf_PllCalcParameterValues(&PllInstancePtr, FreqHz);
	if (Flag != 0)
		return XST_FAILURE;
	Flag = XAVBuf_ConfigurePll(&PllInstancePtr);
	if (Flag != 0)
		return XST_FAILURE;
	XAVBuf_ConfigureExtDivider(&PllInstancePtr, XAVBUF_CLK_FPD_BASEADDR,
		XAVBUF_VIDEO_REF_CTRL);

	return XST_SUCCESS;
}
/******************************************************************************/
/**
 * This function calls API to calculate and configure PLL with desired frequency
 * for Video.
 *
 * @param	FreqHz is the desired frequency in Hz.
 *
 * @return	XST_SUCCESS if PLL is configured without an error.
 *		    XST_FAILURE otherwise.
 *
 * @note	The Pll used is design specific.
 *
*******************************************************************************/
This function calls API to calculate and configure PLL with desired frequency
for Video.

@param       FreqHz is the desired frequency in Hz.

@return      XST_SUCCESS if PLL is configured without an error.

@note        The Pll used is design specific.
This function calls API to calculate and configure PLL with desired frequency for Video . @param FreqHz is the desired frequency in Hz . @return XST_SUCCESS if PLL is configured without an error . @note The Pll used is design specific .
int XAVBuf_SetPixelClock(u64 FreqHz)
{
	u32 PllAssigned;
	XAVBuf_Pll PllInstancePtr;
	u8 Pll;
	u8 CrossDomain;
	u8 Flag;
	Xil_AssertNonvoid(FreqHz < XDPSSU_MAX_VIDEO_FREQ);
	PllAssigned = XAVBuf_ReadReg(XAVBUF_CLK_FPD_BASEADDR,
		XAVBUF_VIDEO_REF_CTRL) & XAVBUF_VIDEO_REF_CTRL_SRCSEL_MASK;
	switch (PllAssigned) {
		case XAVBUF_VPLL_SRC_SEL:
				Pll = VPLL;
				CrossDomain = 0;
				break;
		case XAVBUF_DPLL_SRC_SEL:
				Pll = DPLL;
				CrossDomain = 0;
				break;
		case XAVBUF_RPLL_TO_FPD_SRC_SEL:
				Pll = RPLL;
				CrossDomain = 1;
				break;
		default:
				return XST_FAILURE;
	}
	XAVBuf_PllInitialize(&PllInstancePtr, Pll, CrossDomain,
		XAVBUF_EXTERNAL_DIVIDER);
	Flag = XAVBuf_PllCalcParameterValues(&PllInstancePtr, FreqHz);
	if (Flag != 0)
		return XST_FAILURE;
	Flag = XAVBuf_ConfigurePll(&PllInstancePtr);
	if (Flag != 0)
		return XST_FAILURE;
	XAVBuf_ConfigureExtDivider(&PllInstancePtr, XAVBUF_CLK_FPD_BASEADDR,
		XAVBUF_VIDEO_REF_CTRL);
	return XST_SUCCESS;
}
int XAVBuf_SetPixelClock ( u64 FreqHz ) { u32 PllAssigned ; XAVBuf_Pll PllInstancePtr ; u8 Pll ; u8 CrossDomain ; u8 Flag ; Xil_AssertNonvoid ( FreqHz < XDPSSU_MAX_VIDEO_FREQ ) ; PllAssigned = XAVBuf_ReadReg ( XAVBUF_CLK_FPD_BASEADDR , XAVBUF_VIDEO_REF_CTRL ) & XAVBUF_VIDEO_REF_CTRL_SRCSEL_MASK ; switch ( PllAssigned ) { case XAVBUF_VPLL_SRC_SEL : Pll = VPLL ; CrossDomain = 0 ; break ; case XAVBUF_DPLL_SRC_SEL : Pll = DPLL ; CrossDomain = 0 ; break ; case XAVBUF_RPLL_TO_FPD_SRC_SEL : Pll = RPLL ; CrossDomain = 1 ; break ; default : return XST_FAILURE ; } XAVBuf_PllInitialize ( & PllInstancePtr , Pll , CrossDomain , XAVBUF_EXTERNAL_DIVIDER ) ; Flag = XAVBuf_PllCalcParameterValues ( & PllInstancePtr , FreqHz ) ; if ( Flag != 0 ) return XST_FAILURE ; Flag = XAVBuf_ConfigurePll ( & PllInstancePtr ) ; if ( Flag != 0 ) return XST_FAILURE ; XAVBuf_ConfigureExtDivider ( & PllInstancePtr , XAVBUF_CLK_FPD_BASEADDR , XAVBUF_VIDEO_REF_CTRL ) ; return XST_SUCCESS ; }
This function calls API to calculate and configure PLL with desired frequency
 for Video.
This function calls API to calculate and configure PLL with desired frequency for Video .
/*Verify Input Arguments*/ /*Calculate configure PLL and External Divider*/