mirror of https://github.com/wolfSSL/wolfssl.git
Added details on RTC oscillator startup delay and implemented a delay_us function. Added information about NO_INLINE and USE_SLOW_SHOW to example user_settings.h. Moved the USE_SLOW_SHA2 into the SHA512 area.
parent
5ee0659e1b
commit
726703e903
|
@ -15,6 +15,9 @@ void hw_uart_printchar(int c);
|
||||||
void hw_watchdog_disable(void);
|
void hw_watchdog_disable(void);
|
||||||
uint32_t hw_rand(void);
|
uint32_t hw_rand(void);
|
||||||
|
|
||||||
|
// Delay functions
|
||||||
|
void delay_us(uint32_t microseconds);
|
||||||
|
|
||||||
|
|
||||||
#endif /* WOLFSSL_ROWLEY_HW_H */
|
#endif /* WOLFSSL_ROWLEY_HW_H */
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,16 @@
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
|
|
||||||
// Private functions
|
// Private functions
|
||||||
|
static uint32_t mDelayCyclesPerUs = 0;
|
||||||
|
#define NOP_FOR_LOOP_INSTRUCTION_COUNT 6
|
||||||
|
static void delay_nop(uint32_t count)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i=0; i<count; i++) {
|
||||||
|
__asm volatile("nop");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void hw_mcg_init(void)
|
static void hw_mcg_init(void)
|
||||||
{
|
{
|
||||||
/* Adjust clock dividers (core/system=div/1, bus=div/2, flex bus=div/2, flash=div/4) */
|
/* Adjust clock dividers (core/system=div/1, bus=div/2, flex bus=div/2, flash=div/4) */
|
||||||
|
@ -119,6 +129,9 @@ static void hw_uart_init(void)
|
||||||
|
|
||||||
static void hw_rtc_init(void)
|
static void hw_rtc_init(void)
|
||||||
{
|
{
|
||||||
|
/* Init nop delay */
|
||||||
|
mDelayCyclesPerUs = (SYS_CLK_KHZ / 1000 / NOP_FOR_LOOP_INSTRUCTION_COUNT);
|
||||||
|
|
||||||
/* Enable RTC clock and oscillator */
|
/* Enable RTC clock and oscillator */
|
||||||
SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
|
SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
|
||||||
|
|
||||||
|
@ -141,10 +154,8 @@ static void hw_rtc_init(void)
|
||||||
/* Turn on */
|
/* Turn on */
|
||||||
RTC->CR |= RTC_CR_OSCE_MASK;
|
RTC->CR |= RTC_CR_OSCE_MASK;
|
||||||
|
|
||||||
/* Wait RTC startup delay */
|
/* Wait RTC startup delay 1000 us */
|
||||||
for (i=0; i<10000; i++) {
|
delay_us(1000);
|
||||||
asm("nop");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable counter */
|
/* Enable counter */
|
||||||
|
@ -203,6 +214,12 @@ uint32_t hw_rand(void)
|
||||||
return RNG->OR; /* Return next value in FIFO output register */
|
return RNG->OR; /* Return next value in FIFO output register */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void delay_us(uint32_t microseconds)
|
||||||
|
{
|
||||||
|
delay_nop(mDelayCyclesPerUs * microseconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Watchdog
|
// Watchdog
|
||||||
void hw_watchdog_disable(void)
|
void hw_watchdog_disable(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -156,6 +156,8 @@ extern "C" {
|
||||||
/* Sha */
|
/* Sha */
|
||||||
#undef NO_SHA
|
#undef NO_SHA
|
||||||
#if 1
|
#if 1
|
||||||
|
/* 1k smaller, but 25% slower */
|
||||||
|
//#define USE_SLOW_SHA
|
||||||
#else
|
#else
|
||||||
#define NO_SHA
|
#define NO_SHA
|
||||||
#endif
|
#endif
|
||||||
|
@ -163,8 +165,6 @@ extern "C" {
|
||||||
/* Sha256 */
|
/* Sha256 */
|
||||||
#undef NO_SHA256
|
#undef NO_SHA256
|
||||||
#if 1
|
#if 1
|
||||||
/* over twice as small, but 50% slower */
|
|
||||||
//#define USE_SLOW_SHA2
|
|
||||||
#else
|
#else
|
||||||
#define NO_SHA256
|
#define NO_SHA256
|
||||||
#endif
|
#endif
|
||||||
|
@ -179,6 +179,9 @@ extern "C" {
|
||||||
#if 1
|
#if 1
|
||||||
#define WOLFSSL_SHA384
|
#define WOLFSSL_SHA384
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* over twice as small, but 50% slower */
|
||||||
|
//#define USE_SLOW_SHA2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* MD5 */
|
/* MD5 */
|
||||||
|
@ -306,6 +309,12 @@ extern "C" {
|
||||||
#undef NO_CRYPT_BENCHMARK
|
#undef NO_CRYPT_BENCHMARK
|
||||||
//#define NO_CRYPT_BENCHMARK
|
//#define NO_CRYPT_BENCHMARK
|
||||||
|
|
||||||
|
/* In-lining of misc.c functions */
|
||||||
|
/* If defined, must include wolfcrypt/src/misc.c in build */
|
||||||
|
/* Slower, but about 1k smaller */
|
||||||
|
#undef NO_INLINE
|
||||||
|
//#define NO_INLINE
|
||||||
|
|
||||||
#undef NO_FILESYSTEM
|
#undef NO_FILESYSTEM
|
||||||
#define NO_FILESYSTEM
|
#define NO_FILESYSTEM
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue