Skip to content

Commit

Permalink
Fix race on FSM state in gptimer_start()
Browse files Browse the repository at this point in the history
  • Loading branch information
Lsitar committed Oct 22, 2024
1 parent a97a7b0 commit 4fd888b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/esp_driver_gptimer/src/gptimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ esp_err_t gptimer_start(gptimer_handle_t timer)
portENTER_CRITICAL_SAFE(&timer->spinlock);
timer_ll_enable_alarm(timer->hal.dev, timer->timer_id, timer->flags.alarm_en);
timer_ll_enable_counter(timer->hal.dev, timer->timer_id, true);
atomic_store(&timer->fsm, GPTIMER_FSM_RUN);
portEXIT_CRITICAL_SAFE(&timer->spinlock);
} else {
ESP_RETURN_ON_FALSE_ISR(false, ESP_ERR_INVALID_STATE, TAG, "timer is not enabled yet");
}

atomic_store(&timer->fsm, GPTIMER_FSM_RUN);
return ESP_OK;
}

Expand Down

0 comments on commit 4fd888b

Please sign in to comment.