add MPLAB X projects, PIC32 GenerateSeed()

This commit is contained in:
Chris Conlon
2013-01-30 18:02:18 -07:00
parent b3ffcbd5b4
commit 5d29bf1e49
12 changed files with 327 additions and 2 deletions

View File

@@ -455,6 +455,25 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
return 0;
}
#elif defined(MICROCHIP_PIC32)
#include <peripheral/timer.h>
/* uses the core timer, in nanoseconds to seed srand */
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int i;
srand(ReadCoreTimer() * 25);
for (i = 0; i < sz; i++ ) {
output[i] = rand() % 256;
if ( (i % 8) == 7)
srand(ReadCoreTimer() * 25);
}
return 0;
}
#elif defined(CYASSL_SAFERTOS) || defined(CYASSL_LEANPSK)
#warning "write a real random seed!!!!, just for testing now"