RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Typedefs | Functions | Variables
Constant Bandwidth Server (CBS) Scheduler

This group contains the Constant Bandwidth Server (CBS) Scheduler implementation. More...

Files

file  schedulercbs.h
 This header file provides interfaces of the Constant Bandwidth Server (CBS) Scheduler which are used by the implementation and the Application Configuration.
 
file  schedulercbsimpl.h
 This header file provides interfaces of the Constant Bandwidth Server (CBS) Scheduler which are only used by the implementation.
 
file  schedulercbs.c
 This source file contains the implementation of _Scheduler_CBS_Budget_callout() and _Scheduler_CBS_Initialize().
 
file  schedulercbsattachthread.c
 This source file contains the implementation of _Scheduler_CBS_Attach_thread().
 
file  schedulercbscleanup.c
 This source file contains the implementation of _Scheduler_CBS_Cleanup().
 
file  schedulercbscreateserver.c
 This source file contains the implementation of _Scheduler_CBS_Create_server().
 
file  schedulercbsdestroyserver.c
 This source file contains the implementation of _Scheduler_CBS_Destroy_server().
 
file  schedulercbsdetachthread.c
 This source file contains the implementation of _Scheduler_CBS_Detach_thread().
 
file  schedulercbsgetapprovedbudget.c
 This source file contains the implementation of _Scheduler_CBS_Get_approved_budget().
 
file  schedulercbsgetexecutiontime.c
 This source file contains the implementation of _Scheduler_CBS_Get_execution_time().
 
file  schedulercbsgetparameters.c
 This source file contains the implementation of _Scheduler_CBS_Get_parameters().
 
file  schedulercbsgetremainingbudget.c
 This source file contains the implementation of _Scheduler_CBS_Get_remaining_budget().
 
file  schedulercbsgetserverid.c
 This source file contains the implementation of _Scheduler_CBS_Get_server_id().
 
file  schedulercbsnodeinit.c
 This source file contains the implementation of _Scheduler_CBS_Node_initialize().
 
file  schedulercbsreleasejob.c
 This source file contains the implementation of _Scheduler_CBS_Release_job().
 
file  schedulercbssetparameters.c
 This source file contains the implementation of _Scheduler_CBS_Set_parameters().
 
file  schedulercbsunblock.c
 This source file contains the implementation of _Scheduler_CBS_Unblock().
 

Data Structures

struct  Scheduler_CBS_Parameters
 
struct  Scheduler_CBS_Server
 
struct  Scheduler_CBS_Node
 

Macros

#define SCHEDULER_CBS_MAXIMUM_PRIORITY   SCHEDULER_EDF_MAXIMUM_PRIORITY
 
#define SCHEDULER_CBS_ENTRY_POINTS
 
#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
 
typedef void(* Scheduler_CBS_Budget_overrun) (Scheduler_CBS_Server_id server_id)
 

Functions

