1 | /* |
---|
2 | * Scheduler Handler |
---|
3 | * |
---|
4 | * Copyright (C) 2010 Gedare Bloom. |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * http://www.rtems.com/license/LICENSE. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | |
---|
13 | #if HAVE_CONFIG_H |
---|
14 | #include "config.h" |
---|
15 | #endif |
---|
16 | |
---|
17 | #include <rtems/system.h> |
---|
18 | #include <rtems/config.h> |
---|
19 | #include <rtems/score/chain.h> |
---|
20 | #include <rtems/score/isr.h> |
---|
21 | #include <rtems/score/object.h> |
---|
22 | #include <rtems/score/scheduler.h> |
---|
23 | #include <rtems/score/schedulerpriority.h> |
---|
24 | #include <rtems/score/states.h> |
---|
25 | #include <rtems/score/thread.h> |
---|
26 | |
---|
27 | /* Instantiate any global variables needed by the priority scheduler */ |
---|
28 | volatile Priority_bit_map_Control _Priority_Major_bit_map; |
---|
29 | |
---|
30 | Priority_bit_map_Control _Priority_Bit_map[16] CPU_STRUCTURE_ALIGNMENT; |
---|
31 | |
---|
32 | /* |
---|
33 | * _Scheduler_priority_Initialize |
---|
34 | * |
---|
35 | * Initializes the scheduler for priority scheduling. |
---|
36 | * |
---|
37 | * Input parameters: |
---|
38 | * the_scheduler - pointer to scheduler control |
---|
39 | * |
---|
40 | * Output parameters: NONE |
---|
41 | */ |
---|
42 | |
---|
43 | void _Scheduler_priority_Initialize ( |
---|
44 | Scheduler_Control *the_scheduler |
---|
45 | ) |
---|
46 | { |
---|
47 | /* the operations table is a jump table to redirect generic scheduler |
---|
48 | * function calls to scheduler implementation specific functions. The |
---|
49 | * main purpose of scheduler initialization is to set up the jump table |
---|
50 | * for the scheduler. Every scheduler implementation provides its own |
---|
51 | * scheduler operations table. |
---|
52 | */ |
---|
53 | the_scheduler->operations.schedule = &_Scheduler_priority_Schedule; |
---|
54 | the_scheduler->operations.yield = &_Scheduler_priority_Yield; |
---|
55 | the_scheduler->operations.block = &_Scheduler_priority_Block; |
---|
56 | the_scheduler->operations.unblock = &_Scheduler_priority_Unblock; |
---|
57 | the_scheduler->operations.scheduler_allocate = |
---|
58 | &_Scheduler_priority_Thread_scheduler_allocate; |
---|
59 | the_scheduler->operations.scheduler_free = |
---|
60 | &_Scheduler_priority_Thread_scheduler_free; |
---|
61 | the_scheduler->operations.scheduler_update = |
---|
62 | &_Scheduler_priority_Thread_scheduler_update; |
---|
63 | |
---|
64 | _Scheduler_priority_Ready_queue_initialize( the_scheduler ); |
---|
65 | _Priority_bit_map_Handler_initialization( ); |
---|
66 | } |
---|