SMSC LAN91C111 32/16/8-Bit Three-In-One Fast Ethernet Controller

{

if (Data & 0x8000)

{WriteOneToPhy;} else

{WriteZeroToPhy;} Data <<= 1;

}

outport(0x308, 0x3330); return;

}

int ReadMDI()

{

int i; BankSelect(3); outport(0x308, 0x3330); outport(0x308, 0x3334); i = inport(0x308); outport(0x308, 0x3330); if (i & 0x0002)

{return 1; } else

{return 0; }

}

int ReadFromPhyReg(char RegNo)

{

int Data=0, binvalue, j; BankSelect(3);

//Write atleast 32 1's to Synchronize the interface. for (int i=0; i<=31; i++)

{

outport(0x308, 0x3339); outport(0x308, 0x333D);

}

//Start bits <01> WriteZeroToPhy

WriteOneToPhy

//Read command bits <10> WriteOneToPhy WriteZeroToPhy

//Phy Address, which is 00000 (MSBit first) WriteZeroToPhy

WriteZeroToPhy

SMSC AN 9.6

47

Revision 1.0 (08-14-08)

APPLICATION NOTE