1 | /** |
---|
2 | * @file cbs.inl |
---|
3 | * |
---|
4 | * This include file contains all the constants and structures associated |
---|
5 | * with the CBS library. |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (C) 2011 Petr Benes. |
---|
11 | * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | * |
---|
17 | * $Id$ |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _RTEMS_CBS_H |
---|
21 | # error "Never use <rtems/cbs.inl> directly; include <rtems/cbs.h> instead." |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <rtems/score/schedulercbs.h> |
---|
25 | |
---|
26 | /** |
---|
27 | * @brief rtems cbs init |
---|
28 | * |
---|
29 | * Initializes the CBS library. |
---|
30 | * |
---|
31 | * @return status code. |
---|
32 | */ |
---|
33 | RTEMS_INLINE_ROUTINE int rtems_cbs_initialize ( void ) |
---|
34 | { |
---|
35 | return _Scheduler_CBS_Initialize(); |
---|
36 | } |
---|
37 | |
---|
38 | /** |
---|
39 | * @brief rtems cbs cleanup |
---|
40 | * |
---|
41 | * Cleanup resources associated to the CBS Library. |
---|
42 | * |
---|
43 | * @return status code. |
---|
44 | */ |
---|
45 | RTEMS_INLINE_ROUTINE int rtems_cbs_cleanup ( void ) |
---|
46 | { |
---|
47 | return _Scheduler_CBS_Cleanup(); |
---|
48 | } |
---|
49 | |
---|
50 | /** |
---|
51 | * @brief rtems cbs create server |
---|
52 | * |
---|
53 | * Create a new server with specified parameters. |
---|
54 | * |
---|
55 | * @return status code. |
---|
56 | */ |
---|
57 | RTEMS_INLINE_ROUTINE int rtems_cbs_create_server ( |
---|
58 | rtems_cbs_parameters *params, |
---|
59 | rtems_cbs_budget_overrun budget_overrun_callback, |
---|
60 | rtems_cbs_server_id *server_id |
---|
61 | ) |
---|
62 | { |
---|
63 | return _Scheduler_CBS_Create_server( |
---|
64 | params, |
---|
65 | budget_overrun_callback, |
---|
66 | server_id |
---|
67 | ); |
---|
68 | } |
---|
69 | |
---|
70 | /** |
---|
71 | * @brief rtems cbs attach thread |
---|
72 | * |
---|
73 | * Attach a task to an already existing server. |
---|
74 | * |
---|
75 | * @return status code. |
---|
76 | */ |
---|
77 | RTEMS_INLINE_ROUTINE int rtems_cbs_attach_thread ( |
---|
78 | rtems_cbs_server_id server_id, |
---|
79 | rtems_id task_id |
---|
80 | ) |
---|
81 | { |
---|
82 | return _Scheduler_CBS_Attach_thread( server_id, task_id ); |
---|
83 | } |
---|
84 | |
---|
85 | /** |
---|
86 | * @brief rtems cbs detach thread |
---|
87 | * |
---|
88 | * Detach from the CBS Server. |
---|
89 | * |
---|
90 | * @return status code. |
---|
91 | */ |
---|
92 | RTEMS_INLINE_ROUTINE int rtems_cbs_detach_thread ( |
---|
93 | rtems_cbs_server_id server_id, |
---|
94 | rtems_id task_id |
---|
95 | ) |
---|
96 | { |
---|
97 | return _Scheduler_CBS_Detach_thread( server_id, task_id ); |
---|
98 | } |
---|
99 | |
---|
100 | /** |
---|
101 | * @brief rtems cbs destroy server |
---|
102 | * |
---|
103 | * Detach all tasks from a server and destroy it. |
---|
104 | * |
---|
105 | * @return status code. |
---|
106 | */ |
---|
107 | RTEMS_INLINE_ROUTINE int rtems_cbs_destroy_server ( |
---|
108 | rtems_cbs_server_id server_id |
---|
109 | ) |
---|
110 | { |
---|
111 | return _Scheduler_CBS_Destroy_server( server_id ); |
---|
112 | } |
---|
113 | |
---|
114 | /** |
---|
115 | * @brief rtems cbs get server id |
---|
116 | * |
---|
117 | * Get a thread server id, or RTEMS_CBS_E_NOT_FOUND if it is not |
---|
118 | * attached to any server. |
---|
119 | * |
---|
120 | * @return status code. |
---|
121 | */ |
---|
122 | RTEMS_INLINE_ROUTINE int rtems_cbs_get_server_id ( |
---|
123 | rtems_id task_id, |
---|
124 | rtems_cbs_server_id *server_id |
---|
125 | ) |
---|
126 | { |
---|
127 | return _Scheduler_CBS_Get_server_id( task_id, server_id ); |
---|
128 | } |
---|
129 | |
---|
130 | /** |
---|
131 | * @brief rtems cbs get parameters |
---|
132 | * |
---|
133 | * Retrieve CBS scheduling parameters. |
---|
134 | * |
---|
135 | * @return status code. |
---|
136 | */ |
---|
137 | RTEMS_INLINE_ROUTINE int rtems_cbs_get_parameters ( |
---|
138 | rtems_cbs_server_id server_id, |
---|
139 | rtems_cbs_parameters *params |
---|
140 | ) |
---|
141 | { |
---|
142 | return _Scheduler_CBS_Get_parameters( server_id, params ); |
---|
143 | } |
---|
144 | |
---|
145 | /** |
---|
146 | * @brief rtems cbs set parameters |
---|
147 | * |
---|
148 | * Change CBS scheduling parameters. |
---|
149 | * |
---|
150 | * @return status code. |
---|
151 | */ |
---|
152 | RTEMS_INLINE_ROUTINE int rtems_cbs_set_parameters ( |
---|
153 | rtems_cbs_server_id server_id, |
---|
154 | rtems_cbs_parameters *params |
---|
155 | ) |
---|
156 | { |
---|
157 | return _Scheduler_CBS_Set_parameters( server_id, params ); |
---|
158 | } |
---|
159 | |
---|
160 | /** |
---|
161 | * @brief rtems cbs get execution time |
---|
162 | * |
---|
163 | * Retrieve time info relative to the current server. |
---|
164 | * |
---|
165 | * @return status code. |
---|
166 | */ |
---|
167 | RTEMS_INLINE_ROUTINE int rtems_cbs_get_execution_time ( |
---|
168 | rtems_cbs_server_id server_id, |
---|
169 | time_t *exec_time, |
---|
170 | time_t *abs_time |
---|
171 | ) |
---|
172 | { |
---|
173 | return _Scheduler_CBS_Get_execution_time( server_id, exec_time, abs_time ); |
---|
174 | } |
---|
175 | |
---|
176 | /** |
---|
177 | * @brief rtems cbs get remaining budget |
---|
178 | * |
---|
179 | * Retrieve remaining budget for the current server instance. |
---|
180 | * |
---|
181 | * @return status code. |
---|
182 | */ |
---|
183 | RTEMS_INLINE_ROUTINE int rtems_cbs_get_remaining_budget ( |
---|
184 | rtems_cbs_server_id server_id, |
---|
185 | time_t *remaining_budget |
---|
186 | ) |
---|
187 | { |
---|
188 | return _Scheduler_CBS_Get_remaining_budget( server_id, remaining_budget ); |
---|
189 | } |
---|
190 | |
---|
191 | /** |
---|
192 | * @brief rtems cbs get approved budget |
---|
193 | * |
---|
194 | * Retrieve the budget that has been approved for the subsequent |
---|
195 | * server instances. |
---|
196 | * |
---|
197 | * @return status code. |
---|
198 | */ |
---|
199 | RTEMS_INLINE_ROUTINE int rtems_cbs_get_approved_budget ( |
---|
200 | rtems_cbs_server_id server_id, |
---|
201 | time_t *appr_budget |
---|
202 | ) |
---|
203 | { |
---|
204 | return _Scheduler_CBS_Get_approved_budget( server_id, appr_budget ); |
---|
205 | } |
---|