23 #ifndef _RTEMS_SCORE_MRSPIMPL_H 24 #define _RTEMS_SCORE_MRSPIMPL_H 28 #if defined(RTEMS_SMP) 31 #include <rtems/score/status.h> 45 #define MRSP_TQ_OPERATIONS &_Thread_queue_Operations_priority_inherit 116 uint32_t scheduler_index;
135 uint32_t scheduler_index;
161 Status_Control status;
180 status = STATUS_SUCCESSFUL;
182 status = STATUS_MUTEX_CEILING_VIOLATED;
252 Status_Control status;
262 if ( status != STATUS_SUCCESSFUL ) {
272 return STATUS_SUCCESSFUL;
294 bool initially_locked
300 if ( initially_locked ) {
301 return STATUS_INVALID_NUMBER;
304 for ( i = 0 ; i < scheduler_count ; ++i ) {
309 if ( scheduler != scheduler_of_index ) {
318 return STATUS_SUCCESSFUL;
340 Status_Control status;
350 if ( status != STATUS_SUCCESSFUL ) {
366 if ( status == STATUS_SUCCESSFUL ) {
371 int sticky_level_change;
373 if ( status != STATUS_DEADLOCK ) {
374 sticky_level_change = -1;
376 sticky_level_change = 0;
413 Status_Control status;
420 if ( owner == NULL ) {
422 }
else if ( owner == executing ) {
424 status = STATUS_UNAVAILABLE;
429 status = STATUS_UNAVAILABLE;
455 return STATUS_NOT_OWNER;
465 if ( heads == NULL ) {
474 return STATUS_SUCCESSFUL;
484 return STATUS_SUCCESSFUL;
500 return STATUS_RESOURCE_IN_USE;
503 return STATUS_SUCCESSFUL;
static __inline__ void _Thread_queue_Acquire_critical(Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
Acquires the thread queue control in a critical section.
Thread_Control * owner
The thread queue owner.
uint64_t Priority_Control
The thread priority control.
static __inline__ Status_Control _MRSP_Initialize(MRSP_Control *mrsp, const Scheduler_Control *scheduler, Priority_Control ceiling_priority, Thread_Control *executing, bool initially_locked)
Initializes a MrsP control.
static __inline__ Per_CPU_Control * _Thread_queue_Dispatch_disable(Thread_queue_Context *queue_context)
Disables dispatching in a critical section.
Thread queue context for the thread queue methods.
The priority node to build up a priority aggregation.
static __inline__ void _Thread_queue_Context_set_deadlock_callout(Thread_queue_Context *queue_context, Thread_queue_Deadlock_callout deadlock_callout)
Sets the deadlock callout in the thread queue context.
static __inline__ const Scheduler_Control * _Thread_Scheduler_get_home(const Thread_Control *the_thread)
Gets the home scheduler of the thread.
Inlined Routines in the Watchdog Handler.
Priority_Node Ceiling_priority
The ceiling priority used by the owner thread.
Thread_queue_Control Wait_queue
The thread queue to manage ownership and waiting threads.
static __inline__ Priority_Control _Scheduler_Map_priority(const Scheduler_Control *scheduler, Priority_Control priority)
Maps a thread priority from the user domain to the scheduler domain.
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
void _Thread_Priority_and_sticky_update(Thread_Control *the_thread, int sticky_level_change)
Updates the priority of the thread and changes it sticky level.
Priority_Control ceiling_priorities[RTEMS_ZERO_LENGTH_ARRAY]
One ceiling priority per scheduler instance.
static __inline__ Priority_Control _MRSP_Get_priority(const MRSP_Control *mrsp, const Scheduler_Control *scheduler)
Gets priority of the MrsP control.
void _Thread_queue_Object_initialize(Thread_queue_Control *the_thread_queue)
Initializes a thread queue embedded in an object with identifier.
static __inline__ Thread_Control * _MRSP_Get_owner(const MRSP_Control *mrsp)
Gets owner of the MrsP control.
static __inline__ Status_Control _MRSP_Raise_priority(MRSP_Control *mrsp, Thread_Control *thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Adds the priority to the given thread.
static __inline__ Status_Control _MRSP_Seize(MRSP_Control *mrsp, Thread_Control *executing, bool wait, Thread_queue_Context *queue_context)
Seizes the MrsP control.
Information for the Assert Handler.
Thread_queue_Queue Queue
The actual thread queue.
Thread_queue_Heads * heads
The thread queue heads.
static __inline__ Per_CPU_Control * _Thread_Dispatch_disable_critical(const ISR_lock_Context *lock_context)
Disables thread dispatching inside a critical section (interrupts disabled).
static __inline__ void _MRSP_Acquire_critical(MRSP_Control *mrsp, Thread_queue_Context *queue_context)
Acquires critical accordingt to MrsP.
void _Thread_queue_Deadlock_status(Thread_Control *the_thread)
Sets the thread wait return code to STATUS_DEADLOCK.
static __inline__ void _MRSP_Release(MRSP_Control *mrsp, Thread_queue_Context *queue_context)
Releases according to MrsP.
static __inline__ void _MRSP_Replace_priority(MRSP_Control *mrsp, Thread_Control *thread, Priority_Node *ceiling_priority)
Replaces the given priority node with the ceiling priority of the MrsP control.
static __inline__ Status_Control _MRSP_Wait_for_ownership(MRSP_Control *mrsp, Thread_Control *executing, Thread_queue_Context *queue_context)
Waits for the ownership of the MrsP control.
static __inline__ void _MRSP_Remove_priority(Thread_Control *thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Removes the priority from the given thread.
static __inline__ Scheduler_Node * _Thread_Scheduler_get_home_node(const Thread_Control *the_thread)
Gets the scheduler's home node.
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Constants and Structures Associated with the Manipulation of Objects.
void _Thread_Priority_replace(Thread_Control *the_thread, Priority_Node *victim_node, Priority_Node *replacement_node)
Replaces the victim priority node with the replacement priority node in the corresponding thread prio...
static __inline__ Status_Control _MRSP_Surrender(MRSP_Control *mrsp, Thread_Control *executing, Thread_queue_Context *queue_context)
Surrenders the MrsP control.
const Scheduler_Control _Scheduler_Table[]
This table contains the configured schedulers.
static __inline__ void _Thread_Wait_acquire_default(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the thread wait default lock and disables interrupts.
void _Thread_Dispatch_enable(Per_CPU_Control *cpu_self)
Enables thread dispatching.
static __inline__ void _Thread_queue_Context_clear_priority_updates(Thread_queue_Context *queue_context)
Clears the priority update count of the thread queue context.
void _Thread_queue_Surrender_sticky(Thread_queue_Queue *queue, Thread_queue_Heads *heads, Thread_Control *previous_owner, Thread_queue_Context *queue_context, const Thread_queue_Operations *operations)
Surrenders the thread queue previously owned by the thread to the first enqueued thread.
struct Scheduler_Node::@20 Wait
Thread wait support block.
Definitions for Multiprocessor Resource Sharing Protocol (MrsP).
static __inline__ Status_Control _MRSP_Claim_ownership(MRSP_Control *mrsp, Thread_Control *executing, Thread_queue_Context *queue_context)
Claims ownership of the MrsP control.
const size_t _Scheduler_Count
This constant contains the count of configured schedulers.
Scheduler node for per-thread data.
#define _ISR_lock_ISR_disable(_context)
Disables interrupts and saves the previous interrupt state in the ISR lock context.
static __inline__ Priority_Control _Priority_Get_priority(const Priority_Aggregation *aggregation)
Gets the priority aggregation's priority.
void _Thread_Priority_remove(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Removes the specified thread priority node from the corresponding thread priority aggregation...
static __inline__ void _Thread_Wait_acquire_default_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the thread wait default lock inside a critical section (interrupts disabled).
static __inline__ Status_Control _MRSP_Can_destroy(MRSP_Control *mrsp)
Checks if the MrsP control can be destroyed.
static __inline__ void _MRSP_Destroy(MRSP_Control *mrsp, Thread_queue_Context *queue_context)
Destroys the MrsP control.
static __inline__ void _MRSP_Set_priority(MRSP_Control *mrsp, const Scheduler_Control *scheduler, Priority_Control new_priority)
Sets priority of the MrsP control.
Local ISR lock context for acquire and release pairs.
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
static __inline__ void _Thread_queue_Destroy(Thread_queue_Control *the_thread_queue)
Destroys the thread queue.
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Status_Control _Thread_queue_Enqueue_sticky(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Enqueues the thread on the thread queue and busy waits for dequeue.
static __inline__ void _Thread_Wait_release_default_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the thread wait default lock inside a critical section (interrupts disabled).
void _Thread_queue_Release(Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
Releases the thread queue control and enables interrupts.
void _Thread_Priority_add(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Adds the specified thread priority node to the corresponding thread priority aggregation.
static __inline__ void _Thread_Wait_release_default(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the thread wait default lock and restores the previous interrupt status. ...
static __inline__ uint32_t _Scheduler_Get_index(const Scheduler_Control *scheduler)
Gets the index of the scheduler.
static __inline__ void _MRSP_Set_owner(MRSP_Control *mrsp, Thread_Control *owner)
Sets owner of the MrsP control.
static __inline__ void _Priority_Node_initialize(Priority_Node *node, Priority_Control priority)
Initializes the priority node to the given priority.