From 08bd7d36cee1b041d54ee9dbace86a1b810938af Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 12 Nov 2019 09:33:41 -0600 Subject: Add TOD Hooks to allow BSP to take action when TOD is set Two use cases were envisioned for this. 1) a BSP or application which desires to update a real-time clock when the RTEMS TOD is set. 2) a paravirtualized BSP can use this to propagate setting the time in an RTEMS application to the hosting environment. This enables the entire set of applications in the virtualized environments to have a single consistent TOD. --- cpukit/score/src/coretodset.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cpukit/score/src/coretodset.c') diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c index b021a58dc6..94ecd0b322 100644 --- a/cpukit/score/src/coretodset.c +++ b/cpukit/score/src/coretodset.c @@ -22,7 +22,7 @@ #include #include -void _TOD_Set( +bool _TOD_Set( const struct timespec *tod, ISR_lock_Context *lock_context ) @@ -31,9 +31,16 @@ void _TOD_Set( uint64_t tod_as_ticks; uint32_t cpu_max; uint32_t cpu_index; + bool retval; _Assert( _TOD_Is_owner() ); + retval = _TOD_Hook_Run( TOD_ACTION_SET_CLOCK, tod ); + if ( retval == false ) { + _TOD_Release( lock_context ); + return false; + } + timespec2bintime( tod, &tod_as_bintime ); _Timecounter_Set_clock( &tod_as_bintime, lock_context ); @@ -67,4 +74,6 @@ void _TOD_Set( } _TOD.is_set = true; + + return true; } -- cgit v1.2.3