Skip to content

Commit b0a3e64

Browse files
author
Wayne Ren
committed
example: kernel: update per_init
call timer_present to check whether perf timer present Signed-off-by: Wayne Ren <[email protected]>
1 parent c218fac commit b0a3e64

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

example/freertos/kernel/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ static int sample_count = 0;
135135
/** performance timer initialization */
136136
static void perf_init(unsigned int id)
137137
{
138-
if (timer_start(id, TIMER_CTRL_NH, 0xFFFFFFFF) < 0) {
139-
EMBARC_PRINTF("perf timer init failed\r\n");
140-
138+
if (timer_present(id) == 0) {
139+
EMBARC_PRINTF("perf timer %d is not present\r\n", id);
141140
while (1);
142141
}
143142

143+
timer_start(id, TIMER_CTRL_NH, 0xFFFFFFFF);
144+
144145
perf_id = id;
145146
}
146147

0 commit comments

Comments
 (0)