diff options
Diffstat (limited to 'testhal')
| -rw-r--r-- | testhal/STM32/STM32F7xx/GPT-ADC/main.c | 6 | ||||
| -rw-r--r-- | testhal/STM32/STM32F7xx/SPI/main.c | 8 | 
2 files changed, 8 insertions, 6 deletions
diff --git a/testhal/STM32/STM32F7xx/GPT-ADC/main.c b/testhal/STM32/STM32F7xx/GPT-ADC/main.c index 4e1b27520..d0e810201 100644 --- a/testhal/STM32/STM32F7xx/GPT-ADC/main.c +++ b/testhal/STM32/STM32F7xx/GPT-ADC/main.c @@ -52,8 +52,10 @@ static adcsample_t samples1[ADC_GRP1_NUM_CHANNELS * ADC_GRP1_BUF_DEPTH];  size_t nx = 0, ny = 0;
  static void adccallback(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
 -  /* DMA buffer invalidation because data cache.*/
 -  dmaBufferInvalidate(buffer, buffer + (n * adcp->grpp->num_channels));
 +  /* DMA buffer invalidation because data cache, only invalidating the
 +     half buffer just filled.*/
 +  dmaBufferInvalidate(buffer,
 +                      n * adcp->grpp->num_channels * sizeof (adcsample_t));
    /* Updating counters.*/
    if (samples1 == buffer) {
 diff --git a/testhal/STM32/STM32F7xx/SPI/main.c b/testhal/STM32/STM32F7xx/SPI/main.c index cd7b3ed07..bfed6c07c 100644 --- a/testhal/STM32/STM32F7xx/SPI/main.c +++ b/testhal/STM32/STM32F7xx/SPI/main.c @@ -87,7 +87,7 @@ static THD_FUNCTION(spi_thread_1, p) {      /* Preparing data buffer and flushing cache.*/
      for (i = 0; i < SPI_BUFFERS_SIZE; i++)
        txbuf[i] = (uint8_t)i;
 -    dmaBufferFlush(txbuf, txbuf + SPI_BUFFERS_SIZE);
 +    dmaBufferFlush(txbuf, SPI_BUFFERS_SIZE);
      /* Slave selection and data exchange.*/
      spiSelect(&SPID2);
 @@ -97,7 +97,7 @@ static THD_FUNCTION(spi_thread_1, p) {  #if defined(SPI_LOOPBACK)
      /* Invalidating cache over the buffer then checking the
         loopback result.*/
 -    dmaBufferInvalidate(rxbuf, rxbuf + SPI_BUFFERS_SIZE);
 +    dmaBufferInvalidate(rxbuf, SPI_BUFFERS_SIZE);
      if (memcmp(txbuf, rxbuf, SPI_BUFFERS_SIZE) != 0)
        chSysHalt("loopback failure");
  #endif
 @@ -125,7 +125,7 @@ static THD_FUNCTION(spi_thread_2, p) {      /* Preparing data buffer and flushing cache.*/
      for (i = 0; i < SPI_BUFFERS_SIZE; i++)
        txbuf[i] = (uint8_t)(128U + i);
 -    dmaBufferFlush(txbuf, txbuf + SPI_BUFFERS_SIZE);
 +    dmaBufferFlush(txbuf, SPI_BUFFERS_SIZE);
      /* Slave selection and data exchange.*/
      spiSelect(&SPID2);
 @@ -135,7 +135,7 @@ static THD_FUNCTION(spi_thread_2, p) {  #if defined(SPI_LOOPBACK)
      /* Invalidating cache over the buffer then checking the
         loopback result.*/
 -    dmaBufferInvalidate(rxbuf, rxbuf + SPI_BUFFERS_SIZE);
 +    dmaBufferInvalidate(rxbuf, SPI_BUFFERS_SIZE);
      if (memcmp(txbuf, rxbuf, SPI_BUFFERS_SIZE) != 0)
        chSysHalt("loopback failure");
  #endif
  | 
