]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/FreeRTOS-IoT-Libraries/abstractions/mbedtls/threading_alt.h
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / Source / FreeRTOS-IoT-Libraries / abstractions / mbedtls / threading_alt.h
1 /*\r
2  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
3  *\r
4  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
5  * this software and associated documentation files (the "Software"), to deal in\r
6  * the Software without restriction, including without limitation the rights to\r
7  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
8  * the Software, and to permit persons to whom the Software is furnished to do so,\r
9  * subject to the following conditions:\r
10  *\r
11  * The above copyright notice and this permission notice shall be included in all\r
12  * copies or substantial portions of the Software.\r
13  *\r
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
16  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
17  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
18  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
19  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
20  */\r
21 \r
22 /* mbed TLS threading functions implemented for FreeRTOS. */\r
23 \r
24 #ifndef MBEDTLS_THREADING_ALT_H_\r
25 #define MBEDTLS_THREADING_ALT_H_\r
26 \r
27 /* FreeRTOS includes. */\r
28 #include "FreeRTOS.h"\r
29 #include "semphr.h"\r
30 \r
31 /* mbed TLS mutex type. */\r
32 typedef struct mbedtls_threading_mutex\r
33 {\r
34     SemaphoreHandle_t mutexHandle;\r
35     StaticSemaphore_t mutexStorage;\r
36 } mbedtls_threading_mutex_t;\r
37 \r
38 /* mbed TLS mutex functions. */\r
39 void mbedtls_platform_mutex_init( mbedtls_threading_mutex_t * pMutex );\r
40 void mbedtls_platform_mutex_free( mbedtls_threading_mutex_t * pMutex );\r
41 int mbedtls_platform_mutex_lock( mbedtls_threading_mutex_t * pMutex );\r
42 int mbedtls_platform_mutex_unlock( mbedtls_threading_mutex_t * pMutex );\r
43 \r
44 #endif\r