FreeRTOS: Platform
Platform portability layer
Return to main page ↑
iot_threads.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS Platform V1.1.2
3  * Copyright (C) 2020 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 
31 #ifndef IOT_THREADS_H_
32 #define IOT_THREADS_H_
33 
34 /* The config header is always included first. */
35 #include "iot_config.h"
36 
37 /* Standard includes. */
38 #include <stdbool.h>
39 #include <stdint.h>
40 
41 /* Platform layer types include. */
43 
153 /* @[declare_platform_threads_createdetachedthread] */
155  void * pArgument,
156  int32_t priority,
157  size_t stackSize );
158 /* @[declare_platform_threads_createdetachedthread] */
159 
189 /* @[declare_platform_threads_mutexcreate] */
190 bool IotMutex_Create( IotMutex_t * pNewMutex,
191  bool recursive );
192 /* @[declare_platform_threads_mutexcreate] */
193 
206 /* @[declare_platform_threads_mutexdestroy] */
207 void IotMutex_Destroy( IotMutex_t * pMutex );
208 /* @[declare_platform_threads_mutexdestroy] */
209 
221 /* @[declare_platform_threads_mutexlock] */
222 void IotMutex_Lock( IotMutex_t * pMutex );
223 /* @[declare_platform_threads_mutexlock] */
224 
238 /* @[declare_platform_threads_mutextrylock] */
239 bool IotMutex_TryLock( IotMutex_t * pMutex );
240 /* @[declare_platform_threads_mutextrylock] */
241 
253 /* @[declare_platform_threads_mutexunlock] */
254 void IotMutex_Unlock( IotMutex_t * pMutex );
255 /* @[declare_platform_threads_mutexunlock] */
256 
287 /* @[declare_platform_threads_semaphorecreate] */
288 bool IotSemaphore_Create( IotSemaphore_t * pNewSemaphore,
289  uint32_t initialValue,
290  uint32_t maxValue );
291 /* @[declare_platform_threads_semaphorecreate] */
292 
305 /* @[declare_platform_threads_semaphoredestroy] */
307 /* @[declare_platform_threads_semaphoredestroy] */
308 
319 /* @[declare_platform_threads_semaphoregetcount] */
320 uint32_t IotSemaphore_GetCount( IotSemaphore_t * pSemaphore );
321 /* @[declare_platform_threads_semaphoregetcount] */
322 
336 /* @[declare_platform_threads_semaphorewait] */
337 void IotSemaphore_Wait( IotSemaphore_t * pSemaphore );
338 /* @[declare_platform_threads_semaphorewait] */
339 
356 /* @[declare_platform_threads_semaphoretrywait] */
358 /* @[declare_platform_threads_semaphoretrywait] */
359 
378 /* @[declare_platform_threads_semaphoretimedwait] */
380  uint32_t timeoutMs );
381 /* @[declare_platform_threads_semaphoretimedwait] */
382 
392 /* @[declare_platform_threads_semaphorepost] */
393 void IotSemaphore_Post( IotSemaphore_t * pSemaphore );
394 /* @[declare_platform_threads_semaphorepost] */
395 
396 #endif /* ifndef IOT_THREADS_H_ */
IotSemaphore_Destroy
void IotSemaphore_Destroy(IotSemaphore_t *pSemaphore)
Free resources used by a semaphore.
IotSemaphore_t
_IotSystemSemaphore_t IotSemaphore_t
The type used to represent semaphores, configured with the type _IotSystemSemaphore_t.
Definition: iot_platform_types.h:97
IotMutex_Lock
void IotMutex_Lock(IotMutex_t *pMutex)
Lock a mutex. This function should only return when the mutex is locked; it is not expected to fail.
IotMutex_Unlock
void IotMutex_Unlock(IotMutex_t *pMutex)
Unlock a mutex. This function should only return when the mutex is unlocked; it is not expected to fa...
IotMutex_Create
bool IotMutex_Create(IotMutex_t *pNewMutex, bool recursive)
Create a new mutex.
IotSemaphore_Post
void IotSemaphore_Post(IotSemaphore_t *pSemaphore)
Post to (unlock) a semaphore. This function should only return when the semaphore post succeeds; it i...
IotMutex_t
_IotSystemMutex_t IotMutex_t
The type used to represent mutexes, configured with the type _IotSystemMutex_t.
Definition: iot_platform_types.h:75
iot_platform_types.h
Types of the platform layer.
IotSemaphore_GetCount
uint32_t IotSemaphore_GetCount(IotSemaphore_t *pSemaphore)
Query the current count of the semaphore.
IotMutex_TryLock
bool IotMutex_TryLock(IotMutex_t *pMutex)
Attempt to lock a mutex. Return immediately if the mutex is not available.
Iot_CreateDetachedThread
bool Iot_CreateDetachedThread(IotThreadRoutine_t threadRoutine, void *pArgument, int32_t priority, size_t stackSize)
Create a new detached thread, i.e. a thread that cleans up after itself.
IotMutex_Destroy
void IotMutex_Destroy(IotMutex_t *pMutex)
Free resources used by a mutex.
IotSemaphore_Create
bool IotSemaphore_Create(IotSemaphore_t *pNewSemaphore, uint32_t initialValue, uint32_t maxValue)
Create a new counting semaphore.
IotSemaphore_TryWait
bool IotSemaphore_TryWait(IotSemaphore_t *pSemaphore)
Attempt to wait on (lock) a semaphore. Return immediately if the semaphore is not available.
IotSemaphore_TimedWait
bool IotSemaphore_TimedWait(IotSemaphore_t *pSemaphore, uint32_t timeoutMs)
Attempt to wait on (lock) a semaphore with a timeout.
IotThreadRoutine_t
void(* IotThreadRoutine_t)(void *)
Thread routine function.
Definition: iot_platform_types.h:105
IotSemaphore_Wait
void IotSemaphore_Wait(IotSemaphore_t *pSemaphore)
Wait on (lock) a semaphore. This function should only return when the semaphore wait succeeds; it is ...