SYS/BIOS  7.00
GateMutex.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, 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  */
97 #ifndef ti_sysbios_gates_GateMutex__include
98 #define ti_sysbios_gates_GateMutex__include
99 
100 #include <stdbool.h>
101 #include <stddef.h>
102 #include <stdint.h>
103 
104 #include <ti/sysbios/knl/Queue.h>
106 #include <ti/sysbios/knl/Task.h>
107 
109 
111 /* BIOS 6.x compatibility, use -Dxdc_std__include to disable */
112 #include <xdc/std.h>
113 
114 #define ti_sysbios_gates_GateMutex_long_names
115 #include "GateMutex_defs.h"
118 #ifdef __cplusplus
119 extern "C" {
120 #endif
121 
133 #define GateMutex_A_badContext "bad calling context"
134 
139 
141  uint32_t dummy; /* to make IAR happy */
142 };
143 
148 };
149 
151 typedef struct {
152  Queue_Struct objQ;
153 } GateMutex_Module_State;
163 extern bool GateMutex_canBePreempted(void);
164 
173 extern bool GateMutex_canBlock(void);
174 
183 extern GateMutex_Handle GateMutex_create(const GateMutex_Params *prms, Error_Block *eb);
184 
196 extern GateMutex_Handle GateMutex_construct(GateMutex_Struct *obj, const GateMutex_Params *prms);
197 
206 extern void GateMutex_delete(GateMutex_Handle *gate);
207 
213 extern void GateMutex_destruct(GateMutex_Struct *obj);
214 
226 extern void GateMutex_Params_init(GateMutex_Params *prms);
227 
239 extern intptr_t GateMutex_enter(GateMutex_Handle gate);
240 
251 extern void GateMutex_leave(GateMutex_Handle gate, intptr_t key);
252 
261 extern GateMutex_Handle GateMutex_Object_first(void);
262 
273 extern GateMutex_Handle GateMutex_Object_next(GateMutex_Handle gate);
274 
276 extern bool GateMutex_query(int qual);
277 
278 static inline GateMutex_Handle GateMutex_handle(GateMutex_Struct *str)
279 {
280  return ((GateMutex_Handle)str);
281 }
282 
283 static inline GateMutex_Struct * GateMutex_struct(GateMutex_Handle h)
284 {
285  return ((GateMutex_Struct *)h);
286 }
287 
288 extern void GateMutex_Instance_init(GateMutex_Object *obj, const GateMutex_Params *prms);
289 extern void GateMutex_Instance_finalize(GateMutex_Object *obj);
290 
291 #define GateMutex_module ((GateMutex_Module_State *) &(GateMutex_Module_state))
292 
294 #ifdef __cplusplus
295 }
296 #endif
297 
298 #endif /* ti_sysbios_gates_GateMutex__include */
299 
301 #undef ti_sysbios_gates_GateMutex_long_names
302 #include "GateMutex_defs.h"
Definition: Semaphore.h:312
GateMutex_Handle GateMutex_Object_first(void)
return handle of the first GateMutex on GateMutex list
intptr_t GateMutex_enter(GateMutex_Handle gate)
enter the GateMutex gate
GateMutex_Handle GateMutex_construct(GateMutex_Struct *obj, const GateMutex_Params *prms)
Construct a GateMutex gate.
Opaque queue element.
Definition: Queue.h:204
GateMutex_Handle GateMutex_Object_next(GateMutex_Handle gate)
return handle of the next GateMutex on GateMutex list
GateMutex_Object * GateMutex_Handle
Definition: GateMutex.h:138
Runtime error manager.
Definition: GateMutex.h:140
Queue Manager.
bool GateMutex_canBlock(void)
query Gate &#39;blocking&#39; characteristics
void GateMutex_destruct(GateMutex_Struct *obj)
Destruct a GateMutex gate.
Error block.
Definition: Error.h:152
Queue_Elem objElem
Definition: GateMutex.h:145
void GateMutex_delete(GateMutex_Handle *gate)
Delete a GateMutex gate.
void GateMutex_Params_init(GateMutex_Params *prms)
Initialize the GateMutex_Params structure with default values.
uint32_t dummy
Definition: GateMutex.h:141
void GateMutex_leave(GateMutex_Handle gate, intptr_t key)
leave the GateMutex gate
GateMutex_Handle GateMutex_create(const GateMutex_Params *prms, Error_Block *eb)
Create a GateMutex gate.
Task Manager.
Semaphore_Struct sem
Definition: GateMutex.h:147
Definition: GateMutex.h:144
struct Task_Struct * Task_Handle
Definition: Task.h:526
Task_Handle owner
Definition: GateMutex.h:146
bool GateMutex_canBePreempted(void)
query Gate &#39;preempt&#39; characteristics
Semaphore Manager.
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale