1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** POSIX wrapper for THREADX */
16 /** */
17 /** */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 /* Include necessary system files. */
23
24 #include "tx_api.h" /* Threadx API */
25 #include "pthread.h" /* Posix API */
26 #include "px_int.h" /* Posix helper functions */
27
28
29
30 /**************************************************************************/
31 /* */
32 /* FUNCTION RELEASE */
33 /* */
34 /* sched_get_priority_max PORTABLE C */
35 /* 6.1.7 */
36 /* AUTHOR */
37 /* */
38 /* William E. Lamie, Microsoft Corporation */
39 /* */
40 /* DESCRIPTION */
41 /* */
42 /* This routine returns the higest priority available in the system */
43 /* Note that in POSIX higher number indicates a higher priority */
44 /* */
45 /* INPUT */
46 /* */
47 /* policy */
48 /* */
49 /* OUTPUT */
50 /* */
51 /* Maximum Priority If successful */
52 /* ERROR If policy not implemented */
53 /* */
54 /* CALLS */
55 /* */
56 /* */
57 /* CALLED BY */
58 /* */
59 /* Application Code */
60 /* */
61 /* RELEASE HISTORY */
62 /* */
63 /* DATE NAME DESCRIPTION */
64 /* */
65 /* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
66 /* */
67 /**************************************************************************/
68
69
sched_get_priority_max(INT policy)70 INT sched_get_priority_max(INT policy)
71 {
72 if (policy==SCHED_FIFO || policy==SCHED_RR )
73 return SCHED_PRIO_MAX;
74 else
75 return ERROR;
76 }
77
78
79
80 /**************************************************************************/
81 /* */
82 /* FUNCTION RELEASE */
83 /* */
84 /* sched_get_priority_min PORTABLE C */
85 /* 6.1.7 */
86 /* AUTHOR */
87 /* */
88 /* William E. Lamie, Microsoft Corporation */
89 /* */
90 /* DESCRIPTION */
91 /* */
92 /* This routine returns the lowest priority available in the system */
93 /* Note that in POSIX higher number indicates a higher priority */
94 /* */
95 /* INPUT */
96 /* */
97 /* policy */
98 /* */
99 /* OUTPUT */
100 /* */
101 /* Minimum Priority If successful */
102 /* ERROR If policy not implemented */
103 /* */
104 /* CALLS */
105 /* */
106 /* */
107 /* CALLED BY */
108 /* */
109 /* Application Code */
110 /* */
111 /* RELEASE HISTORY */
112 /* */
113 /* DATE NAME DESCRIPTION */
114 /* */
115 /* 06-02-2021 William E. Lamie Initial Version 6.1.7 */
116 /* */
117 /**************************************************************************/
sched_get_priority_min(INT policy)118 INT sched_get_priority_min(INT policy)
119 {
120 if (policy==SCHED_FIFO || policy==SCHED_RR )
121 return SCHED_PRIO_MIN;
122 else
123 return ERROR;
124 }
125