forked from wolfSSL/wolfssl
add MICROCHIP_TCPIP
This commit is contained in:
@@ -91,6 +91,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#define NO_TIME_H
|
#define NO_TIME_H
|
||||||
/* since Micrium not defining XTIME or XGMTIME, CERT_GEN not available */
|
/* since Micrium not defining XTIME or XGMTIME, CERT_GEN not available */
|
||||||
|
#elif defined(MICROCHIP_TCPIP)
|
||||||
|
#include <time.h>
|
||||||
|
#define XTIME(t1) pic32_time((t1))
|
||||||
|
#define XGMTIME(c) gmtime((c))
|
||||||
|
#define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t))
|
||||||
#elif defined(USER_TIME)
|
#elif defined(USER_TIME)
|
||||||
/* user time, and gmtime compatible functions, there is a gmtime
|
/* user time, and gmtime compatible functions, there is a gmtime
|
||||||
implementation here that WINCE uses, so really just need some ticks
|
implementation here that WINCE uses, so really just need some ticks
|
||||||
@@ -237,6 +242,29 @@ struct tm* my_gmtime(const time_t* timer) /* has a gmtime() but hangs */
|
|||||||
#endif /* THREADX */
|
#endif /* THREADX */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MICROCHIP_TCPIP
|
||||||
|
|
||||||
|
/*
|
||||||
|
* time() is just a stub in Microchip libraries. We need our own
|
||||||
|
* implementation. Use SNTP client to get seconds since epoch.
|
||||||
|
*/
|
||||||
|
time_t pic32_time(time_t* timer)
|
||||||
|
{
|
||||||
|
DWORD sec = 0;
|
||||||
|
time_t localTime;
|
||||||
|
|
||||||
|
if (timer == NULL)
|
||||||
|
timer = &localTime;
|
||||||
|
|
||||||
|
sec = SNTPGetUTCSeconds();
|
||||||
|
*timer = (time_t) sec;
|
||||||
|
|
||||||
|
return *timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* MICROCHIP_TCPIP */
|
||||||
|
|
||||||
|
|
||||||
static INLINE word32 btoi(byte b)
|
static INLINE word32 btoi(byte b)
|
||||||
{
|
{
|
||||||
return b - 0x30;
|
return b - 0x30;
|
||||||
|
@@ -45,6 +45,9 @@
|
|||||||
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
||||||
/* #define MICROCHIP_PIC32 */
|
/* #define MICROCHIP_PIC32 */
|
||||||
|
|
||||||
|
/* Uncomment next line if using Microchip TCP/IP stack, for time features */
|
||||||
|
/* #define MICROCHIP_TCPIP */
|
||||||
|
|
||||||
/* Uncomment next line if using FreeRTOS */
|
/* Uncomment next line if using FreeRTOS */
|
||||||
/* #define FREERTOS */
|
/* #define FREERTOS */
|
||||||
|
|
||||||
@@ -83,7 +86,6 @@
|
|||||||
#ifdef MICROCHIP_PIC32
|
#ifdef MICROCHIP_PIC32
|
||||||
#define SIZEOF_LONG_LONG 8
|
#define SIZEOF_LONG_LONG 8
|
||||||
#define SINGLE_THREADED
|
#define SINGLE_THREADED
|
||||||
#define CYASSL_USER_IO
|
|
||||||
#define NO_WRITEV
|
#define NO_WRITEV
|
||||||
#define NO_DEV_RANDOM
|
#define NO_DEV_RANDOM
|
||||||
#define NO_FILESYSTEM
|
#define NO_FILESYSTEM
|
||||||
@@ -91,6 +93,12 @@
|
|||||||
#define TFM_TIMING_RESISTANT
|
#define TFM_TIMING_RESISTANT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MICROCHIP_TCPIP
|
||||||
|
/* includes timer functions */
|
||||||
|
#include "TCPIP Stack/TCPIP.h"
|
||||||
|
#define CYASSL_USER_IO
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MBED
|
#ifdef MBED
|
||||||
#define SINGLE_THREADED
|
#define SINGLE_THREADED
|
||||||
#define CYASSL_USER_IO
|
#define CYASSL_USER_IO
|
||||||
|
@@ -2064,6 +2064,15 @@ ProtocolVersion MakeDTLSv1_2(void)
|
|||||||
return (word32)clk;
|
return (word32)clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(MICROCHIP_TCPIP)
|
||||||
|
|
||||||
|
word32 LowResTimer(void)
|
||||||
|
{
|
||||||
|
return (word32) TickGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#elif defined(USER_TICKS)
|
#elif defined(USER_TICKS)
|
||||||
#if 0
|
#if 0
|
||||||
word32 LowResTimer(void)
|
word32 LowResTimer(void)
|
||||||
|
Reference in New Issue
Block a user