TI-RTOS for SimpleLink Wireless MCUs  2.14.03.28
SemaphoreP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
56 #ifndef ti_drivers_ports_SemaphoreP__include
57 #define ti_drivers_ports_SemaphoreP__include
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 #include <stdint.h>
64 #include <stdbool.h>
65 #include <stddef.h>
66 
70 typedef enum SemaphoreP_Status {
78 
82 #define SemaphoreP_WAIT_FOREVER ~(0)
83 
87 #define SemaphoreP_NO_WAIT (0)
88 
96 typedef void *SemaphoreP_Handle;
97 
101 typedef enum SemaphoreP_Mode {
105 
115 typedef struct SemaphoreP_Params {
116  char *name;
119  uint32_t maxCount;
121 
134 extern SemaphoreP_Handle SemaphoreP_create(unsigned int count,
135  SemaphoreP_Params *params);
136 
146 extern SemaphoreP_Status SemaphoreP_delete(SemaphoreP_Handle handle);
147 
157 extern void SemaphoreP_Params_init(SemaphoreP_Params *params);
158 
172 extern SemaphoreP_Status SemaphoreP_pend(SemaphoreP_Handle handle,
173  uint32_t timeout);
174 
184 extern SemaphoreP_Status SemaphoreP_post(SemaphoreP_Handle handle);
185 
195 extern SemaphoreP_Status SemaphoreP_postFromClock(SemaphoreP_Handle handle);
196 
206 extern SemaphoreP_Status SemaphoreP_postFromISR(SemaphoreP_Handle handle);
207 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* ti_drivers_ports_SemaphoreP__include */
Basic SemaphoreP Parameters.
Definition: SemaphoreP.h:115
SemaphoreP_Status
Status codes for SemaphoreP APIs.
Definition: SemaphoreP.h:70
Definition: SemaphoreP.h:76
SemaphoreP_Status SemaphoreP_post(SemaphoreP_Handle handle)
Function to post (signal) a semaphore.
SemaphoreP_Status SemaphoreP_postFromISR(SemaphoreP_Handle handle)
Function to post (signal) a semaphore from an ISR.
SemaphoreP_Mode mode
Definition: SemaphoreP.h:118
struct SemaphoreP_Params SemaphoreP_Params
Basic SemaphoreP Parameters.
SemaphoreP_Status SemaphoreP_postFromClock(SemaphoreP_Handle handle)
Function to post (signal) a semaphore from an ClockP function.
SemaphoreP_Status SemaphoreP_pend(SemaphoreP_Handle handle, uint32_t timeout)
Function to pend (wait) on a semaphore.
void * SemaphoreP_Handle
Opaque client reference to an instance of a SemaphoreP.
Definition: SemaphoreP.h:96
SemaphoreP_Status SemaphoreP_delete(SemaphoreP_Handle handle)
Function to delete a semaphore.
SemaphoreP_Handle SemaphoreP_create(unsigned int count, SemaphoreP_Params *params)
Function to create a semaphore.
Definition: SemaphoreP.h:102
Definition: SemaphoreP.h:74
SemaphoreP_Mode
Mode of the semaphore.
Definition: SemaphoreP.h:101
void SemaphoreP_Params_init(SemaphoreP_Params *params)
Initialize params structure to default values.
char * name
Definition: SemaphoreP.h:116
uint32_t maxCount
Definition: SemaphoreP.h:119
Definition: SemaphoreP.h:72
Definition: SemaphoreP.h:103
Copyright 2015, Texas Instruments Incorporated