X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fperformance_test.c;h=b3fff709ca54b3cc0d006063708bbafd9ff5a083;hb=3a9f9d918fb95474996af535c225a7e187d88372;hp=6ba564512985fc1ef0ebfb410be65c7f39d8b3dc;hpb=aa060d30f8600acb9cc5bcf9fa3d97a2fbe5ccda;p=avr-crypto-lib.git diff --git a/test_src/performance_test.c b/test_src/performance_test.c index 6ba5645..b3fff70 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,10 +41,10 @@ -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++; @@ -67,23 +67,22 @@ void startTimer(uint8_t granularity){ TCNT1 = 0; ovfcounter = 0; TCCR1A = 0x00; - TIMSK &= 0xC3; - TIMSK |= _BV(TOIE1); /* enable TOIE1 */ + TIMSK = _BV(TOIE1); /* enable TOIE1 */ TCCR1B = granularity & 0x7; /* start timer */ } 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; } -void getOverhead(uint16_t* constoh, uint16_t* intoh){ +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){