From a15c193ab77665b3b222f960e27ababf88afaeab Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Tue, 20 Oct 2020 16:28:57 +0200 Subject: [PATCH] renew the timer if it underflows --- libprof.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libprof.c b/libprof.c index b0e98f3..6751e39 100644 --- a/libprof.c +++ b/libprof.c @@ -10,6 +10,11 @@ uint32_t volatile *prof_tcnt = NULL; /* Timer ID */ static int prof_timer = -1; +static int callback(void) +{ + return TIMER_CONTINUE; +} + /* prof_init(): Initialize the profiler's timer */ int prof_init(void) { @@ -17,7 +22,7 @@ int prof_init(void) int timer = -1; for(int t = 2; t >= 0 && timer == -1; t--) { - timer = timer_setup(t | TIMER_Pphi_4, 0xffffffff, NULL); + timer = timer_setup(t | TIMER_Pphi_4, 0xffffffff, callback); } if(timer == -1) {