add Microchip MPLAB Harmony support

pull/1/head
toddouska 2013-10-28 11:03:50 -07:00
parent 8c7715ee33
commit 9438d0d41b
3 changed files with 17 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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