summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32/stm32_eth.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-24 15:51:48 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-24 15:51:48 +0000
commit3a9970e4b125c4a629d957d35ca67f662c69ff00 (patch)
tree57575d4289b1d76f23fc786438be6d0332c4b656 /nuttx/arch/arm/src/stm32/stm32_eth.c
parent885d507dd53d6f95c83397b7993431619cb08c5b (diff)
downloadpx4-nuttx-3a9970e4b125c4a629d957d35ca67f662c69ff00.tar.gz
px4-nuttx-3a9970e4b125c4a629d957d35ca67f662c69ff00.tar.bz2
px4-nuttx-3a9970e4b125c4a629d957d35ca67f662c69ff00.zip
Fixes STM32F107 DMA issue
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5182 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32/stm32_eth.c')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_eth.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_eth.c b/nuttx/arch/arm/src/stm32/stm32_eth.c
index ab9cac209..2e892c9e5 100644
--- a/nuttx/arch/arm/src/stm32/stm32_eth.c
+++ b/nuttx/arch/arm/src/stm32/stm32_eth.c
@@ -186,10 +186,12 @@
#endif
/* Add 4 to the configured buffer size to account for the 2 byte checksum
- * memory needed at the end of the maximum size packet.
+ * memory needed at the end of the maximum size packet. Buffer sizes must
+ * be an even multiple of 4, 8, or 16 bytes (depending on buswidth). We
+ * will use the 16-byte alignment in all cases.
*/
-#define OPTIMAL_ETH_BUFSIZE (CONFIG_NET_BUFSIZE+4)
+#define OPTIMAL_ETH_BUFSIZE ((CONFIG_NET_BUFSIZE + 4 + 15) & ~15)
#ifndef CONFIG_STM32_ETH_BUFSIZE
# define CONFIG_STM32_ETH_BUFSIZE OPTIMAL_ETH_BUFSIZE
@@ -199,6 +201,10 @@
# error "CONFIG_STM32_ETH_BUFSIZE is too large"
#endif
+#if (CONFIG_STM32_ETH_BUFSIZE & 15) != 0
+# error "CONFIG_STM32_ETH_BUFSIZE must be aligned"
+#endif
+
#if CONFIG_STM32_ETH_BUFSIZE != OPTIMAL_ETH_BUFSIZE
# warning "You using an incomplete/untested configuration"
#endif
@@ -1470,9 +1476,6 @@ static int stm32_recvframe(FAR struct stm32_ethmac_s *priv)
{
priv->segments++;
- nllvdbg("rxhead: %p rxcurr: %p segments: %d\n",
- priv->rxhead, priv->rxcurr, priv->segments);
-
/* Check if the there is only one segment in the frame */
if (priv->segments == 1)
@@ -1484,6 +1487,9 @@ static int stm32_recvframe(FAR struct stm32_ethmac_s *priv)
rxcurr = priv->rxcurr;
}
+ nllvdbg("rxhead: %p rxcurr: %p segments: %d\n",
+ priv->rxhead, priv->rxcurr, priv->segments);
+
/* Check if any errors are reported in the frame */
if ((rxdesc->rdes0 & ETH_RDES0_ES) == 0)