Select one of the symbols to view example projects that use it.
 
Outline
#include <stdint.h>
#include <stdatomic.h>
#include "sdkconfig.h"
#include "soc/soc_caps.h"
#include "freertos/FreeRTOS.h"
#include "esp_err.h"
#include "esp_intr_alloc.h"
#include "esp_heap_caps.h"
#include "clk_ctrl_os.h"
#include "esp_pm.h"
#include "soc/timer_periph.h"
#include "hal/timer_types.h"
#include "hal/timer_hal.h"
#include "hal/timer_ll.h"
#include "esp_private/sleep_retention.h"
#include "esp_private/periph_ctrl.h"
#define GPTIMER_MEM_ALLOC_CAPS
#define GPTIMER_MEM_ALLOC_CAPS
#define GPTIMER_INTR_ALLOC_FLAGS
#define GPTIMER_INTR_ALLOC_FLAGS
#define GPTIMER_ALLOW_INTR_PRIORITY_MASK
#define GPTIMER_PM_LOCK_NAME_LEN_MAX
#define GPTIMER_USE_RETENTION_LINK
#define GPTIMER_CLOCK_SRC_ATOMIC
#define GPTIMER_CLOCK_SRC_ATOMIC
gptimer_t
gptimer_group_t
gptimer_fsm_t
gptimer_t
gptimer_acquire_group_handle(int);
gptimer_release_group_handle(gptimer_group_t *);
gptimer_select_periph_clock(gptimer_t *, gptimer_clock_source_t, uint32_t);
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/esp_driver_gptimer/src/gptimer_priv.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #pragma once #include <stdint.h> #include <stdatomic.h> #include "sdkconfig.h" #include "soc/soc_caps.h" #include "freertos/FreeRTOS.h" #include "esp_err.h" #include "esp_intr_alloc.h" #include "esp_heap_caps.h" #include "clk_ctrl_os.h" #include "esp_pm.h" #include "soc/timer_periph.h" #include "hal/timer_types.h" #include "hal/timer_hal.h" #include "hal/timer_ll.h" #include "esp_private/sleep_retention.h" #include "esp_private/periph_ctrl.h"16 includes #ifdef __cplusplus extern "C" { #endif // If ISR handler is allowed to run whilst cache is disabled, // Make sure all the code and related variables used by the handler are in the SRAM #if CONFIG_GPTIMER_ISR_IRAM_SAFE || CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM #define GPTIMER_MEM_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) #else #define GPTIMER_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT #endif #if CONFIG_GPTIMER_ISR_IRAM_SAFE #define GPTIMER_INTR_ALLOC_FLAGS (ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_INTRDISABLED) #else #define GPTIMER_INTR_ALLOC_FLAGS ESP_INTR_FLAG_INTRDISABLED #endif #define GPTIMER_ALLOW_INTR_PRIORITY_MASK ESP_INTR_FLAG_LOWMED #define GPTIMER_PM_LOCK_NAME_LEN_MAX 16 #define GPTIMER_USE_RETENTION_LINK (SOC_TIMER_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP) #if SOC_PERIPH_CLK_CTRL_SHARED #define GPTIMER_CLOCK_SRC_ATOMIC() PERIPH_RCC_ATOMIC() #else #define GPTIMER_CLOCK_SRC_ATOMIC() #endif typedef struct gptimer_t gptimer_t; typedef struct gptimer_group_t { int group_id; portMUX_TYPE spinlock; // to protect per-group register level concurrent access gptimer_t *timers[SOC_TIMER_GROUP_TIMERS_PER_GROUP]; }{ ... } gptimer_group_t; typedef enum { GPTIMER_FSM_INIT, // Timer is initialized, but not enabled GPTIMER_FSM_ENABLE, // Timer is enabled, but is not running GPTIMER_FSM_ENABLE_WAIT, // Timer is in the middle of the enable process (Intermediate state) GPTIMER_FSM_RUN, // Timer is in running GPTIMER_FSM_RUN_WAIT, // Timer is in the middle of the run process (Intermediate state) }{ ... } gptimer_fsm_t; struct gptimer_t { gptimer_group_t *group; int timer_id; uint32_t resolution_hz; uint64_t reload_count; uint64_t alarm_count; gptimer_count_direction_t direction; timer_hal_context_t hal; _Atomic gptimer_fsm_t fsm; int intr_priority; intr_handle_t intr; portMUX_TYPE spinlock; // to protect per-timer resources concurrent accessed by task and ISR handler gptimer_alarm_cb_t on_alarm; void *user_ctx; gptimer_clock_source_t clk_src; esp_pm_lock_handle_t pm_lock; // power management lock #if CONFIG_PM_ENABLE char pm_lock_name[GPTIMER_PM_LOCK_NAME_LEN_MAX]; // pm lock name #endif struct { uint32_t intr_shared: 1; uint32_t auto_reload_on_alarm: 1; uint32_t alarm_en: 1; }{ ... } flags; }{ ... }; gptimer_group_t *gptimer_acquire_group_handle(int group_id); void gptimer_release_group_handle(gptimer_group_t *group); esp_err_t gptimer_select_periph_clock(gptimer_t *timer, gptimer_clock_source_t src_clk, uint32_t resolution_hz); #ifdef __cplusplus }{...} #endif
Details
Show:
from
Types: Columns: