141 #ifndef ti_sysbios_knl_Semaphore__include 142 #define ti_sysbios_knl_Semaphore__include 161 #define ti_sysbios_knl_Semaphore_long_names 162 #include "Semaphore_defs.h" 177 #define Semaphore_A_badContext "bad calling context - must be called from a Task" 183 #define Semaphore_A_noEvents "the Semaphore.supportsEvents flag is disabled" 189 #define Semaphore_A_overflow "count has exceeded 65535 and rolled over" 195 #define Semaphore_A_pendTaskDisabled "cannot call Semaphore_pend() while the Task or Swi scheduler is disabled" 198 typedef struct Semaphore_PendElem Semaphore_PendElem;
269 enum Semaphore_PendState {
270 Semaphore_PendState_TIMEOUT = 0,
271 Semaphore_PendState_POSTED = 1,
272 Semaphore_PendState_CLOCK_WAIT = 2,
273 Semaphore_PendState_WAIT_FOREVER = 3
275 typedef enum Semaphore_PendState Semaphore_PendState;
277 struct Semaphore_PendElem {
278 Task_PendElem tpElem;
279 Semaphore_PendState pendState;
330 unsigned int eventId;
341 volatile uint16_t count;
349 } Semaphore_Module_State;
377 typedef void (*Semaphore_EventPost)(
Event_Handle arg1,
unsigned int arg2);
378 extern const Semaphore_EventPost Semaphore_eventPost;
380 typedef void (*Semaphore_EventSync)(
Event_Handle arg1,
unsigned int arg2,
unsigned int arg3);
381 extern const Semaphore_EventSync Semaphore_eventSync;
525 extern bool Semaphore_pend(Semaphore_Handle semaphore, uint32_t timeout);
586 extern void Semaphore_pendTimeout(uintptr_t arg);
590 return ((Semaphore_Handle)str);
606 #undef ti_sysbios_knl_Semaphore_long_names 607 #include "Semaphore_defs.h" Definition: Semaphore.h:312
void Semaphore_delete(Semaphore_Handle *semaphore)
Delete a semaphore.
Semaphore_Mode mode
Semaphore mode.
Definition: Semaphore.h:293
Opaque queue element.
Definition: Queue.h:204
const bool Semaphore_supportsPriority
Support Task priority pend queuing?
void Semaphore_destruct(Semaphore_Struct *obj)
Destruct a semaphore.
void Semaphore_post(Semaphore_Handle semaphore)
Signal a semaphore.
void Semaphore_registerEvent(Semaphore_Handle semaphore, Event_Handle event, unsigned int eventId)
Register an Event Object with a semaphore.
Semaphore_Struct * Semaphore_Handle
Definition: Semaphore.h:204
Semaphore_Handle Semaphore_Object_next(Semaphore_Handle semaphore)
return handle of the next Semaphore on Semaphore list
Binary (FIFO)
Definition: Semaphore.h:235
Error block.
Definition: Error.h:152
unsigned int eventId
eventId if using Events
Definition: Semaphore.h:309
Definition: Semaphore.h:283
bool Semaphore_pend(Semaphore_Handle semaphore, uint32_t timeout)
Wait for a semaphore.
Counting (FIFO)
Definition: Semaphore.h:231
Semaphore_Handle Semaphore_Object_first(void)
return handle of the first Semaphore on Semaphore list
const bool Semaphore_supportsEvents
Support Semaphores with Events?
int Semaphore_getCount(Semaphore_Handle semaphore)
Get current semaphore count.
Semaphore_Mode
Semaphore types.
Definition: Semaphore.h:227
void Semaphore_Params_init(Semaphore_Params *prms)
Initialize the Semaphore_Params structure with default values.
Event_Handle event
Event instance to use if non-NULL.
Definition: Semaphore.h:303
Semaphore_Handle Semaphore_create(int count, const Semaphore_Params *prms, Error_Block *eb)
Create a Semaphore object.
Binary (priority-based)
Definition: Semaphore.h:243
void Semaphore_reset(Semaphore_Handle semaphore, int count)
Reset semaphore count.
Counting (priority-based)
Definition: Semaphore.h:239
Semaphore_Struct * Semaphore_Instance
Definition: Semaphore.h:205
Semaphore_Handle Semaphore_construct(Semaphore_Struct *obj, int count, const Semaphore_Params *prms)
Construct a semaphore.