|
VSF Documented
|
#include "../vsf_espidf_cfg.h"#include "driver/gptimer.h"#include "../vsf_espidf.h"#include "kernel/vsf_kernel.h"#include "hal/driver/driver.h"#include <string.h>Data Structures | |
| struct | gptimer_t |
Enumerations | |
| enum | gptimer_fsm_t { GPTIMER_FSM_INIT = 0 , GPTIMER_FSM_ENABLE = 1 , GPTIMER_FSM_RUN = 2 } |
Functions | |
| void | vsf_espidf_gptimer_init (const vsf_espidf_gptimer_cfg_t *cfg) |
| esp_err_t | gptimer_new_timer (const gptimer_config_t *config, gptimer_handle_t *ret_timer) |
| Allocate a new gptimer handle drawn from the injected VSF pool. | |
| esp_err_t | gptimer_del_timer (gptimer_handle_t timer) |
| Release a gptimer handle, stopping the underlying timer first. | |
| esp_err_t | gptimer_register_event_callbacks (gptimer_handle_t timer, const gptimer_event_callbacks_t *cbs, void *user_data) |
| Register the alarm callback (and future per-event callbacks). | |
| esp_err_t | gptimer_set_alarm_action (gptimer_handle_t timer, const gptimer_alarm_config_t *config) |
| Configure the alarm action applied at the next alarm event. | |
| esp_err_t | gptimer_enable (gptimer_handle_t timer) |
| Transition the timer into the "enabled" state. | |
| esp_err_t | gptimer_disable (gptimer_handle_t timer) |
| Transition the timer out of the "enabled" state. | |
| esp_err_t | gptimer_start (gptimer_handle_t timer) |
| Start the counter. The timer must already be enabled. | |
| esp_err_t | gptimer_stop (gptimer_handle_t timer) |
| Stop the counter. The counter value is retained. | |
| esp_err_t | gptimer_set_raw_count (gptimer_handle_t timer, uint64_t value) |
| Set the raw counter value. | |
| esp_err_t | gptimer_get_raw_count (gptimer_handle_t timer, uint64_t *value) |
| Read the raw counter value. | |
| esp_err_t | gptimer_get_resolution (gptimer_handle_t timer, uint32_t *out_resolution) |
| Query the actual resolution chosen by the underlying hardware. | |
| esp_err_t | gptimer_get_captured_count (gptimer_handle_t timer, uint64_t *value) |
| Return the number of alarms that have fired since enable. | |
| enum gptimer_fsm_t |
|
extern |
| esp_err_t gptimer_new_timer | ( | const gptimer_config_t * | config, |
| gptimer_handle_t * | ret_timer | ||
| ) |
Allocate a new gptimer handle drawn from the injected VSF pool.
| ESP_OK | success |
| ESP_ERR_INVALID_ARG | config / ret_timer is NULL, direction != UP |
| ESP_ERR_INVALID_STATE | shim not initialised or pool exhausted |
| ESP_ERR_NO_MEM | heap exhausted for handle metadata |
| esp_err_t gptimer_del_timer | ( | gptimer_handle_t | timer | ) |
Release a gptimer handle, stopping the underlying timer first.
| ESP_OK | success |
| ESP_ERR_INVALID_ARG | timer is NULL |
| ESP_ERR_INVALID_STATE | timer is still in the enabled state |
| esp_err_t gptimer_register_event_callbacks | ( | gptimer_handle_t | timer, |
| const gptimer_event_callbacks_t * | cbs, | ||
| void * | user_data | ||
| ) |
Register the alarm callback (and future per-event callbacks).
Must be called while the timer is in the disabled state – mirroring the ESP-IDF contract that forbids hot-patching callbacks.
| esp_err_t gptimer_set_alarm_action | ( | gptimer_handle_t | timer, |
| const gptimer_alarm_config_t * | config | ||
| ) |
Configure the alarm action applied at the next alarm event.
Passing config == NULL disables alarm generation. Otherwise the shim programs the underlying vsf_timer so that an overflow IRQ fires every alarm_count ticks; reload_count is honoured only when the implemented backend exposes a way to pre-load the counter (currently: only auto_reload_on_alarm is supported by mapping to a continuous timer, other combinations fall back to continuous semantics too).
| esp_err_t gptimer_enable | ( | gptimer_handle_t | timer | ) |
Transition the timer into the "enabled" state.
The counter is not yet running; call gptimer_start() to start counting.
| esp_err_t gptimer_disable | ( | gptimer_handle_t | timer | ) |
Transition the timer out of the "enabled" state.
| esp_err_t gptimer_start | ( | gptimer_handle_t | timer | ) |
Start the counter. The timer must already be enabled.
| esp_err_t gptimer_stop | ( | gptimer_handle_t | timer | ) |
Stop the counter. The counter value is retained.
| esp_err_t gptimer_set_raw_count | ( | gptimer_handle_t | timer, |
| uint64_t | value | ||
| ) |
Set the raw counter value.
| ESP_ERR_NOT_SUPPORTED | the VSF backend does not expose this |
| esp_err_t gptimer_get_raw_count | ( | gptimer_handle_t | timer, |
| uint64_t * | value | ||
| ) |
Read the raw counter value.
| ESP_ERR_NOT_SUPPORTED | the VSF backend does not expose this |
| esp_err_t gptimer_get_resolution | ( | gptimer_handle_t | timer, |
| uint32_t * | out_resolution | ||
| ) |
Query the actual resolution chosen by the underlying hardware.
May differ from the requested resolution_hz when the clock divider is discrete. The shim returns the value programmed by the backend when available, otherwise the originally requested value.
| esp_err_t gptimer_get_captured_count | ( | gptimer_handle_t | timer, |
| uint64_t * | value | ||
| ) |
Return the number of alarms that have fired since enable.
| ESP_ERR_NOT_SUPPORTED | the VSF backend does not track this |
| bool is_inited |
| vsf_timer_t* const* pool |
| uint16_t pool_count |
| uint32_t pool_busy |
1 bit per entry, LSB = idx 0