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/rtems/src/clockset.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cpukit/rtems') 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; -- cgit v1.2.3