RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
semaphoreimpl.h
Go to the documentation of this file.
1
9/*
10 * Copyright (c) 2015, 2017 embedded brains GmbH. All rights reserved.
11 *
12 * embedded brains GmbH
13 * Dornierstr. 4
14 * 82178 Puchheim
15 * Germany
16 * <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _RTEMS_SCORE_SEMAPHOREIMPL_H
24#define _RTEMS_SCORE_SEMAPHOREIMPL_H
25
26#include <sys/lock.h>
27
28#include <rtems/score/percpu.h>
30
37#ifdef __cplusplus
38extern "C" {
39#endif /* __cplusplus */
40
41typedef struct {
43 unsigned int count;
45
46#define SEMAPHORE_TQ_OPERATIONS &_Thread_queue_Operations_priority
47
55static inline Sem_Control *_Sem_Get( struct _Semaphore_Control *_sem )
56{
57 return (Sem_Control *) _sem;
58}
59
70static inline Thread_Control *_Sem_Queue_acquire_critical(
71 Sem_Control *sem,
72 Thread_queue_Context *queue_context
73)
74{
75 Thread_Control *executing;
76
77 executing = _Thread_Executing;
78 _Thread_queue_Queue_acquire_critical(
79 &sem->Queue.Queue,
80 &executing->Potpourri_stats,
81 &queue_context->Lock_context.Lock_context
82 );
83
84 return executing;
85}
86
94static inline void _Sem_Queue_release(
95 Sem_Control *sem,
96 ISR_Level level,
97 Thread_queue_Context *queue_context
98)
99{
101 &sem->Queue.Queue,
102 &queue_context->Lock_context.Lock_context
103 );
104 _ISR_Local_enable( level );
105}
106
107#ifdef __cplusplus
108}
109#endif /* __cplusplus */
110
113#endif /* _RTEMS_SCORE_SEMAPHOREIMPL_H */
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
Definition: isrlevel.h:74
uint32_t ISR_Level
Definition: isrlevel.h:41
RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_release_critical(Thread_queue_Queue *queue, ISR_lock_Context *lock_context)
Releases the thread queue queue in a critical section.
Definition: threadqimpl.h:603
Definition: semaphoreimpl.h:41
Thread queue context for the thread queue methods.
Definition: threadq.h:198
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:203
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:130
Thread queue with a layout compatible to struct _Thread_queue_Queue defined in Newlib <sys/lock....
Definition: threadqimpl.h:54
Definition: thread.h:732
Constants and Structures Associated with the Manipulation of Objects.