RTEMS: cpukit/include/rtems/qreslib.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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
30extern "C" {
31#endif
32
33#include <stdint.h>
34#include <rtems/score/schedulercbs.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
56 typedef Scheduler_CBS_Server_id qres_sid_t;
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;
73} qres_params_t;
74
82 RTEMS_INLINE_ROUTINE qos_rv qres_init ( void )
83{
84 return _Scheduler_CBS_Initialize();
85}
86
94 RTEMS_INLINE_ROUTINE qos_rv qres_cleanup ( void )
95{
96 return _Scheduler_CBS_Cleanup();
97}
98
106 RTEMS_INLINE_ROUTINE qos_rv qres_create_server (
107 qres_params_t *params,
108 qres_sid_t *server_id
109)
110{
111 return _Scheduler_CBS_Create_server(
112 (Scheduler_CBS_Parameters *) params,
113 NULL,
114 server_id
115 );
116}
117
125 RTEMS_INLINE_ROUTINE qos_rv qres_attach_thread (
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
141 RTEMS_INLINE_ROUTINE qos_rv qres_detach_thread (
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
157 RTEMS_INLINE_ROUTINE qos_rv qres_destroy_server (
158 qres_sid_t server_id
159)
160{
161 return _Scheduler_CBS_Destroy_server( server_id );
162}
163
172 RTEMS_INLINE_ROUTINE qos_rv qres_get_sid (
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
188 RTEMS_INLINE_ROUTINE qos_rv qres_get_params (
189 qres_sid_t server_id,
190 qres_params_t *params
191)
192{
193 return _Scheduler_CBS_Get_parameters(
194 server_id,
195 (Scheduler_CBS_Parameters *) params
196 );
197}
198
206 RTEMS_INLINE_ROUTINE qos_rv qres_set_params (
207 qres_sid_t server_id,
208 qres_params_t *params
209)
210{
211 return _Scheduler_CBS_Set_parameters(
212 server_id,
213 (Scheduler_CBS_Parameters *) params
214 );
215}
216
224 RTEMS_INLINE_ROUTINE qos_rv qres_get_exec_time (
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
240 RTEMS_INLINE_ROUTINE qos_rv qres_get_curr_budget (
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
256 RTEMS_INLINE_ROUTINE qos_rv qres_get_appr_budget (
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 */
NULL
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77
rtems_id
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
RTEMS_INLINE_ROUTINE
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
_Scheduler_CBS_Get_server_id
int _Scheduler_CBS_Get_server_id(rtems_id task_id, Scheduler_CBS_Server_id *server_id)
Gets a thread server id.
Definition: schedulercbsgetserverid.c:25
_Scheduler_CBS_Create_server
int _Scheduler_CBS_Create_server(Scheduler_CBS_Parameters *params, Scheduler_CBS_Budget_overrun budget_overrun_callback, rtems_id *server_id)
Creates a new server with specified parameters.
Definition: schedulercbscreateserver.c:24
_Scheduler_CBS_Cleanup
int _Scheduler_CBS_Cleanup(void)
Cleans up resources associated to the CBS Library.
Definition: schedulercbscleanup.c:24
_Scheduler_CBS_Get_remaining_budget
int _Scheduler_CBS_Get_remaining_budget(Scheduler_CBS_Server_id server_id, time_t *remaining_budget)
Retrieves remaining budget for the current server instance.
Definition: schedulercbsgetremainingbudget.c:24
_Scheduler_CBS_Get_approved_budget
int _Scheduler_CBS_Get_approved_budget(Scheduler_CBS_Server_id server_id, time_t *approved_budget)
Retrieves the approved budget.
Definition: schedulercbsgetapprovedbudget.c:25
_Scheduler_CBS_Detach_thread
int _Scheduler_CBS_Detach_thread(Scheduler_CBS_Server_id server_id, rtems_id task_id)
Detaches from the CBS Server.
Definition: schedulercbsdetachthread.c:25
_Scheduler_CBS_Destroy_server
int _Scheduler_CBS_Destroy_server(Scheduler_CBS_Server_id server_id)
Detaches all tasks from a server and destroys it.
Definition: schedulercbsdestroyserver.c:25
_Scheduler_CBS_Get_execution_time
int _Scheduler_CBS_Get_execution_time(Scheduler_CBS_Server_id server_id, time_t *exec_time, time_t *abs_time)
Gets relative time info.
Definition: schedulercbsgetexecutiontime.c:25
_Scheduler_CBS_Attach_thread
int _Scheduler_CBS_Attach_thread(Scheduler_CBS_Server_id server_id, rtems_id task_id)
Attaches a task to an already existing server.
Definition: schedulercbsattachthread.c:24
_Scheduler_CBS_Initialize
int _Scheduler_CBS_Initialize(void)
_Scheduler_CBS_Initialize
Definition: schedulercbs.c:54
_Scheduler_CBS_Get_parameters
int _Scheduler_CBS_Get_parameters(Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *params)
Retrieves CBS scheduling parameters.
Definition: schedulercbsgetparameters.c:26
Scheduler_CBS_Server_id
uint32_t Scheduler_CBS_Server_id
Definition: schedulercbs.h:95
_Scheduler_CBS_Set_parameters
int _Scheduler_CBS_Set_parameters(Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *parameters)
Sets parameters for CBS scheduling.
Definition: schedulercbssetparameters.c:25
qres_sid_t
Scheduler_CBS_Server_id qres_sid_t
Definition: qreslib.h:56
qres_get_appr_budget
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
qres_get_exec_time
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
qres_detach_thread
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
qos_rv
int qos_rv
Definition: qreslib.h:37
qres_time_t
time_t qres_time_t
Definition: qreslib.h:62
qres_destroy_server
RTEMS_INLINE_ROUTINE qos_rv qres_destroy_server(qres_sid_t server_id)
qres destroy server
Definition: qreslib.h:157
qres_get_curr_budget
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
qres_set_params
RTEMS_INLINE_ROUTINE qos_rv qres_set_params(qres_sid_t server_id, qres_params_t *params)
qres set params
Definition: qreslib.h:206
qres_atime_t
time_t qres_atime_t
Definition: qreslib.h:65
qres_cleanup
RTEMS_INLINE_ROUTINE qos_rv qres_cleanup(void)
qres cleanup
Definition: qreslib.h:94
tid_t
rtems_id tid_t
Definition: qreslib.h:59
qres_attach_thread
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
qres_create_server
RTEMS_INLINE_ROUTINE qos_rv qres_create_server(qres_params_t *params, qres_sid_t *server_id)
qres create server
Definition: qreslib.h:106
qres_get_sid
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
qres_init
RTEMS_INLINE_ROUTINE qos_rv qres_init(void)
qres init
Definition: qreslib.h:82
qres_get_params
RTEMS_INLINE_ROUTINE qos_rv qres_get_params(qres_sid_t server_id, qres_params_t *params)
qres get params
Definition: qreslib.h:188
schedulercbs.h
Thread manipulation for the CBS scheduler.
Scheduler_CBS_Parameters
Definition: schedulercbs.h:105
qres_params_t
Definition: qreslib.h:68
qres_params_t::Q
qres_time_t Q
Definition: qreslib.h:72
qres_params_t::P
qres_time_t P
Definition: qreslib.h:70