add Microchip MPLAB Harmony support

This commit is contained in:
toddouska
2013-10-28 11:03:50 -07:00
parent 8c7715ee33
commit 9438d0d41b
3 changed files with 17 additions and 4 deletions

View File

@@ -458,18 +458,23 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
#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 */
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int i;
srand(ReadCoreTimer() * 25);
srand(PIC32_SEED_COUNT() * 25);
for (i = 0; i < sz; i++ ) {
output[i] = rand() % 256;
if ( (i % 8) == 7)
srand(ReadCoreTimer() * 25);
srand(PIC32_SEED_COUNT() * 25);
}
return 0;