Skip to content

Commit

Permalink
hifive: Check if overflow IRQ is actually pending
Browse files Browse the repository at this point in the history
Timer may have been reset, or the overflow may be already handled
by pwm_get_time().

This fixes sel4test issue 91.

Signed-off-by: Indan Zupancic <indan@nul.nu>
  • Loading branch information
Indanz committed Jun 26, 2023
1 parent 706fc25 commit 3f29c0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libplatsupport/src/plat/hifive/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int pwm_set_timeout(pwm_t *pwm, uint64_t ns, bool periodic)

void pwm_handle_irq(pwm_t *pwm, uint32_t irq)
{
if(pwm->mode == UPCOUNTER) {
if (pwm->mode == UPCOUNTER && (pwm->pwm_map->pwmcfg & PWMCMP0IP)) {
pwm->time_h++;
}

Expand Down

0 comments on commit 3f29c0b

Please sign in to comment.