RTEMS CPU Kit with SuperCore  4.11.2
schedulersimpleimpl.h
Go to the documentation of this file.
1 
11 /*
12  * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
13  *
14  * The license and distribution terms for this file may be
15  * found in the file LICENSE in this distribution or at
16  * http://www.rtems.org/license/LICENSE.
17  */
18 
19 #ifndef _RTEMS_SCORE_SCHEDULERSIMPLEIMPL_H
20 #define _RTEMS_SCORE_SCHEDULERSIMPLEIMPL_H
21 
23 #include <rtems/score/chainimpl.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
36  _Scheduler_simple_Get_context( const Scheduler_Control *scheduler )
37 {
38  return (Scheduler_simple_Context *) _Scheduler_Get_context( scheduler );
39 }
40 
41 RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order(
42  const Chain_Node *to_insert,
43  const Chain_Node *next
44 )
45 {
46  const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
47  const Thread_Control *thread_next = (const Thread_Control *) next;
48 
49  return thread_to_insert->current_priority <= thread_next->current_priority;
50 }
51 
52 RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order(
53  const Chain_Node *to_insert,
54  const Chain_Node *next
55 )
56 {
57  const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
58  const Thread_Control *thread_next = (const Thread_Control *) next;
59 
60  return thread_to_insert->current_priority < thread_next->current_priority;
61 }
62 
63 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_lifo(
64  Chain_Control *chain,
65  Thread_Control *to_insert
66 )
67 {
69  chain,
70  &to_insert->Object.Node,
71  _Scheduler_simple_Insert_priority_lifo_order
72  );
73 }
74 
75 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo(
76  Chain_Control *chain,
77  Thread_Control *to_insert
78 )
79 {
81  chain,
82  &to_insert->Object.Node,
83  _Scheduler_simple_Insert_priority_fifo_order
84  );
85 }
86 
87 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Extract(
88  const Scheduler_Control *scheduler,
89  Thread_Control *the_thread
90 )
91 {
92  (void) scheduler;
93 
94  _Chain_Extract_unprotected( &the_thread->Object.Node );
95 }
96 
97 RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(
98  const Scheduler_Control *scheduler,
99  Thread_Control *the_thread,
100  bool force_dispatch
101 )
102 {
103  Scheduler_simple_Context *context =
104  _Scheduler_simple_Get_context( scheduler );
105  Thread_Control *heir = (Thread_Control *) _Chain_First( &context->Ready );
106 
107  ( void ) the_thread;
108 
109  _Scheduler_Update_heir( heir, force_dispatch );
110 }
111 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif
119 /* end of include file */
This is used to manage each element (node) which is placed on a chain.
Definition: chain.h:65
Scheduler control.
Definition: scheduler.h:192
Priority_Control current_priority
This field is the current priority state of this thread.
Definition: thread.h:683
Chain_Control Ready
One ready queue for all ready threads.
Definition: schedulersimple.h:69
#define RTEMS_INLINE_ROUTINE
The following (in conjunction with compiler arguments) are used to choose between the use of static i...
Definition: basedefs.h:135
Inlined Routines Associated with the Manipulation of the Scheduler.
This is used to manage a chain.
Definition: chain.h:83
RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected(Chain_Node *the_node)
Extract this node (unprotected).
Definition: chainimpl.h:639
Simple scheduler context.
Definition: schedulersimple.h:60
Manipulation of Threads Simple-Priority-Based Ready Queue.
Objects_Control Object
This field is the object management structure for each thread.
Definition: thread.h:673
This structure defines the Thread Control Block (TCB).
Definition: thread.h:671
Chain_Node Node
This is the chain node portion of an object.
Definition: object.h:234
Chain Handler API.
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_First(Chain_Control *the_chain)
Return pointer to chain&#39;s first node.
Definition: chainimpl.h:366
RTEMS_INLINE_ROUTINE void _Chain_Insert_ordered_unprotected(Chain_Control *chain, Chain_Node *to_insert, Chain_Node_order order)
Inserts a node into the chain according to the order relation.
Definition: chainimpl.h:934