21 #ifndef _RTEMS_SCORE_CORESEMIMPL_H 22 #define _RTEMS_SCORE_CORESEMIMPL_H 30 #include <rtems/score/status.h> 56 uint32_t initial_value
134 uint32_t maximum_count,
139 Status_Control status;
141 status = STATUS_SUCCESSFUL;
149 if ( the_thread != NULL ) {
157 if ( the_semaphore->
count < maximum_count )
158 the_semaphore->
count += 1;
160 status = STATUS_MAXIMUM_COUNT_EXCEEDED;
179 return the_semaphore->
count;
213 if ( the_semaphore->
count != 0 ) {
214 the_semaphore->
count -= 1;
216 return STATUS_SUCCESSFUL;
221 return STATUS_UNSATISFIED;
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.
static __inline__ 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.
void _CORE_semaphore_Initialize(CORE_semaphore_Control *the_semaphore, uint32_t initial_value)
Initializes the semaphore based on the parameters passed.
Thread queue context for the thread queue methods.
static __inline__ Status_Control _CORE_semaphore_Surrender(CORE_semaphore_Control *the_semaphore, const Thread_queue_Operations *operations, uint32_t maximum_count, Thread_queue_Context *queue_context)
Surrenders a unit to the semaphore.
Constants and Structures Related with Thread Dispatch.
#define STATES_WAITING_FOR_SEMAPHORE
#define _ISR_Get_level()
Return current interrupt level.
static __inline__ void _CORE_semaphore_Acquire_critical(CORE_semaphore_Control *the_semaphore, Thread_queue_Context *queue_context)
Acquires the semaphore critical.
Thread_queue_Queue Queue
The actual thread queue.
static __inline__ void _Thread_queue_Context_set_thread_state(Thread_queue_Context *queue_context, States_Control thread_state)
Sets the thread state for the thread to enqueue in the thread queue context.
Inlined Routines in the Object Handler.
size_t _Thread_queue_Flush_critical(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_queue_Flush_filter filter, Thread_queue_Context *queue_context)
Unblocks all threads enqueued on the thread queue.
static __inline__ uint32_t _CORE_semaphore_Get_count(const CORE_semaphore_Control *the_semaphore)
Returns the current count associated with the semaphore.
Constants and Structures Associated with the Manipulation of Objects.
Thread_Control * _Thread_queue_Flush_status_object_was_deleted(Thread_Control *the_thread, Thread_queue_Queue *queue, Thread_queue_Context *queue_context)
Status object was deleted thread queue flush filter function.
Inlined Routines Associated with Thread State Information.
static __inline__ Status_Control _CORE_semaphore_Seize(CORE_semaphore_Control *the_semaphore, const Thread_queue_Operations *operations, Thread_Control *executing, bool wait, Thread_queue_Context *queue_context)
Seizes the semaphore.
Inlined Routines from the Thread Handler.
static __inline__ Status_Control _Thread_Wait_get_status(const Thread_Control *the_thread)
Get the status of the wait return code of the thread.
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.
void _Thread_queue_Release(Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
Releases the thread queue control and enables interrupts.
static __inline__ void _CORE_semaphore_Release(CORE_semaphore_Control *the_semaphore, Thread_queue_Context *queue_context)
Releases the semaphore.
void _Thread_queue_Enqueue(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Blocks the thread and places it on the thread queue.
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.
Thread_queue_Control Wait_queue
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Data Associated with the Counting Semaphore Handler.
static __inline__ void _CORE_semaphore_Destroy(CORE_semaphore_Control *the_semaphore, const Thread_queue_Operations *operations, Thread_queue_Context *queue_context)
Destroys the semaphore.