From b61d5cac7c5f1ba801a8d0f896313b2e5cd01111 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 14 Jun 2016 10:56:09 +0200 Subject: bsps: Add CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR Add CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR clock driver option. If defined, then do the clock tick processing on the boot processor on behalf of all other processors. Currently, this is intended as a workaround for a Qemu shortcoming on ARM. Update #2737. --- c/src/lib/libbsp/shared/clockdrv_shell.h | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'c/src/lib/libbsp/shared/clockdrv_shell.h') diff --git a/c/src/lib/libbsp/shared/clockdrv_shell.h b/c/src/lib/libbsp/shared/clockdrv_shell.h index af038610a6..6609f5ea9b 100644 --- a/c/src/lib/libbsp/shared/clockdrv_shell.h +++ b/c/src/lib/libbsp/shared/clockdrv_shell.h @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef Clock_driver_nanoseconds_since_last_tick #error "Update driver to use the timecounter instead of nanoseconds extension" @@ -64,11 +65,29 @@ * instead of the default. */ #ifndef Clock_driver_timecounter_tick - #ifdef CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER - #define Clock_driver_timecounter_tick() rtems_clock_tick() - #else - #define Clock_driver_timecounter_tick() rtems_timecounter_tick() - #endif +static void Clock_driver_timecounter_tick( void ) +{ +#if defined(CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER) + rtems_clock_tick(); +#elif defined(RTEMS_SMP) && defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR) + uint32_t cpu_count = _SMP_Get_processor_count(); + uint32_t cpu_index; + + for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { + Per_CPU_Control *cpu; + + cpu = _Per_CPU_Get_by_index( cpu_index ); + + if ( _Per_CPU_Is_boot_processor( cpu ) ) { + rtems_timecounter_tick(); + } else if ( _Processor_mask_Is_set( _SMP_Online_processors, cpu_index ) ) { + _Watchdog_Tick( cpu ); + } + } +#else + rtems_timecounter_tick(); +#endif +} #endif /** -- cgit v1.2.3