From 3d3f8c9dd38a6b1bde0736407becaa191b685d94 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 18 Aug 2016 14:54:21 +0200 Subject: [PATCH] Support for Frosted OS --- wolfcrypt/src/wc_port.c | 26 ++++++++++++++++++++++++++ wolfssl/wolfcrypt/wc_port.h | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 6e26415bb..2093a533d 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -652,7 +652,33 @@ int UnLockMutex(wolfSSL_Mutex *m) return ; } } + #elif defined (WOLFSSL_FROSTED) + int InitMutex(wolfSSL_Mutex* m) + { + *m = mutex_init(); + if (*m) + return 0; + else + return -1; + } + int FreeMutex(wolfSSL_Mutex* m) + { + mutex_destroy(*m); + return(0) ; + } + + int LockMutex(wolfSSL_Mutex* m) + { + mutex_lock(*m); + return 0; + } + + int UnLockMutex(wolfSSL_Mutex* m) + { + mutex_unlock(*m); + return 0; + } #elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_CMSIS_RTOS) #if defined(WOLFSSL_CMSIS_RTOS) diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 29e557b62..16872303c 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -73,6 +73,8 @@ #elif defined(WOLFSSL_TIRTOS) #include #include +#elif defined(WOLFSSL_FROSTED) + #include #else #ifndef SINGLE_THREADED #define WOLFSSL_PTHREADS @@ -133,6 +135,8 @@ typedef osMutexId wolfSSL_Mutex; #elif defined(WOLFSSL_TIRTOS) typedef ti_sysbios_knl_Semaphore_Handle wolfSSL_Mutex; + #elif defined(WOLFSSL_FROSTED) + typedef mutex_t * wolfSSL_Mutex; #else #error Need a mutex type in multithreaded mode #endif /* USE_WINDOWS_API */