XilinxProcessorIPLib/drivers/v_hdmitxss/examples/xhdmi_example/TxOnly/xhdmi_example.c
int I2cClk(u32 InFreq, u32 OutFreq)
{
	int Status;

#if (!defined XPS_BOARD_ZCU104)
	/* Free running mode */
	if (InFreq == 0) {

		Status = Si5324_SetClock((XPAR_IIC_0_BASEADDR),
					 (I2C_CLK_ADDR),
			                 (SI5324_CLKSRC_XTAL),
					 (SI5324_XTAL_FREQ),
					 OutFreq);
		if (Status != (SI5324_SUCCESS)) {
			xil_printf("Error programming SI5324\r\n");
			return 0;
		}
	}

	/* Locked mode */
	else {
		Status = Si5324_SetClock((XPAR_IIC_0_BASEADDR),
					 (I2C_CLK_ADDR),
					 (SI5324_CLKSRC_CLK1),
					 InFreq,
					 OutFreq);

		if (Status != (SI5324_SUCCESS)) {
			xil_printf("Error programming SI5324\r\n");
			return 0;
		}
	}
#else
	/* Reset I2C controller before issuing new transaction.
	 * This is required torecover the IIC controller in case a previous
	 * transaction is pending.
	 */
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
				  XIIC_RESET_MASK);

	/* Free running mode */
	if (InFreq == 0) {
		Status = IDT_8T49N24x_SetClock((XPAR_IIC_0_BASEADDR),
					       (I2C_CLK_ADDR),
					       (IDT_8T49N24X_XTAL_FREQ),
					       OutFreq,
					       TRUE);

		if (Status != (XST_SUCCESS)) {
			print("Error programming IDT_8T49N241\r\n");
			return 0;
		}
	}

	/* Locked mode */
	else {
		Status = IDT_8T49N24x_SetClock((XPAR_IIC_0_BASEADDR),
					       (I2C_CLK_ADDR),
					       InFreq,
					       OutFreq,
					       FALSE);

		if (Status != (XST_SUCCESS)) {
			print("Error programming SI5324\n\r");
			return 0;
		}
	}
#endif
	return 1;
}
/*****************************************************************************/
/**
*
* This function setup SI5324 clock generator either in free or locked mode.
*
* @param  Index specifies an index for selecting mode frequency.
* @param  Mode specifies either free or locked mode.
*
* @return
*   - Zero if error in programming external clock.
*   - One if programmed external clock.
*
* @note   None.
*
******************************************************************************/
This function setup SI5324 clock generator either in free or locked mode.
This function setup SI5324 clock generator either in free or locked mode .
int I2cClk(u32 InFreq, u32 OutFreq)
{
	int Status;
#if (!defined XPS_BOARD_ZCU104)
	if (InFreq == 0) {
		Status = Si5324_SetClock((XPAR_IIC_0_BASEADDR),
					 (I2C_CLK_ADDR),
			                 (SI5324_CLKSRC_XTAL),
					 (SI5324_XTAL_FREQ),
					 OutFreq);
		if (Status != (SI5324_SUCCESS)) {
			xil_printf("Error programming SI5324\r\n");
			return 0;
		}
	}
	else {
		Status = Si5324_SetClock((XPAR_IIC_0_BASEADDR),
					 (I2C_CLK_ADDR),
					 (SI5324_CLKSRC_CLK1),
					 InFreq,
					 OutFreq);
		if (Status != (SI5324_SUCCESS)) {
			xil_printf("Error programming SI5324\r\n");
			return 0;
		}
	}
#else
	XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
				  XIIC_RESET_MASK);
	if (InFreq == 0) {
		Status = IDT_8T49N24x_SetClock((XPAR_IIC_0_BASEADDR),
					       (I2C_CLK_ADDR),
					       (IDT_8T49N24X_XTAL_FREQ),
					       OutFreq,
					       TRUE);
		if (Status != (XST_SUCCESS)) {
			print("Error programming IDT_8T49N241\r\n");
			return 0;
		}
	}
	else {
		Status = IDT_8T49N24x_SetClock((XPAR_IIC_0_BASEADDR),
					       (I2C_CLK_ADDR),
					       InFreq,
					       OutFreq,
					       FALSE);
		if (Status != (XST_SUCCESS)) {
			print("Error programming SI5324\n\r");
			return 0;
		}
	}
#endif
	return 1;
}
int I2cClk ( u32 InFreq , u32 OutFreq ) { int Status ; #if ( ! defined XPS_BOARD_ZCU104 ) if ( InFreq == 0 ) { Status = Si5324_SetClock ( ( XPAR_IIC_0_BASEADDR ) , ( I2C_CLK_ADDR ) , ( SI5324_CLKSRC_XTAL ) , ( SI5324_XTAL_FREQ ) , OutFreq ) ; if ( Status != ( SI5324_SUCCESS ) ) { xil_printf ( " \r \n " ) ; return 0 ; } } else { Status = Si5324_SetClock ( ( XPAR_IIC_0_BASEADDR ) , ( I2C_CLK_ADDR ) , ( SI5324_CLKSRC_CLK1 ) , InFreq , OutFreq ) ; if ( Status != ( SI5324_SUCCESS ) ) { xil_printf ( " \r \n " ) ; return 0 ; } } #else XIic_WriteReg ( XPAR_IIC_0_BASEADDR , XIIC_RESETR_OFFSET , XIIC_RESET_MASK ) ; if ( InFreq == 0 ) { Status = IDT_8T49N24x_SetClock ( ( XPAR_IIC_0_BASEADDR ) , ( I2C_CLK_ADDR ) , ( IDT_8T49N24X_XTAL_FREQ ) , OutFreq , TRUE ) ; if ( Status != ( XST_SUCCESS ) ) { print ( " \r \n " ) ; return 0 ; } } else { Status = IDT_8T49N24x_SetClock ( ( XPAR_IIC_0_BASEADDR ) , ( I2C_CLK_ADDR ) , InFreq , OutFreq , FALSE ) ; if ( Status != ( XST_SUCCESS ) ) { print ( " \n \r " ) ; return 0 ; } } #endif return 1 ; }
This function setup SI5324 clock generator either in free or locked mode.
This function setup SI5324 clock generator either in free or locked mode .
/* Free running mode */ /* Locked mode */ /* Reset I2C controller before issuing new transaction.
	 * This is required torecover the IIC controller in case a previous
	 * transaction is pending.
	 */ /* Free running mode */ /* Locked mode */