summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/priorityimpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/include/rtems/score/priorityimpl.h')
-rw-r--r--cpukit/include/rtems/score/priorityimpl.h132
1 files changed, 61 insertions, 71 deletions
diff --git a/cpukit/include/rtems/score/priorityimpl.h b/cpukit/include/rtems/score/priorityimpl.h
index 2895a0c4a5..2a95ea605c 100644
--- a/cpukit/include/rtems/score/priorityimpl.h
+++ b/cpukit/include/rtems/score/priorityimpl.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
/**
* @file
*
@@ -8,17 +10,28 @@
*/
/*
- * Copyright (c) 2016 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) 2016 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_PRIORITYIMPL_H
@@ -65,7 +78,7 @@ typedef enum {
*
* @param[out] actions The actions to be initialized empty.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Actions_initialize_empty(
+static inline void _Priority_Actions_initialize_empty(
Priority_Actions *actions
)
{
@@ -80,7 +93,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Actions_initialize_empty(
* @param node The action node for the @a actions to be initialized.
* @param type The action type for the @a actions to be initialized.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Actions_initialize_one(
+static inline void _Priority_Actions_initialize_one(
Priority_Actions *actions,
Priority_Aggregation *aggregation,
Priority_Node *node,
@@ -104,7 +117,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Actions_initialize_one(
* @retval true The priority actions @a actions is empty.
* @retval false The priority actions @a actions is empty.
*/
-RTEMS_INLINE_ROUTINE bool _Priority_Actions_is_empty(
+static inline bool _Priority_Actions_is_empty(
const Priority_Actions *actions
)
{
@@ -112,33 +125,13 @@ RTEMS_INLINE_ROUTINE bool _Priority_Actions_is_empty(
}
/**
- * @brief Checks if the priority actions is valid.
- *
- * @param aggregation The aggregation of the priority action.
- *
- * @retval true The @a aggregation is valid.
- * @retval false The @a aggregation is not valid.
- */
-RTEMS_INLINE_ROUTINE bool _Priority_Actions_is_valid(
- const Priority_Aggregation *aggregation
-)
-{
-#if defined(RTEMS_SMP)
- return aggregation != NULL;
-#else
- (void) aggregation;
- return false;
-#endif
-}
-
-/**
* @brief Moves the priority actions' actions.
*
* @param[in, out] actions The priority actions to move the actions away from.
*
* @return The former actions of @a actions that were moved.
*/
-RTEMS_INLINE_ROUTINE Priority_Aggregation *_Priority_Actions_move(
+static inline Priority_Aggregation *_Priority_Actions_move(
Priority_Actions *actions
)
{
@@ -156,7 +149,7 @@ RTEMS_INLINE_ROUTINE Priority_Aggregation *_Priority_Actions_move(
* @param[in, out] actions The priority actions to add actions to.
* @param[out] aggregation The actions to add to @a actions.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Actions_add(
+static inline void _Priority_Actions_add(
Priority_Actions *actions,
Priority_Aggregation *aggregation
)
@@ -177,7 +170,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Actions_add(
* @param[out] node The priority node to be initialized.
* @param priority The priority to initialize @a node to.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Node_initialize(
+static inline void _Priority_Node_initialize(
Priority_Node *node,
Priority_Control priority
)
@@ -192,7 +185,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Node_initialize(
* @param[out] node The priority node to set the priority of.
* @param priority The new priority for @a node.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Node_set_priority(
+static inline void _Priority_Node_set_priority(
Priority_Node *node,
Priority_Control priority
)
@@ -205,7 +198,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Node_set_priority(
*
* @param[in, out] node The priority node to set inactive.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Node_set_inactive(
+static inline void _Priority_Node_set_inactive(
Priority_Node *node
)
{
@@ -220,7 +213,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Node_set_inactive(
* @retval true The priority node is active.
* @retval false The priority node is inactive.
*/
-RTEMS_INLINE_ROUTINE bool _Priority_Node_is_active(
+static inline bool _Priority_Node_is_active(
const Priority_Node *node
)
{
@@ -232,7 +225,7 @@ RTEMS_INLINE_ROUTINE bool _Priority_Node_is_active(
*
* @param[out] aggregation The priority aggregaton to initialize empty.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Initialize_empty(
+static inline void _Priority_Initialize_empty(
Priority_Aggregation *aggregation
)
{
@@ -253,7 +246,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Initialize_empty(
* @param[out] aggregation The priority aggregaton to initialize.
* @param node The priority node to initialize @a aggregation with.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Initialize_one(
+static inline void _Priority_Initialize_one(
Priority_Aggregation *aggregation,
Priority_Node *node
)
@@ -277,7 +270,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Initialize_one(
* @retval true The priority aggregation is empty.
* @retval false The priority aggregation is not empty.
*/
-RTEMS_INLINE_ROUTINE bool _Priority_Is_empty(
+static inline bool _Priority_Is_empty(
const Priority_Aggregation *aggregation
)
{
@@ -291,7 +284,7 @@ RTEMS_INLINE_ROUTINE bool _Priority_Is_empty(
*
* @return The priority of @a aggregation.
*/
-RTEMS_INLINE_ROUTINE Priority_Control _Priority_Get_priority(
+static inline Priority_Control _Priority_Get_priority(
const Priority_Aggregation *aggregation
)
{
@@ -305,7 +298,7 @@ RTEMS_INLINE_ROUTINE Priority_Control _Priority_Get_priority(
*
* @return The scheduler of @a aggregation.
*/
-RTEMS_INLINE_ROUTINE const Scheduler_Control *_Priority_Get_scheduler(
+static inline const Scheduler_Control *_Priority_Get_scheduler(
const Priority_Aggregation *aggregation
)
{
@@ -323,7 +316,7 @@ RTEMS_INLINE_ROUTINE const Scheduler_Control *_Priority_Get_scheduler(
*
* @return The minimum node of @a aggregation
*/
-RTEMS_INLINE_ROUTINE Priority_Node *_Priority_Get_minimum_node(
+static inline Priority_Node *_Priority_Get_minimum_node(
const Priority_Aggregation *aggregation
)
{
@@ -336,7 +329,7 @@ RTEMS_INLINE_ROUTINE Priority_Node *_Priority_Get_minimum_node(
* @param[out] aggregation The priority aggregation to set the action node of.
* @param node The new priority node for @a aggregation.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Set_action_node(
+static inline void _Priority_Set_action_node(
Priority_Aggregation *aggregation,
Priority_Node *node
)
@@ -350,7 +343,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Set_action_node(
* @param[out] aggregation The priority aggregation to set the action type of.
* @param type The new action type for @a aggregation.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Set_action_type(
+static inline void _Priority_Set_action_type(
Priority_Aggregation *aggregation,
Priority_Action_type type
)
@@ -366,7 +359,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Set_action_type(
* @param node The new action node for @a aggregation.
* @param type The new action type for @a aggregation.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Set_action(
+static inline void _Priority_Set_action(
Priority_Aggregation *aggregation,
Priority_Node *node,
Priority_Action_type type
@@ -376,25 +369,22 @@ RTEMS_INLINE_ROUTINE void _Priority_Set_action(
aggregation->Action.type = type;
}
+#if defined(RTEMS_SMP)
/**
* @brief Gets the next action of the priority aggregation.
*
- * @param aggregation The priority aggregation to get the next action of.
+ * @param aggregation is the priority aggregation to get the next action of.
*
- * @retval next_action The next action of @a aggregation if RTEMS_SMP is defined.
- * @retval NULL RTEMS_SMP is not defined.
+ * @return Returns the next action of the priority aggregation or NULL if there
+ * is no next action.
*/
-RTEMS_INLINE_ROUTINE Priority_Aggregation *_Priority_Get_next_action(
+static inline Priority_Aggregation *_Priority_Get_next_action(
const Priority_Aggregation *aggregation
)
{
-#if defined(RTEMS_SMP)
return aggregation->Action.next;
-#else
- (void) aggregation;
- return NULL;
-#endif
}
+#endif
/**
* @brief Compares two priorities.
@@ -405,7 +395,7 @@ RTEMS_INLINE_ROUTINE Priority_Aggregation *_Priority_Get_next_action(
* @retval true The priority on the left hand side of the comparison is smaller.
* @retval false The priority on the left hand side of the comparison is greater of equal.
*/
-RTEMS_INLINE_ROUTINE bool _Priority_Less(
+static inline bool _Priority_Less(
const void *left,
const RBTree_Node *right
)
@@ -413,7 +403,7 @@ RTEMS_INLINE_ROUTINE bool _Priority_Less(
const Priority_Control *the_left;
const Priority_Node *the_right;
- the_left = left;
+ the_left = (const Priority_Control *) left;
the_right = RTEMS_CONTAINER_OF( right, Priority_Node, Node.RBTree );
return *the_left < the_right->priority;
@@ -432,7 +422,7 @@ RTEMS_INLINE_ROUTINE bool _Priority_Less(
* @retval true The inserted node with its priority is the minimum of the RBTree.
* @retval false The inserted node with its priority is not the minimum of the RBTree.
*/
-RTEMS_INLINE_ROUTINE bool _Priority_Plain_insert(
+static inline bool _Priority_Plain_insert(
Priority_Aggregation *aggregation,
Priority_Node *node,
Priority_Control priority
@@ -454,7 +444,7 @@ RTEMS_INLINE_ROUTINE bool _Priority_Plain_insert(
* @param[in, out] aggregation The aggregation to extract the node from.
* @param node The node to be extracted.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Plain_extract(
+static inline void _Priority_Plain_extract(
Priority_Aggregation *aggregation,
Priority_Node *node
)
@@ -471,7 +461,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Plain_extract(
* @param[in, out] aggregation The aggregation to change the node in.
* @param node The node that has a new priority and will be reinserted in the aggregation.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Plain_changed(
+static inline void _Priority_Plain_changed(
Priority_Aggregation *aggregation,
Priority_Node *node
)
@@ -509,7 +499,7 @@ typedef void ( *Priority_Remove_handler )(
* @param actions Is ignored by the method.
* @param arg Is ignored by the method.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Change_nothing(
+static inline void _Priority_Change_nothing(
Priority_Aggregation *aggregation,
Priority_Group_order group_order,
Priority_Actions *actions,
@@ -531,7 +521,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Change_nothing(
* @param actions Is ignored by the method.
* @param arg Is ignored by the method.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Remove_nothing(
+static inline void _Priority_Remove_nothing(
Priority_Aggregation *aggregation,
Priority_Actions *actions,
void *arg
@@ -555,7 +545,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Remove_nothing(
* @param arg Arguments for @a change that is used if the node is the new
* minimum.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Non_empty_insert(
+static inline void _Priority_Non_empty_insert(
Priority_Aggregation *aggregation,
Priority_Node *node,
Priority_Actions *actions,
@@ -586,7 +576,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Non_empty_insert(
* insert and @a node is the new minimum of the aggregation.
* @param arg The arguments for @a change.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Insert(
+static inline void _Priority_Insert(
Priority_Aggregation *aggregation,
Priority_Node *node,
Priority_Actions *actions,
@@ -620,7 +610,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Insert(
* @param change Is called in the case that the minimal node was extracted.
* @param arg The arguments for @a remove and @a change.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Extract(
+static inline void _Priority_Extract(
Priority_Aggregation *aggregation,
Priority_Node *node,
Priority_Actions *actions,
@@ -660,7 +650,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Extract(
* @param change Is called in the case that the minimal node was extracted.
* @param arg The arguments for @a change.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Extract_non_empty(
+static inline void _Priority_Extract_non_empty(
Priority_Aggregation *aggregation,
Priority_Node *node,
Priority_Actions *actions,
@@ -695,7 +685,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Extract_non_empty(
* @param change Is called if the minimal priority is incorrectly set after the change.
* @param arg The arguments for @a change.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Changed(
+static inline void _Priority_Changed(
Priority_Aggregation *aggregation,
Priority_Node *node,
Priority_Group_order group_order,
@@ -731,7 +721,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Changed(
* @param[out] replacement The node that replaces @a victim. It obtains its priority
* from @a victim.
*/
-RTEMS_INLINE_ROUTINE void _Priority_Replace(
+static inline void _Priority_Replace(
Priority_Aggregation *aggregation,
Priority_Node *victim,
Priority_Node *replacement