From afd737ddcc3ec68d091bf5463d49c75ad8e34cff Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 28 Mar 2015 09:42:45 -0600 Subject: [PATCH] SAMV7 EMAC: Sometimes TX is not started when TSTART is set??? Workaround seems to be to set it twice. Restored full optimization. Also CONFIG_NET_NOINTS is set so that interrupt level provessing is avoided --- arch/arm/src/samv7/sam_emac.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index b173fd82900..97d685ada55 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -1318,7 +1318,7 @@ static int sam_transmit(struct sam_emac_s *priv, int qid) (uintptr_t)txdesc->addr + dev->d_len); } - /* Update TX descriptor status. */ + /* Update TX descriptor status (with USED=0). */ status = dev->d_len | EMACTXD_STA_LAST; if (txhead == priv->xfrq[qid].ntxbuffers - 1) @@ -1347,6 +1347,13 @@ static int sam_transmit(struct sam_emac_s *priv, int qid) regval |= EMAC_NCR_TSTART; sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + /* REVISIT: Sometimes TSTART is missed? In this case, the symptom is + * that the packet is not sent until the next transfer when TXSTART + * is set again. + */ + + sam_putreg(priv, SAM_EMAC_NCR_OFFSET, regval); + /* Setup the TX timeout watchdog (perhaps restarting the timer) */ (void)wd_start(priv->txtimeout, SAM_TXTIMEOUT, sam_txtimeout_expiry, 1, @@ -1515,7 +1522,7 @@ static void sam_dopoll(struct sam_emac_s *priv, int qid) static int sam_recvframe(struct sam_emac_s *priv, int qid) { - struct emac_rxdesc_s *rxdesc; + volatile struct emac_rxdesc_s *rxdesc; struct net_driver_s *dev; const uint8_t *src; uint8_t *dest;