diff options
author | Joel Sherrill <joel@rtems.org> | 2019-11-12 09:33:41 -0600 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2019-12-11 15:22:33 -0600 |
commit | 08bd7d36cee1b041d54ee9dbace86a1b810938af (patch) | |
tree | 18de7bd20167d7430c82810d375534c56dfedb91 /cpukit/rtems | |
parent | pipe: Use condition variables (diff) | |
download | rtems-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/rtems')
-rw-r--r-- | cpukit/rtems/src/clockset.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c index d77268211b..a885fe1169 100644 --- a/cpukit/rtems/src/clockset.c +++ b/cpukit/rtems/src/clockset.c @@ -26,6 +26,8 @@ rtems_status_code rtems_clock_set( const rtems_time_of_day *tod ) { + bool retval; + if ( !tod ) return RTEMS_INVALID_ADDRESS; @@ -39,10 +41,13 @@ rtems_status_code rtems_clock_set( _TOD_Lock(); _TOD_Acquire( &lock_context ); - _TOD_Set( &tod_as_timespec, &lock_context ); + retval = _TOD_Set( &tod_as_timespec, &lock_context ); _TOD_Unlock(); - return RTEMS_SUCCESSFUL; + if ( retval == true ) { + return RTEMS_SUCCESSFUL; + } + return RTEMS_IO_ERROR; } return RTEMS_INVALID_CLOCK; |