XilinxProcessorIPLib/drivers/board_common/src/rfclk/src/xrfclk.c
u32 XRFClk_WriteReg(u32 ChipId, u32 d)
{
	Xil_AssertNonvoid(ChipId < RFCLK_CHIP_NUM);

	u8 tx[4] = { SELECT_SPI_SDO(ChipId), (d >> 16) & 0xff, (d >> 8) & 0xff,
		     d & 0xff };

	/* Check is this the register which controls output Mux control */
	if (ChipId == RFCLK_LMK) {
#ifdef XPS_BOARD_ZCU111
		return XRFClk_WriteRegToLMK04208(ChipId, d);
#else
		if (((d >> LMK_ADDRESS_SHIFT) & LMK_ADDRESS_BITFIELD) ==
		    LMK_MUXOUT_REG_ADDR)
			MuxOutRegStorage[ChipId] = d;
#endif
	} else {
		if (((d >> LMX_ADDRESS_SHIFT) & LMX_ADDRESS_BITFIELD) ==
		    LMX_MUXOUT_REG_ADDR)
			MuxOutRegStorage[ChipId] = d;
	}
	/* Write register */
	return XRFClk_I2CWrData(FD_BRIDGE, I2C_ADDR_I2C2SPI_BRIDGE, tx, 4);
}
/****************************************************************************/
/**
*
* This function is used to write a register on one of LMX2594 or LMX04828.
*
* @param	ChipId indicates the RF clock chip Id.
* @param	d = {D2, D1, D0}
*	Where [D0,D1,D2] bits are:
*		LMK04282:
*			bit [23] - 1-bit command field (R/W)
*			bits [22:21] - 2-bit multi-byte field (W1, W0)
*			bits [20:8] - 13-bit address field (A12 to A0)
*			bits [7-0]- 8-bit data field (D7 to D0).
*		LMX2594:
*			bit [23] - 1-bit command field (R/W)
*			bits [22:16] - 7-bit address field (A6 to A0)
*			bits [15-0]- 16-bit data field (D15 to D0).
*
* @return
*	- XST_SUCCESS if successful.
*	- XST_FAILURE if failed.
*
* @note		None
*
****************************************************************************/
This function is used to write a register on one of LMX2594 or LMX04828.
This function is used to write a register on one of LMX2594 or LMX04828 .
u32 XRFClk_WriteReg(u32 ChipId, u32 d)
{
	Xil_AssertNonvoid(ChipId < RFCLK_CHIP_NUM);
	u8 tx[4] = { SELECT_SPI_SDO(ChipId), (d >> 16) & 0xff, (d >> 8) & 0xff,
		     d & 0xff };
	if (ChipId == RFCLK_LMK) {
#ifdef XPS_BOARD_ZCU111
		return XRFClk_WriteRegToLMK04208(ChipId, d);
#else
		if (((d >> LMK_ADDRESS_SHIFT) & LMK_ADDRESS_BITFIELD) ==
		    LMK_MUXOUT_REG_ADDR)
			MuxOutRegStorage[ChipId] = d;
#endif
	} else {
		if (((d >> LMX_ADDRESS_SHIFT) & LMX_ADDRESS_BITFIELD) ==
		    LMX_MUXOUT_REG_ADDR)
			MuxOutRegStorage[ChipId] = d;
	}
	return XRFClk_I2CWrData(FD_BRIDGE, I2C_ADDR_I2C2SPI_BRIDGE, tx, 4);
}
u32 XRFClk_WriteReg ( u32 ChipId , u32 d ) { Xil_AssertNonvoid ( ChipId < RFCLK_CHIP_NUM ) ; u8 tx [ 4 ] = { SELECT_SPI_SDO ( ChipId ) , ( d >> 16 ) & 0xff , ( d >> 8 ) & 0xff , d & 0xff } ; if ( ChipId == RFCLK_LMK ) { #ifdef XPS_BOARD_ZCU111 return XRFClk_WriteRegToLMK04208 ( ChipId , d ) ; #else if ( ( ( d >> LMK_ADDRESS_SHIFT ) & LMK_ADDRESS_BITFIELD ) == LMK_MUXOUT_REG_ADDR ) MuxOutRegStorage [ ChipId ] = d ; #endif } else { if ( ( ( d >> LMX_ADDRESS_SHIFT ) & LMX_ADDRESS_BITFIELD ) == LMX_MUXOUT_REG_ADDR ) MuxOutRegStorage [ ChipId ] = d ; } return XRFClk_I2CWrData ( FD_BRIDGE , I2C_ADDR_I2C2SPI_BRIDGE , tx , 4 ) ; }
This function is used to write a register on one of LMX2594 or LMX04828.
This function is used to write a register on one of LMX2594 or LMX04828 .
/* Check is this the register which controls output Mux control */ /* Write register */