diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c index 16ee4c95eed..f5598617052 100644 --- a/drivers/net/dm90x0.c +++ b/drivers/net/dm90x0.c @@ -77,6 +77,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* If processing is not done at the interrupt level, then work queue support * is required. */ @@ -317,7 +318,7 @@ union rx_desc_u struct dm9x_driver_s { bool dm_bifup; /* true:ifup false:ifdown */ - bool dm_b100M; /* true:speed == 100M; false:speed == 10M */ + bool dm_b100m; /* true:speed == 100M; false:speed == 10M */ uint8_t dm_ntxpending; /* Count of packets pending transmission */ uint8_t ncrxpackets; /* Number of continuous rx packets */ WDOG_ID dm_txpoll; /* TX poll timer */ @@ -728,7 +729,7 @@ static int dm9x_transmit(FAR struct dm9x_driver_s *priv) * mode, that can be 2 packets, otherwise it is a single packet. */ - if (priv->dm_ntxpending < 1 || (priv->dm_b100M && priv->dm_ntxpending < 2)) + if (priv->dm_ntxpending < 1 || (priv->dm_b100m && priv->dm_ntxpending < 2)) { /* Increment count of packets transmitted */ @@ -838,7 +839,7 @@ static int dm9x_txpoll(FAR struct net_driver_s *dev) * packet. */ - if (priv->dm_ntxpending > 1 || !priv->dm_b100M) + if (priv->dm_ntxpending > 1 || !priv->dm_b100m) { /* Returning a non-zero value will terminate the poll operation */ @@ -1004,7 +1005,7 @@ static void dm9x_receive(FAR struct dm9x_driver_s *priv) */ if (priv->dm_dev.d_len > 0) - { + { /* Update the Ethernet header with the correct MAC address */ #ifdef CONFIG_NET_IPv4 @@ -1184,19 +1185,20 @@ static void dm9x_interrupt_work(FAR void *arg) if (dm9x_phyread(priv, 0) & 0x2000) { - priv->dm_b100M = true; + priv->dm_b100m = true; } else { - priv->dm_b100M = false; + priv->dm_b100m = false; } break; } + up_mdelay(1); } nerr("ERROR: delay: %dmS speed: %s\n", - i, priv->dm_b100M ? "100M" : "10M"); + i, priv->dm_b100m ? "100M" : "10M"); } /* Check if we received an incoming packet */ @@ -1410,7 +1412,7 @@ static void dm9x_poll_work(FAR void *arg) * mode, that can be 2 packets, otherwise it is a single packet. */ - if (priv->dm_ntxpending < 1 || (priv->dm_b100M && priv->dm_ntxpending < 2)) + if (priv->dm_ntxpending < 1 || (priv->dm_b100m && priv->dm_ntxpending < 2)) { /* If so, update TCP timing states and poll the network for new XMIT data */ @@ -1528,7 +1530,7 @@ static int dm9x_ifup(FAR struct net_driver_s *dev) /* Check link state and media speed (waiting up to 3s for link OK) */ - priv->dm_b100M = false; + priv->dm_b100m = false; for (i = 0; i < 3000; i++) { netstatus = getreg(DM9X_NETS); @@ -1540,15 +1542,17 @@ static int dm9x_ifup(FAR struct net_driver_s *dev) netstatus = getreg(DM9X_NETS); if ((netstatus & DM9X_NETS_SPEED) == 0) { - priv->dm_b100M = true; + priv->dm_b100m = true; } + break; } + i++; up_mdelay(1); } - ninfo("delay: %dmS speed: %s\n", i, priv->dm_b100M ? "100M" : "10M"); + ninfo("delay: %dmS speed: %s\n", i, priv->dm_b100m ? "100M" : "10M"); /* Set and activate a timer process */ @@ -1636,13 +1640,12 @@ static void dm9x_txavail_work(FAR void *arg) net_lock(); if (priv->dm_bifup) { - /* Check if there is room in the DM90x0 to hold another packet. In 100M * mode, that can be 2 packets, otherwise it is a single packet. */ if (priv->dm_ntxpending < 1 || - (priv->dm_b100M && priv->dm_ntxpending < 2)) + (priv->dm_b100m && priv->dm_ntxpending < 2)) { /* If so, then poll the network for new XMIT data */ @@ -1881,17 +1884,19 @@ static void dm9x_reset(FAR struct dm9x_driver_s *priv) /* Wait up to 1 second for the link to be OK */ - priv->dm_b100M = false; + priv->dm_b100m = false; for (i = 0; i < 1000; i++) { if (dm9x_phyread(priv, 0x1) & 0x4) { - if (dm9x_phyread(priv, 0) &0x2000) + if (dm9x_phyread(priv, 0) & 0x2000) { - priv->dm_b100M = true; + priv->dm_b100m = true; } + break; } + up_mdelay(1); } diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 7d73aa9784f..299febe90f1 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -962,7 +962,7 @@ static inline void enc_wrbuffer(FAR struct enc_driver_s *priv, */ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false); - enc_bmdump(ENC_WBM, buffer, buflen+1); + enc_bmdump(ENC_WBM, buffer, buflen + 1); } /**************************************************************************** @@ -1389,7 +1389,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv) #ifdef CONFIG_NET_PKT /* When packet sockets are enabled, feed the frame into the packet tap */ - pkt_input(&priv->dev); + pkt_input(&priv->dev); #endif /* We only accept IP packets of the configured type and ARP packets */ @@ -1485,11 +1485,11 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv) * sent out on the network, the field d_len will set to a value > 0. */ - if (priv->dev.d_len > 0) - { - enc_transmit(priv); - } - } + if (priv->dev.d_len > 0) + { + enc_transmit(priv); + } + } else #endif { diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c index 1da3f3d0691..e1d5f6a04be 100644 --- a/drivers/net/encx24j600.c +++ b/drivers/net/encx24j600.c @@ -529,7 +529,6 @@ static inline void enc_setethrst(FAR struct enc_driver_s *priv) static void enc_setbank(FAR struct enc_driver_s *priv, uint8_t bank) { - /* Check if a bank has to be set and if the bank setting has changed. * For registers that are available on all banks, the bank command is set * to 0. @@ -1556,7 +1555,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv) */ if (priv->dev.d_len > 0) - { + { /* Update the Ethernet header with the correct MAC address */ #ifdef CONFIG_NET_IPv4 @@ -2737,10 +2736,10 @@ static int enc_reset(FAR struct enc_driver_s *priv) return -ENODEV; } - /** - * Wait at least 256 μs for the PHY registers and PHY status bits to become + /* Wait at least 256 μs for the PHY registers and PHY status bits to become * available. */ + up_udelay(256); /* Initialize RX/TX buffers */ diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 1e3f02c4b08..45d230a3852 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -68,6 +68,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* If processing is not done at the interrupt level, then work queue support * is required. */ @@ -316,6 +317,7 @@ static int ftmac100_transmit(FAR struct ftmac100_driver_s *priv) priv->tx_pending++; /* Enable Tx polling */ + /* FIXME: enable interrupts */ putreg32(1, &iobase->txpd); @@ -750,7 +752,7 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s *priv) */ if (priv->ft_dev.d_len > 0) - { + { /* Update the Ethernet header with the correct MAC address */ #ifdef CONFIG_NET_IPv4 @@ -789,6 +791,7 @@ static void ftmac100_receive(FAR struct ftmac100_driver_s *priv) } } #endif + priv->rx_pointer = (priv->rx_pointer + 1) & (CONFIG_FTMAC100_RX_DESC - 1); @@ -1594,6 +1597,7 @@ int ftmac100_initialize(int intf) /* Put the interface in the down state. This usually amounts to resetting * the device and/or calling ftmac100_ifdown(). */ + ftmac100_reset(priv); /* Read the MAC address from the hardware into priv->ft_dev.d_mac.ether.ether_addr_octet */ diff --git a/drivers/net/lan91c111.c b/drivers/net/lan91c111.c index bf04c588fb8..d80bfe6e6c4 100644 --- a/drivers/net/lan91c111.c +++ b/drivers/net/lan91c111.c @@ -420,6 +420,7 @@ static int lan91c111_transmit(FAR struct net_driver_s *dev) * * If odd size then last byte is included in ctl word. */ + pages = ((dev->d_len & ~1) + 6) >> 8; while (1) @@ -536,6 +537,7 @@ static int lan91c111_txpoll(FAR struct net_driver_s *dev) arp_out(dev); } #endif /* CONFIG_NET_IPv4 */ + #ifdef CONFIG_NET_IPv6 if (IFF_IS_IPv6(dev->d_flags)) { @@ -599,6 +601,7 @@ static void lan91c111_reply(FAR struct net_driver_s *dev) arp_out(dev); } #endif + #ifdef CONFIG_NET_IPv6 if (IFF_IS_IPv6(dev->d_flags)) { @@ -1321,7 +1324,7 @@ static uint32_t lan91c111_crc32(FAR const uint8_t *src, size_t len) } } - return crc; + return crc; } static int lan91c111_addmac(FAR struct net_driver_s *dev, diff --git a/drivers/net/phy_notify.c b/drivers/net/phy_notify.c index 4ebcdd25f7d..71664a3af22 100644 --- a/drivers/net/phy_notify.c +++ b/drivers/net/phy_notify.c @@ -104,7 +104,7 @@ struct phy_notify_s { bool assigned; - char intf[CONFIG_PHY_NOTIFICATION_MAXINTFLEN+1]; + char intf[CONFIG_PHY_NOTIFICATION_MAXINTFLEN + 1]; pid_t pid; struct sigevent event; struct sigwork_s work; diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index 13983dc30d1..33bf32b59ac 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -1194,7 +1194,8 @@ int skel_initialize(int intf) * the device and/or calling skel_ifdown(). */ - /* Read the MAC address from the hardware into priv->sk_dev.d_mac.ether.ether_addr_octet + /* Read the MAC address from the hardware into + * priv->sk_dev.d_mac.ether.ether_addr_octet * Applies only if the Ethernet MAC has its own internal address. */ diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 12dff74ba11..1b85ff93db6 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -631,7 +631,7 @@ static inline void slip_receive(FAR struct slip_driver_s *priv) default: { - if (priv->rxlen < CONFIG_NET_SLIP_PKTSIZE+2) + if (priv->rxlen < CONFIG_NET_SLIP_PKTSIZE + 2) { priv->rxbuf[priv->rxlen++] = ch; } diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 08209906949..8dca0f222ae 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -518,6 +518,7 @@ static ssize_t telnet_receive(FAR struct telnet_dev_s *priv, break; case STATE_DONT: + /* Reply with a WONT */ telnet_sendopt(priv, TELNET_WONT, ch); @@ -554,6 +555,7 @@ static ssize_t telnet_receive(FAR struct telnet_dev_s *priv, /* Handle NAWS sub-option negotiation */ case STATE_SB_NAWS: + /* Update cols / rows based on received byte count */ switch (priv->td_sb_count)