mirror of https://github.com/wolfSSL/wolfssl.git
add Microchip MPLAB Harmony support
parent
8c7715ee33
commit
9438d0d41b
|
@ -285,7 +285,11 @@ time_t pic32_time(time_t* timer)
|
||||||
if (timer == NULL)
|
if (timer == NULL)
|
||||||
timer = &localTime;
|
timer = &localTime;
|
||||||
|
|
||||||
|
#ifdef MICROCHIP_MPLAB_HARMONY
|
||||||
|
sec = TCPIP_SNTP_UTCSecondsGet();
|
||||||
|
#else
|
||||||
sec = SNTPGetUTCSeconds();
|
sec = SNTPGetUTCSeconds();
|
||||||
|
#endif
|
||||||
*timer = (time_t) sec;
|
*timer = (time_t) sec;
|
||||||
|
|
||||||
return *timer;
|
return *timer;
|
||||||
|
|
|
@ -458,18 +458,23 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||||
|
|
||||||
#elif defined(MICROCHIP_PIC32)
|
#elif defined(MICROCHIP_PIC32)
|
||||||
|
|
||||||
#include <peripheral/timer.h>
|
#ifndef MICROCHIP_MPLAB_HARMONY
|
||||||
|
#include <peripheral/timer.h>
|
||||||
|
#define PIC32_SEED_COUNT _CP0_GET_COUNT
|
||||||
|
#else
|
||||||
|
#define PIC32_SEED_COUNT ReadCoreTimer
|
||||||
|
#endif
|
||||||
|
|
||||||
/* uses the core timer, in nanoseconds to seed srand */
|
/* uses the core timer, in nanoseconds to seed srand */
|
||||||
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
srand(ReadCoreTimer() * 25);
|
srand(PIC32_SEED_COUNT() * 25);
|
||||||
|
|
||||||
for (i = 0; i < sz; i++ ) {
|
for (i = 0; i < sz; i++ ) {
|
||||||
output[i] = rand() % 256;
|
output[i] = rand() % 256;
|
||||||
if ( (i % 8) == 7)
|
if ( (i % 8) == 7)
|
||||||
srand(ReadCoreTimer() * 25);
|
srand(PIC32_SEED_COUNT() * 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -130,7 +130,11 @@
|
||||||
#ifdef MICROCHIP_TCPIP
|
#ifdef MICROCHIP_TCPIP
|
||||||
/* include timer, NTP functions */
|
/* include timer, NTP functions */
|
||||||
#include "system/system_services.h"
|
#include "system/system_services.h"
|
||||||
#include "tcpip/sntp.h"
|
#ifdef MICROCHIP_MPLAB_HARMONY
|
||||||
|
#include "tcpip/tcpip.h"
|
||||||
|
#else
|
||||||
|
#include "tcpip/sntp.h"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MBED
|
#ifdef MBED
|
||||||
|
|
Loading…
Reference in New Issue