From d09eec1066442d8b390ab2b36876b2176bea016d Mon Sep 17 00:00:00 2001 From: Andrew Webster Date: Thu, 21 Jan 2016 18:36:27 -0600 Subject: [PATCH] Kinetis enet: fix minor logic errors --- arch/arm/src/kinetis/kinetis_enet.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index cb678c786d..c81aa10d65 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -312,7 +312,7 @@ static bool kinetics_txringfull(FAR struct kinetis_driver_s *priv) */ txnext = priv->txhead + 1; - if (txnext > CONFIG_ENET_NTXBUFFERS) + if (txnext >= CONFIG_ENET_NTXBUFFERS) { txnext = 0; } @@ -353,7 +353,7 @@ static int kinetis_transmit(FAR struct kinetis_driver_s *priv) txdesc = &priv->txdesc[priv->txhead]; priv->txhead++; - if (priv->txhead > CONFIG_ENET_NTXBUFFERS) + if (priv->txhead >= CONFIG_ENET_NTXBUFFERS) { priv->txhead = 0; } @@ -490,7 +490,7 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv) { /* Loop while there are received packets to be processed */ - while ((priv->rxdesc[priv->rxtail].status1 & RXDESC_E) != 0) + while ((priv->rxdesc[priv->rxtail].status1 & RXDESC_E) == 0) { /* Update statistics */ @@ -660,7 +660,7 @@ static void kinetis_txdone(FAR struct kinetis_driver_s *priv) /* Yes.. bump up the tail pointer, making space for a new TX descriptor */ priv->txtail++; - if (priv->txtail > CONFIG_ENET_NTXBUFFERS) + if (priv->txtail >= CONFIG_ENET_NTXBUFFERS) { priv->txtail = 0; } @@ -795,8 +795,8 @@ static void kinetis_txtimeout(int argc, uint32_t arg, ...) * hardware reset. */ - (void)kinetis_ifup(&priv->dev); (void)kinetis_ifdown(&priv->dev); + (void)kinetis_ifup(&priv->dev); /* Then poll uIP for new XMIT data */