mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
arch/arm/src/sam34 and sama5: Port Anthony Merlino's fix of commit ee840c74da to similar Ethernet drivers for parts in other SAM families.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/sam34/sam_emac.c
|
* arch/arm/src/sam34/sam_emac.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2015, 2017-2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014-2015, 2017-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* This logic derives from the SAM34D3 Ethernet driver.
|
* This logic derives from the SAM34D3 Ethernet driver.
|
||||||
@@ -1163,9 +1163,23 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
|||||||
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No packet was found */
|
/* isframe indicates that we have found a SOF. If we've received a SOF,
|
||||||
|
* but not an EOF in the sequential buffers we own, it must mean that we
|
||||||
|
* have a partial packet. This should only happen if there was a Buffer
|
||||||
|
* Not Available (BNA) error. When bursts of data come in, quickly
|
||||||
|
* filling the available buffers, before our interrupts can even service
|
||||||
|
* them. Eventually, the ring buffer loops back on itself and the
|
||||||
|
* peripheral sees it cannot write the next fragment of the packet.
|
||||||
|
*
|
||||||
|
* In this case, we keep the rxndx at the start of the last frame, since
|
||||||
|
* the peripheral will finish writing the packet there next.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!isframe)
|
||||||
|
{
|
||||||
priv->rxndx = rxndx;
|
priv->rxndx = rxndx;
|
||||||
|
}
|
||||||
|
|
||||||
ninfo("rxndx: %d\n", priv->rxndx);
|
ninfo("rxndx: %d\n", priv->rxndx);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* 10/100 Base-T Ethernet driver for the SAMA5D3. Denoted as 'A' to
|
* 10/100 Base-T Ethernet driver for the SAMA5D3. Denoted as 'A' to
|
||||||
* distinguish it from the SAMA5D4 EMAC driver.
|
* distinguish it from the SAMA5D4 EMAC driver.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* References:
|
* References:
|
||||||
@@ -1201,9 +1201,23 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
|||||||
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No packet was found */
|
/* isframe indicates that we have found a SOF. If we've received a SOF,
|
||||||
|
* but not an EOF in the sequential buffers we own, it must mean that we
|
||||||
|
* have a partial packet. This should only happen if there was a Buffer
|
||||||
|
* Not Available (BNA) error. When bursts of data come in, quickly
|
||||||
|
* filling the available buffers, before our interrupts can even service
|
||||||
|
* them. Eventually, the ring buffer loops back on itself and the
|
||||||
|
* peripheral sees it cannot write the next fragment of the packet.
|
||||||
|
*
|
||||||
|
* In this case, we keep the rxndx at the start of the last frame, since
|
||||||
|
* the peripheral will finish writing the packet there next.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!isframe)
|
||||||
|
{
|
||||||
priv->rxndx = rxndx;
|
priv->rxndx = rxndx;
|
||||||
|
}
|
||||||
|
|
||||||
ninfo("rxndx: %d\n", priv->rxndx);
|
ninfo("rxndx: %d\n", priv->rxndx);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* separate (mostly because the 'B' driver needs to support two EMAC blocks.
|
* separate (mostly because the 'B' driver needs to support two EMAC blocks.
|
||||||
* But the 'B' driver should replace the 'A' driver someday.
|
* But the 'B' driver should replace the 'A' driver someday.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2015, 2017-2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014-2015, 2017-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* This logic derives from the SAM4E Ethernet driver which, in turn, derived
|
* This logic derives from the SAM4E Ethernet driver which, in turn, derived
|
||||||
@@ -1536,9 +1536,23 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
|||||||
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No packet was found */
|
/* isframe indicates that we have found a SOF. If we've received a SOF,
|
||||||
|
* but not an EOF in the sequential buffers we own, it must mean that we
|
||||||
|
* have a partial packet. This should only happen if there was a Buffer
|
||||||
|
* Not Available (BNA) error. When bursts of data come in, quickly
|
||||||
|
* filling the available buffers, before our interrupts can even service
|
||||||
|
* them. Eventually, the ring buffer loops back on itself and the
|
||||||
|
* peripheral sees it cannot write the next fragment of the packet.
|
||||||
|
*
|
||||||
|
* In this case, we keep the rxndx at the start of the last frame, since
|
||||||
|
* the peripheral will finish writing the packet there next.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!isframe)
|
||||||
|
{
|
||||||
priv->rxndx = rxndx;
|
priv->rxndx = rxndx;
|
||||||
|
}
|
||||||
|
|
||||||
ninfo("rxndx: %d\n", priv->rxndx);
|
ninfo("rxndx: %d\n", priv->rxndx);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/sama5/sam_gmac.c
|
* arch/arm/src/sama5/sam_gmac.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* References:
|
* References:
|
||||||
@@ -1131,9 +1131,23 @@ static int sam_recvframe(struct sam_gmac_s *priv)
|
|||||||
(uintptr_t)rxdesc + sizeof(struct gmac_rxdesc_s));
|
(uintptr_t)rxdesc + sizeof(struct gmac_rxdesc_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No packet was found */
|
/* isframe indicates that we have found a SOF. If we've received a SOF,
|
||||||
|
* but not an EOF in the sequential buffers we own, it must mean that we
|
||||||
|
* have a partial packet. This should only happen if there was a Buffer
|
||||||
|
* Not Available (BNA) error. When bursts of data come in, quickly
|
||||||
|
* filling the available buffers, before our interrupts can even service
|
||||||
|
* them. Eventually, the ring buffer loops back on itself and the
|
||||||
|
* peripheral sees it cannot write the next fragment of the packet.
|
||||||
|
*
|
||||||
|
* In this case, we keep the rxndx at the start of the last frame, since
|
||||||
|
* the peripheral will finish writing the packet there next.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!isframe)
|
||||||
|
{
|
||||||
priv->rxndx = rxndx;
|
priv->rxndx = rxndx;
|
||||||
|
}
|
||||||
|
|
||||||
ninfo("rxndx: %d\n", priv->rxndx);
|
ninfo("rxndx: %d\n", priv->rxndx);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1873,16 +1873,16 @@ static int sam_recvframe(struct sam_emac_s *priv, int qid)
|
|||||||
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* isframe indicates that we have found a SOF. If we've received a SOF, but not
|
/* isframe indicates that we have found a SOF. If we've received a SOF,
|
||||||
* an EOF in the sequential buffers we own, it must mean that we have a partial
|
* but not an EOF in the sequential buffers we own, it must mean that we
|
||||||
* packet. This should only happen if there was a Buffer Not Available (BNA) error.
|
* have a partial packet. This should only happen if there was a Buffer
|
||||||
* When bursts of data come in, quickly filling the available buffers, before our
|
* Not Available (BNA) error. When bursts of data come in, quickly
|
||||||
* interrupts can even service them. Eventually, the ring buffer loops back on
|
* filling the available buffers, before our interrupts can even service
|
||||||
* itself and the peripheral sees it cannot write the next fragment of the packet.
|
* them. Eventually, the ring buffer loops back on itself and the
|
||||||
*
|
* peripheral sees it cannot write the next fragment of the packet.
|
||||||
* In this case, we keep the rxndx at the start of the last frame, since the peripheral
|
|
||||||
* will finish writing the packet there next.
|
|
||||||
*
|
*
|
||||||
|
* In this case, we keep the rxndx at the start of the last frame, since
|
||||||
|
* the peripheral will finish writing the packet there next.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!isframe)
|
if (!isframe)
|
||||||
|
|||||||
Reference in New Issue
Block a user