[an error occurred while processing this directive]
|
/*==============================================================================*/
static cyg_uint16 i82559_mdio_read(cyg_uint32 ioaddr, cyg_uint32 regno)
{cyg_uint32 v1, v2, v3;
int counter;
for(counter=0x100000, v1=0; counter>0 && !(v1 & 0x10000000); counter--)
v1 = INL(ioaddr + SCBCtrlMDI);
v3 = INL(ioaddr +SCBStatus);
if(counter <=0) console_printf(" status error=%x reg= %x\n", v3, v1);
v1=0x08000000 | (regno<<16) | (0x01<<21);
OUTL(v1, ioaddr + SCBCtrlMDI);
counter=0x100000;
do {v2 = INL(ioaddr + SCBCtrlMDI);
if (--counter < 0)
{v3 = INL(ioaddr +SCBStatus);
console_printf(" i82559_mdio_read(%x) timed out with val = %08x status= %x.\n", v1, v2, v3);
break;
}
} while (! (v2 & 0x10000000));
return (cyg_uint16) (v2 & 0x00ffff);
}
/*==============================================================================*/
static void i82559_mdio_write(cyg_uint32 ioaddr, cyg_uint32 regno, cyg_uint32 val)
{cyg_uint32 v1, v2, v3;
int counter;
for(counter=0x100000, v1=0; counter>0 && !(v1 & 0x10000000); counter--)
v1 = INL(ioaddr + SCBCtrlMDI);
v3 = INL(ioaddr +SCBStatus);
if(counter <=0) console_printf(" status error=%x reg= %x\n", v3, v1);
v1=0x08000000 | (regno<<16) | (0x01<<21)| val;
OUTL(v1 , ioaddr + SCBCtrlMDI);
counter=0x100000;
do {v2 = INL(ioaddr + SCBCtrlMDI);
if (--counter < 0)
{v3 = INL(ioaddr +SCBStatus);
console_printf(" i82559_mdio_write(%x) timed out with val = %08x status= %x.\n", v1,v2,v3);
break;
}
} while (! (val & 0x10000000));
return;
}
/*=======================================================================================================*/
// Function : i82559_status
void i82559_dump_mdc( cyg_uint32 ioaddr)
{cyg_uint32 i,v;
v = INL(ioaddr +SCBStatus);
console_printf("\r\n MDIdump: status=%x\n", v);
for(i=0; i<16; i++)
{v=i82559_mdio_read( ioaddr, i); console_printf(" \t\tMDI%d= %02x \n", i, v);}
return;
}