19 #ifndef _RTEMS_SCORE_CORESEMIMPL_H 20 #define _RTEMS_SCORE_CORESEMIMPL_H 68 #define CORE_SEMAPHORE_STATUS_LAST CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED 95 uint32_t initial_value
102 _Thread_queue_Destroy( &the_semaphore->
Wait_queue );
129 Thread_Control *the_thread;
130 CORE_semaphore_Status status;
134 _Thread_queue_Acquire_critical( &the_semaphore->
Wait_queue, lock_context );
137 if ( the_thread != NULL ) {
138 #if defined(RTEMS_MULTIPROCESSING) 148 #if defined(RTEMS_MULTIPROCESSING) 150 (*api_semaphore_mp_support) ( the_thread, id );
156 the_semaphore->
count += 1;
160 _Thread_queue_Release( &the_semaphore->
Wait_queue, lock_context );
189 remote_extract_callout,
220 return the_semaphore->
count;
241 Thread_Control *executing,
251 _Thread_queue_Acquire_critical( &the_semaphore->
Wait_queue, lock_context );
252 if ( the_semaphore->
count != 0 ) {
253 the_semaphore->
count -= 1;
254 _Thread_queue_Release( &the_semaphore->
Wait_queue, lock_context );
259 _Thread_queue_Release( &the_semaphore->
Wait_queue, lock_context );
This status indicates that an attempt was made to unlock the semaphore and this would have made its c...
Definition: coresemimpl.h:60
CORE_semaphore_Disciplines discipline
This field indicates whether threads waiting on the semaphore block in FIFO or priority order...
Definition: coresem.h:62
void(* CORE_semaphore_API_mp_support_callout)(Thread_Control *, Objects_Id)
The following type defines the callout which the API provides to support global/multiprocessor operat...
Definition: coresemimpl.h:74
This status indicates that the calling task did not want to block and the operation was unable to com...
Definition: coresemimpl.h:47
RTEMS_INLINE_ROUTINE void _CORE_semaphore_Flush(CORE_semaphore_Control *the_semaphore, Thread_queue_Flush_callout remote_extract_callout, uint32_t status)
Core semaphore flush.
Definition: coresemimpl.h:181
RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize(CORE_semaphore_Control *the_semaphore, Thread_Control *executing, Objects_Id id, bool wait, Watchdog_Interval timeout, ISR_lock_Context *lock_context)
This routine attempts to receive a unit from the_semaphore.
Definition: coresemimpl.h:239
#define RTEMS_INLINE_ROUTINE
The following (in conjunction with compiler arguments) are used to choose between the use of static i...
Definition: basedefs.h:135
RTEMS_INLINE_ROUTINE void _Thread_Dispatch_enable(Per_CPU_Control *cpu_self)
Enables thread dispatching.
Definition: threaddispatch.h:304
The following defines the control block used to manage each counting semaphore.
Definition: coresem.h:69
This status indicates that the thread was blocked waiting for an operation to complete and the semaph...
Definition: coresemimpl.h:51
void _Thread_queue_Flush(Thread_queue_Control *the_thread_queue, Thread_queue_Flush_callout remote_extract_callout, uint32_t status)
Unblocks all threads blocked on the_thread_queue.
Definition: threadqflush.c:24
RTEMS_INLINE_ROUTINE Per_CPU_Control * _Thread_Dispatch_disable(void)
Disables thread dispatching.
Definition: threaddispatch.h:277
CORE_semaphore_Status
Core Semaphore handler return statuses.
Definition: coresemimpl.h:40
void _Thread_queue_Enqueue_critical(Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, States_Control state, Watchdog_Interval timeout, uint32_t timeout_code, ISR_lock_Context *lock_context)
Blocks the thread and places it on the thread queue.
Definition: threadqenqueue.c:48
void _Thread_queue_Extract_critical(Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, ISR_lock_Context *lock_context)
Extracts the thread from the thread queue and unblocks it.
Definition: threadqenqueue.c:152
Objects_Control Object
This field is the object management structure for each thread.
Definition: thread.h:673
This structure defines the Thread Control Block (TCB).
Definition: thread.h:671
RTEMS_INLINE_ROUTINE bool _CORE_semaphore_Is_priority(const CORE_semaphore_Attributes *the_attribute)
This function returns true if the priority attribute is enabled in the attribute_set and false otherw...
Definition: coresemimpl.h:202
Constants and Structures Associated with the Manipulation of Objects.
This status indicates that the operation completed successfully.
Definition: coresemimpl.h:42
This status indicates that the calling task was willing to block but the operation was unable to comp...
Definition: coresemimpl.h:56
The following defines the control block used to manage the attributes of each semaphore.
Definition: coresem.h:56
Inlined Routines Associated with Thread State Information.
This specifies that threads will wait for the semaphore in priority order.
Definition: coresem.h:49
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Definition: watchdog.h:47
RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(CORE_semaphore_Control *the_semaphore, Objects_Id id, CORE_semaphore_API_mp_support_callout api_semaphore_mp_support, ISR_lock_Context *lock_context)
Surrender a unit to a semaphore.
Definition: coresemimpl.h:122
void _CORE_semaphore_Initialize(CORE_semaphore_Control *the_semaphore, const CORE_semaphore_Attributes *the_semaphore_attributes, uint32_t initial_value)
Initialize the semaphore based on the parameters passed.
Definition: coresem.c:23
RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count(CORE_semaphore_Control *the_semaphore)
This routine returns the current count associated with the semaphore.
Definition: coresemimpl.h:216
#define STATES_WAITING_FOR_SEMAPHORE
This macro corresponds to a task waiting for a semaphore.
Definition: statesimpl.h:58
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
CORE_semaphore_Attributes Attributes
This element is the set of attributes which define this instance's behavior.
Definition: coresem.h:77
RTEMS_INLINE_ROUTINE Thread_Control * _Thread_queue_First_locked(Thread_queue_Control *the_thread_queue)
Returns the first thread on the thread queue if it exists, otherwise NULL.
Definition: threadqimpl.h:293
RTEMS_INLINE_ROUTINE bool _Objects_Is_local_id(Objects_Id id)
This function returns true if the id is of a local object, and false otherwise.
Definition: objectimpl.h:766
Inlined Routines in the Object Handler.
uint32_t Objects_Id
The following type defines the control block used to manage object IDs.
Definition: object.h:122
Thread_queue_Control Wait_queue
This field is the Waiting Queue used to manage the set of tasks which are blocked waiting to obtain t...
Definition: coresem.h:73
Thread_Wait_information Wait
This field is the blocking information for this thread.
Definition: thread.h:715
void(* Thread_queue_Flush_callout)(Thread_Control *)
The following type defines the callout used when a remote task is extracted from a local thread queue...
Definition: threadqimpl.h:65
Data Associated with the Counting Semaphore Handler.
uint32_t count
This element contains the current count of this semaphore.
Definition: coresem.h:79
uint32_t maximum_count
This element indicates the maximum count this semaphore may have.
Definition: coresem.h:58
Objects_Id id
This is the object's ID.
Definition: object.h:236