1
0
mirror of https://github.com/espressif/esp-idf synced 2025-04-02 04:40:11 -04:00
Jiang Jiang Jian 42ef2887f4 Merge branch 'fix/fix_regdma_wait_node_issue_v5.3' into 'release/v5.3'
fix(esp_driver_gptimer): do gptimer retention by timer unit rather than timer group (v5.3)

See merge request 
2024-12-09 15:27:24 +08:00
..

GPTimer Driver Design

State Transition

State transition is achieved by using the primitives provided by <stdatomic.h>.

Other functions won't change the driver state. The functions above labeled with * are allowed to be used in the interrupt context.

Concurrency

There might be race conditions when the user calls the APIs from a thread and interrupt at the same time. e.g. a Task is just running the gptimer_start, and suddenly an interrupt occurs, where the user calls gptimer_stop for the same timer handle. Which is possible to make a "stopped" timer continue to run if the interrupt is returned before the Task.

By introducing a "middle" state like run_wait and enable_wait, we make sure that the timer is in a safe state before we start/stop it. And if the state is invalid, it can return an error code to the user.