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

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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
27#include <rtems/score/schedulercbs.h>
28
29#ifdef __cplusplus
30extern "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
50 typedef Scheduler_CBS_Budget_overrun rtems_cbs_budget_overrun;
51
53 typedef Scheduler_CBS_Server_id rtems_cbs_server_id;
54
56 typedef Scheduler_CBS_Parameters rtems_cbs_parameters;
57
65 RTEMS_INLINE_ROUTINE int rtems_cbs_initialize ( void )
66{
67 return _Scheduler_CBS_Initialize();
68}
69
77 RTEMS_INLINE_ROUTINE int rtems_cbs_cleanup ( void )
78{
79 return _Scheduler_CBS_Cleanup();
80}
81
89 RTEMS_INLINE_ROUTINE int rtems_cbs_create_server (
90 rtems_cbs_parameters *params,
91 rtems_cbs_budget_overrun budget_overrun_callback,
92 rtems_cbs_server_id *server_id
93)
94{
95 return _Scheduler_CBS_Create_server(
96 params,
97 budget_overrun_callback,
98 server_id
99 );
100}
101
109 RTEMS_INLINE_ROUTINE int rtems_cbs_attach_thread (
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
124 RTEMS_INLINE_ROUTINE int rtems_cbs_detach_thread (
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
139 RTEMS_INLINE_ROUTINE int rtems_cbs_destroy_server (
140 rtems_cbs_server_id server_id
141)
142{
143 return _Scheduler_CBS_Destroy_server( server_id );
144}
145
154 RTEMS_INLINE_ROUTINE int rtems_cbs_get_server_id (
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
169 RTEMS_INLINE_ROUTINE int rtems_cbs_get_parameters (
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
184 RTEMS_INLINE_ROUTINE int rtems_cbs_set_parameters (
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
199 RTEMS_INLINE_ROUTINE int rtems_cbs_get_execution_time (
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
215 RTEMS_INLINE_ROUTINE int rtems_cbs_get_remaining_budget (
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
231 RTEMS_INLINE_ROUTINE int rtems_cbs_get_approved_budget (
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 */
rtems_cbs_parameters
Scheduler_CBS_Parameters rtems_cbs_parameters
Definition: cbs.h:56
rtems_cbs_server_id
Scheduler_CBS_Server_id rtems_cbs_server_id
Definition: cbs.h:53
rtems_cbs_attach_thread
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_cbs_create_server
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
rtems_cbs_initialize
RTEMS_INLINE_ROUTINE int rtems_cbs_initialize(void)
Initialize the CBS library.
Definition: cbs.h:65
rtems_cbs_get_server_id
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
rtems_cbs_set_parameters
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_cbs_get_remaining_budget
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
rtems_cbs_get_parameters
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_cbs_detach_thread
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
rtems_cbs_get_approved_budget
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
rtems_cbs_cleanup
RTEMS_INLINE_ROUTINE int rtems_cbs_cleanup(void)
Cleanup resources associated to the CBS Library.
Definition: cbs.h:77
rtems_cbs_destroy_server
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
rtems_cbs_budget_overrun
Scheduler_CBS_Budget_overrun rtems_cbs_budget_overrun
Definition: cbs.h:50
rtems_cbs_get_execution_time
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
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_Budget_overrun
void(* Scheduler_CBS_Budget_overrun)(Scheduler_CBS_Server_id server_id)
Definition: schedulercbs.h:98
_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
schedulercbs.h
Thread manipulation for the CBS scheduler.
Scheduler_CBS_Parameters
Definition: schedulercbs.h:105