git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5672 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2013-05-04 08:10:31 +00:00
parent 397bc099cd
commit 2a2598ff1b
2 changed files with 21 additions and 4 deletions

View File

@ -475,11 +475,27 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
*/
uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
/*
* Data register must be accessed with the appropriate data size.
* Byte size access (uint8_t *) for transactions that are <= 8-bit.
* Halfword size access (uint16_t) for transactions that are <= 8-bit.
*/
if ((spip->config->cr2 & SPI_CR2_DS) <= (SPI_CR2_DS_2 |
SPI_CR2_DS_1 |
SPI_CR2_DS_0)) {
volatile uint8_t *spidr = (volatile uint8_t *)&spip->spi->DR;
*spidr = (uint8_t)frame;
while ((spip->spi->SR & SPI_SR_RXNE) == 0)
;
return (uint16_t)*spidr;
}
else {
spip->spi->DR = frame;
while ((spip->spi->SR & SPI_SR_RXNE) == 0)
;
return spip->spi->DR;
}
}
#endif /* HAL_USE_SPI */

View File

@ -89,6 +89,7 @@
*****************************************************************************
*** 2.5.2 ***
- FIX: Fixed STM32 SPIv2 polled exchange (bug #372).
- FIX: Fixed wrong macro in PWM driver (bug #407)(backported to 2.4.4).
- FIX: Fixed USB driver possible deadlock under certain configurations (bug
#406)(backported to 2.4.4).