XilinxProcessorIPLib/drivers/board_common/src/rfclk/src/xrfclk.c
static u32 XRFClk_getConfig_fromLMK(u32 ChipId, u32 *in, u32 *out)
{
#ifdef XPS_BOARD_ZCU111
	(void)ChipId;
	(void)in;
	(void)out;
	LOG("not supported");
	return XST_FAILURE;
#else
	u8 data[3];
	u8 tx[4];
	tx[0] = SELECT_SPI_SDO(ChipId);

	for (int i = 0; i < LMK_COUNT; i++) {
		data[0] = 0xff & (in[i] >> 16);
		data[1] = 0xff & (in[i] >> 8);
		tx[1] = data[0];
		tx[2] = data[1];

		if ((((in[i]) >> 8) & 0xffff) == LMK_MUXOUT_REG_ADDR) {
			out[i] = 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;
		}

		out[i] = (data[0] << 16) + (data[1] << 8) + data[2];
	}
#endif
	return XST_SUCCESS;
}
/****************************************************************************/
/**
*
* This function is used to get config from LMK.
*
* @param	ChipId indicates the RF clock chip Id.
* @param	in pointer to array of data read from the chip registers.
* @param	out 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_fromLMK(u32 ChipId, u32 *in, u32 *out)
{
#ifdef XPS_BOARD_ZCU111
	(void)ChipId;
	(void)in;
	(void)out;
	LOG("not supported");
	return XST_FAILURE;
#else
	u8 data[3];
	u8 tx[4];
	tx[0] = SELECT_SPI_SDO(ChipId);
	for (int i = 0; i < LMK_COUNT; i++) {
		data[0] = 0xff & (in[i] >> 16);
		data[1] = 0xff & (in[i] >> 8);
		tx[1] = data[0];
		tx[2] = data[1];
		if ((((in[i]) >> 8) & 0xffff) == LMK_MUXOUT_REG_ADDR) {
			out[i] = 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;
		}
		out[i] = (data[0] << 16) + (data[1] << 8) + data[2];
	}
#endif
	return XST_SUCCESS;
}
static u32 XRFClk_getConfig_fromLMK ( u32 ChipId , u32 * in , u32 * out ) { #ifdef XPS_BOARD_ZCU111 ( void ) ChipId ; ( void ) in ; ( void ) out ; LOG ( " " ) ; return XST_FAILURE ; #else u8 data [ 3 ] ; u8 tx [ 4 ] ; tx [ 0 ] = SELECT_SPI_SDO ( ChipId ) ; for ( int i = 0 ; i < LMK_COUNT ; i ++ ) { data [ 0 ] = 0xff & ( in [ i ] >> 16 ) ; data [ 1 ] = 0xff & ( in [ i ] >> 8 ) ; tx [ 1 ] = data [ 0 ] ; tx [ 2 ] = data [ 1 ] ; if ( ( ( ( in [ i ] ) >> 8 ) & 0xffff ) == LMK_MUXOUT_REG_ADDR ) { out [ i ] = 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 ; } out [ i ] = ( data [ 0 ] << 16 ) + ( data [ 1 ] << 8 ) + data [ 2 ] ; } #endif return XST_SUCCESS ; }
This function is used to get config from LMK.
This function is used to get config from LMK .
/* Read register */