RTEMS CPU Kit with SuperCore  4.11.3
Files | Data Structures | Macros | Typedefs | Functions | Variables
Collaboration diagram for CBS Scheduler:

Files

file  schedulercbsimpl.h
 CBS Scheduler Implementation.
 

Data Structures

struct  Scheduler_CBS_Parameters
 This structure handles server parameters. More...
 
struct  Scheduler_CBS_Server
 This structure represents a time server. More...
 
struct  Scheduler_CBS_Node
 This structure handles CBS specific data of a thread. More...
 

Macros

#define SCHEDULER_CBS_ENTRY_POINTS
 Entry points for the Constant Bandwidth Server Scheduler. More...
 
#define SCHEDULER_CBS_OK   0
 
#define SCHEDULER_CBS_ERROR_GENERIC   -16
 
#define SCHEDULER_CBS_ERROR_NO_MEMORY   -17
 
#define SCHEDULER_CBS_ERROR_INVALID_PARAMETER   -18
 
#define SCHEDULER_CBS_ERROR_UNAUTHORIZED   -19
 
#define SCHEDULER_CBS_ERROR_UNIMPLEMENTED   -20
 
#define SCHEDULER_CBS_ERROR_MISSING_COMPONENT   -21
 
#define SCHEDULER_CBS_ERROR_INCONSISTENT_STATE   -22
 
#define SCHEDULER_CBS_ERROR_SYSTEM_OVERLOAD   -23
 
#define SCHEDULER_CBS_ERROR_INTERNAL_ERROR   -24
 
#define SCHEDULER_CBS_ERROR_NOT_FOUND   -25
 
#define SCHEDULER_CBS_ERROR_FULL   -26
 
#define SCHEDULER_CBS_ERROR_EMPTY   -27
 
#define SCHEDULER_CBS_ERROR_NOSERVER   SCHEDULER_CBS_ERROR_NOT_FOUND
 

Typedefs

typedef uint32_t Scheduler_CBS_Server_id
 Server id. More...
 
typedef void(* Scheduler_CBS_Budget_overrun) (Scheduler_CBS_Server_id server_id)
 Callback function invoked when a budget overrun of a task occurs. More...
 

Functions

