1 | /** |
---|
2 | * @file rtems/posix/priority.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * COPYRIGHT (c) 1989-2008. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _RTEMS_POSIX_PRIORITY_H |
---|
17 | #define _RTEMS_POSIX_PRIORITY_H |
---|
18 | |
---|
19 | #include <rtems/score/priority.h> |
---|
20 | |
---|
21 | /** |
---|
22 | * 1003.1b-1993,2.2.2.80 definition of priority, p. 19 |
---|
23 | * |
---|
24 | * "Numerically higher values represent higher priorities." |
---|
25 | * |
---|
26 | * Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API. |
---|
27 | * |
---|
28 | * There are only 254 posix priority levels since a task at priority level |
---|
29 | * 255 would never run because of the RTEMS idle task. This is necessary |
---|
30 | * because GNAT maps the lowest Ada task priority to the lowest thread |
---|
31 | * priority. The lowest priority Ada task should get to run, so there is |
---|
32 | * a fundamental conflict with having 255 priorities. |
---|
33 | * |
---|
34 | * But since RTEMS can be configured with fewer than 256 priorities, |
---|
35 | * we use the internal constant. |
---|
36 | */ |
---|
37 | #define POSIX_SCHEDULER_MAXIMUM_PRIORITY (PRIORITY_MAXIMUM - 1) |
---|
38 | |
---|
39 | |
---|
40 | /** |
---|
41 | * This is the numerically least important POSIX priority. |
---|
42 | */ |
---|
43 | #define POSIX_SCHEDULER_MINIMUM_PRIORITY (1) |
---|
44 | |
---|
45 | /** |
---|
46 | * 1003.1b-1993,2.2.2.80 definition of priority, p. 19 |
---|
47 | * |
---|
48 | * "Numerically higher values represent higher priorities." |
---|
49 | * |
---|
50 | * Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API. |
---|
51 | * |
---|
52 | * @param[in] priority is the priority to test |
---|
53 | * |
---|
54 | * @return This method returns true if the priority is valid and |
---|
55 | * false otherwise. |
---|
56 | */ |
---|
57 | bool _POSIX_Priority_Is_valid( |
---|
58 | int priority |
---|
59 | ); |
---|
60 | |
---|
61 | /** |
---|
62 | * @brief Convert POSIX Priority To SuperCore Priority |
---|
63 | * |
---|
64 | * This method converts a POSIX API priority into onto the corresponding |
---|
65 | * SuperCore value. |
---|
66 | * |
---|
67 | * @param[in] priority is the POSIX API priority. |
---|
68 | * |
---|
69 | * @return This method returns the corresponding SuperCore priority. |
---|
70 | */ |
---|
71 | RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core( |
---|
72 | int priority |
---|
73 | ); |
---|
74 | |
---|
75 | /** |
---|
76 | * @brief Convert SuperCore Priority To POSIX Priority |
---|
77 | * |
---|
78 | * This method converts a SuperCore priority into onto the corresponding |
---|
79 | * POSIX API value. |
---|
80 | * |
---|
81 | * @param[in] priority is the POSIX API priority. |
---|
82 | * |
---|
83 | * @return This method returns the corresponding POSIX priority. |
---|
84 | */ |
---|
85 | RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core( |
---|
86 | Priority_Control priority |
---|
87 | ); |
---|
88 | |
---|
89 | #include <rtems/posix/priority.inl> |
---|
90 | |
---|
91 | #endif |
---|