XilinxProcessorIPLib/drivers/axiethernet/examples/avb/xavb_example.c
static int AvbEnterPhyLoopBack(XAxiEthernet *InstancePtr)
{
	u16 PhyReg0;
	signed int PhyAddr;
	u16 PhyReg;

	for (PhyAddr = 31; PhyAddr >= 0; PhyAddr--) {
		XAxiEthernet_PhyRead(&AxiEthernetInstance, PhyAddr,
						PHY_DETECT_REG, &PhyReg);
		if ((PhyReg != 0xFFFF) && ((PhyReg & PHY_DETECT_MASK)
						== PHY_DETECT_MASK)) {
			/* Found a valid PHY address */
			break;
		}
	}

	if(PhyAddr == 0)
		return XST_FAILURE;
	/*
	 * Clear the PHY of any existing bits by zeroing this out
	 */
	PhyReg0 = 0;
	PhyReg0 |= PHY_R0_DFT_SPD_1000;

	/*
	 * Set the speed and put the PHY in reset, then put the PHY in loopback
	 */
	XAxiEthernet_PhyWrite(&AxiEthernetInstance, PhyAddr, 0,
						PhyReg0 | PHY_R0_RESET);
	AvbUtilPhyDelay(1);
	XAxiEthernet_PhyRead(&AxiEthernetInstance, PhyAddr, 0,&PhyReg0);
	XAxiEthernet_PhyWrite(&AxiEthernetInstance, PhyAddr, 0,
						PhyReg0 | PHY_R0_LOOPBACK);
	AvbUtilPhyDelay(1);

	return XST_SUCCESS;
}
/******************************************************************************/
/**
*
* This function sets the PHY to loopback mode. This works with the marvell PHY
* common on Xilinx evaluation boards. This sets the PHY speed to 1000 Mbps.
*
* @param	AxiEthernetInstancePtr is a pointer to the instance of the
*		AxiEthernet component.
*
* @return	- XST_SUCCESS if successful.
*		- XST_FAILURE, in case of failure..
*
* @note		None.
*
******************************************************************************/
This function sets the PHY to loopback mode. This works with the marvell PHY
common on Xilinx evaluation boards. This sets the PHY speed to 1000 Mbps.
This function sets the PHY to loopback mode . This works with the marvell PHY common on Xilinx evaluation boards . This sets the PHY speed to 1000 Mbps .
static int AvbEnterPhyLoopBack(XAxiEthernet *InstancePtr)
{
	u16 PhyReg0;
	signed int PhyAddr;
	u16 PhyReg;
	for (PhyAddr = 31; PhyAddr >= 0; PhyAddr--) {
		XAxiEthernet_PhyRead(&AxiEthernetInstance, PhyAddr,
						PHY_DETECT_REG, &PhyReg);
		if ((PhyReg != 0xFFFF) && ((PhyReg & PHY_DETECT_MASK)
						== PHY_DETECT_MASK)) {
			break;
		}
	}
	if(PhyAddr == 0)
		return XST_FAILURE;
	PhyReg0 = 0;
	PhyReg0 |= PHY_R0_DFT_SPD_1000;
	XAxiEthernet_PhyWrite(&AxiEthernetInstance, PhyAddr, 0,
						PhyReg0 | PHY_R0_RESET);
	AvbUtilPhyDelay(1);
	XAxiEthernet_PhyRead(&AxiEthernetInstance, PhyAddr, 0,&PhyReg0);
	XAxiEthernet_PhyWrite(&AxiEthernetInstance, PhyAddr, 0,
						PhyReg0 | PHY_R0_LOOPBACK);
	AvbUtilPhyDelay(1);
	return XST_SUCCESS;
}
static int AvbEnterPhyLoopBack ( XAxiEthernet * InstancePtr ) { u16 PhyReg0 ; signed int PhyAddr ; u16 PhyReg ; for ( PhyAddr = 31 ; PhyAddr >= 0 ; PhyAddr -- ) { XAxiEthernet_PhyRead ( & AxiEthernetInstance , PhyAddr , PHY_DETECT_REG , & PhyReg ) ; if ( ( PhyReg != 0xFFFF ) && ( ( PhyReg & PHY_DETECT_MASK ) == PHY_DETECT_MASK ) ) { break ; } } if ( PhyAddr == 0 ) return XST_FAILURE ; PhyReg0 = 0 ; PhyReg0 |= PHY_R0_DFT_SPD_1000 ; XAxiEthernet_PhyWrite ( & AxiEthernetInstance , PhyAddr , 0 , PhyReg0 | PHY_R0_RESET ) ; AvbUtilPhyDelay ( 1 ) ; XAxiEthernet_PhyRead ( & AxiEthernetInstance , PhyAddr , 0 , & PhyReg0 ) ; XAxiEthernet_PhyWrite ( & AxiEthernetInstance , PhyAddr , 0 , PhyReg0 | PHY_R0_LOOPBACK ) ; AvbUtilPhyDelay ( 1 ) ; return XST_SUCCESS ; }
This function sets the PHY to loopback mode.
This function sets the PHY to loopback mode .
/* Found a valid PHY address */ /*
	 * Clear the PHY of any existing bits by zeroing this out
	 */ /*
	 * Set the speed and put the PHY in reset, then put the PHY in loopback
	 */