SMSC LAN91C111
outport(0x308, 0x333D);\ outport(0x308, 0x3339);
#define WriteZToPhy \
outport(0x308, 0x3330);\ outport(0x308, 0x3334);\ outport(0x308, 0x3330);
void WriteToPhyReg(char RegNo, int Data)
{
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;
//Command bits <Write=01> WriteZeroToPhy; WriteOneToPhy;
//Phy Address, which is 00000 for LAN91C111's internal PHY WriteZeroToPhy;
WriteZeroToPhy;
WriteZeroToPhy;
WriteZeroToPhy;
WriteZeroToPhy;
//PHY reg to write.. 5 bits.. (MSBit goes first) for (i=0; i<5; i++)
{
if (RegNo & 0x10)
{WriteOneToPhy;} else
{WriteZeroToPhy;} RegNo <<= 1;
}
//Send the turnaround bit <10> WriteOneToPhy; WriteOneToPhy;
for (i=0; i<16; i++)
Revision 1.0 | 46 | SMSC AN 9.6 |
APPLICATION NOTE