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