EFM32 SPI: Change some logic that I fear could cause RX data overrun
This commit is contained in:
parent
0100d0f6c0
commit
82bf0558e1
@ -1259,12 +1259,10 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
|
|||||||
unsent = nwords;
|
unsent = nwords;
|
||||||
while (unrecvd > 0)
|
while (unrecvd > 0)
|
||||||
{
|
{
|
||||||
/* REVISIT: This might cause RX data overruns??? */
|
/* REVISIT: Could this cause RX data overruns??? */
|
||||||
/* Send data while there is space in the TX buffer. This should
|
/* Send data if there is space in the TX buffer. */
|
||||||
* provide some benefit when the depth of the TC buffer is > 1
|
|
||||||
*/
|
|
||||||
|
|
||||||
while ((spi_getreg(config, EFM32_USART_STATUS_OFFSET) & USART_STATUS_TXBL) != 0 &&
|
if ((spi_getreg(config, EFM32_USART_STATUS_OFFSET) & USART_STATUS_TXBL) != 0 &&
|
||||||
unsent > 0)
|
unsent > 0)
|
||||||
{
|
{
|
||||||
/* Get the next word to write. Is there a source buffer? */
|
/* Get the next word to write. Is there a source buffer? */
|
||||||
@ -1284,9 +1282,9 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
|
|||||||
unsent--;
|
unsent--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Receive data where there is data available */
|
/* Receive data if there is data available */
|
||||||
|
|
||||||
while ((spi_getreg(config, EFM32_USART_STATUS_OFFSET) & USART_STATUS_RXDATAV) != 0 &&
|
if ((spi_getreg(config, EFM32_USART_STATUS_OFFSET) & USART_STATUS_RXDATAV) != 0 &&
|
||||||
unrecvd > 0)
|
unrecvd > 0)
|
||||||
{
|
{
|
||||||
/* Receive the data */
|
/* Receive the data */
|
||||||
@ -1315,10 +1313,8 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
|
|||||||
unsent = nwords;
|
unsent = nwords;
|
||||||
while (unrecvd > 0)
|
while (unrecvd > 0)
|
||||||
{
|
{
|
||||||
/* REVISIT: This might cause RX data overruns??? */
|
/* REVISIT: Could this cause RX data overruns??? */
|
||||||
/* Send data while there is space in the TX buffer. This should
|
/* Send data if there is space in the TX buffer. */
|
||||||
* provide some benefit when the depth of the TC buffer is > 1
|
|
||||||
*/
|
|
||||||
|
|
||||||
while ((spi_getreg(config, EFM32_USART_STATUS_OFFSET) & USART_STATUS_TXBL) != 0 &&
|
while ((spi_getreg(config, EFM32_USART_STATUS_OFFSET) & USART_STATUS_TXBL) != 0 &&
|
||||||
unsent > 0)
|
unsent > 0)
|
||||||
@ -1340,9 +1336,9 @@ static void spi_exchange(struct spi_dev_s *dev, const void *txbuffer,
|
|||||||
unsent--;
|
unsent--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Receive data where there is data available */
|
/* Receive data if there is data available */
|
||||||
|
|
||||||
while ((spi_getreg(config, EFM32_USART_STATUS_OFFSET) & USART_STATUS_RXDATAV) != 0 &&
|
if ((spi_getreg(config, EFM32_USART_STATUS_OFFSET) & USART_STATUS_RXDATAV) != 0 &&
|
||||||
unrecvd > 0)
|
unrecvd > 0)
|
||||||
{
|
{
|
||||||
/* Receive the data */
|
/* Receive the data */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user