network: allow to set a NIC's link from the status bar

This commit is contained in:
Adrien Moulin
2022-08-27 19:08:28 +02:00
parent c0b6c55926
commit ea21790fc9
16 changed files with 202 additions and 67 deletions

View File

@@ -228,7 +228,9 @@ dp8390_write_cr(dp8390_t *dev, uint32_t val)
/* Send the packet to the system driver */
dev->CR.tx_packet = 1;
network_tx(dev->card, &dev->mem[(dev->tx_page_start * 256) - dev->mem_start], dev->tx_bytes);
/* TODO: report TX error to the driver ? */
if (!(dev->card->link_state & NET_LINK_DOWN))
network_tx(dev->card, &dev->mem[(dev->tx_page_start * 256) - dev->mem_start], dev->tx_bytes);
/* some more debug */
#ifdef ENABLE_DP8390_LOG
@@ -291,6 +293,8 @@ dp8390_rx_common(void *priv, uint8_t *buf, int io_len)
if ((dev->CR.stop != 0) || (dev->page_start == 0))
return 0;
if (dev->card->link_state & NET_LINK_DOWN)
return 0;
/*
* Add the pkt header + CRC to the length, and work
* out how many 256-byte pages the frame would occupy.