RTEMS  5.0.0
qreslib.h
Go to the documentation of this file.
1 
13 /*
14  * Copyright (C) 2011 Petr Benes.
15  * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
16  *
17  * The license and distribution terms for this file may be
18  * found in the file LICENSE in this distribution or at
19  * http://www.rtems.org/license/LICENSE.
20  */
21 
22 #ifndef CONFIGURE_SCHEDULER_CBS
23  #error "qreslib.h available only with CONFIGURE_SCHEDULER_CBS"
24 #endif
25 
26 #ifndef _QRESLIB_H
27 #define _QRESLIB_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <stdint.h>
35 
37 typedef int qos_rv;
38 
39 /* Return codes. */
40 #define QOS_OK SCHEDULER_CBS_OK
41 #define QOS_E_GENERIC SCHEDULER_CBS_ERROR_GENERIC
42 #define QOS_E_NO_MEMORY SCHEDULER_CBS_ERROR_NO_MEMORY
43 #define QOS_E_INVALID_PARAM SCHEDULER_CBS_ERROR_INVALID_PARAMETER
44 #define QOS_E_UNAUTHORIZED SCHEDULER_CBS_ERROR_UNAUTHORIZED
45 #define QOS_E_UNIMPLEMENTED SCHEDULER_CBS_ERROR_UNIMPLEMENTED
46 #define QOS_E_MISSING_COMPONENT SCHEDULER_CBS_ERROR_MISSING_COMPONENT
47 #define QOS_E_INCONSISTENT_STATE SCHEDULER_CBS_ERROR_INCONSISTENT_STATE
48 #define QOS_E_SYSTEM_OVERLOAD SCHEDULER_CBS_ERROR_SYSTEM_OVERLOAD
49 #define QOS_E_INTERNAL_ERROR SCHEDULER_CBS_ERROR_INTERNAL_ERROR
50 #define QOS_E_NOT_FOUND SCHEDULER_CBS_ERROR_NOT_FOUND
51 #define QOS_E_FULL SCHEDULER_CBS_ERROR_FULL
52 #define QOS_E_EMPTY SCHEDULER_CBS_ERROR_EMPTY
53 #define QOS_E_NOSERVER SCHEDULER_CBS_ERROR_NOSERVER
54 
57 
59 typedef rtems_id tid_t;
60 
62 typedef time_t qres_time_t;
63 
65 typedef time_t qres_atime_t;
66 
68 typedef struct {
70  qres_time_t P;
72  qres_time_t Q;
74 
83 {
85 }
86 
95 {
96  return _Scheduler_CBS_Cleanup();
97 }
98 
107  qres_params_t *params,
108  qres_sid_t *server_id
109 )
110 {
112  (Scheduler_CBS_Parameters *) params,
113  NULL,
114  server_id
115  );
116 }
117 
126  qres_sid_t server_id,
127  pid_t pid,
128  tid_t task_id
129 )
130 {
131  return _Scheduler_CBS_Attach_thread( server_id, task_id );
132 }
133 
142  qres_sid_t server_id,
143  pid_t pid,
144  tid_t task_id
145 )
146 {
147  return _Scheduler_CBS_Detach_thread( server_id, task_id );
148 }
149 
158  qres_sid_t server_id
159 )
160 {
161  return _Scheduler_CBS_Destroy_server( server_id );
162 }
163 
173  pid_t pid,
174  tid_t task_id,
175  qres_sid_t *server_id
176 )
177 {
178  return _Scheduler_CBS_Get_server_id( task_id, server_id );
179 }
180 
189  qres_sid_t server_id,
190  qres_params_t *params
191 )
192 {
194  server_id,
195  (Scheduler_CBS_Parameters *) params
196  );
197 }
198 
207  qres_sid_t server_id,
208  qres_params_t *params
209 )
210 {
212  server_id,
213  (Scheduler_CBS_Parameters *) params
214  );
215 }
216 
225  qres_sid_t server_id,
226  qres_time_t *exec_time,
227  qres_atime_t *abs_time
228 )
229 {
230  return _Scheduler_CBS_Get_execution_time( server_id, exec_time, abs_time );
231 }
232 
241  qres_sid_t server_id,
242  qres_time_t *current_budget
243 )
244 {
245  return _Scheduler_CBS_Get_remaining_budget( server_id, current_budget );
246 }
247 
257  qres_sid_t server_id,
258  qres_time_t *appr_budget
259 )
260 {
261  return _Scheduler_CBS_Get_approved_budget( server_id, appr_budget );
262 }
263 
264 #ifdef __cplusplus
265 }
266 #endif
267 
268 #endif
269 /* end of include file */
qres_time_t P
Definition: qreslib.h:70
RTEMS_INLINE_ROUTINE qos_rv qres_get_sid(pid_t pid, tid_t task_id, qres_sid_t *server_id)
qres get server id
Definition: qreslib.h:172
time_t qres_atime_t
Definition: qreslib.h:65
int _Scheduler_CBS_Attach_thread(Scheduler_CBS_Server_id server_id, rtems_id task_id)
Attach a task to an already existing server.
Definition: schedulercbsattachthread.c:24
int _Scheduler_CBS_Get_server_id(rtems_id task_id, Scheduler_CBS_Server_id *server_id)
Get a thread server id.
Definition: schedulercbsgetserverid.c:25
int _Scheduler_CBS_Get_execution_time(Scheduler_CBS_Server_id server_id, time_t *exec_time, time_t *abs_time)
Get relative time info.
Definition: schedulercbsgetexecutiontime.c:25
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
RTEMS_INLINE_ROUTINE qos_rv qres_destroy_server(qres_sid_t server_id)
qres destroy server
Definition: qreslib.h:157
RTEMS_INLINE_ROUTINE qos_rv qres_get_params(qres_sid_t server_id, qres_params_t *params)
qres get params
Definition: qreslib.h:188
rtems_id tid_t
Definition: qreslib.h:59
RTEMS_INLINE_ROUTINE qos_rv qres_get_exec_time(qres_sid_t server_id, qres_time_t *exec_time, qres_atime_t *abs_time)
qres get execution time
Definition: qreslib.h:224
RTEMS_INLINE_ROUTINE qos_rv qres_init(void)
qres init
Definition: qreslib.h:82
RTEMS_INLINE_ROUTINE qos_rv qres_create_server(qres_params_t *params, qres_sid_t *server_id)
qres create server
Definition: qreslib.h:106
uint32_t Scheduler_CBS_Server_id
Definition: schedulercbs.h:90
RTEMS_INLINE_ROUTINE qos_rv qres_attach_thread(qres_sid_t server_id, pid_t pid, tid_t task_id)
qres attach thread
Definition: qreslib.h:125
int _Scheduler_CBS_Set_parameters(Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *parameters)
Set parameters for CBS scheduling.
Definition: schedulercbssetparameters.c:25
Definition: qreslib.h:68
RTEMS_INLINE_ROUTINE qos_rv qres_detach_thread(qres_sid_t server_id, pid_t pid, tid_t task_id)
qres detach thread
Definition: qreslib.h:141
int _Scheduler_CBS_Initialize(void)
_Scheduler_CBS_Initialize
Definition: schedulercbs.c:53
int _Scheduler_CBS_Get_approved_budget(Scheduler_CBS_Server_id server_id, time_t *approved_budget)
Retrieve the approved budget.
Definition: schedulercbsgetapprovedbudget.c:25
time_t qres_time_t
Definition: qreslib.h:62
int _Scheduler_CBS_Get_parameters(Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *params)
Retrieve CBS scheduling parameters.
Definition: schedulercbsgetparameters.c:25
Scheduler_CBS_Server_id qres_sid_t
Definition: qreslib.h:56
RTEMS_INLINE_ROUTINE qos_rv qres_get_appr_budget(qres_sid_t server_id, qres_time_t *appr_budget)
qres get approved budget
Definition: qreslib.h:256
Definition: schedulercbs.h:100
int _Scheduler_CBS_Destroy_server(Scheduler_CBS_Server_id server_id)
Detach all tasks from a server and destroy it.
Definition: schedulercbsdestroyserver.c:25
RTEMS_INLINE_ROUTINE qos_rv qres_set_params(qres_sid_t server_id, qres_params_t *params)
qres set params
Definition: qreslib.h:206
int _Scheduler_CBS_Create_server(Scheduler_CBS_Parameters *params, Scheduler_CBS_Budget_overrun budget_overrun_callback, rtems_id *server_id)
Create a new server with specified parameters.
Definition: schedulercbscreateserver.c:24
int _Scheduler_CBS_Cleanup(void)
Cleanup resources associated to the CBS Library.
Definition: schedulercbscleanup.c:24
RTEMS_INLINE_ROUTINE qos_rv qres_get_curr_budget(qres_sid_t server_id, qres_time_t *current_budget)
qres get current budget
Definition: qreslib.h:240
int _Scheduler_CBS_Detach_thread(Scheduler_CBS_Server_id server_id, rtems_id task_id)
Detach from the CBS Server.
Definition: schedulercbsdetachthread.c:25
int _Scheduler_CBS_Get_remaining_budget(Scheduler_CBS_Server_id server_id, time_t *remaining_budget)
Retrieve remaining budget for the current server instance.
Definition: schedulercbsgetremainingbudget.c:24
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
RTEMS_INLINE_ROUTINE qos_rv qres_cleanup(void)
qres cleanup
Definition: qreslib.h:94
qres_time_t Q
Definition: qreslib.h:72
int qos_rv
Definition: qreslib.h:37
Thread manipulation for the CBS scheduler.
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77