XilinxProcessorIPLib/drivers/board_common/src/rfclk/src/xrfclk.c
static u32 XRFClk_getConfig_fromLMX(u32 ChipId, u32 *d)
{
	u8 data[3] = { 0, 0, 0 };
	u8 tx[4] = { SELECT_SPI_SDO(ChipId), data[0], data[1], data[2] };
	for (int i = 0; i < LMX2594_COUNT; i++, d++) {
		data[0] = i;

		if (data[0] == LMX_MUXOUT_REG_ADDR) {
			*d = MuxOutRegStorage[ChipId];
			continue;
		}

		/* Read register */
		tx[1] = data[0] | RF_DATA_READ_BIT;
		if (XST_FAILURE == XRFClk_I2CWrData(FD_BRIDGE,
						    I2C_ADDR_I2C2SPI_BRIDGE, tx,
						    4)) {
			LOG("write reg");
			return XST_FAILURE;
		}
		if (XST_FAILURE == XRFClk_I2CRdData(FD_BRIDGE,
						    I2C_ADDR_I2C2SPI_BRIDGE,
						    data, 3)) {
			LOG("read reg");
			return XST_FAILURE;
		}

		*d = (data[0] << 16) + (data[1] << 8) + data[2];
	}
	return XST_SUCCESS;
}
/****************************************************************************/
/**
*
* This function is used to get config from LMK.
*
* @param	ChipId indicates the RF clock chip Id.
* @param	d pointer to array of data read from the chip registers.
*
* @return
*	- XST_SUCCESS if successful.
*	- XST_FAILURE if failed.
*
* @note		None
*
****************************************************************************/
This function is used to get config from LMK.
This function is used to get config from LMK .
static u32 XRFClk_getConfig_fromLMX(u32 ChipId, u32 *d)
{
	u8 data[3] = { 0, 0, 0 };
	u8 tx[4] = { SELECT_SPI_SDO(ChipId), data[0], data[1], data[2] };
	for (int i = 0; i < LMX2594_COUNT; i++, d++) {
		data[0] = i;
		if (data[0] == LMX_MUXOUT_REG_ADDR) {
			*d = MuxOutRegStorage[ChipId];
			continue;
		}
		tx[1] = data[0] | RF_DATA_READ_BIT;
		if (XST_FAILURE == XRFClk_I2CWrData(FD_BRIDGE,
						    I2C_ADDR_I2C2SPI_BRIDGE, tx,
						    4)) {
			LOG("write reg");
			return XST_FAILURE;
		}
		if (XST_FAILURE == XRFClk_I2CRdData(FD_BRIDGE,
						    I2C_ADDR_I2C2SPI_BRIDGE,
						    data, 3)) {
			LOG("read reg");
			return XST_FAILURE;
		}
		*d = (data[0] << 16) + (data[1] << 8) + data[2];
	}
	return XST_SUCCESS;
}
static u32 XRFClk_getConfig_fromLMX ( u32 ChipId , u32 * d ) { u8 data [ 3 ] = { 0 , 0 , 0 } ; u8 tx [ 4 ] = { SELECT_SPI_SDO ( ChipId ) , data [ 0 ] , data [ 1 ] , data [ 2 ] } ; for ( int i = 0 ; i < LMX2594_COUNT ; i ++ , d ++ ) { data [ 0 ] = i ; if ( data [ 0 ] == LMX_MUXOUT_REG_ADDR ) { * d = MuxOutRegStorage [ ChipId ] ; continue ; } tx [ 1 ] = data [ 0 ] | RF_DATA_READ_BIT ; if ( XST_FAILURE == XRFClk_I2CWrData ( FD_BRIDGE , I2C_ADDR_I2C2SPI_BRIDGE , tx , 4 ) ) { LOG ( " " ) ; return XST_FAILURE ; } if ( XST_FAILURE == XRFClk_I2CRdData ( FD_BRIDGE , I2C_ADDR_I2C2SPI_BRIDGE , data , 3 ) ) { LOG ( " " ) ; return XST_FAILURE ; } * d = ( data [ 0 ] << 16 ) + ( data [ 1 ] << 8 ) + data [ 2 ] ; } return XST_SUCCESS ; }
This function is used to get config from LMK.
This function is used to get config from LMK .
/* Read register */