diff options
Diffstat (limited to 'cpukit/include/rtems/score/mrspimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/mrspimpl.h | 69 |
1 files changed, 42 insertions, 27 deletions
diff --git a/cpukit/include/rtems/score/mrspimpl.h b/cpukit/include/rtems/score/mrspimpl.h index daa309e7cb..fd783bf2a0 100644 --- a/cpukit/include/rtems/score/mrspimpl.h +++ b/cpukit/include/rtems/score/mrspimpl.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -8,17 +10,28 @@ */ /* - * Copyright (c) 2014, 2019 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * 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. + * Copyright (C) 2014, 2019 embedded brains GmbH & Co. KG + * + * 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. */ #ifndef _RTEMS_SCORE_MRSPIMPL_H @@ -51,7 +64,7 @@ extern "C" { * @param mrsp The MrsP control for the operation. * @param queue_context The thread queue context. */ -RTEMS_INLINE_ROUTINE void _MRSP_Acquire_critical( +static inline void _MRSP_Acquire_critical( MRSP_Control *mrsp, Thread_queue_Context *queue_context ) @@ -65,7 +78,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Acquire_critical( * @param mrsp The MrsP control for the operation. * @param queue_context The thread queue context. */ -RTEMS_INLINE_ROUTINE void _MRSP_Release( +static inline void _MRSP_Release( MRSP_Control *mrsp, Thread_queue_Context *queue_context ) @@ -80,7 +93,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Release( * * @return The owner of the Mrsp control. */ -RTEMS_INLINE_ROUTINE Thread_Control *_MRSP_Get_owner( +static inline Thread_Control *_MRSP_Get_owner( const MRSP_Control *mrsp ) { @@ -93,7 +106,7 @@ RTEMS_INLINE_ROUTINE Thread_Control *_MRSP_Get_owner( * @param[out] mrsp The MrsP control to set the owner of. * @param owner The desired new owner for @a mrsp. */ -RTEMS_INLINE_ROUTINE void _MRSP_Set_owner( +static inline void _MRSP_Set_owner( MRSP_Control *mrsp, Thread_Control *owner ) @@ -109,7 +122,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Set_owner( * * @return The priority of the MrsP control. */ -RTEMS_INLINE_ROUTINE Priority_Control _MRSP_Get_priority( +static inline Priority_Control _MRSP_Get_priority( const MRSP_Control *mrsp, const Scheduler_Control *scheduler ) @@ -117,6 +130,7 @@ RTEMS_INLINE_ROUTINE Priority_Control _MRSP_Get_priority( uint32_t scheduler_index; scheduler_index = _Scheduler_Get_index( scheduler ); + _Assert( scheduler_index < _Scheduler_Count ); return mrsp->ceiling_priorities[ scheduler_index ]; } @@ -127,7 +141,7 @@ RTEMS_INLINE_ROUTINE Priority_Control _MRSP_Get_priority( * @param schedulger The corresponding scheduler. * @param new_priority The new priority for the MrsP control */ -RTEMS_INLINE_ROUTINE void _MRSP_Set_priority( +static inline void _MRSP_Set_priority( MRSP_Control *mrsp, const Scheduler_Control *scheduler, Priority_Control new_priority @@ -136,6 +150,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Set_priority( uint32_t scheduler_index; scheduler_index = _Scheduler_Get_index( scheduler ); + _Assert( scheduler_index < _Scheduler_Count ); mrsp->ceiling_priorities[ scheduler_index ] = new_priority; } @@ -152,7 +167,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Set_priority( * @retval STATUS_MUTEX_CEILING_VIOLATED The wait priority of the thread * exceeds the ceiling priority. */ -RTEMS_INLINE_ROUTINE Status_Control _MRSP_Raise_priority( +static inline Status_Control _MRSP_Raise_priority( MRSP_Control *mrsp, Thread_Control *thread, Priority_Node *priority_node, @@ -194,7 +209,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Raise_priority( * @param priority_node The priority node to remove from the thread * @param queue_context The thread queue context. */ -RTEMS_INLINE_ROUTINE void _MRSP_Remove_priority( +static inline void _MRSP_Remove_priority( Thread_Control *thread, Priority_Node *priority_node, Thread_queue_Context *queue_context @@ -216,7 +231,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Remove_priority( * @param[out] thread The thread to replace the priorities. * @param ceiling_priority The node to be replaced. */ -RTEMS_INLINE_ROUTINE void _MRSP_Replace_priority( +static inline void _MRSP_Replace_priority( MRSP_Control *mrsp, Thread_Control *thread, Priority_Node *ceiling_priority @@ -244,7 +259,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Replace_priority( * @retval STATUS_MUTEX_CEILING_VIOLATED The wait priority of the executing * thread exceeds the ceiling priority. */ -RTEMS_INLINE_ROUTINE Status_Control _MRSP_Claim_ownership( +static inline Status_Control _MRSP_Claim_ownership( MRSP_Control *mrsp, Thread_Control *executing, Thread_queue_Context *queue_context @@ -287,7 +302,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Claim_ownership( * @retval STATUS_INVALID_NUMBER The MrsP control is initially locked. * @retval STATUS_NO_MEMORY There is not enough memory to allocate. */ -RTEMS_INLINE_ROUTINE Status_Control _MRSP_Initialize( +static inline Status_Control _MRSP_Initialize( MRSP_Control *mrsp, const Scheduler_Control *scheduler, Priority_Control ceiling_priority, @@ -348,7 +363,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Initialize( * @retval STATUS_DEADLOCK A deadlock occurred. * @retval STATUS_TIMEOUT A timeout occurred. */ -RTEMS_INLINE_ROUTINE Status_Control _MRSP_Wait_for_ownership( +static inline Status_Control _MRSP_Wait_for_ownership( MRSP_Control *mrsp, Thread_Control *executing, Thread_queue_Context *queue_context @@ -426,7 +441,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Wait_for_ownership( * @retval STATUS_MUTEX_CEILING_VIOLATED The current priority of the executing * thread exceeds the ceiling priority of the mutex. */ -RTEMS_INLINE_ROUTINE Status_Control _MRSP_Seize( +static inline Status_Control _MRSP_Seize( MRSP_Control *mrsp, Thread_Control *executing, bool wait, @@ -465,7 +480,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Seize( * @retval STATUS_SUCCESSFUL The operation succeeded. * @retval STATUS_NOT_OWNER The executing thread does not own the MrsP control. */ -RTEMS_INLINE_ROUTINE Status_Control _MRSP_Surrender( +static inline Status_Control _MRSP_Surrender( MRSP_Control *mrsp, Thread_Control *executing, Thread_queue_Context *queue_context @@ -517,7 +532,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Surrender( * @retval STATUS_RESOURCE_IN_USE The MrsP control is in use, * it cannot be destroyed. */ -RTEMS_INLINE_ROUTINE Status_Control _MRSP_Can_destroy( MRSP_Control *mrsp ) +static inline Status_Control _MRSP_Can_destroy( MRSP_Control *mrsp ) { if ( _MRSP_Get_owner( mrsp ) != NULL ) { return STATUS_RESOURCE_IN_USE; @@ -532,7 +547,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Can_destroy( MRSP_Control *mrsp ) * @param[in, out] The mrsp that is about to be destroyed. * @param queue_context The thread queue context. */ -RTEMS_INLINE_ROUTINE void _MRSP_Destroy( +static inline void _MRSP_Destroy( MRSP_Control *mrsp, Thread_queue_Context *queue_context ) |