SMSC LAN91C111 Switch User Manual


 
SMSC LAN91C111 32/16/8-Bit Three-In-One Fast Ethernet Controller
Revision 1.0 (08-14-08) 48 SMSC AN 9.6
APPLICATION NOTE
WriteZeroToPhy
WriteZeroToPhy
WriteZeroToPhy
//phy reg to read.. 5 bits..MSB First
for (i=0; i<5; i++)
{
if (RegNo & 0x10)
{WriteOneToPhy;}
else
{WriteZeroToPhy;}
RegNo <<= 1;
}
//Send the turnaround bit <Z>
WriteZToPhy;
Data = 0;
for (i=0; i<=15; i++)
{
Data <<= 1;
if (ReadMDI())
Data |= 0x0001;
}
//Send the turnaround bit. <Z>
WriteZToPhy;
return Data;
}
main()
{
BankSelect(0);
printf("\n\n\nResetting...");
outport(0x304, 0x8000);
outport(0x304, 0);
sleep(5);//5 Seconds delay (Just to be on the safer side)
/*
Please refer to the data sheet and/or application note for the exact
delay required here. */
printf("\nReady");
BankSelect(1);