18 #ifndef _RTEMS_SCORE_COREMUTEXIMPL_H 19 #define _RTEMS_SCORE_COREMUTEXIMPL_H 24 #include <rtems/score/status.h> 38 #define CORE_MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority 40 #define CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS \ 41 &_Thread_queue_Operations_priority_inherit 201 return STATUS_SUCCESSFUL;
234 if ( owner ==
NULL ) {
238 return STATUS_SUCCESSFUL;
241 if ( owner == executing ) {
242 Status_Control status;
244 status = ( *nested )( the_mutex );
276 unsigned int nest_level;
283 return STATUS_NOT_OWNER;
288 if ( nest_level > 0 ) {
291 return STATUS_SUCCESSFUL;
299 if ( heads ==
NULL ) {
301 return STATUS_SUCCESSFUL;
311 return STATUS_SUCCESSFUL;
330 #if defined(RTEMS_SMP) 331 the_mutex->scheduler = scheduler;
347 #if defined(RTEMS_SMP) 348 return the_mutex->scheduler;
371 if ( owner !=
NULL ) {
431 return STATUS_MUTEX_CEILING_VIOLATED;
447 return STATUS_SUCCESSFUL;
479 if ( owner ==
NULL ) {
480 #if defined(RTEMS_SMP) 486 return STATUS_NOT_DEFINED;
498 if ( owner == executing ) {
499 Status_Control status;
501 status = ( *nested )( &the_mutex->
Recursive );
508 CORE_MUTEX_TQ_OPERATIONS,
531 unsigned int nest_level;
540 return STATUS_NOT_OWNER;
545 if ( nest_level > 0 ) {
548 return STATUS_SUCCESSFUL;
564 CORE_MUTEX_TQ_OPERATIONS
572 if ( new_owner !=
NULL ) {
573 #if defined(RTEMS_MULTIPROCESSING) 587 CORE_MUTEX_TQ_OPERATIONS,
597 return STATUS_SUCCESSFUL;
Priority_Node Priority_ceiling
The priority ceiling node for the mutex owner.
Definition: coremutex.h:92
Thread_Control * owner
The thread queue owner.
Definition: threadq.h:431
RTEMS_INLINE_ROUTINE 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).
Definition: threadimpl.h:1632
RTEMS_INLINE_ROUTINE Per_CPU_Control * _Thread_queue_Dispatch_disable(Thread_queue_Context *queue_context)
Disables dispatching in a critical section.
Definition: threadqimpl.h:429
RTEMS_INLINE_ROUTINE Per_CPU_Control * _Thread_Dispatch_disable_critical(const ISR_lock_Context *lock_context)
Disables thread dispatching inside a critical section (interrupts disabled).
Definition: threaddispatch.h:179
RTEMS_INLINE_ROUTINE Thread_Control * _Thread_queue_First_locked(Thread_queue_Control *the_thread_queue, const Thread_queue_Operations *operations)
Returns the first thread on the thread queue if it exists, otherwise NULL.
Definition: threadqimpl.h:1173
RTEMS_INLINE_ROUTINE bool _Objects_Is_local_id(Objects_Id id RTEMS_UNUSED)
Checks if the id is of a local object.
Definition: objectimpl.h:584
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
Thread_queue_Control Wait_queue
The thread queue of this mutex.
Definition: coremutex.h:62
Thread queue context for the thread queue methods.
Definition: threadq.h:198
RTEMS_INLINE_ROUTINE void _Thread_Resource_count_decrement(Thread_Control *the_thread)
Decrements the thread's resource count.
Definition: threadimpl.h:1329
unsigned int nest_level
The nest level in case of a recursive seize.
Definition: coremutex.h:77
CORE_recursive_mutex_Control Recursive
The plain recursive mutex.
Definition: coremutex.h:87
Inlined Routines Associated with the Manipulation of the Scheduler.
Priority_Control priority
The priority value of this node.
Definition: priority.h:110
RTEMS_INLINE_ROUTINE Status_Control _CORE_ceiling_mutex_Set_owner(CORE_ceiling_mutex_Control *the_mutex, Thread_Control *owner, Thread_queue_Context *queue_context)
Sets the owner of the ceiling mutex.
Definition: coremuteximpl.h:411
RTEMS_INLINE_ROUTINE Status_Control _CORE_recursive_mutex_Seize(CORE_recursive_mutex_Control *the_mutex, const Thread_queue_Operations *operations, Thread_Control *executing, bool wait, Status_Control(*nested)(CORE_recursive_mutex_Control *), Thread_queue_Context *queue_context)
Seizes the recursive mutex.
Definition: coremuteximpl.h:219
void _Thread_queue_Object_initialize(Thread_queue_Control *the_thread_queue)
Initializes a thread queue embedded in an object with identifier.
Definition: threadq.c:148
RTEMS_INLINE_ROUTINE Status_Control _CORE_ceiling_mutex_Seize(CORE_ceiling_mutex_Control *the_mutex, Thread_Control *executing, bool wait, Status_Control(*nested)(CORE_recursive_mutex_Control *), Thread_queue_Context *queue_context)
Seizes the ceiling mutex.
Definition: coremuteximpl.h:465
RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Acquires the thread wait default lock and disables interrupts.
Definition: threadimpl.h:1842
Thread queue operations.
Definition: threadq.h:517
RTEMS_INLINE_ROUTINE void _CORE_mutex_Release(CORE_mutex_Control *the_mutex, Thread_queue_Context *queue_context)
Releases the mutex.
Definition: coremuteximpl.h:85
Thread_queue_Queue Queue
The actual thread queue.
Definition: threadq.h:583
Thread_queue_Heads * heads
Lock to protect this thread queue.
Definition: threadq.h:426
Thread queue heads.
Definition: threadq.h:360
RTEMS_INLINE_ROUTINE void _Thread_Resource_count_increment(Thread_Control *the_thread)
Increments the thread's resource count.
Definition: threadimpl.h:1313
RTEMS_INLINE_ROUTINE Status_Control _CORE_recursive_mutex_Surrender(CORE_recursive_mutex_Control *the_mutex, const Thread_queue_Operations *operations, Thread_Control *executing, Thread_queue_Context *queue_context)
Surrenders the recursive mutex.
Definition: coremuteximpl.h:269
RTEMS_INLINE_ROUTINE void _Thread_queue_Destroy(Thread_queue_Control *the_thread_queue)
Destroys the thread queue.
Definition: threadqimpl.h:1378
Per CPU Core Structure.
Definition: percpu.h:347
RTEMS_INLINE_ROUTINE void _Thread_Wait_release(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Releases the thread wait lock and restores the previous interrupt status.
Definition: threadimpl.h:1903
RTEMS_INLINE_ROUTINE Thread_Control * _CORE_mutex_Get_owner(const CORE_mutex_Control *the_mutex)
Gets the owner of the mutex.
Definition: coremuteximpl.h:100
RTEMS_INLINE_ROUTINE void _Priority_Node_initialize(Priority_Node *node, Priority_Control priority)
Initializes the priority node to the given priority.
Definition: priorityimpl.h:156
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:203
Objects_Control Object
Definition: thread.h:734
CORE_mutex_Control Mutex
The plain non-recursive mutex.
Definition: coremutex.h:72
Constants and Structures Associated with the Manipulation of Objects.
RTEMS_INLINE_ROUTINE void _CORE_mutex_Destroy(CORE_mutex_Control *the_mutex)
Destroys the mutex.
Definition: coremuteximpl.h:60
void _Thread_queue_Surrender(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.
Definition: threadqenqueue.c:660
const Scheduler_Control _Scheduler_Table[]
Registered schedulers.
void _Thread_Priority_update(Thread_queue_Context *queue_context)
Updates the priority of all threads in the set.
Definition: threadchangepriority.c:339
void _Thread_Dispatch_enable(Per_CPU_Control *cpu_self)
Enables thread dispatching.
Definition: threaddispatch.c:362
The recursive mutex control.
Definition: coremutex.h:68
RTEMS_INLINE_ROUTINE void _CORE_ceiling_mutex_Initialize(CORE_ceiling_mutex_Control *the_mutex, const Scheduler_Control *scheduler, Priority_Control priority_ceiling)
initializes a ceiling mutex.
Definition: coremuteximpl.h:322
RTEMS_INLINE_ROUTINE 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).
Definition: threadimpl.h:1692
RTEMS_INLINE_ROUTINE void _CORE_mutex_Initialize(CORE_mutex_Control *the_mutex)
Initializes the mutex.
Definition: coremuteximpl.h:48
RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_locked(const CORE_mutex_Control *the_mutex)
Checks if the mutex is locked.
Definition: coremuteximpl.h:118
RTEMS_INLINE_ROUTINE 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.
Definition: threadqimpl.h:681
RTEMS_INLINE_ROUTINE const Scheduler_Control * _CORE_ceiling_mutex_Get_scheduler(const CORE_ceiling_mutex_Control *the_mutex)
Gets the scheduler of the ceiling mutex.
Definition: coremuteximpl.h:343
RTEMS_INLINE_ROUTINE Priority_Control _CORE_ceiling_mutex_Get_priority(const CORE_ceiling_mutex_Control *the_mutex)
Gets the priority of the ceiling mutex.
Definition: coremuteximpl.h:393
RTEMS_INLINE_ROUTINE void _Thread_queue_Context_clear_priority_updates(Thread_queue_Context *queue_context)
Clears the priority update count of the thread queue context.
Definition: threadqimpl.h:338
RTEMS_INLINE_ROUTINE void _CORE_recursive_mutex_Initialize(CORE_recursive_mutex_Control *the_mutex)
Initializes a recursive mutex.
Definition: coremuteximpl.h:181
RTEMS_INLINE_ROUTINE const Scheduler_Control * _Thread_Scheduler_get_home(const Thread_Control *the_thread)
Gets the home scheduler of the thread.
Definition: threadimpl.h:1393
Control block used to manage each mutex.
Definition: coremutex.h:56
RTEMS_INLINE_ROUTINE Status_Control _CORE_ceiling_mutex_Surrender(CORE_ceiling_mutex_Control *the_mutex, Thread_Control *executing, Thread_queue_Context *queue_context)
Surrenders the ceiling mutex.
Definition: coremuteximpl.h:525
Scheduler control.
Definition: scheduler.h:269
Scheduler node for per-thread data.
Definition: schedulernode.h:79
RTEMS_INLINE_ROUTINE void _CORE_ceiling_mutex_Set_priority(CORE_ceiling_mutex_Control *the_mutex, Priority_Control priority_ceiling, Thread_queue_Context *queue_context)
Sets the priority of the ceiling mutex.
Definition: coremuteximpl.h:361
Inlined Routines from the Thread Handler.
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.
Definition: threadchangepriority.c:292
struct Scheduler_Node::@3980 Wait
Thread wait support block.
RTEMS_INLINE_ROUTINE Priority_Control _Priority_Get_priority(const Priority_Aggregation *aggregation)
Gets the priority aggregation's priority.
Definition: priorityimpl.h:270
RTEMS_INLINE_ROUTINE Status_Control _CORE_recursive_mutex_Seize_nested(CORE_recursive_mutex_Control *the_mutex)
Seizes the recursive mutex nested.
Definition: coremuteximpl.h:196
The recursive mutex control with priority ceiling protocol support.
Definition: coremutex.h:83
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_owner(const CORE_mutex_Control *the_mutex, const Thread_Control *the_thread)
Checks if the the thread is the owner of the mutex.
Definition: coremuteximpl.h:168
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:130
RTEMS_INLINE_ROUTINE void _Thread_queue_Release(Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
Releases the thread queue control and enables interrupts.
Definition: threadqimpl.h:787
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.
Definition: threadchangepriority.c:277
RTEMS_INLINE_ROUTINE void _Thread_Priority_change(Thread_Control *the_thread, Priority_Node *priority_node, Priority_Control new_priority, bool prepend_it, Thread_queue_Context *queue_context)
Changes the thread priority value of the specified thread priority node in the corresponding thread p...
Definition: threadimpl.h:696
void _Thread_queue_Extract_critical(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Extracts the thread from the thread queue and unblocks it.
Definition: threadqenqueue.c:600
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
RTEMS_INLINE_ROUTINE void _CORE_mutex_Acquire_critical(CORE_mutex_Control *the_mutex, Thread_queue_Context *queue_context)
Acquires the mutex critical.
Definition: coremuteximpl.h:71
Status_Control _CORE_mutex_Seize_slow(CORE_mutex_Control *the_mutex, const Thread_queue_Operations *operations, Thread_Control *executing, bool wait, Thread_queue_Context *queue_context)
Seize the mutex slowly.
Definition: coremutexseize.c:26
RTEMS_INLINE_ROUTINE void _CORE_mutex_Set_owner(CORE_mutex_Control *the_mutex, Thread_Control *owner)
Sets the owner of the mutex.
Definition: coremuteximpl.h:151
RTEMS_INLINE_ROUTINE Scheduler_Node * _Thread_Scheduler_get_home_node(const Thread_Control *the_thread)
Gets the scheduler's home node.
Definition: threadimpl.h:1412
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77
Objects_Id id
Definition: objectdata.h:43