mirror of
https://github.com/apache/nuttx.git
synced 2026-10-04 12:48:09 +00:00
xtensa/esp32s3: add setup rx dma after slave receive data
This commit is contained in:
parent
73f0c7c51d
commit
7acb298f26
1 changed files with 20 additions and 11 deletions
|
|
@ -1732,19 +1732,28 @@ static size_t spislave_qpoll(struct spi_slave_ctrlr_s *ctrlr)
|
|||
|
||||
tmp = SPIS_DEV_RECEIVE(priv->dev, priv->rx_buffer,
|
||||
BYTES2WORDS(priv, priv->rx_length));
|
||||
recv_n = WORDS2BYTES(priv, tmp);
|
||||
if (recv_n < priv->rx_length)
|
||||
if (tmp)
|
||||
{
|
||||
/* If the upper layer does not receive all of the data from the receive
|
||||
* buffer, move the remaining data to the head of the buffer.
|
||||
*/
|
||||
recv_n = WORDS2BYTES(priv, tmp);
|
||||
if (recv_n < priv->rx_length)
|
||||
{
|
||||
/* If the upper layer does not receive all of the data from the
|
||||
* receive buffer, move the remaining data to the head of the
|
||||
* buffer.
|
||||
*/
|
||||
|
||||
priv->rx_length -= recv_n;
|
||||
memmove(priv->rx_buffer, priv->rx_buffer + recv_n, priv->rx_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->rx_length = 0;
|
||||
priv->rx_length -= recv_n;
|
||||
memmove(priv->rx_buffer, priv->rx_buffer + recv_n,
|
||||
priv->rx_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->rx_length = 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ESP32S3_SPI_DMA
|
||||
spislave_setup_rx_dma(priv);
|
||||
#endif
|
||||
}
|
||||
|
||||
remaining_words = BYTES2WORDS(priv, priv->rx_length);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue