ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
Loading...
Searching...
No Matches
semaphore.h
Go to the documentation of this file.
1
16#ifndef ICARUS_SEMAPHORE_H
17#define ICARUS_SEMAPHORE_H
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <stdint.h>
24#include <stdbool.h>
25
26/* ============================================================================
27 * SEMAPHORE API
28 * ========================================================================= */
29
36bool semaphore_init(uint8_t semaphore_idx, uint32_t semaphore_count);
37
45bool semaphore_feed(uint8_t semaphore_idx);
46
54bool semaphore_consume(uint8_t semaphore_idx);
55
65bool semaphore_consume_timeout(uint8_t semaphore_idx, uint32_t max_ticks);
66
72uint32_t semaphore_get_count(uint8_t semaphore_idx);
73
79uint32_t semaphore_get_max_count(uint8_t semaphore_idx);
80
81/* ============================================================================
82 * SVC CALL GATES (MPU Protection)
83 * ========================================================================= */
84
91bool sem_can_feed(uint8_t semaphore_idx);
92
99bool sem_can_consume(uint8_t semaphore_idx);
100
107void sem_increment(uint8_t semaphore_idx);
108
115void sem_decrement(uint8_t semaphore_idx);
116
117/* ============================================================================
118 * PRIVILEGED IMPLEMENTATIONS (Internal - Do Not Call Directly)
119 * ========================================================================= */
120
121bool __semaphore_init(uint8_t semaphore_idx, uint32_t semaphore_count);
122bool __semaphore_feed(uint8_t semaphore_idx);
123bool __semaphore_consume(uint8_t semaphore_idx);
124bool __semaphore_consume_timeout(uint8_t semaphore_idx, uint32_t max_ticks);
125uint32_t __semaphore_get_count(uint8_t semaphore_idx);
126uint32_t __semaphore_get_max_count(uint8_t semaphore_idx);
127bool __sem_can_feed(uint8_t semaphore_idx);
128bool __sem_can_consume(uint8_t semaphore_idx);
129void __sem_increment(uint8_t semaphore_idx);
130void __sem_decrement(uint8_t semaphore_idx);
131
132#ifdef __cplusplus
133}
134#endif
135
136#endif /* ICARUS_SEMAPHORE_H */
uint32_t semaphore_get_max_count(uint8_t semaphore_idx)
Get semaphore maximum count.
Definition svc.c:841
bool semaphore_consume(uint8_t semaphore_idx)
Decrement semaphore count (P operation / wait)
Definition svc.c:807
bool sem_can_feed(uint8_t semaphore_idx)
Check if semaphore can accept a feed (SVC call gate)
Definition svc.c:946
uint32_t semaphore_get_count(uint8_t semaphore_idx)
Get current semaphore count.
Definition svc.c:821
uint32_t __semaphore_get_count(uint8_t semaphore_idx)
Privileged implementation of semaphore_get_count.
Definition semaphore.c:146
bool semaphore_consume_timeout(uint8_t semaphore_idx, uint32_t max_ticks)
Decrement semaphore count with timeout (timed P / wait).
Definition svc.c:814
bool __semaphore_consume_timeout(uint8_t semaphore_idx, uint32_t max_ticks)
Privileged implementation of semaphore_consume_timeout.
Definition semaphore.c:116
uint32_t __semaphore_get_max_count(uint8_t semaphore_idx)
Privileged implementation of semaphore_get_max_count.
Definition semaphore.c:158
void sem_decrement(uint8_t semaphore_idx)
Decrement semaphore count (SVC call gate)
Definition svc.c:1056
void __sem_decrement(uint8_t semaphore_idx)
Privileged write gate: decrement semaphore count.
Definition semaphore.c:213
bool __semaphore_feed(uint8_t semaphore_idx)
Privileged implementation of semaphore_feed.
Definition semaphore.c:54
bool __sem_can_consume(uint8_t semaphore_idx)
Privileged call gate: can semaphore be consumed?
Definition semaphore.c:186
bool __semaphore_init(uint8_t semaphore_idx, uint32_t semaphore_count)
Privileged implementation of semaphore_init.
Definition semaphore.c:35
bool sem_can_consume(uint8_t semaphore_idx)
Check if semaphore can be consumed (SVC call gate)
Definition svc.c:967
bool semaphore_feed(uint8_t semaphore_idx)
Increment semaphore count (V operation / signal)
Definition svc.c:800
bool __sem_can_feed(uint8_t semaphore_idx)
Privileged call gate: can semaphore accept a feed?
Definition semaphore.c:172
bool semaphore_init(uint8_t semaphore_idx, uint32_t semaphore_count)
Initialize a counting semaphore.
Definition svc.c:778
void sem_increment(uint8_t semaphore_idx)
Increment semaphore count (SVC call gate)
Definition svc.c:1038
void __sem_increment(uint8_t semaphore_idx)
Privileged write gate: increment semaphore count.
Definition semaphore.c:199
bool __semaphore_consume(uint8_t semaphore_idx)
Privileged implementation of semaphore_consume.
Definition semaphore.c:81