Scheduler_Void_or_thread _Scheduler_CBS_Unblock (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 Unblocks a thread from the queue. More...
 
void _Scheduler_CBS_Release_job (const Scheduler_Control *scheduler, Thread_Control *the_thread, uint32_t length)
 Called when a new job of task is released. More...
 
int _Scheduler_CBS_Initialize (void)
 _Scheduler_CBS_Initialize More...
 
int _Scheduler_CBS_Attach_thread (Scheduler_CBS_Server_id server_id, rtems_id task_id)
 Attach a task to an already existing server. More...
 
int _Scheduler_CBS_Detach_thread (Scheduler_CBS_Server_id server_id, rtems_id task_id)
 Detach from the CBS Server. More...
 
int _Scheduler_CBS_Cleanup (void)
 Cleanup resources associated to the CBS Library. More...
 
int _Scheduler_CBS_Create_server (Scheduler_CBS_Parameters *params, Scheduler_CBS_Budget_overrun budget_overrun_callback, rtems_id *server_id)
 Create a new server with specified parameters. More...
 
int _Scheduler_CBS_Destroy_server (Scheduler_CBS_Server_id server_id)
 Detach all tasks from a server and destroy it. More...
 
int _Scheduler_CBS_Get_approved_budget (Scheduler_CBS_Server_id server_id, time_t *approved_budget)
 Retrieve the approved budget. More...
 
int _Scheduler_CBS_Get_remaining_budget (Scheduler_CBS_Server_id server_id, time_t *remaining_budget)
 Retrieve remaining budget for the current server instance. More...
 
int _Scheduler_CBS_Get_execution_time (Scheduler_CBS_Server_id server_id, time_t *exec_time, time_t *abs_time)
 Get relative time info. More...
 
int _Scheduler_CBS_Get_parameters (Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *params)
 Retrieve CBS scheduling parameters. More...
 
int _Scheduler_CBS_Get_server_id (rtems_id task_id, Scheduler_CBS_Server_id *server_id)
 Get a thread server id. More...
 
int _Scheduler_CBS_Set_parameters (Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *parameters)
 Set parameters for CBS scheduling. More...
 
void _Scheduler_CBS_Budget_callout (Thread_Control *the_thread)
 Invoked when a limited time quantum is exceeded. More...
 
void _Scheduler_CBS_Node_initialize (const Scheduler_Control *scheduler, Thread_Control *the_thread)
 Initializes a CBS specific scheduler node of the_thread.
 
RTEMS_INLINE_ROUTINE Scheduler_CBS_Node_Scheduler_CBS_Thread_get_node (Thread_Control *the_thread)
 

Variables

const uint32_t _Scheduler_CBS_Maximum_servers
 Maximum number of simultaneous servers. More...
 
Scheduler_CBS_Server _Scheduler_CBS_Server_list []
 List of servers. More...
 

Detailed Description

Macro Definition Documentation

◆ SCHEDULER_CBS_ENTRY_POINTS

#define SCHEDULER_CBS_ENTRY_POINTS
Value:
{ \
_Scheduler_EDF_Initialize, /* initialize entry point */ \
_Scheduler_EDF_Schedule, /* schedule entry point */ \
_Scheduler_EDF_Yield, /* yield entry point */ \
_Scheduler_EDF_Block, /* block entry point */ \
_Scheduler_CBS_Unblock, /* unblock entry point */ \
_Scheduler_EDF_Change_priority, /* change priority entry point */ \
_Scheduler_CBS_Node_initialize, /* node initialize entry point */ \
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_EDF_Update_priority, /* update priority entry point */ \
_Scheduler_EDF_Priority_compare, /* compares two priorities */ \
_Scheduler_CBS_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
_Scheduler_default_Start_idle /* start idle entry point */ \
SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
}
void _Scheduler_CBS_Node_initialize(const Scheduler_Control *scheduler, Thread_Control *the_thread)
Initializes a CBS specific scheduler node of the_thread.
Definition: schedulercbsnodeinit.c:23

Entry points for the Constant Bandwidth Server Scheduler.

Note
: The CBS scheduler is an enhancement of EDF scheduler, therefor some routines are similar.

Typedef Documentation

◆ Scheduler_CBS_Budget_overrun

typedef void(* Scheduler_CBS_Budget_overrun) (Scheduler_CBS_Server_id server_id)

Callback function invoked when a budget overrun of a task occurs.

◆ Scheduler_CBS_Server_id

typedef uint32_t Scheduler_CBS_Server_id

Server id.

Function Documentation

◆ _Scheduler_CBS_Attach_thread()

int _Scheduler_CBS_Attach_thread ( Scheduler_CBS_Server_id  server_id,
rtems_id  task_id 
)

Attach a task to an already existing server.

Attach a task to an already existing server.

Return values
statuscode.

◆ _Scheduler_CBS_Budget_callout()

void _Scheduler_CBS_Budget_callout ( Thread_Control the_thread)

Invoked when a limited time quantum is exceeded.

This routine is invoked when a limited time quantum is exceeded.

◆ _Scheduler_CBS_Cleanup()

int _Scheduler_CBS_Cleanup ( void  )

Cleanup resources associated to the CBS Library.

Cleanup resources associated to the CBS Library.

Return values
statuscode.

References _Scheduler_CBS_Maximum_servers, and _Scheduler_CBS_Server_list.

Referenced by qres_cleanup(), and rtems_cbs_cleanup().

◆ _Scheduler_CBS_Create_server()

int _Scheduler_CBS_Create_server ( Scheduler_CBS_Parameters params,
Scheduler_CBS_Budget_overrun  budget_overrun_callback,
rtems_id server_id 
)

Create a new server with specified parameters.

Create a new server with specified parameters.

Return values
statuscode.

◆ _Scheduler_CBS_Destroy_server()

int _Scheduler_CBS_Destroy_server ( Scheduler_CBS_Server_id  server_id)

Detach all tasks from a server and destroy it.

Detach all tasks from a server and destroy it.

Parameters
[in]server_idis the ID of the server
Return values
statuscode.

◆ _Scheduler_CBS_Detach_thread()

int _Scheduler_CBS_Detach_thread ( Scheduler_CBS_Server_id  server_id,
rtems_id  task_id 
)

Detach from the CBS Server.

Detach from the CBS Server.

Return values
statuscode.

◆ _Scheduler_CBS_Get_approved_budget()

int _Scheduler_CBS_Get_approved_budget ( Scheduler_CBS_Server_id  server_id,
time_t *  approved_budget 
)

Retrieve the approved budget.

Retrieve the budget that has been approved for the subsequent server instances.

Return values
statuscode.

◆ _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 
)

