PDK API Guide for J721E
SemaphoreP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, 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  */
32 
65 #ifndef ti_osal_SemaphoreP__include
66 #define ti_osal_SemaphoreP__include
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 #include <stdint.h>
73 #include <stdbool.h>
74 #include <stddef.h>
75 
84 typedef int32_t SemaphoreP_Status;
85 #define SemaphoreP_OK (0)
86 
87 #define SemaphoreP_FAILURE (-(int32_t)1)
88 
89 #define SemaphoreP_TIMEOUT (-(int32_t)2)
90 
91 #define SemaphoreP_UNSUPPORTED (-(int32_t)3)
92 
93 /* @} */
94 
98 #define SemaphoreP_WAIT_FOREVER (~((uint32_t)0U))
99 
103 #define SemaphoreP_NO_WAIT ((uint32_t)0U)
104 
112 typedef void *SemaphoreP_Handle;
113 
122 typedef uint32_t SemaphoreP_Mode;
123 #define SemaphoreP_Mode_COUNTING (0x0U)
124 #define SemaphoreP_Mode_BINARY (0x1U)
125 /* @} */
126 
136 typedef struct SemaphoreP_Params_s {
137  char *name;
140  uint32_t maxCount;
142 
156  const SemaphoreP_Params *semParams);
157 
168 
178 extern void SemaphoreP_Params_init(SemaphoreP_Params *semParams);
179 
194  uint32_t timeout);
195 
206 
217 
236 extern int32_t SemaphoreP_getCount(SemaphoreP_Handle semPhandle);
237 
245 #ifdef __cplusplus
246 }
247 #endif
248 
249 #endif /* ti_osal_SemaphoreP__include */
250 /* @} */
SemaphoreP_Status SemaphoreP_delete(SemaphoreP_Handle semPhandle)
Function to delete a semaphore.
SemaphoreP_Status SemaphoreP_post(SemaphoreP_Handle semPhandle)
Function to post (signal) a semaphore.
uint32_t count
Definition: tisci_rm_ra.h:166
uint32_t maxCount
Definition: SemaphoreP.h:140
SemaphoreP_Status SemaphoreP_reset(SemaphoreP_Handle semPhandle)
Function to clear a semaphore for reuse.
Basic SemaphoreP Parameters.
Definition: SemaphoreP.h:136
void * SemaphoreP_Handle
Opaque client reference to an instance of a SemaphoreP.
Definition: SemaphoreP.h:112
char * name
Definition: SemaphoreP.h:137
uint32_t SemaphoreP_Mode
Mode of the semaphore.
Definition: SemaphoreP.h:122
SemaphoreP_Status SemaphoreP_postFromISR(SemaphoreP_Handle semPhandle)
Function to post (signal) a semaphore from an ISR.
SemaphoreP_Handle SemaphoreP_create(uint32_t count, const SemaphoreP_Params *semParams)
Function to create a semaphore.
SemaphoreP_Status SemaphoreP_postFromClock(SemaphoreP_Handle semPhandle)
Function to post (signal) a semaphore from an ClockP function.
void SemaphoreP_Params_init(SemaphoreP_Params *semParams)
Initialize params structure to default values.
int32_t SemaphoreP_getCount(SemaphoreP_Handle semPhandle)
Function to return the count of a semaphore.
int32_t SemaphoreP_Status
Status codes for SemaphoreP APIs.
Definition: SemaphoreP.h:84
SemaphoreP_Status SemaphoreP_pend(SemaphoreP_Handle semPhandle, uint32_t timeout)
Function to pend (wait) on a semaphore.
SemaphoreP_Mode mode
Definition: SemaphoreP.h:139