XilinxProcessorIPLib/drivers/vphy/src/xvphy.c
u32 XVphy_SetPolarity(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId,
		XVphy_DirectionType Dir, u8 Polarity)
{
	u32 RegVal;
	u32 MaskVal;
	u32 RegOffset;

	/* Suppress Warning Messages */
	QuadId = QuadId;

	if (Dir == XVPHY_DIR_TX) {
		RegOffset = XVPHY_TX_CONTROL_REG;
		if (ChId == XVPHY_CHANNEL_ID_CHA) {
			MaskVal =  XVPHY_TX_CONTROL_TXPOLARITY_ALL_MASK;
		}
		else {
			MaskVal = XVPHY_TX_CONTROL_TXPOLARITY_MASK(ChId);
		}
	}
	else {
		RegOffset = XVPHY_RX_CONTROL_REG;
		if (ChId == XVPHY_CHANNEL_ID_CHA) {
			MaskVal = XVPHY_RX_CONTROL_RXPOLARITY_ALL_MASK;
		}
		else {
			MaskVal = XVPHY_RX_CONTROL_RXPOLARITY_MASK(ChId);
		}
	}

	/* Read TX|RX Control Register */
	RegVal = XVphy_ReadReg(InstancePtr->Config.BaseAddr, RegOffset);

	/* Clear Polarity Register bits */
	RegVal &= ~MaskVal;

	if (Polarity) {
		RegVal |= MaskVal;
	}
	XVphy_WriteReg(InstancePtr->Config.BaseAddr, RegOffset, RegVal);

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
* This function will set/clear the TX/RX polarity bit.
*
* @param	InstancePtr is a pointer to the XVphy core instance.
* @param	QuadId is the GT quad ID to operate on.
* @param	ChId is the channel ID which to operate on.
* @param	Dir is an indicator for TX or RX.
* @param	Polarity 0-Not inverted 1-Inverted
*
* @return
*		- XST_SUCCESS.
*
* @note		None.
*
******************************************************************************/
This function will set/clear the TX/RX polarity bit.
This function will set / clear the TX / RX polarity bit .
u32 XVphy_SetPolarity(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId,
		XVphy_DirectionType Dir, u8 Polarity)
{
	u32 RegVal;
	u32 MaskVal;
	u32 RegOffset;
	QuadId = QuadId;
	if (Dir == XVPHY_DIR_TX) {
		RegOffset = XVPHY_TX_CONTROL_REG;
		if (ChId == XVPHY_CHANNEL_ID_CHA) {
			MaskVal =  XVPHY_TX_CONTROL_TXPOLARITY_ALL_MASK;
		}
		else {
			MaskVal = XVPHY_TX_CONTROL_TXPOLARITY_MASK(ChId);
		}
	}
	else {
		RegOffset = XVPHY_RX_CONTROL_REG;
		if (ChId == XVPHY_CHANNEL_ID_CHA) {
			MaskVal = XVPHY_RX_CONTROL_RXPOLARITY_ALL_MASK;
		}
		else {
			MaskVal = XVPHY_RX_CONTROL_RXPOLARITY_MASK(ChId);
		}
	}
	RegVal = XVphy_ReadReg(InstancePtr->Config.BaseAddr, RegOffset);
	RegVal &= ~MaskVal;
	if (Polarity) {
		RegVal |= MaskVal;
	}
	XVphy_WriteReg(InstancePtr->Config.BaseAddr, RegOffset, RegVal);
	return XST_SUCCESS;
}
u32 XVphy_SetPolarity ( XVphy * InstancePtr , u8 QuadId , XVphy_ChannelId ChId , XVphy_DirectionType Dir , u8 Polarity ) { u32 RegVal ; u32 MaskVal ; u32 RegOffset ; QuadId = QuadId ; if ( Dir == XVPHY_DIR_TX ) { RegOffset = XVPHY_TX_CONTROL_REG ; if ( ChId == XVPHY_CHANNEL_ID_CHA ) { MaskVal = XVPHY_TX_CONTROL_TXPOLARITY_ALL_MASK ; } else { MaskVal = XVPHY_TX_CONTROL_TXPOLARITY_MASK ( ChId ) ; } } else { RegOffset = XVPHY_RX_CONTROL_REG ; if ( ChId == XVPHY_CHANNEL_ID_CHA ) { MaskVal = XVPHY_RX_CONTROL_RXPOLARITY_ALL_MASK ; } else { MaskVal = XVPHY_RX_CONTROL_RXPOLARITY_MASK ( ChId ) ; } } RegVal = XVphy_ReadReg ( InstancePtr -> Config . BaseAddr , RegOffset ) ; RegVal &= ~ MaskVal ; if ( Polarity ) { RegVal |= MaskVal ; } XVphy_WriteReg ( InstancePtr -> Config . BaseAddr , RegOffset , RegVal ) ; return XST_SUCCESS ; }
This function will set/clear the TX/RX polarity bit.
This function will set / clear the TX / RX polarity bit .
/* Suppress Warning Messages */ /* Read TX|RX Control Register */ /* Clear Polarity Register bits */