XilinxProcessorIPLib/drivers/board_common/src/rfclk/src/xrfclk.c
static int XRFClk_MuxSPISDO(u8 ChipId)
{
	u32 ret;
	u8 tx[4];

#ifdef XPS_BOARD_ZCU111
	Xil_AssertNonvoid(ChipId != RFCLK_LMK);
#endif

	/* Set the Output MUX pin on a RFclk chip to SPI SDO */
	tx[0] = SELECT_SPI_SDO(ChipId);
	tx[1] = (MuxOutRegStorage[ChipId] >> 16) & 0xff;
	tx[2] = (MuxOutRegStorage[ChipId] >> 8) & 0xff;

	if (ChipId == RFCLK_LMK)
		tx[3] = LMK_MUXOUT_REG_VAL;
	else
		tx[3] = (MuxOutRegStorage[ChipId] & 0xff) & ~MUXOUT_LD_SEL_BIT;

	ret = XRFClk_I2CWrData(FD_BRIDGE, I2C_ADDR_I2C2SPI_BRIDGE, tx, 4);
	if (XST_FAILURE == ret) {
		LOG("write I2C2SPI bridge");
		return XST_FAILURE;
	}

	/* Set the MUX_SEL GPIOs to connect appropriate SPI SDO */
	if (XST_FAILURE == XRFClk_MUX_SPI_SDO_GPIOPin(ChipId)) {
		LOG("write gpio to MUX to clk104 chip");
		return XST_FAILURE;
	}

	return XST_SUCCESS;
}
/****************************************************************************/
/**
*
* This function is used to connect MUX for read from the selected chip. The
* function also reconfigure the MUXOUT pin to act as a SPI SDO. The previous
* setting has been saved.
*
* @param	ChipId indicates the RF clock chip Id.
*
* @return
*	- XST_SUCCESS if successful.
*	- XST_FAILURE if failed.
*
* @note		None
*
****************************************************************************/
This function is used to connect MUX for read from the selected chip. The
function also reconfigure the MUXOUT pin to act as a SPI SDO. The previous
setting has been saved.
This function is used to connect MUX for read from the selected chip . The function also reconfigure the MUXOUT pin to act as a SPI SDO . The previous setting has been saved .
static int XRFClk_MuxSPISDO(u8 ChipId)
{
	u32 ret;
	u8 tx[4];
#ifdef XPS_BOARD_ZCU111
	Xil_AssertNonvoid(ChipId != RFCLK_LMK);
#endif
	tx[0] = SELECT_SPI_SDO(ChipId);
	tx[1] = (MuxOutRegStorage[ChipId] >> 16) & 0xff;
	tx[2] = (MuxOutRegStorage[ChipId] >> 8) & 0xff;
	if (ChipId == RFCLK_LMK)
		tx[3] = LMK_MUXOUT_REG_VAL;
	else
		tx[3] = (MuxOutRegStorage[ChipId] & 0xff) & ~MUXOUT_LD_SEL_BIT;
	ret = XRFClk_I2CWrData(FD_BRIDGE, I2C_ADDR_I2C2SPI_BRIDGE, tx, 4);
	if (XST_FAILURE == ret) {
		LOG("write I2C2SPI bridge");
		return XST_FAILURE;
	}
	if (XST_FAILURE == XRFClk_MUX_SPI_SDO_GPIOPin(ChipId)) {
		LOG("write gpio to MUX to clk104 chip");
		return XST_FAILURE;
	}
	return XST_SUCCESS;
}
static int XRFClk_MuxSPISDO ( u8 ChipId ) { u32 ret ; u8 tx [ 4 ] ; #ifdef XPS_BOARD_ZCU111 Xil_AssertNonvoid ( ChipId != RFCLK_LMK ) ; #endif tx [ 0 ] = SELECT_SPI_SDO ( ChipId ) ; tx [ 1 ] = ( MuxOutRegStorage [ ChipId ] >> 16 ) & 0xff ; tx [ 2 ] = ( MuxOutRegStorage [ ChipId ] >> 8 ) & 0xff ; if ( ChipId == RFCLK_LMK ) tx [ 3 ] = LMK_MUXOUT_REG_VAL ; else tx [ 3 ] = ( MuxOutRegStorage [ ChipId ] & 0xff ) & ~ MUXOUT_LD_SEL_BIT ; ret = XRFClk_I2CWrData ( FD_BRIDGE , I2C_ADDR_I2C2SPI_BRIDGE , tx , 4 ) ; if ( XST_FAILURE == ret ) { LOG ( " " ) ; return XST_FAILURE ; } if ( XST_FAILURE == XRFClk_MUX_SPI_SDO_GPIOPin ( ChipId ) ) { LOG ( " " ) ; return XST_FAILURE ; } return XST_SUCCESS ; }
This function is used to connect MUX for read from the selected chip.
This function is used to connect MUX for read from the selected chip .
/* Set the Output MUX pin on a RFclk chip to SPI SDO */ /* Set the MUX_SEL GPIOs to connect appropriate SPI SDO */