firmware: rst active_rpt if eth link is not active

This commit is contained in:
linuswck 2024-04-18 17:32:58 +08:00
parent 0e087c6992
commit 4116962175
2 changed files with 6 additions and 3 deletions

View File

@ -72,7 +72,9 @@ fn main() -> ! {
loop { loop {
wd.feed(); wd.feed();
net::net::eth_poll_and_update_link_speed(); if !net::net::eth_poll_link_status_and_update_link_speed() {
active_report = [false; net::net::NUM_OF_SOCKETS];
}
match state { match state {
State::LoadFlashSettings => { State::LoadFlashSettings => {

View File

@ -352,13 +352,14 @@ impl<M: Miim> EthernetPhy<M> {
} }
} }
pub fn eth_poll_and_update_link_speed() { pub fn eth_poll_link_status_and_update_link_speed() -> bool {
unsafe { unsafe {
if let Some(ref mut server_handle ) = SERVER_HANDLE { if let Some(ref mut server_handle ) = SERVER_HANDLE {
server_handle.update_link_speed(); server_handle.update_link_speed();
return server_handle.link_was_up;
} }
else { else {
panic!("eth_poll_and_update_link_speed is called before init"); panic!("eth_poll_link_status_and_update_link_speed is called before init");
} }
} }
} }