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:
parent
ee840c74da
commit
d8943be51c
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* 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>
|
||||
*
|
||||
* This logic derives from the SAM34D3 Ethernet driver.
|
||||
@ -292,10 +292,10 @@ struct sam_emac_s
|
||||
/* Debug stuff */
|
||||
|
||||
#ifdef CONFIG_SAM34_EMAC_REGDEBUG
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1163,9 +1163,23 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
||||
(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);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 10/100 Base-T Ethernet driver for the SAMA5D3. Denoted as 'A' to
|
||||
* 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>
|
||||
*
|
||||
* References:
|
||||
@ -297,10 +297,10 @@ struct sam_emac_s
|
||||
/* Debug stuff */
|
||||
|
||||
#ifdef CONFIG_SAMA5_EMACA_REGDEBUG
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1201,9 +1201,23 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
||||
(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);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
* separate (mostly because the 'B' driver needs to support two EMAC blocks.
|
||||
* 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>
|
||||
*
|
||||
* This logic derives from the SAM4E Ethernet driver which, in turn, derived
|
||||
@ -441,10 +441,10 @@ struct sam_emac_s
|
||||
/* Debug stuff */
|
||||
|
||||
#ifdef CONFIG_SAMA5_EMACB_REGDEBUG
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1536,9 +1536,23 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
||||
(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);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* 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>
|
||||
*
|
||||
* References:
|
||||
@ -223,10 +223,10 @@ struct sam_gmac_s
|
||||
/* Debug stuff */
|
||||
|
||||
#ifdef CONFIG_SAMA5_GMAC_REGDEBUG
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1131,9 +1131,23 @@ static int sam_recvframe(struct sam_gmac_s *priv)
|
||||
(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);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
@ -550,13 +550,13 @@ struct sam_emac_s
|
||||
|
||||
struct sam_queue_s xfrq[EMAC_NQUEUES_MAX];
|
||||
|
||||
/* Debug stuff */
|
||||
/* Debug stuff */
|
||||
|
||||
#ifdef CONFIG_SAMV7_EMAC_REGDEBUG
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
bool wrlast; /* Last was a write */
|
||||
uintptr_t addrlast; /* Last address */
|
||||
uint32_t vallast; /* Last value */
|
||||
int ntimes; /* Number of times */
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1873,16 +1873,16 @@ static int sam_recvframe(struct sam_emac_s *priv, int qid)
|
||||
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
||||
}
|
||||
|
||||
/* 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.
|
||||
/* 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)
|
||||
|
Loading…
Reference in New Issue
Block a user