summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/coretodset.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2019-11-12 09:33:41 -0600
committerJoel Sherrill <joel@rtems.org>2019-12-11 15:22:33 -0600
commit08bd7d36cee1b041d54ee9dbace86a1b810938af (patch)
tree18de7bd20167d7430c82810d375534c56dfedb91 /cpukit/score/src/coretodset.c
parentpipe: Use condition variables (diff)
downloadrtems-08bd7d36cee1b041d54ee9dbace86a1b810938af.tar.bz2
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.
Diffstat (limited to 'cpukit/score/src/coretodset.c')
-rw-r--r--cpukit/score/src/coretodset.c11
1 files changed, 10 insertions, 1 deletions
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 <rtems/score/assert.h>
#include <rtems/score/watchdogimpl.h>
-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;
}