From d8b4ba3e592d490fb1572a07b6c48d7ba6c02687 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 13 Aug 2015 09:57:10 +0000 Subject: Added cache handling to DMAv2 driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8209 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'testhal/STM32/STM32F7xx') diff --git a/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c b/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c index a71d2540f..0ff6372bf 100644 --- a/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c +++ b/testhal/STM32/STM32F7xx/GPT-ADC-SPI-PWM-ICU/main.c @@ -47,6 +47,11 @@ size_t nx = 0, ny = 0; static void adccallback(ADCDriver *adcp, adcsample_t *buffer, size_t n) { (void)adcp; + + /* DMA buffer invalidation because data cache.*/ + dmaBufferInvalidate(buffer, n * ADC_GRP1_NUM_CHANNELS); + + /* Updating counters.*/ if (samples1 == buffer) { nx += n; } @@ -111,11 +116,6 @@ static THD_FUNCTION(Thread1, arg) { */ int main(void) { - SCB_InvalidateICache(); - SCB_EnableICache(); - SCB_InvalidateDCache(); - SCB_EnableDCache(); - /* * System initializations. * - HAL initialization, this also initializes the configured device drivers @@ -126,6 +126,11 @@ int main(void) { halInit(); chSysInit(); + SCB_InvalidateICache(); + SCB_EnableICache(); + SCB_InvalidateDCache(); + SCB_EnableDCache(); + /* * Activates the serial driver 1 using the driver default configuration. */ -- cgit v1.2.3