[PATCH 6/8] score: Add scheduler node implementation header

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 6 12:40:26 UTC 2016


Update #2556.
---
 cpukit/score/Makefile.am                           |   1 +
 cpukit/score/include/rtems/score/schedulerimpl.h   | 100 ---------------
 cpukit/score/include/rtems/score/schedulernode.h   |   6 -
 .../score/include/rtems/score/schedulernodeimpl.h  | 134 +++++++++++++++++++++
 cpukit/score/include/rtems/score/threadimpl.h      |   1 +
 cpukit/score/preinstall.am                         |   4 +
 6 files changed, 140 insertions(+), 106 deletions(-)
 create mode 100644 cpukit/score/include/rtems/score/schedulernodeimpl.h

diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index c12820b..f18af7d 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -73,6 +73,7 @@ include_rtems_score_HEADERS += include/rtems/score/schedulercbsimpl.h
 include_rtems_score_HEADERS += include/rtems/score/scheduleredf.h
 include_rtems_score_HEADERS += include/rtems/score/scheduleredfimpl.h
 include_rtems_score_HEADERS += include/rtems/score/schedulernode.h
+include_rtems_score_HEADERS += include/rtems/score/schedulernodeimpl.h
 include_rtems_score_HEADERS += include/rtems/score/schedulerpriority.h
 include_rtems_score_HEADERS += include/rtems/score/schedulerpriorityimpl.h
 include_rtems_score_HEADERS += include/rtems/score/schedulerprioritysmp.h
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 0832360..bbad6e0 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -110,15 +110,6 @@ RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Thread_get_own_node(
 #endif
 }
 
