RTEMS  5.1
cbs.h
Go to the documentation of this file.
1 
11 /*
12  * Copyright (C) 2011 Petr Benes.
13  * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
14  *
15  * The license and distribution terms for this file may be
16  * found in the file LICENSE in this distribution or at
17  * http://www.rtems.org/license/LICENSE.
18  */
19 
20 #ifndef CONFIGURE_SCHEDULER_CBS
21  #error "cbs.h available only with CONFIGURE_SCHEDULER_CBS"
22 #endif
23 
24 #ifndef _RTEMS_CBS_H
25 #define _RTEMS_CBS_H
26 
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /* Return codes. */
34 #define RTEMS_CBS_OK SCHEDULER_CBS_OK
35 #define RTEMS_CBS_ERROR_GENERIC SCHEDULER_CBS_ERROR_GENERIC
36 #define RTEMS_CBS_ERROR_NO_MEMORY SCHEDULER_CBS_ERROR_NO_MEMORY
37 #define RTEMS_CBS_ERROR_INVALID_PARAMETER SCHEDULER_CBS_ERROR_INVALID_PARAM
38 #define RTEMS_CBS_ERROR_UNAUTHORIZED SCHEDULER_CBS_ERROR_UNAUTHORIZED
39 #define RTEMS_CBS_ERROR_UNIMPLEMENTED SCHEDULER_CBS_ERROR_UNIMPLEMENTED
40 #define RTEMS_CBS_ERROR_MISSING_COMPONENT SCHEDULER_CBS_ERROR_MISSING_COMPONENT
41 #define RTEMS_CBS_ERROR_INCONSISTENT_STATE SCHEDULER_CBS_ERROR_INCONSISTENT_STATE
42 #define RTEMS_CBS_ERROR_SYSTEM_OVERLOAD SCHEDULER_CBS_ERROR_SYSTEM_OVERLOAD
43 #define RTEMS_CBS_ERROR_INTERNAL_ERROR SCHEDULER_CBS_ERROR_INTERNAL_ERROR
44 #define RTEMS_CBS_ERROR_NOT_FOUND SCHEDULER_CBS_ERROR_NOT_FOUND
45 #define RTEMS_CBS_ERROR_FULL SCHEDULER_CBS_ERROR_FULL
46 #define RTEMS_CBS_ERROR_EMPTY SCHEDULER_CBS_ERROR_EMPTY
47 #define RTEMS_CBS_ERROR_NOSERVER SCHEDULER_CBS_ERROR_NOSERVER
48 
51 
54 
57 
66 {
68 }
69 
78 {
79  return _Scheduler_CBS_Cleanup();
80 }
81 
90  rtems_cbs_parameters *params,
91  rtems_cbs_budget_overrun budget_overrun_callback,
92  rtems_cbs_server_id *server_id
93 )
94 {
96  params,
97  budget_overrun_callback,
98  server_id
99  );
100 }
101 
110  rtems_cbs_server_id server_id,
111  rtems_id task_id
112 )
113 {
114  return _Scheduler_CBS_Attach_thread( server_id, task_id );
115 }
116 
125  rtems_cbs_server_id server_id,
126  rtems_id task_id
127 )
128 {
129  return _Scheduler_CBS_Detach_thread( server_id, task_id );
130 }
131 
140  rtems_cbs_server_id server_id
141 )
142 {
143  return _Scheduler_CBS_Destroy_server( server_id );
144 }
145 
155  rtems_id task_id,
156  rtems_cbs_server_id *server_id
157 )
158 {
159  return _Scheduler_CBS_Get_server_id( task_id, server_id );
160 }
161 
170  rtems_cbs_server_id server_id,
171  rtems_cbs_parameters *params
172 )
173 {
174  return _Scheduler_CBS_Get_parameters( server_id, params );
175 }
176 
185  rtems_cbs_server_id server_id,
186  rtems_cbs_parameters *params
187 )
188 {
189  return _Scheduler_CBS_Set_parameters( server_id, params );
190 }
191 
200  rtems_cbs_server_id server_id,
201  time_t *exec_time,
202  time_t *abs_time
203 )
204 {
205  return _Scheduler_CBS_Get_execution_time( server_id, exec_time, abs_time );
206 }
207 
216  rtems_cbs_server_id server_id,
217  time_t *remaining_budget
218 )
219 {
220  return _Scheduler_CBS_Get_remaining_budget( server_id, remaining_budget );
221 }
222 
232  rtems_cbs_server_id server_id,
233  time_t *appr_budget
234 )
235 {
236  return _Scheduler_CBS_Get_approved_budget( server_id, appr_budget );
237 }
238 
239 #ifdef __cplusplus
240 }
241 #endif
242 
243 #endif
244 /* end of include file */
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
int _Scheduler_CBS_Detach_thread(Scheduler_CBS_Server_id server_id, rtems_id task_id)
Detaches from the CBS Server.
Definition: schedulercbsdetachthread.c:25
RTEMS_INLINE_ROUTINE int rtems_cbs_get_server_id(rtems_id task_id, rtems_cbs_server_id *server_id)
Get CBS server id.
Definition: cbs.h:154
uint32_t Scheduler_CBS_Server_id
Definition: schedulercbs.h:95
RTEMS_INLINE_ROUTINE int rtems_cbs_get_approved_budget(rtems_cbs_server_id server_id, time_t *appr_budget)
Get the approved CBS budget.
Definition: cbs.h:231
Scheduler_CBS_Budget_overrun rtems_cbs_budget_overrun
Definition: cbs.h:50
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
RTEMS_INLINE_ROUTINE int rtems_cbs_initialize(void)
Initialize the CBS library.
Definition: cbs.h:65
RTEMS_INLINE_ROUTINE int rtems_cbs_detach_thread(rtems_cbs_server_id server_id, rtems_id task_id)
Detach from the CBS server.
Definition: cbs.h:124
Scheduler_CBS_Server_id rtems_cbs_server_id
Definition: cbs.h:53
RTEMS_INLINE_ROUTINE int rtems_cbs_destroy_server(rtems_cbs_server_id server_id)
Detach all tasks from a server and destroy it.
Definition: cbs.h:139
int _Scheduler_CBS_Set_parameters(Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *parameters)
Sets parameters for CBS scheduling.
Definition: schedulercbssetparameters.c:25
int _Scheduler_CBS_Get_parameters(Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *params)
Retrieves CBS scheduling parameters.
Definition: schedulercbsgetparameters.c:26
RTEMS_INLINE_ROUTINE int rtems_cbs_get_parameters(rtems_cbs_server_id server_id, rtems_cbs_parameters *params)
Get CBS parameters.
Definition: cbs.h:169
RTEMS_INLINE_ROUTINE int rtems_cbs_create_server(rtems_cbs_parameters *params, rtems_cbs_budget_overrun budget_overrun_callback, rtems_cbs_server_id *server_id)
Create a new server with specified parameters.
Definition: cbs.h:89
int _Scheduler_CBS_Get_approved_budget(Scheduler_CBS_Server_id server_id, time_t *approved_budget)
Retrieves the approved budget.
Definition: schedulercbsgetapprovedbudget.c:25
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
Definition: schedulercbs.h:105
void(* Scheduler_CBS_Budget_overrun)(Scheduler_CBS_Server_id server_id)
Definition: schedulercbs.h:98
RTEMS_INLINE_ROUTINE int rtems_cbs_attach_thread(rtems_cbs_server_id server_id, rtems_id task_id)
Attach a task to an already existing server.
Definition: cbs.h:109
RTEMS_INLINE_ROUTINE int rtems_cbs_set_parameters(rtems_cbs_server_id server_id, rtems_cbs_parameters *params)
Set CBS parameters.
Definition: cbs.h:184
RTEMS_INLINE_ROUTINE int rtems_cbs_cleanup(void)
Cleanup resources associated to the CBS Library.
Definition: cbs.h:77
int _Scheduler_CBS_Cleanup(void)
Cleans up resources associated to the CBS Library.
Definition: schedulercbscleanup.c:24
Scheduler_CBS_Parameters rtems_cbs_parameters
Definition: cbs.h:56
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
RTEMS_INLINE_ROUTINE int rtems_cbs_get_execution_time(rtems_cbs_server_id server_id, time_t *exec_time, time_t *abs_time)
Get the CBS get execution time.
Definition: cbs.h:199
int _Scheduler_CBS_Initialize(void)
_Scheduler_CBS_Initialize
Definition: schedulercbs.c:54
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
RTEMS_INLINE_ROUTINE int rtems_cbs_get_remaining_budget(rtems_cbs_server_id server_id, time_t *remaining_budget)
Get the remaining CBS budget.
Definition: cbs.h:215
int _Scheduler_CBS_Destroy_server(Scheduler_CBS_Server_id server_id)
Detaches all tasks from a server and destroys it.
Definition: schedulercbsdestroyserver.c:25
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
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
Thread manipulation for the CBS scheduler.