X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fperformance_test.c;h=de718bc54f63de6f42696de35f46ec751f373295;hb=8abb80e1fe152be6d95d3fa2967789ba3238d695;hp=ad745fc4c96a0b6480bb25fb563500f911040689;hpb=52ec168ece9d61bd9cb652235dfe8faee6232a11;p=avr-crypto-lib.git diff --git a/test_src/performance_test.c b/test_src/performance_test.c index ad745fc..de718bc 100644 --- a/test_src/performance_test.c +++ b/test_src/performance_test.c @@ -20,10 +20,10 @@ * author: Daniel Otte * email: daniel.otte@rub.de * license: GPLv3 - * - * + * + * **/ - + #include "config.h" #include #include @@ -41,17 +41,17 @@ -uint32_t ovfcounter; +static volatile uint32_t ovfcounter; -uint16_t const_overhead=0; -uint16_t int_overhead=0; +static uint16_t const_overhead=0; +static uint16_t int_overhead=0; ISR(TIMER1_OVF_vect){ ovfcounter++; } void calibrateTimer(void){ - volatile uint8_t i; + volatile uint8_t i=0; startTimer(1); stopTimer(); const_overhead = TCNT1; @@ -75,7 +75,7 @@ void startTimer(uint8_t granularity){ uint64_t stopTimer(void){ TCCR1B = 0; /* stop timer */ uint64_t ret; - ret = (ovfcounter<<16) | TCNT1; + ret = (((uint64_t)ovfcounter)<<16) | TCNT1; ret -= const_overhead; ret -= ovfcounter * int_overhead; return ret; @@ -83,7 +83,7 @@ uint64_t stopTimer(void){ void getOverhead(uint16_t* constoh, uint16_t* intoh){ *constoh = const_overhead; - *intoh = int_overhead; + *intoh = int_overhead; } void print_time_P(PGM_P s, uint64_t t){