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;
RTEMS_INLINE_ROUTINE Status_Control _Thread_Wait_get_status(const Thread_Control *the_thread)
Get the status of the wait return code of the thread.
Definition: threadimpl.h:2328
void _CORE_semaphore_Initialize(CORE_semaphore_Control *the_semaphore, uint32_t initial_value)
Initializes the semaphore based on the parameters passed.
Definition: coresem.c:23
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
Thread queue context for the thread queue methods.
Definition: threadq.h:198
Constants and Structures Related with Thread Dispatch.
RTEMS_INLINE_ROUTINE void _CORE_semaphore_Acquire_critical(CORE_semaphore_Control *the_semaphore, Thread_queue_Context *queue_context)
Acquires the semaphore critical.
Definition: coresemimpl.h:67
#define STATES_WAITING_FOR_SEMAPHORE
Definition: statesimpl.h:51
RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy(CORE_semaphore_Control *the_semaphore, const Thread_queue_Operations *operations, Thread_queue_Context *queue_context)
Destroys the semaphore.
Definition: coresemimpl.h:100
RTEMS_INLINE_ROUTINE 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.
Definition: coresemimpl.h:131
#define _ISR_Get_level()
Return current interrupt level.
Definition: isrlevel.h:128
Thread queue operations.
Definition: threadq.h:517
Thread_queue_Queue Queue
The actual thread queue.
Definition: threadq.h:583
RTEMS_INLINE_ROUTINE void _Thread_queue_Destroy(Thread_queue_Control *the_thread_queue)
Destroys the thread queue.
Definition: threadqimpl.h:1378
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.
Definition: threadqflush.c:63
RTEMS_INLINE_ROUTINE void _CORE_semaphore_Release(CORE_semaphore_Control *the_semaphore, Thread_queue_Context *queue_context)
Releases the semaphore.
Definition: coresemimpl.h:83
RTEMS_INLINE_ROUTINE 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.
Definition: threadqimpl.h:178
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.
Definition: threadqflush.c:37
RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count(const CORE_semaphore_Control *the_semaphore)
Returns the current count associated with the semaphore.
Definition: coresemimpl.h:175
Inlined Routines Associated with Thread State Information.
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
Inlined Routines from the Thread Handler.
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
Inlined Routines in the Object Handler.
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.
Definition: threadqenqueue.c:380
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
Thread_queue_Control Wait_queue
Definition: coresem.h:52
RTEMS_INLINE_ROUTINE 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.
Definition: coresemimpl.h:202
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100
Data Associated with the Counting Semaphore Handler.
uint32_t count
Definition: coresem.h:55
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77