1 /*
2  * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include <stdint.h>
10 
11 // we assign the systimer resources statically
12 #define SYSTIMER_COUNTER_ESPTIMER    0 // Counter used by esptimer, to generate the system level wall clock
13 #define SYSTIMER_COUNTER_OS_TICK     1 // Counter used by RTOS porting layer, to generate the OS tick
14 #define SYSTIMER_ALARM_OS_TICK_CORE0 0 // Alarm used by OS tick, dedicated for core 0
15 #define SYSTIMER_ALARM_OS_TICK_CORE1 1 // Alarm used by OS tick, dedicated for core 1
16 #define SYSTIMER_ALARM_ESPTIMER      2 // Alarm used by esptimer
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /**
23  * @brief Convert ticks to microseconds
24  *
25  * @param ticks ticks to convert
26  * @return microseconds
27  */
28 uint64_t systimer_ticks_to_us(uint64_t ticks) __attribute__((const));
29 
30 /**
31  * @brief Convert microseconds to ticks
32  *
33  * @param us microseconds to convert
34  * @return ticks
35  */
36 uint64_t systimer_us_to_ticks(uint64_t us) __attribute__((const));
37 
38 #ifdef __cplusplus
39 }
40 #endif
41