SAM3/4 and SAMA5 Ethernet: Fix an error in the function that determines the number of free TX descriptors
This commit is contained in:
parent
f5abca3952
commit
e7aa949380
@ -516,7 +516,7 @@ static uint16_t sam_txinuse(struct sam_emac_s *priv)
|
|||||||
uint32_t txhead32 = (uint32_t)priv->txhead;
|
uint32_t txhead32 = (uint32_t)priv->txhead;
|
||||||
if ((uint32_t)priv->txtail > txhead32)
|
if ((uint32_t)priv->txtail > txhead32)
|
||||||
{
|
{
|
||||||
return txhead32 += CONFIG_SAM34_EMAC_NTXBUFFERS;
|
txhead32 += CONFIG_SAM34_EMAC_NTXBUFFERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uint16_t)(txhead32 - (uint32_t)priv->txtail);
|
return (uint16_t)(txhead32 - (uint32_t)priv->txtail);
|
||||||
@ -1251,7 +1251,7 @@ static void sam_txdone(struct sam_emac_s *priv)
|
|||||||
|
|
||||||
/* At least one TX descriptor is available. Re-enable RX interrupts.
|
/* At least one TX descriptor is available. Re-enable RX interrupts.
|
||||||
* RX interrupts may previously have been disabled when we ran out of
|
* RX interrupts may previously have been disabled when we ran out of
|
||||||
* TX desciptors (see commits in sam_transmit()).
|
* TX descriptors (see comments in sam_transmit()).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sam_putreg(priv, SAM_EMAC_IER, EMAC_INT_RCOMP);
|
sam_putreg(priv, SAM_EMAC_IER, EMAC_INT_RCOMP);
|
||||||
|
@ -521,7 +521,7 @@ static uint16_t sam_txinuse(struct sam_emac_s *priv)
|
|||||||
uint32_t txhead32 = (uint32_t)priv->txhead;
|
uint32_t txhead32 = (uint32_t)priv->txhead;
|
||||||
if ((uint32_t)priv->txtail > txhead32)
|
if ((uint32_t)priv->txtail > txhead32)
|
||||||
{
|
{
|
||||||
return txhead32 += CONFIG_SAMA5_EMAC_NTXBUFFERS;
|
txhead32 += CONFIG_SAMA5_EMAC_NTXBUFFERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uint16_t)(txhead32 - (uint32_t)priv->txtail);
|
return (uint16_t)(txhead32 - (uint32_t)priv->txtail);
|
||||||
@ -1293,7 +1293,7 @@ static void sam_txdone(struct sam_emac_s *priv)
|
|||||||
|
|
||||||
/* At least one TX descriptor is available. Re-enable RX interrupts.
|
/* At least one TX descriptor is available. Re-enable RX interrupts.
|
||||||
* RX interrupts may previously have been disabled when we ran out of
|
* RX interrupts may previously have been disabled when we ran out of
|
||||||
* TX desciptors (see commits in sam_transmit()).
|
* TX descriptors (see comments in sam_transmit()).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sam_putreg(priv, SAM_EMAC_IER, EMAC_INT_RCOMP);
|
sam_putreg(priv, SAM_EMAC_IER, EMAC_INT_RCOMP);
|
||||||
|
@ -843,7 +843,7 @@ static uint16_t sam_txinuse(struct sam_emac_s *priv)
|
|||||||
uint32_t txhead32 = (uint32_t)priv->txhead;
|
uint32_t txhead32 = (uint32_t)priv->txhead;
|
||||||
if ((uint32_t)priv->txtail > txhead32)
|
if ((uint32_t)priv->txtail > txhead32)
|
||||||
{
|
{
|
||||||
return txhead32 += priv->attr->ntxbuffers;
|
txhead32 += priv->attr->ntxbuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uint16_t)(txhead32 - (uint32_t)priv->txtail);
|
return (uint16_t)(txhead32 - (uint32_t)priv->txtail);
|
||||||
@ -1259,7 +1259,6 @@ static int sam_recvframe(struct sam_emac_s *priv)
|
|||||||
|
|
||||||
cp15_invalidate_dcache((uintptr_t)rxdesc,
|
cp15_invalidate_dcache((uintptr_t)rxdesc,
|
||||||
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
(uintptr_t)rxdesc + sizeof(struct emac_rxdesc_s));
|
||||||
|
|
||||||
nllvdbg("rxndx: %d\n", rxndx);
|
nllvdbg("rxndx: %d\n", rxndx);
|
||||||
|
|
||||||
while ((rxdesc->addr & EMACRXD_ADDR_OWNER) != 0)
|
while ((rxdesc->addr & EMACRXD_ADDR_OWNER) != 0)
|
||||||
@ -1615,7 +1614,7 @@ static void sam_txdone(struct sam_emac_s *priv)
|
|||||||
|
|
||||||
/* At least one TX descriptor is available. Re-enable RX interrupts.
|
/* At least one TX descriptor is available. Re-enable RX interrupts.
|
||||||
* RX interrupts may previously have been disabled when we ran out of
|
* RX interrupts may previously have been disabled when we ran out of
|
||||||
* TX descriptors (see commits in sam_transmit()).
|
* TX descriptors (see comments in sam_transmit()).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sam_putreg(priv, SAM_EMAC_IER_OFFSET, EMAC_INT_RCOMP);
|
sam_putreg(priv, SAM_EMAC_IER_OFFSET, EMAC_INT_RCOMP);
|
||||||
|
@ -452,7 +452,7 @@ static uint16_t sam_txinuse(struct sam_gmac_s *priv)
|
|||||||
uint32_t txhead32 = (uint32_t)priv->txhead;
|
uint32_t txhead32 = (uint32_t)priv->txhead;
|
||||||
if ((uint32_t)priv->txtail > txhead32)
|
if ((uint32_t)priv->txtail > txhead32)
|
||||||
{
|
{
|
||||||
return txhead32 += CONFIG_SAMA5_GMAC_NTXBUFFERS;
|
txhead32 += CONFIG_SAMA5_GMAC_NTXBUFFERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uint16_t)(txhead32 - (uint32_t)priv->txtail);
|
return (uint16_t)(txhead32 - (uint32_t)priv->txtail);
|
||||||
@ -1221,7 +1221,7 @@ static void sam_txdone(struct sam_gmac_s *priv)
|
|||||||
|
|
||||||
/* At least one TX descriptor is available. Re-enable RX interrupts.
|
/* At least one TX descriptor is available. Re-enable RX interrupts.
|
||||||
* RX interrupts may previously have been disabled when we ran out of
|
* RX interrupts may previously have been disabled when we ran out of
|
||||||
* TX desciptors (see commits in sam_transmit()).
|
* TX descriptors (see comments in sam_transmit()).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sam_putreg(priv, SAM_GMAC_IER, GMAC_INT_RCOMP);
|
sam_putreg(priv, SAM_GMAC_IER, GMAC_INT_RCOMP);
|
||||||
|
Loading…
Reference in New Issue
Block a user