1 | /* |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Initialize Scheduler Priority |
---|
5 | * @ingroup RTEMSScoreScheduler |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * Copyright (C) 2010 Gedare Bloom. |
---|
10 | * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/score/schedulerpriorityimpl.h> |
---|
22 | |
---|
23 | void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler ) |
---|
24 | { |
---|
25 | Scheduler_priority_Context *context = |
---|
26 | _Scheduler_priority_Get_context( scheduler ); |
---|
27 | |
---|
28 | _Priority_bit_map_Initialize( &context->Bit_map ); |
---|
29 | _Scheduler_priority_Ready_queue_initialize( |
---|
30 | &context->Ready[ 0 ], |
---|
31 | scheduler->maximum_priority |
---|
32 | ); |
---|
33 | } |
---|
34 | |
---|
35 | void _Scheduler_priority_Node_initialize( |
---|
36 | const Scheduler_Control *scheduler, |
---|
37 | Scheduler_Node *node, |
---|
38 | Thread_Control *the_thread, |
---|
39 | Priority_Control priority |
---|
40 | ) |
---|
41 | { |
---|
42 | Scheduler_priority_Context *context; |
---|
43 | Scheduler_priority_Node *the_node; |
---|
44 | |
---|
45 | _Scheduler_Node_do_initialize( scheduler, node, the_thread, priority ); |
---|
46 | |
---|
47 | context = _Scheduler_priority_Get_context( scheduler ); |
---|
48 | the_node = _Scheduler_priority_Node_downcast( node ); |
---|
49 | _Scheduler_priority_Ready_queue_update( |
---|
50 | &the_node->Ready_queue, |
---|
51 | SCHEDULER_PRIORITY_UNMAP( priority ), |
---|
52 | &context->Bit_map, |
---|
53 | &context->Ready[ 0 ] |
---|
54 | ); |
---|
55 | } |
---|