RTEMS
5.1
|
CBS Scheduler. More...
Files | |
file | schedulercbs.h |
Thread manipulation for the CBS scheduler. | |
file | schedulercbsimpl.h |
CBS Scheduler Implementation. | |
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. More... | |
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. More... | |
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. 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) |
Attaches a task to an already existing server. More... | |
int | _Scheduler_CBS_Detach_thread (Scheduler_CBS_Server_id server_id, rtems_id task_id) |
Detaches from the CBS Server. More... | |
int | _Scheduler_CBS_Cleanup (void) |
Cleans up 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) |
Creates a new server with specified parameters. More... | |
int | _Scheduler_CBS_Destroy_server (Scheduler_CBS_Server_id server_id) |
Detaches all tasks from a server and destroys it. More... | |
int | _Scheduler_CBS_Get_approved_budget (Scheduler_CBS_Server_id server_id, time_t *approved_budget) |
Retrieves the approved budget. More... | |
int | _Scheduler_CBS_Get_remaining_budget (Scheduler_CBS_Server_id server_id, time_t *remaining_budget) |
Retrieves 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) |
Gets relative time info. More... | |
int | _Scheduler_CBS_Get_parameters (Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *params) |
Retrieves CBS scheduling parameters. More... | |
int | _Scheduler_CBS_Get_server_id (rtems_id task_id, Scheduler_CBS_Server_id *server_id) |
Gets a thread server id. More... | |
int | _Scheduler_CBS_Set_parameters (Scheduler_CBS_Server_id server_id, Scheduler_CBS_Parameters *parameters) |
Sets 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, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority) |
Initializes a CBS specific scheduler node of the_thread. More... | |
RTEMS_INLINE_ROUTINE Scheduler_CBS_Node * | _Scheduler_CBS_Thread_get_node (Thread_Control *the_thread) |
Gets the CBS node of the thread. More... | |
RTEMS_INLINE_ROUTINE Scheduler_CBS_Node * | _Scheduler_CBS_Node_downcast (Scheduler_Node *node) |
Casts the scheduler node to a scheduler CBS node. More... | |
Variables | |
const uint32_t | _Scheduler_CBS_Maximum_servers |
Scheduler_CBS_Server | _Scheduler_CBS_Server_list [] |
CBS Scheduler.
#define SCHEDULER_CBS_ENTRY_POINTS |
Entry points for the Constant Bandwidth Server Scheduler.
typedef void(* Scheduler_CBS_Budget_overrun) (Scheduler_CBS_Server_id server_id) |
Callback function invoked when a budget overrun of a task occurs.
typedef uint32_t Scheduler_CBS_Server_id |
Server id.
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.
server_id | The id of the existing server. |
task_id | The id of the task to attach. |
SCHEDULER_CBS_OK | The operation was successful. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The server id is so big or there is no thread for this task id. |
SCHEDULER_CBS_ERROR_NOSERVER | The server is not yet initialized. |
SCHEDULER_CBS_ERROR_FULL | The server already has a task. |
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.
the_thread | The thread that exceeded a limited time quantum. |
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.
scheduler | The scheduler for the operation. |
the_thread | The corresponding thread. |
priority_node | The priority node for the operation. |
queue_context | The thread queue context. |
int _Scheduler_CBS_Cleanup | ( | void | ) |
Cleans up resources associated to the CBS Library.
Cleanup 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.
Create a new server with specified parameters.
params | The parameters for the server. | |
budget_overrun_callback | The budget overrun for the new server. | |
[out] | server_id | In the case of success, this parameter contains the id of the newly created server. |
SCHEDULER_CBS_OK | The operation succeeded. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The given parameters are invalid. |
SCHEDULER_CBS_ERROR_FULL | The maximum number of servers was already created, a new server cannot be created. |
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.
server_id | The id of the server to destroy. |
SCHEDULER_CBS_OK | The operation was successful. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The server id is too big. |
SCHEDULER_CBS_ERROR_NOSERVER | There is no initialized server with this id. |
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.
server_id | The id of the existing server. |
task_id | The id of the task to attach. |
SCHEDULER_CBS_OK | The operation was successful. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The 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_NOSERVER | The server is not yet initialized. |
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.
server_id | The id of the server instance of which the budget is wanted. | |
[out] | approved_budget | Contains the approved budget after a successful method call. |
SCHEDULER_CBS_OK | The operation was successful. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The server id is too big. |
SCHEDULER_CBS_ERROR_NOSERVER | There is no initialized server with this id. |
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.
server_id | is the server to get the status code from. | |
[out] | exec_time | Contains the execution time after a successful method call. |
abs_time | Not apparently used. |
SCHEDULER_CBS_OK | The operation was successful. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The server id is too big. |
SCHEDULER_CBS_ERROR_NOSERVER | There is no initialized server with this id. |
int _Scheduler_CBS_Get_parameters | ( | Scheduler_CBS_Server_id | server_id, |
Scheduler_CBS_Parameters * | params | ||
) |
Retrieves CBS scheduling parameters.
Retrieve CBS scheduling parameters.
server_id | The id of the server to get the scheduling parameters from. | |
[out] | params | Will contain the scheduling parameters after successful method call. |
SCHEDULER_CBS_OK | The operation was successful. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The server id is too big. |
SCHEDULER_CBS_ERROR_NOSERVER | There is no initialized server with this id. |
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.
server_id | The id of the server instance of which the remaining budget is wanted. | |
[out] | remaining_budget | Contains the remaining budget after a successful method call. |
SCHEDULER_CBS_OK | The operation was successful. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The server id is too big. |
SCHEDULER_CBS_ERROR_NOSERVER | There is no initialized server with this 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.
task_id | The id of the task to get the corresponding server. | |
[out] | server_id | Will contain the server id after successful method call. |
SCHEDULER_CBS_OK | The operation was successful |
SCHEDULER_CBS_ERROR_NOSERVER | There is no server with this task attached. |
int _Scheduler_CBS_Initialize | ( | void | ) |
_Scheduler_CBS_Initialize
Initializes the CBS library.
RTEMS_INLINE_ROUTINE Scheduler_CBS_Node* _Scheduler_CBS_Node_downcast | ( | Scheduler_Node * | node | ) |
Casts the scheduler node to a scheduler CBS node.
node | The node to be casted to a scheduler CBS node. |
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.
scheduler | The scheduler control for the operation. | |
[out] | node | The scheduler node to initalize. |
the_thread | The thread to initialize a scheduler node for. | |
priority | The priority for the node. |
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.
scheduler | The scheduler for the operation. |
the_thread | The corresponding thread. |
priority_node | The priority node for the operation. |
deadline | The deadline for the job. |
queue_context | The thread queue context. |
int _Scheduler_CBS_Set_parameters | ( | Scheduler_CBS_Server_id | server_id, |
Scheduler_CBS_Parameters * | parameters | ||
) |
Sets parameters for CBS scheduling.
Change CBS scheduling parameters.
server_id | The id of the server. |
parameters | The parameters to set. |
SCHEDULER_CBS_OK | The operation was successful. |
SCHEDULER_CBS_ERROR_INVALID_PARAMETER | The server id is too big or the given parameters are invalid. |
SCHEDULER_CBS_ERROR_NOSERVER | There is no server with this id. |
RTEMS_INLINE_ROUTINE Scheduler_CBS_Node* _Scheduler_CBS_Thread_get_node | ( | Thread_Control * | the_thread | ) |
Gets the CBS node of the thread.
the_thread | The thread to get the CBS node of. |
void _Scheduler_CBS_Unblock | ( | const Scheduler_Control * | scheduler, |
Thread_Control * | the_thread, | ||
Scheduler_Node * | node | ||
) |
Unblocks a thread.
scheduler | The scheduler control. |
the_thread | The thread to unblock. |
node | The scheduler node. |
const uint32_t _Scheduler_CBS_Maximum_servers |
Maximum number of simultaneous servers.
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.