1 /*
2  * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include <stdint.h>
10 #include "soc/soc_caps.h"
11 #include "esp_assert.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /*
18  * @brief The structure of the counter value in systimer
19  *
20  */
21 typedef struct {
22     union {
23         struct {
24             uint64_t lo : SOC_SYSTIMER_BIT_WIDTH_LO; /*!< Low part of counter value */
25             uint64_t hi : SOC_SYSTIMER_BIT_WIDTH_HI; /*!< High part of counter value */
26 #if (SOC_SYSTIMER_BIT_WIDTH_LO  + SOC_SYSTIMER_BIT_WIDTH_HI) < 64
27             uint64_t reserved: (64 - (SOC_SYSTIMER_BIT_WIDTH_LO  + SOC_SYSTIMER_BIT_WIDTH_HI));
28 #endif
29         };
30         uint64_t val; /*!< counter value */
31     };
32 } systimer_counter_value_t;
33 
34 /** @cond */
35 ESP_STATIC_ASSERT(sizeof(systimer_counter_value_t) == 8, "systimer_counter_value_t should occupy 8 bytes in memory");
36 /** @endcond */
37 
38 /**
39  * @brief systimer alarm mode
40  *
41  */
42 typedef enum {
43     SYSTIMER_ALARM_MODE_ONESHOT, /*!< systimer alarm oneshot mode */
44     SYSTIMER_ALARM_MODE_PERIOD,  /*!< systimer alarm period mode */
45 } systimer_alarm_mode_t;
46 
47 #ifdef __cplusplus
48 }
49 #endif
50