FreeRTOS threads support, windows simulator support
This commit is contained in:
parent
90385bb4b3
commit
afa27f0021
@ -48,6 +48,9 @@
|
||||
/* Uncomment next line if using FreeRTOS */
|
||||
/* #define FREERTOS */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||
/* #define FREERTOS_WINSIM */
|
||||
|
||||
/* Uncomment next line if using lwip */
|
||||
/* #define CYASSL_LWIP */
|
||||
|
||||
@ -82,13 +85,22 @@
|
||||
#define NO_HC128
|
||||
#endif /* MBED */
|
||||
|
||||
#ifdef FREERTOS
|
||||
#define SINGLE_THREADED
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS
|
||||
#define NO_WRITEV
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_GAME_BUILD
|
||||
|
@ -132,7 +132,7 @@ enum {
|
||||
|
||||
|
||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||
#if defined(_WIN32) && !defined(MICRIUM)
|
||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS)
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
@ -69,6 +69,8 @@
|
||||
#endif
|
||||
#elif defined(MICRIUM)
|
||||
/* do nothing, just don't pick Unix */
|
||||
#elif defined(FREERTOS)
|
||||
/* do nothing */
|
||||
#else
|
||||
#ifndef SINGLE_THREADED
|
||||
#define CYASSL_PTHREADS
|
||||
@ -662,7 +664,10 @@ struct CYASSL_CIPHER {
|
||||
#ifdef SINGLE_THREADED
|
||||
typedef int CyaSSL_Mutex;
|
||||
#else /* MULTI_THREADED */
|
||||
#ifdef USE_WINDOWS_API
|
||||
/* FREERTOS comes first to enable use of FreeRTOS Windows simulator only */
|
||||
#ifdef FREERTOS
|
||||
typedef xSemaphoreHandle CyaSSL_Mutex;
|
||||
#elif defined(USE_WINDOWS_API)
|
||||
typedef CRITICAL_SECTION CyaSSL_Mutex;
|
||||
#elif defined(CYASSL_PTHREADS)
|
||||
typedef pthread_mutex_t CyaSSL_Mutex;
|
||||
|
@ -6860,7 +6860,41 @@ int UnLockMutex(CyaSSL_Mutex* m)
|
||||
|
||||
#else /* MULTI_THREAD */
|
||||
|
||||
#ifdef USE_WINDOWS_API
|
||||
#if defined(FREERTOS)
|
||||
|
||||
int InitMutex(CyaSSL_Mutex* m)
|
||||
{
|
||||
int iReturn;
|
||||
|
||||
*m = ( CyaSSL_Mutex ) xSemaphoreCreateMutex();
|
||||
if( *m != NULL )
|
||||
iReturn = 0;
|
||||
else
|
||||
iReturn = BAD_MUTEX_ERROR;
|
||||
|
||||
return iReturn;
|
||||
}
|
||||
|
||||
int FreeMutex(CyaSSL_Mutex* m)
|
||||
{
|
||||
vSemaphoreDelete( *m );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LockMutex(CyaSSL_Mutex* m)
|
||||
{
|
||||
/* Assume an infinite block, or should there be zero block? */
|
||||
xSemaphoreTake( *m, portMAX_DELAY );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int UnLockMutex(CyaSSL_Mutex* m)
|
||||
{
|
||||
xSemaphoreGive( *m );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(USE_WINDOWS_API)
|
||||
|
||||
int InitMutex(CyaSSL_Mutex* m)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user