[ba7bc099] | 1 | /** |
---|
[a936aa49] | 2 | * @file |
---|
[ba7bc099] | 3 | * |
---|
[a936aa49] | 4 | * @brief Simple SMP Scheduler API |
---|
[a1f9934a] | 5 | * |
---|
[5b1ff71a] | 6 | * @ingroup ScoreSchedulerSMPSimple |
---|
[ba7bc099] | 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). |
---|
| 11 | * |
---|
[a936aa49] | 12 | * Copyright (c) 2013 embedded brains GmbH. |
---|
| 13 | * |
---|
[ba7bc099] | 14 | * The license and distribution terms for this file may be |
---|
| 15 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 16 | * http://www.rtems.org/license/LICENSE. |
---|
[ba7bc099] | 17 | */ |
---|
| 18 | |
---|
| 19 | #ifndef _RTEMS_SCORE_SCHEDULERSIMPLE_SMP_H |
---|
| 20 | #define _RTEMS_SCORE_SCHEDULERSIMPLE_SMP_H |
---|
| 21 | |
---|
| 22 | #ifdef __cplusplus |
---|
| 23 | extern "C" { |
---|
| 24 | #endif |
---|
| 25 | |
---|
| 26 | #include <rtems/score/scheduler.h> |
---|
[ac9d2ecc] | 27 | #include <rtems/score/schedulerpriority.h> |
---|
[9d83f58a] | 28 | #include <rtems/score/schedulersmp.h> |
---|
[ba7bc099] | 29 | |
---|
| 30 | /** |
---|
[5b1ff71a] | 31 | * @defgroup ScoreSchedulerSMPSimple Simple Priority SMP Scheduler |
---|
[a936aa49] | 32 | * |
---|
[5b1ff71a] | 33 | * @ingroup ScoreSchedulerSMP |
---|
[a936aa49] | 34 | * |
---|
[5b1ff71a] | 35 | * The Simple Priority SMP Scheduler allocates a processor for the processor |
---|
| 36 | * count highest priority ready threads. The thread priority and position in |
---|
| 37 | * the ready chain are the only information to determine the scheduling |
---|
| 38 | * decision. Threads with an allocated processor are in the scheduled chain. |
---|
| 39 | * After initialization the scheduled chain has exactly processor count nodes. |
---|
| 40 | * Each processor has exactly one allocated thread after initialization. All |
---|
[a936aa49] | 41 | * enqueue and extract operations may exchange threads with the scheduled |
---|
| 42 | * chain. One thread will be added and another will be removed. The scheduled |
---|
| 43 | * and ready chain is ordered according to the thread priority order. The |
---|
| 44 | * chain insert operations are O(count of ready threads), thus this scheduler |
---|
| 45 | * is unsuitable for most real-time applications. |
---|
| 46 | * |
---|
| 47 | * The thread preempt mode will be ignored. |
---|
| 48 | * |
---|
| 49 | * @{ |
---|
| 50 | */ |
---|
| 51 | |
---|
[e1598a6] | 52 | typedef struct { |
---|
| 53 | Scheduler_SMP_Context Base; |
---|
| 54 | Chain_Control Ready; |
---|
| 55 | } Scheduler_simple_SMP_Context; |
---|
| 56 | |
---|
[a936aa49] | 57 | /** |
---|
| 58 | * @brief Entry points for the Simple SMP Scheduler. |
---|
[ba7bc099] | 59 | */ |
---|
| 60 | #define SCHEDULER_SIMPLE_SMP_ENTRY_POINTS \ |
---|
| 61 | { \ |
---|
[e9ee2f0] | 62 | _Scheduler_simple_SMP_Initialize, \ |
---|
[3733b224] | 63 | _Scheduler_default_Schedule, \ |
---|
[e9ee2f0] | 64 | _Scheduler_simple_SMP_Yield, \ |
---|
| 65 | _Scheduler_simple_SMP_Block, \ |
---|
[f39f667a] | 66 | _Scheduler_simple_SMP_Unblock, \ |
---|
| 67 | _Scheduler_simple_SMP_Change_priority, \ |
---|
[e9ee2f0] | 68 | _Scheduler_simple_SMP_Allocate, \ |
---|
[62d947d] | 69 | _Scheduler_default_Free, \ |
---|
[3346106b] | 70 | _Scheduler_default_Update, \ |
---|
[a936aa49] | 71 | _Scheduler_priority_Priority_compare, \ |
---|
[037cfd1] | 72 | _Scheduler_default_Release_job, \ |
---|
[a936aa49] | 73 | _Scheduler_default_Tick, \ |
---|
[6359b68] | 74 | _Scheduler_SMP_Start_idle, \ |
---|
[cfe457f] | 75 | _Scheduler_default_Get_affinity, \ |
---|
| 76 | _Scheduler_default_Set_affinity \ |
---|
[ba7bc099] | 77 | } |
---|
| 78 | |
---|
[e9ee2f0] | 79 | void _Scheduler_simple_SMP_Initialize( const Scheduler_Control *scheduler ); |
---|
[a936aa49] | 80 | |
---|
[e9ee2f0] | 81 | bool _Scheduler_simple_SMP_Allocate( |
---|
[beab7329] | 82 | const Scheduler_Control *scheduler, |
---|
| 83 | Thread_Control *the_thread |
---|
| 84 | ); |
---|
| 85 | |
---|
[e9ee2f0] | 86 | void _Scheduler_simple_SMP_Block( |
---|
[e1598a6] | 87 | const Scheduler_Control *scheduler, |
---|
[24934e36] | 88 | Thread_Control *thread |
---|
| 89 | ); |
---|
[aea4a91] | 90 | |
---|
[f39f667a] | 91 | void _Scheduler_simple_SMP_Unblock( |
---|
[e1598a6] | 92 | const Scheduler_Control *scheduler, |
---|
[24934e36] | 93 | Thread_Control *thread |
---|
| 94 | ); |
---|
[a936aa49] | 95 | |
---|
[f39f667a] | 96 | void _Scheduler_simple_SMP_Change_priority( |
---|
[e1598a6] | 97 | const Scheduler_Control *scheduler, |
---|
[f39f667a] | 98 | Thread_Control *the_thread, |
---|
| 99 | Priority_Control new_priority, |
---|
| 100 | bool prepend_it |
---|
[24934e36] | 101 | ); |
---|
[a936aa49] | 102 | |
---|
[e9ee2f0] | 103 | void _Scheduler_simple_SMP_Yield( |
---|
[e1598a6] | 104 | const Scheduler_Control *scheduler, |
---|
[24934e36] | 105 | Thread_Control *thread |
---|
| 106 | ); |
---|
[a936aa49] | 107 | |
---|
| 108 | /** @} */ |
---|
[ba7bc099] | 109 | |
---|
| 110 | #ifdef __cplusplus |
---|
| 111 | } |
---|
| 112 | #endif |
---|
| 113 | |
---|
| 114 | #endif |
---|
[a15eaaf] | 115 | /* end of include file */ |
---|