1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief POSIX Priority Support |
---|
5 | * |
---|
6 | * This include file defines the interface to the POSIX priority |
---|
7 | * implementation. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2011. |
---|
12 | * 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.com/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_POSIX_PRIORITY_H |
---|
20 | #define _RTEMS_POSIX_PRIORITY_H |
---|
21 | |
---|
22 | /** |
---|
23 | * @defgroup POSIX_PRIORITY POSIX Priority Support |
---|
24 | * |
---|
25 | * @ingroup POSIX |
---|
26 | * |
---|
27 | * @brief Interface to the POSIX Priority Implementation |
---|
28 | * |
---|
29 | * @{ |
---|
30 | */ |
---|
31 | |
---|
32 | #include <rtems/score/priority.h> |
---|
33 | |
---|
34 | /** |
---|
35 | * 1003.1b-1993,2.2.2.80 definition of priority, p. 19 |
---|
36 | * |
---|
37 | * "Numerically higher values represent higher priorities." |
---|
38 | * |
---|
39 | * Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API. |
---|
40 | * |
---|
41 | * There are only 254 posix priority levels since a task at priority level |
---|
42 | * 255 would never run because of the RTEMS idle task. This is necessary |
---|
43 | * because GNAT maps the lowest Ada task priority to the lowest thread |
---|
44 | * priority. The lowest priority Ada task should get to run, so there is |
---|
45 | * a fundamental conflict with having 255 priorities. |
---|
46 | * |
---|
47 | * But since RTEMS can be configured with fewer than 256 priorities, |
---|
48 | * we use the internal constant. |
---|
49 | */ |
---|
50 | #define POSIX_SCHEDULER_MAXIMUM_PRIORITY (PRIORITY_MAXIMUM - 1) |
---|
51 | |
---|
52 | |
---|
53 | /** |
---|
54 | * This is the numerically least important POSIX priority. |
---|
55 | */ |
---|
56 | #define POSIX_SCHEDULER_MINIMUM_PRIORITY (1) |
---|
57 | |
---|
58 | /** |
---|
59 | * @brief Check if POSIX priority is valid. |
---|
60 | * |
---|
61 | * 1003.1b-1993,2.2.2.80 definition of priority, p. 19 |
---|
62 | * |
---|
63 | * "Numerically higher values represent higher priorities." |
---|
64 | * |
---|
65 | * Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API. |
---|
66 | * |
---|
67 | * @param[in] priority is the priority to test |
---|
68 | * |
---|
69 | * @retval TRUE The priority is valid. |
---|
70 | * @retval FALSE The priority is invalid. |
---|
71 | */ |
---|
72 | bool _POSIX_Priority_Is_valid( |
---|
73 | int priority |
---|
74 | ); |
---|
75 | |
---|
76 | /** |
---|
77 | * @brief Convert POSIX priority to SuperCore priority. |
---|
78 | * |
---|
79 | * This method converts a POSIX API priority into onto the corresponding |
---|
80 | * SuperCore value. |
---|
81 | * |
---|
82 | * @param[in] priority is the POSIX API priority. |
---|
83 | * |
---|
84 | * @return This method returns the corresponding SuperCore priority. |
---|
85 | */ |
---|
86 | RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core( |
---|
87 | int priority |
---|
88 | ); |
---|
89 | |
---|
90 | /** |
---|
91 | * @brief Convert SuperCore priority To POSIX priority. |
---|
92 | * |
---|
93 | * This method converts a SuperCore priority into onto the corresponding |
---|
94 | * POSIX API value. |
---|
95 | * |
---|
96 | * @param[in] priority is the POSIX API priority. |
---|
97 | * |
---|
98 | * @return This method returns the corresponding POSIX priority. |
---|
99 | */ |
---|
100 | RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core( |
---|
101 | Priority_Control priority |
---|
102 | ); |
---|
103 | |
---|
104 | #include <rtems/posix/priority.inl> |
---|
105 | |
---|
106 | /** @} */ |
---|
107 | |
---|
108 | #endif |
---|