• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <stdint.h>
22 #include "soc/soc_caps.h"
23 
24 /*
25  * @brief The structure of the counter value in systimer
26  *
27  */
28 typedef struct {
29     union {
30         struct {
31             uint64_t lo : SOC_SYSTIMER_BIT_WIDTH_LO; /*!< Low part of counter value */
32             uint64_t hi : SOC_SYSTIMER_BIT_WIDTH_HI; /*!< High part of counter value */
33         };
34         uint64_t val; /*!< counter value */
35     };
36 } systimer_counter_value_t;
37 
38 /** @cond */
39 _Static_assert(sizeof(systimer_counter_value_t) == 8, "systimer_counter_value_t should occupy 8 bytes in memory");
40 /** @endcond */
41 
42 /**
43  * @brief systimer counter ID
44  *
45  */
46 typedef enum {
47     SYSTIMER_COUNTER_0, /*!< systimer counter 0 */
48 #if SOC_SYSTIMER_COUNTER_NUM > 1
49     SYSTIMER_COUNTER_1, /*!< systimer counter 1 */
50 #endif
51 } systimer_counter_id_t;
52 
53 /**
54  * @brief systimer alarm ID
55  *
56  */
57 typedef enum {
58     SYSTIMER_ALARM_0, /*!< systimer alarm 0 */
59     SYSTIMER_ALARM_1, /*!< systimer alarm 1 */
60     SYSTIMER_ALARM_2, /*!< systimer alarm 2 */
61 } systimer_alarm_id_t;
62 
63 /**
64  * @brief systimer alarm mode
65  *
66  */
67 typedef enum {
68     SYSTIMER_ALARM_MODE_ONESHOT, /*!< systimer alarm oneshot mode */
69     SYSTIMER_ALARM_MODE_PERIOD,  /*!< systimer alarm period mode */
70 } systimer_alarm_mode_t;
71 
72 #ifdef __cplusplus
73 }
74 #endif
75