XilinxProcessorIPLib/drivers/v_hdmitxss1/examples/xhdmi_example/idt_8t49n24x.c
static u8 IDT_8T49N24x_GetRegister(void *IicPtr, u8 I2CSlaveAddress,
							u16 RegisterAddress)
{
	u32 ByteCount = 0;
	u8 Buffer[2];
	u8 Data;
	u8 Retry = 0;
	u8 Exit;


	Exit = FALSE;
	Data = 0;

	do {
		/* Set Address */
		Buffer[0] = (RegisterAddress >> 8); 
		Buffer[1] = RegisterAddress & 0xff; 
		ByteCount = IDT_8T49N24x_I2cSend(IicPtr, I2CSlaveAddress, (u8*)Buffer,
									2, I2C_REPEATED_START);

		if (ByteCount != 2) {
			Retry++;
			
			/* Maximum retries */
			if (Retry == 255) {
				Exit = TRUE;
			}
		}

		/* Read data */
		else {
			/* Read data */
			ByteCount = IDT_8T49N24x_I2cRecv(IicPtr, I2CSlaveAddress,
							(u8*)Buffer, 1, I2C_STOP);
			if (ByteCount != 1) {
				Exit = FALSE;
			}

			else {
				Data = Buffer[0];
				Exit = TRUE;
			}
		}
	} while (!Exit);

	return Data;
}
/*****************************************************************************/
/**
*
* This function reads a single byte to the IDT 8T49N24x  
*
* @param I2CBaseAddress is the baseaddress of the I2C core.
* @param I2CSlaveAddress is the 7-bit I2C slave address.
*
* @return
*    - XST_SUCCESS Initialization was successful.
*    - XST_FAILURE I2C write error.
*
* @note None.
*
******************************************************************************/
This function reads a single byte to the IDT 8T49N24x
This function reads a single byte to the IDT 8T49N24x
static u8 IDT_8T49N24x_GetRegister(void *IicPtr, u8 I2CSlaveAddress,
							u16 RegisterAddress)
{
	u32 ByteCount = 0;
	u8 Buffer[2];
	u8 Data;
	u8 Retry = 0;
	u8 Exit;
	Exit = FALSE;
	Data = 0;
	do {
		Buffer[0] = (RegisterAddress >> 8); 
		Buffer[1] = RegisterAddress & 0xff; 
		ByteCount = IDT_8T49N24x_I2cSend(IicPtr, I2CSlaveAddress, (u8*)Buffer,
									2, I2C_REPEATED_START);
		if (ByteCount != 2) {
			Retry++;
			if (Retry == 255) {
				Exit = TRUE;
			}
		}
		else {
			ByteCount = IDT_8T49N24x_I2cRecv(IicPtr, I2CSlaveAddress,
							(u8*)Buffer, 1, I2C_STOP);
			if (ByteCount != 1) {
				Exit = FALSE;
			}
			else {
				Data = Buffer[0];
				Exit = TRUE;
			}
		}
	} while (!Exit);
	return Data;
}
static u8 IDT_8T49N24x_GetRegister ( void * IicPtr , u8 I2CSlaveAddress , u16 RegisterAddress ) { u32 ByteCount = 0 ; u8 Buffer [ 2 ] ; u8 Data ; u8 Retry = 0 ; u8 Exit ; Exit = FALSE ; Data = 0 ; do { Buffer [ 0 ] = ( RegisterAddress >> 8 ) ; Buffer [ 1 ] = RegisterAddress & 0xff ; ByteCount = IDT_8T49N24x_I2cSend ( IicPtr , I2CSlaveAddress , ( u8 * ) Buffer , 2 , I2C_REPEATED_START ) ; if ( ByteCount != 2 ) { Retry ++ ; if ( Retry == 255 ) { Exit = TRUE ; } } else { ByteCount = IDT_8T49N24x_I2cRecv ( IicPtr , I2CSlaveAddress , ( u8 * ) Buffer , 1 , I2C_STOP ) ; if ( ByteCount != 1 ) { Exit = FALSE ; } else { Data = Buffer [ 0 ] ; Exit = TRUE ; } } } while ( ! Exit ) ; return Data ; }
This function reads a single byte to the IDT 8T49N24x
This function reads a single byte to the IDT 8T49N24x
/* Set Address */ /* Maximum retries */ /* Read data */ /* Read data */