mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Freescale: Add support for KSDK (FREESCALE_KSDK_MQX)
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG_WOLFSSL) || defined(SHOW_SECRETS) || defined(CHACHA_AEAD_TEST)
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#if MQX_USE_IO_OLD
|
||||
#include <fio.h>
|
||||
#else
|
||||
@@ -2479,7 +2479,7 @@ ProtocolVersion MakeDTLSv1_2(void)
|
||||
|
||||
#endif
|
||||
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
|
||||
word32 LowResTimer(void)
|
||||
{
|
||||
|
32
src/io.c
32
src/io.c
@@ -57,6 +57,8 @@
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#include <posix.h>
|
||||
#include <rtcs.h>
|
||||
#elif defined(FREESCALE_KSDK_MQX)
|
||||
#include <rtcs.h>
|
||||
#elif defined(WOLFSSL_MDK_ARM)
|
||||
#if defined(WOLFSSL_MDK5)
|
||||
#include "cmsis_os.h"
|
||||
@@ -129,15 +131,25 @@
|
||||
#define SOCKET_EPIPE SYS_NET_EPIPE
|
||||
#define SOCKET_ECONNREFUSED SYS_NET_ECONNREFUSED
|
||||
#define SOCKET_ECONNABORTED SYS_NET_ECONNABORTED
|
||||
#elif defined(FREESCALE_MQX)
|
||||
/* RTCS doesn't have an EWOULDBLOCK error */
|
||||
#define SOCKET_EWOULDBLOCK EAGAIN
|
||||
#define SOCKET_EAGAIN EAGAIN
|
||||
#define SOCKET_ECONNRESET RTCSERR_TCP_CONN_RESET
|
||||
#define SOCKET_EINTR EINTR
|
||||
#define SOCKET_EPIPE EPIPE
|
||||
#define SOCKET_ECONNREFUSED RTCSERR_TCP_CONN_REFUSED
|
||||
#define SOCKET_ECONNABORTED RTCSERR_TCP_CONN_ABORTED
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#if MQX_USE_IO_OLD
|
||||
/* RTCS old I/O doesn't have an EWOULDBLOCK */
|
||||
#define SOCKET_EWOULDBLOCK EAGAIN
|
||||
#define SOCKET_EAGAIN EAGAIN
|
||||
#define SOCKET_ECONNRESET RTCSERR_TCP_CONN_RESET
|
||||
#define SOCKET_EINTR EINTR
|
||||
#define SOCKET_EPIPE EPIPE
|
||||
#define SOCKET_ECONNREFUSED RTCSERR_TCP_CONN_REFUSED
|
||||
#define SOCKET_ECONNABORTED RTCSERR_TCP_CONN_ABORTED
|
||||
#else
|
||||
#define SOCKET_EWOULDBLOCK NIO_EWOULDBLOCK
|
||||
#define SOCKET_EAGAIN NIO_EAGAIN
|
||||
#define SOCKET_ECONNRESET NIO_ECONNRESET
|
||||
#define SOCKET_EINTR NIO_EINTR
|
||||
#define SOCKET_EPIPE NIO_EPIPE
|
||||
#define SOCKET_ECONNREFUSED NIO_ECONNREFUSED
|
||||
#define SOCKET_ECONNABORTED NIO_ECONNABORTED
|
||||
#endif
|
||||
#elif defined(WOLFSSL_MDK_ARM)
|
||||
#if defined(WOLFSSL_MDK5)
|
||||
#define SOCKET_EWOULDBLOCK BSD_ERROR_WOULDBLOCK
|
||||
@@ -200,7 +212,7 @@ static INLINE int TranslateReturnCode(int old, int sd)
|
||||
{
|
||||
(void)sd;
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
if (old == 0) {
|
||||
errno = SOCKET_EWOULDBLOCK;
|
||||
return -1; /* convert to BSD style wouldblock as error */
|
||||
|
@@ -66,7 +66,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_DEBUG_ENCODING
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#if MQX_USE_IO_OLD
|
||||
#include <fio.h>
|
||||
#else
|
||||
@@ -109,7 +109,7 @@
|
||||
#define XTIME(t1) pic32_time((t1))
|
||||
#define XGMTIME(c, t) gmtime((c))
|
||||
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t))
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#define XTIME(t1) mqx_time((t1))
|
||||
#define XGMTIME(c, t) mqx_gmtime((c), (t))
|
||||
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t))
|
||||
@@ -338,7 +338,7 @@ time_t pic32_time(time_t* timer)
|
||||
#endif /* MICROCHIP_TCPIP */
|
||||
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
|
||||
time_t mqx_time(time_t* timer)
|
||||
{
|
||||
|
@@ -1080,7 +1080,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
}
|
||||
#endif /* WOLFSSL_MIC32MZ_RNG */
|
||||
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
|
||||
#ifdef FREESCALE_K70_RNGA
|
||||
/*
|
||||
|
@@ -115,7 +115,7 @@
|
||||
/* do nothing */
|
||||
#elif defined(EBSNET)
|
||||
/* do nothing */
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
/* do nothing */
|
||||
#elif defined(WOLFSSL_MDK_ARM)
|
||||
#if defined(WOLFSSL_MDK5)
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#include <wolfssl/version.h>
|
||||
|
||||
#ifndef NO_FILESYSTEM
|
||||
#ifdef FREESCALE_MQX
|
||||
#if defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#if MQX_USE_IO_OLD
|
||||
#include <fio.h>
|
||||
#else
|
||||
|
@@ -72,9 +72,12 @@
|
||||
/* Uncomment next line if building wolfSSL for LSR */
|
||||
/* #define WOLFSSL_LSR */
|
||||
|
||||
/* Uncomment next line if building wolfSSL for Freescale MQX/RTCS/MFS */
|
||||
/* Uncomment next line if building for Freescale Classic MQX/RTCS/MFS */
|
||||
/* #define FREESCALE_MQX */
|
||||
|
||||
/* Uncomment next line if building for Freescale KSDK MQX/RTCS/MFS */
|
||||
/* #define FREESCALE_KSDK_MQX */
|
||||
|
||||
/* Uncomment next line if using STM32F2 */
|
||||
/* #define WOLFSSL_STM32F2 */
|
||||
|
||||
@@ -470,11 +473,7 @@
|
||||
#include "mqx.h"
|
||||
#ifndef NO_FILESYSTEM
|
||||
#include "mfs.h"
|
||||
#if MQX_USE_IO_OLD
|
||||
#include "fio.h"
|
||||
#else
|
||||
#include "nio.h"
|
||||
#endif
|
||||
#include "fio.h"
|
||||
#endif
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "mutex.h"
|
||||
@@ -485,6 +484,35 @@
|
||||
/* Note: MQX has no realloc, using fastmath above */
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_KSDK_MQX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_RABBIT
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define NO_OLD_RNGNAME
|
||||
#define FREESCALE_K70_RNGA
|
||||
/* #define FREESCALE_K53_RNGB */
|
||||
#include <mqx.h>
|
||||
#ifndef NO_FILESYSTEM
|
||||
#if MQX_USE_IO_OLD
|
||||
#include <fio.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <nio.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifndef SINGLE_THREADED
|
||||
#include <mutex.h>
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
#define XREALLOC(p, n, h, t) _mem_realloc((p), (n)) /* since MQX 4.1.2 */
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_STM32F2
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_DEV_RANDOM
|
||||
|
@@ -179,7 +179,8 @@
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \
|
||||
&& !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \
|
||||
&& !defined(WOLFSSL_LEANPSK) && !defined(FREERTOS)
|
||||
&& !defined(FREESCALE_KSDK_MQX) && !defined(WOLFSSL_LEANPSK) \
|
||||
&& !defined(FREERTOS)
|
||||
/* default C runtime, can install different routines at runtime via cbs */
|
||||
#include <wolfssl/wolfcrypt/memory.h>
|
||||
#define XMALLOC(s, h, t) ((void)h, (void)t, wolfSSL_Malloc((s)))
|
||||
|
@@ -53,7 +53,7 @@
|
||||
/* do nothing */
|
||||
#elif defined(EBSNET)
|
||||
/* do nothing */
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
/* do nothing */
|
||||
#elif defined(WOLFSSL_MDK_ARM)
|
||||
#if defined(WOLFSSL_MDK5)
|
||||
@@ -98,7 +98,7 @@
|
||||
typedef OS_MUTEX wolfSSL_Mutex;
|
||||
#elif defined(EBSNET)
|
||||
typedef RTP_MUTEX wolfSSL_Mutex;
|
||||
#elif defined(FREESCALE_MQX)
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
typedef MUTEX_STRUCT wolfSSL_Mutex;
|
||||
#elif defined(WOLFSSL_MDK_ARM)
|
||||
#if defined(WOLFSSL_CMSIS_RTOS)
|
||||
|
Reference in New Issue
Block a user