-#if defined(RTEMS_SMP)
-RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Node_get_user(
-  const Scheduler_Node *node
-)
-{
-  return node->user;
-}
-#endif
-
 ISR_LOCK_DECLARE( extern, _Scheduler_Lock )
 
 /**
@@ -779,82 +770,6 @@ RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Thread_get_node(
   return the_thread->Scheduler.node;
 }
 
-RTEMS_INLINE_ROUTINE void _Scheduler_Node_do_initialize(
-  Scheduler_Node   *node,
-  Thread_Control   *the_thread,
-  Priority_Control  priority
-)
-{
-  node->owner = the_thread;
-
-  node->Priority.value = priority;
-  node->Priority.prepend_it = false;
-
-#if defined(RTEMS_SMP)
-  node->user = the_thread;
-  node->help_state = SCHEDULER_HELP_YOURSELF;
-  node->idle = NULL;
-  node->accepts_help = the_thread;
-  _SMP_sequence_lock_Initialize( &node->Priority.Lock );
-#else
-  (void) the_thread;
-#endif
-}
-
-RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Node_get_owner(
-  const Scheduler_Node *node
-)
-{
-  return node->owner;
-}
-
-RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Node_get_priority(
-  Scheduler_Node *node,
-  bool           *prepend_it_p
-)
-{
-  Priority_Control priority;
-  bool             prepend_it;
-
-#if defined(RTEMS_SMP)
-  unsigned int     seq;
-
-  do {
-    seq = _SMP_sequence_lock_Read_begin( &node->Priority.Lock );
-#endif
-
-    priority = node->Priority.value;
-    prepend_it = node->Priority.prepend_it;
-
-#if defined(RTEMS_SMP)
-  } while ( _SMP_sequence_lock_Read_retry( &node->Priority.Lock, seq ) );
-#endif
-
-  *prepend_it_p = prepend_it;
-
-  return priority;
-}
-
-RTEMS_INLINE_ROUTINE void _Scheduler_Node_set_priority(
-  Scheduler_Node   *node,
-  Priority_Control  new_priority,
-  bool              prepend_it
-)
-{
-#if defined(RTEMS_SMP)
-  unsigned int seq;
-
-  seq = _SMP_sequence_lock_Write_begin( &node->Priority.Lock );
-#endif
-
-  node->Priority.value = new_priority;
-  node->Priority.prepend_it = prepend_it;
-
-#if defined(RTEMS_SMP)
-  _SMP_sequence_lock_Write_end( &node->Priority.Lock, seq );
-#endif
-}
-
 RTEMS_INLINE_ROUTINE void _Scheduler_Thread_set_priority(
   Thread_Control   *the_thread,
   Priority_Control  new_priority,
@@ -893,21 +808,6 @@ typedef void ( *Scheduler_Release_idle_thread )(
   Thread_Control    *idle
 );
 
-RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Node_get_idle(
-  const Scheduler_Node *node
-)
-{
-  return node->idle;
-}
-
-RTEMS_INLINE_ROUTINE void _Scheduler_Node_set_user(
-  Scheduler_Node *node,
-  Thread_Control *user
-)
-{
-  node->user = user;
-}
-
 RTEMS_INLINE_ROUTINE void _Scheduler_Thread_set_node(
   Thread_Control *the_thread,
   Scheduler_Node *node
diff --git a/cpukit/score/include/rtems/score/schedulernode.h b/cpukit/score/include/rtems/score/schedulernode.h
index 63d86e6..293887c 100644
--- a/cpukit/score/include/rtems/score/schedulernode.h
+++ b/cpukit/score/include/rtems/score/schedulernode.h
@@ -205,12 +205,6 @@ typedef struct {
   } Priority;
 } Scheduler_Node;
 
-#define SCHEDULER_NODE_OF_WAIT_CHAIN_NODE( node ) \
-  RTEMS_CONTAINER_OF( node, Scheduler_Node, Wait.Node.Chain )
-
-#define SCHEDULER_NODE_OF_WAIT_RBTREE_NODE( node ) \
-  RTEMS_CONTAINER_OF( node, Scheduler_Node, Wait.Node.RBTree )
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/cpukit/score/include/rtems/score/schedulernodeimpl.h b/cpukit/score/include/rtems/score/schedulernodeimpl.h
new file mode 100644
index 0000000..ecb61c2
--- /dev/null
+++ b/cpukit/score/include/rtems/score/schedulernodeimpl.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2014, 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at 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.
+ */
+
+#ifndef _RTEMS_SCORE_SCHEDULERNODEIMPL_H
+#define _RTEMS_SCORE_SCHEDULERNODEIMPL_H
+
+#include <rtems/score/schedulernode.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define SCHEDULER_NODE_OF_WAIT_CHAIN_NODE( node ) \
+  RTEMS_CONTAINER_OF( node, Scheduler_Node, Wait.Node.Chain )
+
+#define SCHEDULER_NODE_OF_WAIT_RBTREE_NODE( node ) \
+  RTEMS_CONTAINER_OF( node, Scheduler_Node, Wait.Node.RBTree )
+
+RTEMS_INLINE_ROUTINE void _Scheduler_Node_do_initialize(
+  Scheduler_Node   *node,
+  Thread_Control   *the_thread,
+  Priority_Control  priority
+)
+{
+  node->owner = the_thread;
+
+  node->Priority.value = priority;
+  node->Priority.prepend_it = false;
+
+#if defined(RTEMS_SMP)
+  node->user = the_thread;
+  node->help_state = SCHEDULER_HELP_YOURSELF;
+  node->idle = NULL;
+  node->accepts_help = the_thread;
+  _SMP_sequence_lock_Initialize( &node->Priority.Lock );
+#else
+  (void) the_thread;
+#endif
+}
+
+RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Node_get_owner(
+  const Scheduler_Node *node
+)
+{
+  return node->owner;
+}
+
+RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Node_get_priority(
+  Scheduler_Node *node,
+  bool           *prepend_it_p
+)
+{
+  Priority_Control priority;
+  bool             prepend_it;
+
+#if defined(RTEMS_SMP)
+  unsigned int     seq;
+
+  do {
+    seq = _SMP_sequence_lock_Read_begin( &node->Priority.Lock );
+#endif
+
+    priority = node->Priority.value;
+    prepend_it = node->Priority.prepend_it;
+
+#if defined(RTEMS_SMP)
+  } while ( _SMP_sequence_lock_Read_retry( &node->Priority.Lock, seq ) );
+#endif
+
+  *prepend_it_p = prepend_it;
+
+  return priority;
+}
+
+RTEMS_INLINE_ROUTINE void _Scheduler_Node_set_priority(
+  Scheduler_Node   *node,
+  Priority_Control  new_priority,
+  bool              prepend_it
+)
+{
+#if defined(RTEMS_SMP)
+  unsigned int seq;
+
+  seq = _SMP_sequence_lock_Write_begin( &node->Priority.Lock );
+#endif
+
+  node->Priority.value = new_priority;
+  node->Priority.prepend_it = prepend_it;
+
+#if defined(RTEMS_SMP)
+  _SMP_sequence_lock_Write_end( &node->Priority.Lock, seq );
+#endif
+}
+
+#if defined(RTEMS_SMP)
+RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Node_get_user(
+  const Scheduler_Node *node
+)
+{
+  return node->user;
+}
+
+RTEMS_INLINE_ROUTINE void _Scheduler_Node_set_user(
+  Scheduler_Node *node,
+  Thread_Control *user
+)
+{
+  node->user = user;
+}
+
+RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Node_get_idle(
+  const Scheduler_Node *node
+)
+{
+  return node->idle;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_SCHEDULERNODEIMPL_H */
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 2b45a2e..30f903f 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -28,6 +28,7 @@
 #include <rtems/score/isr.h>
 #include <rtems/score/objectimpl.h>
 #include <rtems/score/resourceimpl.h>
+#include <rtems/score/schedulernodeimpl.h>
 #include <rtems/score/statesimpl.h>
 #include <rtems/score/status.h>
 #include <rtems/score/sysstate.h>
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 85527c6..61d44b8 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -260,6 +260,10 @@ $(PROJECT_INCLUDE)/rtems/score/schedulernode.h: include/rtems/score/schedulernod
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulernode.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulernode.h
 
+$(PROJECT_INCLUDE)/rtems/score/schedulernodeimpl.h: include/rtems/score/schedulernodeimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulernodeimpl.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulernodeimpl.h
+
 $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h: include/rtems/score/schedulerpriority.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulerpriority.h
-- 
1.8.4.5




More information about the devel mailing list