diff options
Diffstat (limited to 'cpukit/rtems/src/ratemongetstatus.c')
-rw-r--r-- | cpukit/rtems/src/ratemongetstatus.c | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/ratemongetstatus.c index 745b52f026..8443c5ed94 100644 --- a/cpukit/rtems/src/ratemongetstatus.c +++ b/cpukit/rtems/src/ratemongetstatus.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -10,12 +12,29 @@ /* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). - * Copyright (c) 2016 embedded brains GmbH. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * Copyright (c) 2017 Kuan-Hsun Chen. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H @@ -31,7 +50,6 @@ rtems_status_code rtems_rate_monotonic_get_status( { Rate_monotonic_Control *the_period; ISR_lock_Context lock_context; - rtems_status_code status; if ( period_status == NULL ) { return RTEMS_INVALID_ADDRESS; @@ -54,35 +72,28 @@ rtems_status_code rtems_rate_monotonic_get_status( */ _Timespec_Set_to_zero( &period_status->since_last_period ); _Timespec_Set_to_zero( &period_status->executed_since_last_period ); - status = RTEMS_SUCCESSFUL; } else { Timestamp_Control wall_since_last_period; Timestamp_Control cpu_since_last_period; - bool valid_status; /* * Grab the current status. */ - valid_status = _Rate_monotonic_Get_status( + _Rate_monotonic_Get_status( the_period, &wall_since_last_period, &cpu_since_last_period ); - if ( valid_status ) { - _Timestamp_To_timespec( - &wall_since_last_period, - &period_status->since_last_period - ); - _Timestamp_To_timespec( - &cpu_since_last_period, - &period_status->executed_since_last_period - ); - status = RTEMS_SUCCESSFUL; - } else { - status = RTEMS_NOT_DEFINED; - } + _Timestamp_To_timespec( + &wall_since_last_period, + &period_status->since_last_period + ); + _Timestamp_To_timespec( + &cpu_since_last_period, + &period_status->executed_since_last_period + ); } _Rate_monotonic_Release( the_period, &lock_context ); - return status; + return RTEMS_SUCCESSFUL; } |