XilinxProcessorIPLib/drivers/iicps/examples/xiicps_eeprom_intr_example.c
static int MuxInitChannel(u16 MuxIicAddr, u8 WriteBuffer)
{
	u8 Buffer = 0;

	TotalErrorCount = 0;
	TransmitComplete = FALSE;
	TotalErrorCount = 0;

	XIicPs_MasterSend(&IicInstance, &WriteBuffer,1,MuxIicAddr);
	while (TransmitComplete == FALSE) {
		if (0 != TotalErrorCount) {
			return XST_FAILURE;
		}
	}
	/*
	 * Wait until bus is idle to start another transfer.
	 */

	while (XIicPs_BusIsBusy(&IicInstance));

	ReceiveComplete = FALSE;
	/*
	 * Receive the Data.
	 */
	XIicPs_MasterRecv(&IicInstance, &Buffer,1, MuxIicAddr);

	while (ReceiveComplete == FALSE) {
		if (0 != TotalErrorCount) {
			return XST_FAILURE;
		}
	}
	/*
	 * Wait until bus is idle to start another transfer.
	 */
	while (XIicPs_BusIsBusy(&IicInstance));

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
* This function initializes the IIC MUX to select the required channel.
*
* @param	MuxAddress and Channel select value.
*
* @return	XST_SUCCESS if pass, otherwise XST_FAILURE.
*
* @note		None.
*
****************************************************************************/
This function initializes the IIC MUX to select the required channel.
This function initializes the IIC MUX to select the required channel .
static int MuxInitChannel(u16 MuxIicAddr, u8 WriteBuffer)
{
	u8 Buffer = 0;
	TotalErrorCount = 0;
	TransmitComplete = FALSE;
	TotalErrorCount = 0;
	XIicPs_MasterSend(&IicInstance, &WriteBuffer,1,MuxIicAddr);
	while (TransmitComplete == FALSE) {
		if (0 != TotalErrorCount) {
			return XST_FAILURE;
		}
	}
	while (XIicPs_BusIsBusy(&IicInstance));
	ReceiveComplete = FALSE;
	XIicPs_MasterRecv(&IicInstance, &Buffer,1, MuxIicAddr);
	while (ReceiveComplete == FALSE) {
		if (0 != TotalErrorCount) {
			return XST_FAILURE;
		}
	}
	while (XIicPs_BusIsBusy(&IicInstance));
	return XST_SUCCESS;
}
static int MuxInitChannel ( u16 MuxIicAddr , u8 WriteBuffer ) { u8 Buffer = 0 ; TotalErrorCount = 0 ; TransmitComplete = FALSE ; TotalErrorCount = 0 ; XIicPs_MasterSend ( & IicInstance , & WriteBuffer , 1 , MuxIicAddr ) ; while ( TransmitComplete == FALSE ) { if ( 0 != TotalErrorCount ) { return XST_FAILURE ; } } while ( XIicPs_BusIsBusy ( & IicInstance ) ) ; ReceiveComplete = FALSE ; XIicPs_MasterRecv ( & IicInstance , & Buffer , 1 , MuxIicAddr ) ; while ( ReceiveComplete == FALSE ) { if ( 0 != TotalErrorCount ) { return XST_FAILURE ; } } while ( XIicPs_BusIsBusy ( & IicInstance ) ) ; return XST_SUCCESS ; }
This function initializes the IIC MUX to select the required channel.
This function initializes the IIC MUX to select the required channel .
/*
	 * Wait until bus is idle to start another transfer.
	 */ /*
	 * Receive the Data.
	 */ /*
	 * Wait until bus is idle to start another transfer.
	 */