RTEMS CPU Kit with SuperCore  4.10.99.0
rtems/cbs.h
Go to the documentation of this file.
00001 
00011 /*
00012  *  Copyright (C) 2011 Petr Benes.
00013  *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
00014  *
00015  *  The license and distribution terms for this file may be
00016  *  found in the file LICENSE in this distribution or at
00017  *  http://www.rtems.org/license/LICENSE.
00018  */
00019 
00020 #ifndef CONFIGURE_SCHEDULER_CBS
00021   #error "cbs.h available only with CONFIGURE_SCHEDULER_CBS"
00022 #endif
00023 
00024 #ifndef _RTEMS_CBS_H
00025 #define _RTEMS_CBS_H
00026 
00027 #include <rtems/score/schedulercbs.h>
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 /* Return codes. */
00034 #define RTEMS_CBS_OK                       SCHEDULER_CBS_OK
00035 #define RTEMS_CBS_ERROR_GENERIC            SCHEDULER_CBS_ERROR_GENERIC
00036 #define RTEMS_CBS_ERROR_NO_MEMORY          SCHEDULER_CBS_ERROR_NO_MEMORY
00037 #define RTEMS_CBS_ERROR_INVALID_PARAMETER  SCHEDULER_CBS_ERROR_INVALID_PARAM
00038 #define RTEMS_CBS_ERROR_UNAUTHORIZED       SCHEDULER_CBS_ERROR_UNAUTHORIZED
00039 #define RTEMS_CBS_ERROR_UNIMPLEMENTED      SCHEDULER_CBS_ERROR_UNIMPLEMENTED
00040 #define RTEMS_CBS_ERROR_MISSING_COMPONENT  SCHEDULER_CBS_ERROR_MISSING_COMPONENT
00041 #define RTEMS_CBS_ERROR_INCONSISTENT_STATE SCHEDULER_CBS_ERROR_INCONSISTENT_STATE
00042 #define RTEMS_CBS_ERROR_SYSTEM_OVERLOAD    SCHEDULER_CBS_ERROR_SYSTEM_OVERLOAD
00043 #define RTEMS_CBS_ERROR_INTERNAL_ERROR     SCHEDULER_CBS_ERROR_INTERNAL_ERROR
00044 #define RTEMS_CBS_ERROR_NOT_FOUND          SCHEDULER_CBS_ERROR_NOT_FOUND
00045 #define RTEMS_CBS_ERROR_FULL               SCHEDULER_CBS_ERROR_FULL
00046 #define RTEMS_CBS_ERROR_EMPTY              SCHEDULER_CBS_ERROR_EMPTY
00047 #define RTEMS_CBS_ERROR_NOSERVER           SCHEDULER_CBS_ERROR_NOSERVER
00048 
00050 typedef Scheduler_CBS_Budget_overrun rtems_cbs_budget_overrun;
00051 
00053 typedef Scheduler_CBS_Server_id rtems_cbs_server_id;
00054 
00056 typedef Scheduler_CBS_Parameters rtems_cbs_parameters;
00057 
00065 RTEMS_INLINE_ROUTINE int rtems_cbs_initialize ( void )
00066 {
00067   return _Scheduler_CBS_Initialize();
00068 }
00069 
00077 RTEMS_INLINE_ROUTINE int rtems_cbs_cleanup ( void )
00078 {
00079   return _Scheduler_CBS_Cleanup();
00080 }
00081 
00089 RTEMS_INLINE_ROUTINE int rtems_cbs_create_server (
00090   rtems_cbs_parameters     *params,
00091   rtems_cbs_budget_overrun  budget_overrun_callback,
00092   rtems_cbs_server_id      *server_id
00093 )
00094 {
00095   return _Scheduler_CBS_Create_server(
00096              params,
00097              budget_overrun_callback,
00098              server_id
00099          );
00100 }
00101 
00109 RTEMS_INLINE_ROUTINE int rtems_cbs_attach_thread (
00110   rtems_cbs_server_id server_id,
00111   rtems_id            task_id
00112 )
00113 {
00114   return _Scheduler_CBS_Attach_thread( server_id, task_id );
00115 }
00116 
00124 RTEMS_INLINE_ROUTINE int rtems_cbs_detach_thread (
00125   rtems_cbs_server_id server_id,
00126   rtems_id            task_id
00127 )
00128 {
00129   return _Scheduler_CBS_Detach_thread( server_id, task_id );
00130 }
00131 
00139 RTEMS_INLINE_ROUTINE int rtems_cbs_destroy_server (
00140   rtems_cbs_server_id server_id
00141 )
00142 {
00143   return _Scheduler_CBS_Destroy_server( server_id );
00144 }
00145 
00154 RTEMS_INLINE_ROUTINE int rtems_cbs_get_server_id (
00155   rtems_id             task_id,
00156   rtems_cbs_server_id *server_id
00157 )
00158 {
00159   return _Scheduler_CBS_Get_server_id( task_id, server_id );
00160 }
00161 
00169 RTEMS_INLINE_ROUTINE int rtems_cbs_get_parameters (
00170   rtems_cbs_server_id   server_id,
00171   rtems_cbs_parameters *params
00172 )
00173 {
00174   return _Scheduler_CBS_Get_parameters( server_id, params );
00175 }
00176 
00184 RTEMS_INLINE_ROUTINE int rtems_cbs_set_parameters (
00185   rtems_cbs_server_id   server_id,
00186   rtems_cbs_parameters *params
00187 )
00188 {
00189   return _Scheduler_CBS_Set_parameters( server_id, params );
00190 }
00191 
00199 RTEMS_INLINE_ROUTINE int rtems_cbs_get_execution_time (
00200   rtems_cbs_server_id    server_id,
00201   time_t                *exec_time,
00202   time_t                *abs_time
00203 )
00204 {
00205   return _Scheduler_CBS_Get_execution_time( server_id, exec_time, abs_time );
00206 }
00207 
00215 RTEMS_INLINE_ROUTINE int rtems_cbs_get_remaining_budget (
00216   rtems_cbs_server_id  server_id,
00217   time_t              *remaining_budget
00218 )
00219 {
00220   return _Scheduler_CBS_Get_remaining_budget( server_id, remaining_budget );
00221 }
00222 
00231 RTEMS_INLINE_ROUTINE int rtems_cbs_get_approved_budget (
00232   rtems_cbs_server_id  server_id,
00233   time_t              *appr_budget
00234 )
00235 {
00236   return _Scheduler_CBS_Get_approved_budget( server_id, appr_budget );
00237 }
00238 
00239 #ifdef __cplusplus
00240 }
00241 #endif
00242 
00243 #endif
00244 /* end of include file */