XilinxProcessorIPLib/drivers/v_hdmitxss1/examples/xhdmi_example/video_fmc.c
int Vfmc_I2cMuxSelect(XVfmc *VfmcPtr)
{
	u8 Buffer;
	int Status;
	void *IicPtr = VfmcPtr->IicPtr;
	XVfmc_Location Loc = VfmcPtr->Loc;

#if (defined (XPS_BOARD_VCU118)) && (!defined (XPS_BOARD_ZCU106))
	Loc = Loc;

	/* Reset I2C controller before issuing new transaction. This is
	 * required to recover the IIC controller in case a previous
	 * transaction is pending.
	 */
	/*XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
				  XIIC_RESET_MASK);*/

	/* Set TCA9548 MUX1 to select port 1 (FMCP HSCP IIC port)*/
	Buffer = 0x02;
	Status = Vfmc_I2cSend(IicPtr, 0x75,
					   (u8 *)&Buffer, 1, (I2C_STOP));

	/* Set TCA9548 MUX1 to select port 1 (No connection)*/
	Buffer = 0x02;
	Status = Vfmc_I2cSend(IicPtr, 0x74,
					   (u8 *)&Buffer, 1, (I2C_STOP));

#elif defined (XPS_BOARD_ZCU102)
	/* Set TCA9548 U34 to select port 7 (No connection)*/
	Buffer = 0x80;
	Status = Vfmc_I2cSend(IicPtr, 0x74,
					   (u8 *)&Buffer, 1, (I2C_STOP));

	/* Set TCA9548 U135 to select port 0 or 1 (HPC0/1)*/
	if (Loc == VFMC_HPC0) {
		Buffer = 0x01;
	} else {
		Buffer = 0x02;
	}

	Status = Vfmc_I2cSend(IicPtr, 0x75,
					   (u8 *)&Buffer, 1, (I2C_STOP));

#elif defined (XPS_BOARD_ZCU106)
	/* Set TCA9548 U34 to select port 7 (No connection)*/
	Buffer = 0x80;
	Status = Vfmc_I2cSend(IicPtr, 0x74,
					   (u8 *)&Buffer, 1, (I2C_STOP));

	/* Set TCA9548 U135 to select port 0 or 1 (HPC0/1)*/
	if (Loc == VFMC_HPC0) {
		Buffer = 0x01;
	} else {
		Buffer = 0x02;
	}

	Status = Vfmc_I2cSend(IicPtr, 0x75,
					   (u8 *)&Buffer, 1, (I2C_STOP));
#elif defined (XPS_BOARD_VCK190)
	/* Set TCA9548 U135 to select port 0 or 1 (HPC0/1)*/
	if (Loc == VFMC_HPC0) {
		Buffer = 0x02;
	} else {
		Buffer = 0x04;
	}
	Status = Vfmc_I2cSend(IicPtr, 0x74,
					   (u8 *)&Buffer, 1, (I2C_STOP));
#endif

	/* When a device is found, it returns one byte */
	if (Status)
	  return XST_SUCCESS;
	else
	  return XST_FAILURE;
}
/*****************************************************************************/
/**
*
* This function setup the IIC MUX to select the VFMC on the HPC header
*
* @param  None.
*
* @return The number of bytes sent.
*
* @note   None.
*
******************************************************************************/
This function setup the IIC MUX to select the VFMC on the HPC header
This function setup the IIC MUX to select the VFMC on the HPC header
int Vfmc_I2cMuxSelect(XVfmc *VfmcPtr)
{
	u8 Buffer;
	int Status;
	void *IicPtr = VfmcPtr->IicPtr;
	XVfmc_Location Loc = VfmcPtr->Loc;
#if (defined (XPS_BOARD_VCU118)) && (!defined (XPS_BOARD_ZCU106))
	Loc = Loc;
	Buffer = 0x02;
	Status = Vfmc_I2cSend(IicPtr, 0x75,
					   (u8 *)&Buffer, 1, (I2C_STOP));
	Buffer = 0x02;
	Status = Vfmc_I2cSend(IicPtr, 0x74,
					   (u8 *)&Buffer, 1, (I2C_STOP));
#elif defined (XPS_BOARD_ZCU102)
	Buffer = 0x80;
	Status = Vfmc_I2cSend(IicPtr, 0x74,
					   (u8 *)&Buffer, 1, (I2C_STOP));
	if (Loc == VFMC_HPC0) {
		Buffer = 0x01;
	} else {
		Buffer = 0x02;
	}
	Status = Vfmc_I2cSend(IicPtr, 0x75,
					   (u8 *)&Buffer, 1, (I2C_STOP));
#elif defined (XPS_BOARD_ZCU106)
	Buffer = 0x80;
	Status = Vfmc_I2cSend(IicPtr, 0x74,
					   (u8 *)&Buffer, 1, (I2C_STOP));
	if (Loc == VFMC_HPC0) {
		Buffer = 0x01;
	} else {
		Buffer = 0x02;
	}
	Status = Vfmc_I2cSend(IicPtr, 0x75,
					   (u8 *)&Buffer, 1, (I2C_STOP));
#elif defined (XPS_BOARD_VCK190)
	if (Loc == VFMC_HPC0) {
		Buffer = 0x02;
	} else {
		Buffer = 0x04;
	}
	Status = Vfmc_I2cSend(IicPtr, 0x74,
					   (u8 *)&Buffer, 1, (I2C_STOP));
#endif
	if (Status)
	  return XST_SUCCESS;
	else
	  return XST_FAILURE;
}
int Vfmc_I2cMuxSelect ( XVfmc * VfmcPtr ) { u8 Buffer ; int Status ; void * IicPtr = VfmcPtr -> IicPtr ; XVfmc_Location Loc = VfmcPtr -> Loc ; #if ( defined ( XPS_BOARD_VCU118 ) ) && ( ! defined ( XPS_BOARD_ZCU106 ) ) Loc = Loc ; Buffer = 0x02 ; Status = Vfmc_I2cSend ( IicPtr , 0x75 , ( u8 * ) & Buffer , 1 , ( I2C_STOP ) ) ; Buffer = 0x02 ; Status = Vfmc_I2cSend ( IicPtr , 0x74 , ( u8 * ) & Buffer , 1 , ( I2C_STOP ) ) ; #elif defined ( XPS_BOARD_ZCU102 ) Buffer = 0x80 ; Status = Vfmc_I2cSend ( IicPtr , 0x74 , ( u8 * ) & Buffer , 1 , ( I2C_STOP ) ) ; if ( Loc == VFMC_HPC0 ) { Buffer = 0x01 ; } else { Buffer = 0x02 ; } Status = Vfmc_I2cSend ( IicPtr , 0x75 , ( u8 * ) & Buffer , 1 , ( I2C_STOP ) ) ; #elif defined ( XPS_BOARD_ZCU106 ) Buffer = 0x80 ; Status = Vfmc_I2cSend ( IicPtr , 0x74 , ( u8 * ) & Buffer , 1 , ( I2C_STOP ) ) ; if ( Loc == VFMC_HPC0 ) { Buffer = 0x01 ; } else { Buffer = 0x02 ; } Status = Vfmc_I2cSend ( IicPtr , 0x75 , ( u8 * ) & Buffer , 1 , ( I2C_STOP ) ) ; #elif defined ( XPS_BOARD_VCK190 ) if ( Loc == VFMC_HPC0 ) { Buffer = 0x02 ; } else { Buffer = 0x04 ; } Status = Vfmc_I2cSend ( IicPtr , 0x74 , ( u8 * ) & Buffer , 1 , ( I2C_STOP ) ) ; #endif if ( Status ) return XST_SUCCESS ; else return XST_FAILURE ; }
This function setup the IIC MUX to select the VFMC on the HPC header
This function setup the IIC MUX to select the VFMC on the HPC header
/* Reset I2C controller before issuing new transaction. This is
	 * required to recover the IIC controller in case a previous
	 * transaction is pending.
	 */ /*XIic_WriteReg(XPAR_IIC_0_BASEADDR, XIIC_RESETR_OFFSET,
				  XIIC_RESET_MASK);*/ /* Set TCA9548 MUX1 to select port 1 (FMCP HSCP IIC port)*/ /* Set TCA9548 MUX1 to select port 1 (No connection)*/ /* Set TCA9548 U34 to select port 7 (No connection)*/ /* Set TCA9548 U135 to select port 0 or 1 (HPC0/1)*/ /* Set TCA9548 U34 to select port 7 (No connection)*/ /* Set TCA9548 U135 to select port 0 or 1 (HPC0/1)*/ /* Set TCA9548 U135 to select port 0 or 1 (HPC0/1)*/ /* When a device is found, it returns one byte */