diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-06-14 10:56:09 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-06-14 11:57:48 +0200 |
commit | b61d5cac7c5f1ba801a8d0f896313b2e5cd01111 (patch) | |
tree | b76e1012bcf602b35b426582ab4e97c38ed5df8f /c/src/lib/libbsp/shared/clockdrv_shell.h | |
parent | score: _Scheduler_priority_Ready_queue_initialize (diff) | |
download | rtems-b61d5cac7c5f1ba801a8d0f896313b2e5cd01111.tar.bz2 |
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.
Diffstat (limited to 'c/src/lib/libbsp/shared/clockdrv_shell.h')
-rw-r--r-- | c/src/lib/libbsp/shared/clockdrv_shell.h | 29 |
1 files changed, 24 insertions, 5 deletions
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 <rtems/clockdrv.h> #include <rtems/score/percpu.h> #include <rtems/score/smpimpl.h> +#include <rtems/score/watchdogimpl.h> #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 /** |