Xilinx Temac link detect

John Linn John.Linn at xilinx.com
Fri Mar 7 09:14:44 EST 2008


Hi Kevin,

I couldn't find any example laying around, so I took a shot at it based
on other non-network examples we had. I've not personally done it so
bear that in mind.

I have not tried to compile any of this, just stole parts for places and
pasted in.

Hope it helps,
John

#include <ioctl.h>

	/*
 	 * FD of the IIC device opened.
 	 */
	int Fdtemac;

	struct mii_ioctl_data ioctl_data;	

	/*
	 * Open the device.
	 */
	Fdtemac = open("/dev/TBD", O_RDWR);
	if(Fdtemac < 0)
	{
		printf("Cannot open the temac device\n");
		return -1;
	}

	/* setup the inputs to the ioctl call */

	ioctl_data.phy_num = TBD;
	ioctl_data.reg_num = TBD;
	
	/*
	 * Read the phy register
	 */
	Register = ioctl(Fdtemac, SIOCGMIIREG, &ioctl_data);
	if(Status < 0)
	{
		/* failure */
		return 0;
	}

	/* results should be in ioctl_data.val_out I think

}



More information about the Linuxppc-embedded mailing list