aboutsummaryrefslogtreecommitdiff
path: root/nuttx/drivers
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-09-14 21:48:07 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-09-14 21:48:07 +0000
commitcfa24e37d6f153dbb5c7e2e0de6484719ea4a9b0 (patch)
treea959068a8c5c237a2ddc41be693aed929924e57b /nuttx/drivers
parent7c82cf692476202eb80d4caa4122c4cd390d2b2d (diff)
downloadpx4-firmware-cfa24e37d6f153dbb5c7e2e0de6484719ea4a9b0.tar.gz
px4-firmware-cfa24e37d6f153dbb5c7e2e0de6484719ea4a9b0.tar.bz2
px4-firmware-cfa24e37d6f153dbb5c7e2e0de6484719ea4a9b0.zip
Some ENC28J60-related fixes
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5154 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/drivers')
-rw-r--r--nuttx/drivers/net/enc28j60.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/nuttx/drivers/net/enc28j60.c b/nuttx/drivers/net/enc28j60.c
index 6ac399a19..47a84ec9f 100644
--- a/nuttx/drivers/net/enc28j60.c
+++ b/nuttx/drivers/net/enc28j60.c
@@ -1383,7 +1383,14 @@ static void enc_worker(FAR void *arg)
DEBUGASSERT(priv);
- /* Disable further interrupts by clearing the global interrup enable bit */
+ /* Disable further interrupts by clearing the global interrupt enable bit.
+ * "After an interrupt occurs, the host controller should clear the global
+ * enable bit for the interrupt pin before servicing the interrupt. Clearing
+ * the enable bit will cause the interrupt pin to return to the non-asserted
+ * state (high). Doing so will prevent the host controller from missing a
+ * falling edge should another interrupt occur while the immediate interrupt
+ * is being serviced."
+ */
enc_bfcgreg(priv, ENC_EIE, EIE_INTIE);
@@ -1551,12 +1558,17 @@ static void enc_worker(FAR void *arg)
enc_rxerif(priv); /* Handle the RX error */
enc_bfcgreg(priv, ENC_EIR, EIR_RXERIF); /* Clear the RXERIF interrupt */
}
-
}
/* Enable Ethernet interrupts */
enc_bfsgreg(priv, ENC_EIE, EIE_INTIE);
+
+ /* Enable GPIO interrupts if they were disbled in enc_interrupt */
+
+#ifndef CONFIG_SPI_OWNBUS
+ priv->lower->enable(priv->lower);
+#endif
}
/****************************************************************************
@@ -1596,6 +1608,14 @@ static int enc_interrupt(int irq, FAR void *context)
* a good thing to do in any event.
*/
+ DEBUGASSERT(work_available(&priv->work));
+
+ /* Notice that further GPIO interrupts are disabled until the work is
+ * actually performed. This is to prevent overrun of the worker thread.
+ * Interrupts are re-enabled in enc_worker() when the work is completed.
+ */
+
+ priv->lower->disable(priv->lower);
return work_queue(HPWORK, &priv->work, enc_worker, (FAR void *)priv, 0);
#endif
}