[6c2675d] | 1 | /** |
---|
[cf301c9] | 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @brief POSIX Priority Support |
---|
[21242c2] | 5 | * |
---|
| 6 | * This include file defines the interface to the POSIX priority |
---|
| 7 | * implementation. |
---|
[6c2675d] | 8 | */ |
---|
| 9 | |
---|
[5e9b32b] | 10 | /* |
---|
[21242c2] | 11 | * COPYRIGHT (c) 1989-2011. |
---|
[feaa007] | 12 | * On-Line Applications Research Corporation (OAR). |
---|
[5e9b32b] | 13 | * |
---|
[feaa007] | 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. |
---|
[5e9b32b] | 17 | */ |
---|
| 18 | |
---|
[97552c98] | 19 | #ifndef _RTEMS_POSIX_PRIORITYIMPL_H |
---|
| 20 | #define _RTEMS_POSIX_PRIORITYIMPL_H |
---|
| 21 | |
---|
[7dfb4b9] | 22 | #include <rtems/score/scheduler.h> |
---|
[97552c98] | 23 | |
---|
| 24 | #ifdef __cplusplus |
---|
| 25 | extern "C" { |
---|
| 26 | #endif |
---|
[5e9b32b] | 27 | |
---|
[e43f4758] | 28 | /** |
---|
| 29 | * @defgroup POSIX_PRIORITY POSIX Priority Support |
---|
| 30 | * |
---|
[a15eaaf] | 31 | * @ingroup POSIXAPI |
---|
[e43f4758] | 32 | * |
---|
[5a32c48] | 33 | * @brief Interface to the POSIX Priority Implementation. |
---|
[6881e0c] | 34 | * |
---|
[5a32c48] | 35 | * @{ |
---|
[5e9b32b] | 36 | */ |
---|
[2212a2ad] | 37 | |
---|
| 38 | /** |
---|
| 39 | * This is the numerically least important POSIX priority. |
---|
| 40 | */ |
---|
[5e9b32b] | 41 | #define POSIX_SCHEDULER_MINIMUM_PRIORITY (1) |
---|
| 42 | |
---|
[2df7fcf] | 43 | /** |
---|
| 44 | * @brief Gets the maximum POSIX API priority for this scheduler instance. |
---|
| 45 | * |
---|
| 46 | * Such a priority is valid. A scheduler instance may support priority values |
---|
| 47 | * that are not representable as an integer. |
---|
| 48 | * |
---|
| 49 | * @return The maximum POSIX API priority for this scheduler instance. |
---|
| 50 | */ |
---|
| 51 | int _POSIX_Priority_Get_maximum( const Scheduler_Control *scheduler ); |
---|
| 52 | |
---|
[2212a2ad] | 53 | /** |
---|
[1a4eac50] | 54 | * @brief Converts the POSIX API priority to the corresponding SuperCore |
---|
| 55 | * priority and validates it. |
---|
[e43f4758] | 56 | * |
---|
[5a32c48] | 57 | * According to POSIX, numerically higher values represent higher priorities. |
---|
| 58 | * Thus, SuperCore has priorities run in the opposite sense of the POSIX API. |
---|
| 59 | * |
---|
| 60 | * Let N be the maximum priority of this scheduler instance. The SuperCore |
---|
| 61 | * priority zero is system reserved (PRIORITY_PSEUDO_ISR). There are only |
---|
| 62 | * N - 1 POSIX API priority levels since a thread at SuperCore priority N would |
---|
| 63 | * never run because of the idle threads. This is necessary because GNAT maps |
---|
| 64 | * the lowest Ada task priority to the lowest thread priority. The lowest |
---|
| 65 | * priority Ada task should get to run, so there is a fundamental conflict with |
---|
| 66 | * having N priorities. |
---|
| 67 | * |
---|
| 68 | * @param[in] scheduler The scheduler instance. |
---|
[1a4eac50] | 69 | * @param[in] priority The POSIX API priority to convert and validate. |
---|
| 70 | * @param[out] valid Indicates if the POSIX API priority is valid and a |
---|
| 71 | * corresponding SuperCore priority in the specified scheduler instance |
---|
| 72 | * exists. |
---|
[5a32c48] | 73 | * |
---|
[1a4eac50] | 74 | * @return The corresponding SuperCore priority. |
---|
[2212a2ad] | 75 | */ |
---|
[1a4eac50] | 76 | Priority_Control _POSIX_Priority_To_core( |
---|
[5a32c48] | 77 | const Scheduler_Control *scheduler, |
---|
[1a4eac50] | 78 | int priority, |
---|
| 79 | bool *valid |
---|
[5e9b32b] | 80 | ); |
---|
| 81 | |
---|
[2212a2ad] | 82 | /** |
---|
[5a32c48] | 83 | * @brief Converts the SuperCore priority to the corresponding POSIX API |
---|
| 84 | * priority. |
---|
[2212a2ad] | 85 | * |
---|
[5a32c48] | 86 | * @param[in] scheduler The scheduler instance. |
---|
| 87 | * @param[in] priority The SuperCore priority to convert. |
---|
[2212a2ad] | 88 | * |
---|
[5a32c48] | 89 | * @return The corresponding POSIX API priority. |
---|
[1de949a8] | 90 | */ |
---|
[77ff5599] | 91 | int _POSIX_Priority_From_core( |
---|
[5a32c48] | 92 | const Scheduler_Control *scheduler, |
---|
| 93 | Priority_Control priority |
---|
[77ff5599] | 94 | ); |
---|
[5e9b32b] | 95 | |
---|
[cf301c9] | 96 | /** @} */ |
---|
| 97 | |
---|
[97552c98] | 98 | #ifdef __cplusplus |
---|
| 99 | } |
---|
| 100 | #endif |
---|
| 101 | |
---|
[5e9b32b] | 102 | #endif |
---|