void _Scheduler_CBS_Unblock (const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
 Unblocks a thread.
 
void _Scheduler_CBS_Release_job (const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, uint64_t deadline, Thread_queue_Context *queue_context)
 Releases a job.
 
void _Scheduler_CBS_Cancel_job (const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
 Cancels a job.
 
int _Scheduler_CBS_Initialize (void)
 _Scheduler_CBS_Initialize
 
int _Scheduler_CBS_Attach_thread (Scheduler_CBS_Server_id server_id, rtems_id task_id)
 Attaches a task to an already existing server.
 
int _Scheduler_CBS_Detach_thread (Scheduler_CBS_Server_id server_id, rtems_id task_id)
 Detaches from the CBS Server.
 
int _Scheduler_CBS_Cleanup (void)
 Cleans up resources associated to the CBS Library.
 
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.
 
int _Scheduler_CBS_Destroy_server (Scheduler_CBS_Server_id server_id)
 Detaches all tasks from a server and destroys it.
 
int _Scheduler_CBS_Get_approved_budget (Scheduler_CBS_Server_id server_id, time_t *approved_budget)
 Retrieves the approved 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.
 
int _Scheduler_CBS_Get_execution_time (Scheduler_CBS_Server_id server_id, time_t *exec_time, time_t *abs_time)
 Gets relative time info.
 
int _Scheduler_CBS_Get_parameters (Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *params)
 Retrieves CBS scheduling parameters.
 
int _Scheduler_CBS_Get_server_id (rtems_id task_id, Scheduler_CBS_Server_id *server_id)
 Gets a thread server id.
 
int _Scheduler_CBS_Set_parameters (Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *parameters)
 Sets parameters for CBS scheduling.
 
void _Scheduler_CBS_Node_initialize (const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
 Initializes a CBS specific scheduler node of the_thread.
 

Variables

const uint32_t _Scheduler_CBS_Maximum_servers
 
Scheduler_CBS_Server _Scheduler_CBS_Server_list []
 
const Thread_CPU_budget_operations _Scheduler_CBS_Budget
 These are the CBS CPU budget operations.
 

Detailed Description

This group contains the Constant Bandwidth Server (CBS) Scheduler implementation.

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_Update_priority, /* update priority entry point */ \
_Scheduler_EDF_Map_priority, /* map priority entry point */ \
_Scheduler_EDF_Unmap_priority, /* unmap priority entry point */ \
SCHEDULER_DEFAULT_SMP_OPERATIONS \
_Scheduler_CBS_Node_initialize, /* node initialize entry point */ \
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_CBS_Release_job, /* new period of task */ \
_Scheduler_CBS_Cancel_job, /* cancel period of task */ \
_Scheduler_default_Start_idle /* start idle entry point */ \
}
void _Scheduler_CBS_Release_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, uint64_t deadline, Thread_queue_Context *queue_context)
Releases a job.
Definition: schedulercbsreleasejob.c:44
void _Scheduler_CBS_Cancel_job(const Scheduler_Control *scheduler, Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Cancels a job.
Definition: schedulercbsreleasejob.c:74
void _Scheduler_CBS_Unblock(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Unblocks a thread.
Definition: schedulercbsunblock.c:48
void _Scheduler_EDF_Yield(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Executes a thread yield for the thread.
Definition: scheduleredfyield.c:44
void _Scheduler_EDF_Initialize(const Scheduler_Control *scheduler)
Initializes EDF scheduler.
Definition: scheduleredf.c:44
void _Scheduler_EDF_Block(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Removes the blocking thread from the ready queue and schedules is only again if the thread is executi...
Definition: scheduleredfblock.c:44
Priority_Control _Scheduler_EDF_Map_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Gets the mapped priority map of the priority control.
Definition: scheduleredfreleasejob.c:45
Priority_Control _Scheduler_EDF_Unmap_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Gets the unmapped priority map of the priority control.
Definition: scheduleredfreleasejob.c:53
void _Scheduler_EDF_Update_priority(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Updates the priority of the scheduler node.
Definition: scheduleredfchangepriority.c:44
void _Scheduler_EDF_Schedule(const Scheduler_Control *scheduler, Thread_Control *the_thread)
Sets the heir thread to be the next ready thread in the rbtree ready queue.
Definition: scheduleredfschedule.c:44
void _Scheduler_default_Node_destroy(const Scheduler_Control *scheduler, Scheduler_Node *node)
Does nothing.
Definition: schedulerdefaultnodedestroy.c:45
#define SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION
This define provides the default implementation for the SMP-specific set affinity operation.
Definition: scheduler.h:691
void _Scheduler_default_Start_idle(const Scheduler_Control *scheduler, Thread_Control *the_thread, struct Per_CPU_Control *cpu)
Starts an idle thread.
Definition: schedulerdefaultstartidle.c:43

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 
)

Attaches a task to an already existing server.

Attach a task to an already existing server.

Parameters
server_idThe id of the existing server.
task_idThe id of the task to attach.
Return values
SCHEDULER_CBS_OKThe operation was successful.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe server id is so big or there is no thread for this task id.
SCHEDULER_CBS_ERROR_NOSERVERThe server is not yet initialized.
SCHEDULER_CBS_ERROR_FULLThe server already has a task.

◆ _Scheduler_CBS_Cancel_job()

void _Scheduler_CBS_Cancel_job ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Priority_Node priority_node,
Thread_queue_Context queue_context 
)

Cancels a job.

Parameters
schedulerThe scheduler for the operation.
the_threadThe corresponding thread.
priority_nodeThe priority node for the operation.
queue_contextThe thread queue context.

◆ _Scheduler_CBS_Cleanup()

int _Scheduler_CBS_Cleanup ( void  )

Cleans up resources associated to the CBS Library.

Cleanup resources associated to the CBS Library.

Returns
This method always returns SCHEDULER_CBS_OK.

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

Create a new server with specified parameters.

Parameters
paramsThe parameters for the server.
budget_overrun_callbackThe budget overrun for the new server.
[out]server_idIn the case of success, this parameter contains the id of the newly created server.
Return values
SCHEDULER_CBS_OKThe operation succeeded.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe given parameters are invalid.
SCHEDULER_CBS_ERROR_FULLThe maximum number of servers was already created, a new server cannot be created.

◆ _Scheduler_CBS_Destroy_server()

int _Scheduler_CBS_Destroy_server ( Scheduler_CBS_Server_id  server_id)

Detaches all tasks from a server and destroys it.

Detach all tasks from a server and destroy it.

Parameters
server_idThe id of the server to destroy.
Return values
SCHEDULER_CBS_OKThe operation was successful.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe server id is too big.
SCHEDULER_CBS_ERROR_NOSERVERThere is no initialized server with this id.

◆ _Scheduler_CBS_Detach_thread()

int _Scheduler_CBS_Detach_thread ( Scheduler_CBS_Server_id  server_id,
rtems_id  task_id 
)

Detaches from the CBS Server.

Detach from the CBS Server.

Parameters
server_idThe id of the existing server.
task_idThe id of the task to attach.
Return values
SCHEDULER_CBS_OKThe operation was successful.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe server id is to big, or the task with this id is not attached to this server or there is no thread with this task.
SCHEDULER_CBS_ERROR_NOSERVERThe server is not yet initialized.

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

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

Parameters
server_idThe id of the server instance of which the budget is wanted.
[out]approved_budgetContains the approved budget after a successful method call.
Return values
SCHEDULER_CBS_OKThe operation was successful.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe server id is too big.
SCHEDULER_CBS_ERROR_NOSERVERThere is no initialized server with this id.

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

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

Parameters
server_idis the server to get the status code from.
[out]exec_timeContains the execution time after a successful method call.
abs_timeNot apparently used.
Return values
SCHEDULER_CBS_OKThe operation was successful.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe server id is too big.
SCHEDULER_CBS_ERROR_NOSERVERThere is no initialized server with this id.

◆ _Scheduler_CBS_Get_parameters()

int _Scheduler_CBS_Get_parameters ( Scheduler_CBS_Server_id  server_id,
Scheduler_CBS_Parameters params 
)

Retrieves CBS scheduling parameters.

Retrieve CBS scheduling parameters.

Parameters
server_idThe id of the server to get the scheduling parameters from.
[out]paramsWill contain the scheduling parameters after successful method call.
Return values
SCHEDULER_CBS_OKThe operation was successful.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe server id is too big.
SCHEDULER_CBS_ERROR_NOSERVERThere is no initialized server with this id.

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

Retrieve remaining budget for the current server instance.

Parameters
server_idThe id of the server instance of which the remaining budget is wanted.
[out]remaining_budgetContains the remaining budget after a successful method call.
Return values
SCHEDULER_CBS_OKThe operation was successful.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe server id is too big.
SCHEDULER_CBS_ERROR_NOSERVERThere is no initialized server with this id.

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

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

Parameters
task_idThe id of the task to get the corresponding server.
[out]server_idWill contain the server id after successful method call.
Return values
SCHEDULER_CBS_OKThe operation was successful
SCHEDULER_CBS_ERROR_NOSERVERThere is no server with this task attached.

◆ _Scheduler_CBS_Initialize()

int _Scheduler_CBS_Initialize ( void  )

_Scheduler_CBS_Initialize

Initializes the CBS library.

Returns
SCHEDULER_CBS_OK This method always returns this status.

◆ _Scheduler_CBS_Node_initialize()

void _Scheduler_CBS_Node_initialize ( const Scheduler_Control scheduler,
Scheduler_Node node,
Thread_Control the_thread,
Priority_Control  priority 
)

Initializes a CBS specific scheduler node of the_thread.

Parameters
schedulerThe scheduler control for the operation.
[out]nodeThe scheduler node to initalize.
the_threadThe thread to initialize a scheduler node for.
priorityThe priority for the node.

◆ _Scheduler_CBS_Release_job()

void _Scheduler_CBS_Release_job ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Priority_Node priority_node,
uint64_t  deadline,
Thread_queue_Context queue_context 
)

Releases a job.

Parameters
schedulerThe scheduler for the operation.
the_threadThe corresponding thread.
priority_nodeThe priority node for the operation.
deadlineThe deadline for the job.
queue_contextThe thread queue context.

◆ _Scheduler_CBS_Set_parameters()

int _Scheduler_CBS_Set_parameters ( Scheduler_CBS_Server_id  server_id,
Scheduler_CBS_Parameters parameters 
)

Sets parameters for CBS scheduling.

Change CBS scheduling parameters.

Parameters
server_idThe id of the server.
parametersThe parameters to set.
Return values
SCHEDULER_CBS_OKThe operation was successful.
SCHEDULER_CBS_ERROR_INVALID_PARAMETERThe server id is too big or the given parameters are invalid.
SCHEDULER_CBS_ERROR_NOSERVERThere is no server with this id.

◆ _Scheduler_CBS_Unblock()

void _Scheduler_CBS_Unblock ( const Scheduler_Control scheduler,
Thread_Control the_thread,
Scheduler_Node node 
)

Unblocks a thread.

Parameters
schedulerThe scheduler control.
the_threadThe thread to unblock.
nodeThe scheduler node.

Variable Documentation

◆ _Scheduler_CBS_Maximum_servers

const uint32_t _Scheduler_CBS_Maximum_servers
extern

Maximum number of simultaneous servers.

◆ _Scheduler_CBS_Server_list

Scheduler_CBS_Server _Scheduler_CBS_Server_list[]
extern

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