mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-09 20:00:40 +00:00
Got link detection working on the Ethernet interface
This commit is contained in:
parent
bca2e179f9
commit
bbe5d156b7
2 changed files with 12 additions and 14 deletions
|
@ -188,10 +188,14 @@ void arp_test(void)
|
|||
|
||||
void init_network(void)
|
||||
{
|
||||
handle.Init.DuplexMode = ETH_MODE_FULLDUPLEX;
|
||||
handle.Init.DuplexMode = ETH_MODE_HALFDUPLEX;
|
||||
handle.Init.MACAddr = myMAC;
|
||||
handle.Init.ChecksumMode = ETH_CHECKSUM_BY_HARDWARE;
|
||||
handle.Init.InterruptEnableBits = 0;
|
||||
handle.Init.InterruptEnableBits = EIE_LINKIE;
|
||||
|
||||
debugstr("Setting MAC address to C0:FF:EE:C0:FF:EE.");
|
||||
debugcrlf();
|
||||
ENC_SetMacAddr(&handle);
|
||||
|
||||
debugstr("Starting network up.");
|
||||
debugcrlf();
|
||||
|
@ -202,7 +206,11 @@ void init_network(void)
|
|||
}
|
||||
debugcrlf();
|
||||
|
||||
debugstr("Setting MAC address to C0:FF:EE:C0:FF:EE.");
|
||||
debugstr("Waiting for ifup.");
|
||||
debugcrlf();
|
||||
while (!(handle.LinkStatus & PHSTAT2_LSTAT)) ENC_IRQHandler(&handle);
|
||||
|
||||
debugstr("Link status: ");
|
||||
debughex(((handle.LinkStatus & PHSTAT2_LSTAT) != 0));
|
||||
debugcrlf();
|
||||
ENC_SetMacAddr(&handle);
|
||||
}
|
||||
|
|
|
@ -885,16 +885,6 @@ bool ENC_Start(ENC_HandleTypeDef *handle)
|
|||
/* Enable the receiver */
|
||||
enc_bfsgreg(ENC_ECON1, ECON1_RXEN);
|
||||
|
||||
regval = enc_rdphy(handle, ENC_PHSTAT1) & PHSTAT1_LLSTAT;
|
||||
debugstr("Link status 1: ");
|
||||
debughex(regval);
|
||||
debugcrlf();
|
||||
|
||||
regval = enc_rdphy(handle, ENC_PHSTAT2) & PHSTAT2_LSTAT;
|
||||
debugstr("Link status 2: ");
|
||||
debughex(regval);
|
||||
debugcrlf();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue