stm32: Revert "stm32: performance improvement for spi on stm32f0"
This reverts commit a2c309a2b02d16ec15fee5702463621239261266. The above commit is causing crashes on the stm32f103xb chip when spi is in use. It's unclear what the cause of the regression is, but the optimization isn't required so revert it until the root cause can be determined. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
e9e0f59204
commit
121249c999
@ -92,14 +92,10 @@ spi_transfer(struct spi_config config, uint8_t receive_data,
|
||||
uint8_t len, uint8_t *data)
|
||||
{
|
||||
SPI_TypeDef *spi = config.spi;
|
||||
uint8_t *wptr = data;
|
||||
uint8_t *end = data + len;
|
||||
|
||||
while (data < end) {
|
||||
if (spi->SR & SPI_SR_TXE && wptr < end)
|
||||
writeb((void *)&spi->DR, *wptr++);
|
||||
if (!(spi->SR & SPI_SR_RXNE))
|
||||
continue;
|
||||
while (len--) {
|
||||
writeb((void *)&spi->DR, *data);
|
||||
while (!(spi->SR & SPI_SR_RXNE))
|
||||
;
|
||||
uint8_t rdata = readb((void *)&spi->DR);
|
||||
if (receive_data)
|
||||
*data = rdata;
|
||||
|
Loading…
x
Reference in New Issue
Block a user