Get relative time info.

Retrieve time info relative to server_id. The server status code is returned.

Parameters
[in]server_idis the server to get the status code from.
[in]exec_timeis the execution time.
[in]abs_timeis not apparently used.
Return values
statuscode.

◆ _Scheduler_CBS_Get_parameters()

int _Scheduler_CBS_Get_parameters ( Scheduler_CBS_Server_id  server_id,
Scheduler_CBS_Parameters params 
)

Retrieve CBS scheduling parameters.

Retrieve CBS scheduling parameters.

Return values
statuscode.

◆ _Scheduler_CBS_Get_remaining_budget()

int _Scheduler_CBS_Get_remaining_budget ( Scheduler_CBS_Server_id  server_id,
time_t *  remaining_budget 
)

Retrieve remaining budget for the current server instance.

Retrieve remaining budget for the current server instance.

Return values
statuscode.

◆ _Scheduler_CBS_Get_server_id()

int _Scheduler_CBS_Get_server_id ( rtems_id  task_id,
Scheduler_CBS_Server_id server_id 
)

Get a thread server id.

Get a thread server id, or SCHEDULER_CBS_ERROR_NOT_FOUND if it is not attached to any server.

Return values
statuscode.

◆ _Scheduler_CBS_Initialize()

int _Scheduler_CBS_Initialize ( void  )

_Scheduler_CBS_Initialize

Initializes the CBS library.

Return values
statuscode.

Referenced by qres_init(), and rtems_cbs_initialize().

◆ _Scheduler_CBS_Release_job()

void _Scheduler_CBS_Release_job ( const Scheduler_Control scheduler,
Thread_Control the_thread,
uint32_t  length 
)

Called when a new job of task is released.

This routine is called when a new job of task is released. It is called only from Rate Monotonic manager in the beginning of new period. Deadline has to be shifted and budget replenished.

Parameters
[in]schedulerThe scheduler instance.
[in]the_threadis the owner of the job.
[in]lengthof the new job from now. If equal to 0, the job was cancelled or deleted.

◆ _Scheduler_CBS_Set_parameters()

int _Scheduler_CBS_Set_parameters ( Scheduler_CBS_Server_id  server_id,
Scheduler_CBS_Parameters parameters 
)

Set parameters for CBS scheduling.

Change CBS scheduling parameters.

Parameters
[in]server_idis the ID of the server.
[in]parametersare the parameters to set.
Return values
statuscode.

◆ _Scheduler_CBS_Unblock()

Scheduler_Void_or_thread _Scheduler_CBS_Unblock ( const Scheduler_Control scheduler,
Thread_Control the_thread 
)

Unblocks a thread from the queue.

This routine adds the_thread to the scheduling decision, that is, adds it to the ready queue and updates any appropriate scheduling variables, for example the heir thread. It is checked whether the remaining budget is sufficient. If not, the thread continues as a new job in order to protect concurrent threads.

Parameters
[in]schedulerThe scheduler instance.
[in]the_threadwill be unblocked.
Note
This has to be asessed as missed deadline of the current job.

Variable Documentation

◆ _Scheduler_CBS_Maximum_servers

const uint32_t _Scheduler_CBS_Maximum_servers

Maximum number of simultaneous servers.

Referenced by _Scheduler_CBS_Cleanup().

◆ _Scheduler_CBS_Server_list

Scheduler_CBS_Server _Scheduler_CBS_Server_list[]

List of servers.

The Scheduler_CBS_Server is the index to the array of pointers to _Scheduler_CBS_Server_list.

Referenced by _Scheduler_CBS_Cleanup().