XilinxProcessorIPLib/drivers/dp14txss/examples/src/kcu_dp14/si_5344.c
void SI_5344_RegisterDump(u32 I2CBaseAddress, u8 I2CSlaveAddress)
{
	u32 ByteCount = 0;
	u8 Buffer[256];
	int i;
	int page;

	print("\n\r");
	print("-----------------------\n\r");
	print("- SI 5344 I2C dump:\n\r");
	print("-----------------------\n\r");
	
	for (page=0; page<3; page++) {
		xil_printf("\n\rpage %d\n\r", page);

		/* Page */
		Buffer[0] = 1;
		Buffer[1] = page;
		ByteCount = XIic_Send(I2CBaseAddress, I2CSlaveAddress,
				      (u8*)Buffer, 2, XIIC_STOP);
		if (ByteCount != 2) {
			xil_printf("I2C write error: %d\n\r", ByteCount);
		}

		/* Register address */
		Buffer[0] = 0;
		ByteCount = XIic_Send(I2CBaseAddress, I2CSlaveAddress,
				      (u8*)Buffer, 1, XIIC_REPEATED_START);
		if (ByteCount != 1) {
			xil_printf("I2C write error: %d\n\r", ByteCount);
		}

		/* Read page */
		ByteCount = XIic_Recv(I2CBaseAddress, I2CSlaveAddress,
				      (u8*)Buffer, 256, XIIC_STOP);
		if (ByteCount != 256) {
			xil_printf("I2C read error: %d\n\r", ByteCount);
		}

		xil_printf("      ");
		for (i=0; i<16; i++)
			xil_printf("+%01x ", i);

		xil_printf("\n\r      ");
		for (i=0; i<16; i++)
			xil_printf("---");
		
		for (i = 0; i < ByteCount; i++) {
			if ((i % 16) == 0) {
				xil_printf("\n\r%01x%02x : ", page, i);
			}
			xil_printf("%02x ", Buffer[i]);
		}
	}

	print("\n\r");
}
/*****************************************************************************/
/**
*
* This function displays a registerdump of the SI 5344 device.
*
* @param I2CBaseAddress is the baseaddress of the I2C core.
* @param I2CSlaveAddress is the 7-bit I2C slave address.
*
* @return None
*
* @note None.
*
******************************************************************************/
This function displays a registerdump of the SI 5344 device.
This function displays a registerdump of the SI 5344 device .
void SI_5344_RegisterDump(u32 I2CBaseAddress, u8 I2CSlaveAddress)
{
	u32 ByteCount = 0;
	u8 Buffer[256];
	int i;
	int page;
	print("\n\r");
	print("-----------------------\n\r");
	print("- SI 5344 I2C dump:\n\r");
	print("-----------------------\n\r");
	for (page=0; page<3; page++) {
		xil_printf("\n\rpage %d\n\r", page);
		Buffer[0] = 1;
		Buffer[1] = page;
		ByteCount = XIic_Send(I2CBaseAddress, I2CSlaveAddress,
				      (u8*)Buffer, 2, XIIC_STOP);
		if (ByteCount != 2) {
			xil_printf("I2C write error: %d\n\r", ByteCount);
		}
		Buffer[0] = 0;
		ByteCount = XIic_Send(I2CBaseAddress, I2CSlaveAddress,
				      (u8*)Buffer, 1, XIIC_REPEATED_START);
		if (ByteCount != 1) {
			xil_printf("I2C write error: %d\n\r", ByteCount);
		}
		ByteCount = XIic_Recv(I2CBaseAddress, I2CSlaveAddress,
				      (u8*)Buffer, 256, XIIC_STOP);
		if (ByteCount != 256) {
			xil_printf("I2C read error: %d\n\r", ByteCount);
		}
		xil_printf("      ");
		for (i=0; i<16; i++)
			xil_printf("+%01x ", i);
		xil_printf("\n\r      ");
		for (i=0; i<16; i++)
			xil_printf("---");
		for (i = 0; i < ByteCount; i++) {
			if ((i % 16) == 0) {
				xil_printf("\n\r%01x%02x : ", page, i);
			}
			xil_printf("%02x ", Buffer[i]);
		}
	}
	print("\n\r");
}
void SI_5344_RegisterDump ( u32 I2CBaseAddress , u8 I2CSlaveAddress ) { u32 ByteCount = 0 ; u8 Buffer [ 256 ] ; int i ; int page ; print ( " \n \r " ) ; print ( " \n \r " ) ; print ( " \n \r " ) ; print ( " \n \r " ) ; for ( page = 0 ; page < 3 ; page ++ ) { xil_printf ( " \n \r \n \r " , page ) ; Buffer [ 0 ] = 1 ; Buffer [ 1 ] = page ; ByteCount = XIic_Send ( I2CBaseAddress , I2CSlaveAddress , ( u8 * ) Buffer , 2 , XIIC_STOP ) ; if ( ByteCount != 2 ) { xil_printf ( " \n \r " , ByteCount ) ; } Buffer [ 0 ] = 0 ; ByteCount = XIic_Send ( I2CBaseAddress , I2CSlaveAddress , ( u8 * ) Buffer , 1 , XIIC_REPEATED_START ) ; if ( ByteCount != 1 ) { xil_printf ( " \n \r " , ByteCount ) ; } ByteCount = XIic_Recv ( I2CBaseAddress , I2CSlaveAddress , ( u8 * ) Buffer , 256 , XIIC_STOP ) ; if ( ByteCount != 256 ) { xil_printf ( " \n \r " , ByteCount ) ; } xil_printf ( " " ) ; for ( i = 0 ; i < 16 ; i ++ ) xil_printf ( " " , i ) ; xil_printf ( " \n \r " ) ; for ( i = 0 ; i < 16 ; i ++ ) xil_printf ( " " ) ; for ( i = 0 ; i < ByteCount ; i ++ ) { if ( ( i % 16 ) == 0 ) { xil_printf ( " \n \r " , page , i ) ; } xil_printf ( " " , Buffer [ i ] ) ; } } print ( " \n \r " ) ; }
This function displays a registerdump of the SI 5344 device.
This function displays a registerdump of the SI 5344 device .
/* Page */ /* Register address */ /* Read page */