From 0116b4d06b31b2adbd03576074bbc8503a023218 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 6 Jan 2011 12:18:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2596 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/LPC13xx/spi_lld.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'os/hal/platforms/LPC13xx/spi_lld.c') diff --git a/os/hal/platforms/LPC13xx/spi_lld.c b/os/hal/platforms/LPC13xx/spi_lld.c index d7dd8f17f..1a98a7a15 100644 --- a/os/hal/platforms/LPC13xx/spi_lld.c +++ b/os/hal/platforms/LPC13xx/spi_lld.c @@ -59,10 +59,16 @@ static void ssp_fifo_preload(SPIDriver *spip) { while(((ssp->SR & SR_TNF) != 0) && (n > 0)) { if (spip->spd_txptr != NULL) { - if ((ssp->CR0 & CR0_DSSMASK) > CR0_DSS8BIT) - ssp->DR = *(uint16_t *)spip->spd_txptr++; - else - ssp->DR = *(uint8_t *)spip->spd_txptr++; + if ((ssp->CR0 & CR0_DSSMASK) > CR0_DSS8BIT) { + const uint16_t *p = spip->spd_txptr; + ssp->DR = *p++; + spip->spd_txptr = p; + } + else { + const uint8_t *p = spip->spd_txptr; + ssp->DR = *p++; + spip->spd_txptr = p; + } } else ssp->DR = 0xFFFFFFFF; @@ -87,10 +93,16 @@ static void spi_serve_interrupt(SPIDriver *spip) { ssp->ICR = ICR_RT | ICR_ROR; while ((ssp->SR & SR_RNE) != 0) { if (spip->spd_rxptr != NULL) { - if ((ssp->CR0 & CR0_DSSMASK) > CR0_DSS8BIT) - *(uint16_t *)spip->spd_rxptr++ = ssp->DR; - else - *(uint8_t *)spip->spd_rxptr++ = ssp->DR; + if ((ssp->CR0 & CR0_DSSMASK) > CR0_DSS8BIT) { + uint16_t *p = spip->spd_rxptr; + *p++ = ssp->DR; + spip->spd_rxptr = p; + } + else { + uint8_t *p = spip->spd_rxptr; + *p++ = ssp->DR; + spip->spd_rxptr = p; + } } else (void)ssp->DR; -- cgit v1.2.3