You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/03/21 07:17:08 UTC
[incubator-nuttx] branch master updated (27e2da3 -> e4efa9d)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from 27e2da3 xtensa/esp32: Fix buffer size word-alignment for DMA transfers
new 20d24fe xtensa/esp32: Fix esp32_spi_setbits for Polling when DMA is also enabled
new e4efa9d xtensa/esp32: Fix interrupt flag configuration for DMA transfers
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/xtensa/src/esp32/esp32_spi.c | 33 ++++++++++-----------------------
1 file changed, 10 insertions(+), 23 deletions(-)
[incubator-nuttx] 02/02: xtensa/esp32: Fix interrupt flag
configuration for DMA transfers
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit e4efa9dfa7c9286e8fc4e07a36c2b7eca99e63d6
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Sat Mar 20 22:37:09 2021 -0300
xtensa/esp32: Fix interrupt flag configuration for DMA transfers
Previously SPI interrupts were enabled on DMA initialization. But since
the addition of SPI Mixed mode it created a side-effect, breaking
polling transfers. So now interrupts are enabled before the DMA
transactions and disabled once they are finished.
Furthermore, the transaction done flag is also cleared before a new
transaction starts.
---
arch/xtensa/src/esp32/esp32_spi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/xtensa/src/esp32/esp32_spi.c b/arch/xtensa/src/esp32/esp32_spi.c
index 26f7eca..2ad5792 100644
--- a/arch/xtensa/src/esp32/esp32_spi.c
+++ b/arch/xtensa/src/esp32/esp32_spi.c
@@ -889,6 +889,9 @@ static void esp32_spi_dma_exchange(FAR struct esp32_spi_priv_s *priv,
tp = rp;
}
+ esp32_spi_reset_regbits(priv, SPI_SLAVE_OFFSET, SPI_TRANS_DONE_M);
+ esp32_spi_set_regbits(priv, SPI_SLAVE_OFFSET, SPI_INT_EN_M);
+
while (bytes)
{
esp32_spi_set_reg(priv, SPI_DMA_IN_LINK_OFFSET, 0);
@@ -943,6 +946,8 @@ static void esp32_spi_dma_exchange(FAR struct esp32_spi_priv_s *priv,
rp += n;
}
+ esp32_spi_reset_regbits(priv, SPI_SLAVE_OFFSET, SPI_INT_EN_M);
+
#ifdef CONFIG_XTENSA_IMEM_USE_SEPARATE_HEAP
if (esp32_ptr_extram(rxbuffer))
{
@@ -1303,8 +1308,6 @@ static void esp32_spi_init(FAR struct spi_dev_s *dev)
esp32_spi_set_reg(priv, SPI_DMA_CONF_OFFSET, SPI_OUT_DATA_BURST_EN_M |
SPI_INDSCR_BURST_EN_M |
SPI_OUTDSCR_BURST_EN_M);
-
- esp32_spi_set_regbits(priv, SPI_SLAVE_OFFSET, SPI_INT_EN_M);
}
esp32_spi_setfrequency(dev, config->clk_freq);
[incubator-nuttx] 01/02: xtensa/esp32: Fix esp32_spi_setbits for
Polling when DMA is also enabled
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 20d24fe14894108221c9f6a926a487dd9be80909
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Sat Mar 20 22:31:09 2021 -0300
xtensa/esp32: Fix esp32_spi_setbits for Polling when DMA is also enabled
Commit 6382b2ba introduced the possibility of using SPI in Mixed mode,
i.e. performing SPI transfers via both polling and interrupts. However,
setbits was only applying the configuration if DMA was not enabled.
---
arch/xtensa/src/esp32/esp32_spi.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/arch/xtensa/src/esp32/esp32_spi.c b/arch/xtensa/src/esp32/esp32_spi.c
index 76e4c09..26f7eca 100644
--- a/arch/xtensa/src/esp32/esp32_spi.c
+++ b/arch/xtensa/src/esp32/esp32_spi.c
@@ -784,28 +784,12 @@ static void esp32_spi_setbits(FAR struct spi_dev_s *dev, int nbits)
spiinfo("nbits=%d\n", nbits);
- /* Has the number of bits changed? */
+ priv->nbits = nbits;
- if (nbits != priv->nbits)
- {
- /* Save the selection so that subsequent re-configurations
- * will be faster.
- */
-
- priv->nbits = nbits;
-
- /* Each DMA transmission will set these value according to
- * calculated buffer length.
- */
-
- if (!priv->config->use_dma)
- {
- esp32_spi_set_reg(priv, SPI_MISO_DLEN_OFFSET,
- (priv->nbits - 1) << SPI_USR_MISO_DBITLEN_S);
- esp32_spi_set_reg(priv, SPI_MOSI_DLEN_OFFSET,
- (priv->nbits - 1) << SPI_USR_MOSI_DBITLEN_S);
- }
- }
+ esp32_spi_set_reg(priv, SPI_MISO_DLEN_OFFSET,
+ (priv->nbits - 1) << SPI_USR_MISO_DBITLEN_S);
+ esp32_spi_set_reg(priv, SPI_MOSI_DLEN_OFFSET,
+ (priv->nbits - 1) << SPI_USR_MOSI_DBITLEN_S);
}
/****************************************************************************