RTEMS 6.1-rc5
Loading...
Searching...
No Matches
cbs.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
13/*
14 * Copyright (C) 2011 Petr Benes.
15 * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef CONFIGURE_SCHEDULER_CBS
40 #error "cbs.h available only with CONFIGURE_SCHEDULER_CBS"
41#endif
42
43#ifndef _RTEMS_CBS_H
44#define _RTEMS_CBS_H
45
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52/* Return codes. */
53#define RTEMS_CBS_OK SCHEDULER_CBS_OK
54#define RTEMS_CBS_ERROR_GENERIC SCHEDULER_CBS_ERROR_GENERIC
55#define RTEMS_CBS_ERROR_NO_MEMORY SCHEDULER_CBS_ERROR_NO_MEMORY
56#define RTEMS_CBS_ERROR_INVALID_PARAMETER SCHEDULER_CBS_ERROR_INVALID_PARAM
57#define RTEMS_CBS_ERROR_UNAUTHORIZED SCHEDULER_CBS_ERROR_UNAUTHORIZED
58#define RTEMS_CBS_ERROR_UNIMPLEMENTED SCHEDULER_CBS_ERROR_UNIMPLEMENTED
59#define RTEMS_CBS_ERROR_MISSING_COMPONENT SCHEDULER_CBS_ERROR_MISSING_COMPONENT
60#define RTEMS_CBS_ERROR_INCONSISTENT_STATE SCHEDULER_CBS_ERROR_INCONSISTENT_STATE
61#define RTEMS_CBS_ERROR_SYSTEM_OVERLOAD SCHEDULER_CBS_ERROR_SYSTEM_OVERLOAD
62#define RTEMS_CBS_ERROR_INTERNAL_ERROR SCHEDULER_CBS_ERROR_INTERNAL_ERROR
63#define RTEMS_CBS_ERROR_NOT_FOUND SCHEDULER_CBS_ERROR_NOT_FOUND
64#define RTEMS_CBS_ERROR_FULL SCHEDULER_CBS_ERROR_FULL
65#define RTEMS_CBS_ERROR_EMPTY SCHEDULER_CBS_ERROR_EMPTY
66#define RTEMS_CBS_ERROR_NOSERVER SCHEDULER_CBS_ERROR_NOSERVER
67
70
73
76
84static inline int rtems_cbs_initialize ( void )
85{
87}
88
96static inline int rtems_cbs_cleanup ( void )
97{
99}
100
108static inline int rtems_cbs_create_server (
109 rtems_cbs_parameters *params,
110 rtems_cbs_budget_overrun budget_overrun_callback,
111 rtems_cbs_server_id *server_id
112)
113{
115 params,
116 budget_overrun_callback,
117 server_id
118 );
119}
120
128static inline int rtems_cbs_attach_thread (
129 rtems_cbs_server_id server_id,
130 rtems_id task_id
131)
132{
133 return _Scheduler_CBS_Attach_thread( server_id, task_id );
134}
135
143static inline int rtems_cbs_detach_thread (
144 rtems_cbs_server_id server_id,
145 rtems_id task_id
146)
147{
148 return _Scheduler_CBS_Detach_thread( server_id, task_id );
149}
150
158static inline int rtems_cbs_destroy_server (
159 rtems_cbs_server_id server_id
160)
161{
162 return _Scheduler_CBS_Destroy_server( server_id );
163}
164
173static inline int rtems_cbs_get_server_id (
174 rtems_id task_id,
175 rtems_cbs_server_id *server_id
176)
177{
178 return _Scheduler_CBS_Get_server_id( task_id, server_id );
179}
180
188static inline int rtems_cbs_get_parameters (
189 rtems_cbs_server_id server_id,
191)
192{
193 return _Scheduler_CBS_Get_parameters( server_id, params );
194}
195
203static inline int rtems_cbs_set_parameters (
204 rtems_cbs_server_id server_id,
206)
207{
208 return _Scheduler_CBS_Set_parameters( server_id, params );
209}
210
218static inline int rtems_cbs_get_execution_time (
219 rtems_cbs_server_id server_id,
220 time_t *exec_time,
221 time_t *abs_time
222)
223{
224 return _Scheduler_CBS_Get_execution_time( server_id, exec_time, abs_time );
225}
226
234static inline int rtems_cbs_get_remaining_budget (
235 rtems_cbs_server_id server_id,
236 time_t *remaining_budget
237)
238{
239 return _Scheduler_CBS_Get_remaining_budget( server_id, remaining_budget );
240}
241
250static inline int rtems_cbs_get_approved_budget (
251 rtems_cbs_server_id server_id,
252 time_t *appr_budget
253)
254{
255 return _Scheduler_CBS_Get_approved_budget( server_id, appr_budget );
256}
257
258#ifdef __cplusplus
259}
260#endif
261
262#endif
263/* end of include file */
Scheduler_CBS_Parameters rtems_cbs_parameters
Definition: cbs.h:75
Scheduler_CBS_Server_id rtems_cbs_server_id
Definition: cbs.h:72
Scheduler_CBS_Budget_overrun rtems_cbs_budget_overrun
Definition: cbs.h:69
Objects_Id rtems_id
This type represents RTEMS object identifiers.
Definition: types.h:94
int _Scheduler_CBS_Get_server_id(rtems_id task_id, Scheduler_CBS_Server_id *server_id)
Gets a thread server id.
Definition: schedulercbsgetserverid.c:46
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:45
int _Scheduler_CBS_Cleanup(void)
Cleans up resources associated to the CBS Library.
Definition: schedulercbscleanup.c:44
void(* Scheduler_CBS_Budget_overrun)(Scheduler_CBS_Server_id server_id)
Definition: schedulercbs.h:116
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:45
int _Scheduler_CBS_Get_approved_budget(Scheduler_CBS_Server_id server_id, time_t *approved_budget)
Retrieves the approved budget.
Definition: schedulercbsgetapprovedbudget.c:46
int _Scheduler_CBS_Detach_thread(Scheduler_CBS_Server_id server_id, rtems_id task_id)
Detaches from the CBS Server.
Definition: schedulercbsdetachthread.c:45
int _Scheduler_CBS_Destroy_server(Scheduler_CBS_Server_id server_id)
Detaches all tasks from a server and destroys it.
Definition: schedulercbsdestroyserver.c:44
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:45
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:45
int _Scheduler_CBS_Initialize(void)
_Scheduler_CBS_Initialize
Definition: schedulercbs.c:109
int _Scheduler_CBS_Get_parameters(Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *params)
Retrieves CBS scheduling parameters.
Definition: schedulercbsgetparameters.c:46
uint32_t Scheduler_CBS_Server_id
Definition: schedulercbs.h:113
int _Scheduler_CBS_Set_parameters(Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *parameters)
Sets parameters for CBS scheduling.
Definition: schedulercbssetparameters.c:45
This header file provides interfaces of the Constant Bandwidth Server (CBS) Scheduler which are used ...
Definition: schedulercbs.h:123