AWS IoT FreeRTOS+POSIX
FreeRTOS_POSIX_internal.h
Go to the documentation of this file.
1 /*
2  * Amazon FreeRTOS+POSIX V1.0.0
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
26 #ifndef _FREERTOS_POSIX_INTERNAL_H_
27 #define _FREERTOS_POSIX_INTERNAL_H_
28 
34 /* Amazon FreeRTOS includes. */
35 #include "aws_doubly_linked_list.h"
36 
40 #if posixconfigENABLE_PTHREAD_MUTEXATTR_T == 1
41  typedef struct pthread_mutexattr_internal
42  {
43  int iType;
44  } pthread_mutexattr_internal_t;
45 #endif
46 
47 #if posixconfigENABLE_PTHREAD_MUTEX_T == 1
48 
51 typedef struct pthread_mutex_internal
52 {
53  BaseType_t xIsInitialized;
54  StaticSemaphore_t xMutex;
55  TaskHandle_t xTaskOwner;
56  pthread_mutexattr_internal_t xAttr;
57 } pthread_mutex_internal_t;
58 
62 #define FREERTOS_POSIX_MUTEX_INITIALIZER \
63  ( &( ( pthread_mutex_internal_t ) \
64  { \
65  .xIsInitialized = pdFALSE, \
66  .xMutex = { { 0 } }, \
67  .xTaskOwner = NULL, \
68  .xAttr = { .iType = 0 } \
69  } \
70  ) \
71  )
72 #endif
73 
77 typedef struct pthread_cond_internal
78 {
79  BaseType_t xIsInitialized;
80  StaticSemaphore_t xCondMutex;
81  StaticSemaphore_t xCondWaitSemaphore;
84 
88 #define FREERTOS_POSIX_COND_INITIALIZER \
89  ( &( ( pthread_cond_internal_t ) \
90  { \
91  .xIsInitialized = pdFALSE, \
92  .xCondMutex = { { 0 } }, \
93  .xCondWaitSemaphore = { { 0 } },\
94  .iWaitingThreads = 0 \
95  } \
96  ) \
97  )
98 
99 #endif /* _FREERTOS_POSIX_INTERNAL_H_ */
BaseType_t xIsInitialized
Definition: FreeRTOS_POSIX_internal.h:79
StaticSemaphore_t xCondMutex
Definition: FreeRTOS_POSIX_internal.h:80
int iWaitingThreads
Definition: FreeRTOS_POSIX_internal.h:82
StaticSemaphore_t xCondWaitSemaphore
Definition: FreeRTOS_POSIX_internal.h:81
Mutex attribute object.
Definition: FreeRTOS_POSIX_internal.h:77